Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
f7a3b1ef
Commit
f7a3b1ef
authored
Sep 01, 2021
by
suntengda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add app内团餐列表接口
parent
6316744f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
5 deletions
+81
-5
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+61
-0
MarketingService.php
application/services/marketing/MarketingService.php
+20
-5
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
f7a3b1ef
...
...
@@ -7,6 +7,8 @@ use App\Services\marketing\MarketingGoodsService;
use
\Validate\MarketingGoodsRateValidate
;
use
\Validate\MarketingOnlineStatusValidate
;
use
\Validate\MarketingInfoValidate
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\MarketingPindan
;
class
MarketingController
extends
Base
{
...
...
@@ -155,4 +157,63 @@ class MarketingController extends Base
$this
->
success
();
}
/**
* app内团餐活动列表
* @throws \App\Exception\custom\InterfaceException
*/
public
function
tuancan_listAction
()
{
$this
->
params
[
'marketing_type'
]
=
Marketing
::
MARKETING_TYPE_PINDAN
;
//1分销 2团购 3秒杀 4团餐
$this
->
params
[
'online_status'
]
=
Marketing
::
ONLINE_STATUS_QIDONG
;
//状态 , 1启用,2关闭,3 到期
$this
->
params
[
'from'
]
=
1
;
//1 小程序前台 默认0 后台
//正在进行中的
$this
->
params
[
'sort_field'
]
=
'end_time'
;
$this
->
params
[
'sort_type'
]
=
'asc'
;
$this
->
params
[
'need_buy_num'
]
=
false
;
$this
->
params
[
'activity_status'
]
=
MarketingPindan
::
ACTIVITY_STATUS_IN_PROGRESS
;
//1 未开始,2进行中,3已结束
$list
[
'doing'
]
=
MarketingService
::
marketingList
(
$this
->
params
)[
'result'
];
$list
[
'doing'
]
=
$list
[
'doing'
]
?
array_column
(
$list
[
'doing'
],
null
,
'marketing_id'
)
:
[];
$marketingIdsDoing
=
array_keys
(
$list
[
'doing'
]);
//当天即将开始的
$this
->
params
[
'page'
]
=
1
;
$this
->
params
[
'sort_field'
]
=
'end_time'
;
$this
->
params
[
'sort_type'
]
=
'asc'
;
$this
->
params
[
'need_buy_num'
]
=
false
;
$this
->
params
[
'activity_status'
]
=
MarketingPindan
::
ACTIVITY_STATUS_START_TODAY
;
//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list
[
'prepare'
]
=
MarketingService
::
marketingList
(
$this
->
params
)[
'result'
];
$list
[
'prepare'
]
=
$list
[
'prepare'
]
?
array_column
((
array
)
$list
[
'prepare'
],
null
,
'marketing_id'
)
:
[];
$marketingIdsPrepare
=
array_keys
(
$list
[
'prepare'
]);
//已结束的
$this
->
params
[
'page'
]
=
1
;
$this
->
params
[
'sort_field'
]
=
'end_time'
;
$this
->
params
[
'sort_type'
]
=
'desc'
;
$this
->
params
[
'need_buy_num'
]
=
false
;
$this
->
params
[
'activity_status'
]
=
MarketingPindan
::
ACTIVITY_STATUS_FINISHED
;
//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list
[
'end'
]
=
MarketingService
::
marketingList
(
$this
->
params
)[
'result'
];
$list
[
'end'
]
=
$list
[
'end'
]
?
array_column
(
$list
[
'end'
],
null
,
'marketing_id'
)
:
[];
$marketingIdsEnd
=
array_keys
(
$list
[
'end'
]);
$marketingIds
=
array_merge
(
$marketingIdsDoing
,
$marketingIdsPrepare
,
$marketingIdsEnd
);
//获取活动的sku列表
$skuList
=
MarketingService
::
getGoodsSkuListByMarketingIds
(
$marketingIds
);
//获取活动支付用户列表
$orderUser
=
MarketingService
::
getMarketingOrderUser
([
'marketing_id'
=>
$marketingIds
]);
//获取活动支付用户数
$buyNum
=
MarketingService
::
getHaveBuyGoodsUserCount
([
'marketing_id'
=>
$marketingIds
]);
//组合sku和order信息
foreach
(
$list
as
&
$listPart
)
{
foreach
(
$listPart
as
$marketingId
=>
&
$value
)
{
$value
[
'sku_list'
]
=
$skuList
[
$marketingId
]
??
[];
$value
[
'order_user'
]
=
$orderUser
[
$marketingId
]
??
[];
$value
[
'participate_number'
]
=
$buyNum
[
$marketingId
]
??
0
;
}
unset
(
$value
);
}
unset
(
$listPart
);
$this
->
success
([
'result'
=>
$list
]);
}
}
\ No newline at end of file
application/services/marketing/MarketingService.php
View file @
f7a3b1ef
...
...
@@ -1083,11 +1083,6 @@ class MarketingService
return
$marketing_list
;
}
public
static
function
tuancanList
(
$params
)
{
}
/**
* 获取多个活动的商品列表
* @param $marketingIds
...
...
@@ -1140,6 +1135,26 @@ class MarketingService
return
$list
;
}
/**
* 获取活动支付用户列表
* @param $params
* @return array|mixed
* @throws InterfaceException
*/
public
static
function
getMarketingOrderUser
(
$params
)
{
$url
=
config
(
'interface'
,
'order.marketing.marketing_user'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$res
=
HttpUtil
::
get
(
$url
,
$params
);
$data
=
[];
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
][
"result"
]))
{
$data
=
$res
[
"response"
][
"result"
];
}
return
$data
;
}
/**
*判断长度
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment