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
984dd218
Commit
984dd218
authored
Sep 17, 2021
by
suntengda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 拼单小程序活动列表新版接口
parent
e68ce8cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+2
-1
MarketingService.php
application/services/marketing/MarketingService.php
+12
-4
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
984dd218
...
@@ -177,8 +177,9 @@ class MarketingController extends Base
...
@@ -177,8 +177,9 @@ class MarketingController extends Base
*/
*/
public
function
pindan_active_basic_listAction
()
public
function
pindan_active_basic_listAction
()
{
{
$excludeMarketingId
=
$this
->
params
[
'exclude_marketing_id'
]
??
''
;
$limit
=
$this
->
params
[
'limit'
]
??
1
;
$limit
=
$this
->
params
[
'limit'
]
??
1
;
$list
=
MarketingService
::
pindanActiveBasicList
(
$limit
,
true
);
$list
=
MarketingService
::
pindanActiveBasicList
(
$
excludeMarketingId
,
$
limit
,
true
);
$this
->
success
([
'result'
=>
$list
]);
$this
->
success
([
'result'
=>
$list
]);
}
}
...
...
application/services/marketing/MarketingService.php
View file @
984dd218
...
@@ -397,13 +397,15 @@ class MarketingService
...
@@ -397,13 +397,15 @@ class MarketingService
/**
/**
* 正在进行中的活动简单信息列表
* 正在进行中的活动简单信息列表
* @param $excludeMarketingId
* @param int $limit
* @param int $limit
* @param bool $needSkuList
* @param bool $needSkuList
* @return \Api\PhpUtils\Mysql\MysqlBase
* @return \Api\PhpUtils\Mysql\MysqlBase
|array
* @throws InterfaceException
* @throws InterfaceException
*/
*/
public
static
function
pindanActiveBasicList
(
$limit
=
2
,
$needSkuList
=
true
)
public
static
function
pindanActiveBasicList
(
$
excludeMarketingId
=
''
,
$
limit
=
2
,
$needSkuList
=
true
)
{
{
$limit
+=
1
;
//查询结果需要排除掉传递的活动,所以需要多取一条
$where
[
"marketing_type"
]
=
Marketing
::
MARKETING_TYPE_PINDAN
;
$where
[
"marketing_type"
]
=
Marketing
::
MARKETING_TYPE_PINDAN
;
$where
[
'online_status'
]
=
Marketing
::
ONLINE_STATUS_QIDONG
;
$where
[
'online_status'
]
=
Marketing
::
ONLINE_STATUS_QIDONG
;
$where
+=
self
::
getStartEndTimeFilter
(
MarketingPindan
::
ACTIVITY_STATUS_IN_PROGRESS
);
$where
+=
self
::
getStartEndTimeFilter
(
MarketingPindan
::
ACTIVITY_STATUS_IN_PROGRESS
);
...
@@ -415,18 +417,24 @@ class MarketingService
...
@@ -415,18 +417,24 @@ class MarketingService
if
(
empty
(
$list
))
{
if
(
empty
(
$list
))
{
return
[];
return
[];
}
}
$list
=
array_column
(
$list
,
null
,
'marketing_id'
);
//从列表中排除需要排除的活动
if
(
$excludeMarketingId
&&
isset
(
$list
[
$excludeMarketingId
])){
unset
(
$list
[
$excludeMarketingId
]);
}
//获取活动sku列表
//获取活动sku列表
if
(
$needSkuList
)
{
if
(
$needSkuList
)
{
$list
=
array_column
(
$list
,
null
,
'marketing_id'
);
$skuList
=
self
::
getGoodsSkuListByMarketingIds
(
array_keys
(
$list
));
$skuList
=
self
::
getGoodsSkuListByMarketingIds
(
array_keys
(
$list
));
foreach
(
$list
as
$marketingId
=>
&
$value
)
{
foreach
(
$list
as
$marketingId
=>
&
$value
)
{
$value
[
'sku_list'
]
=
$skuList
[
$marketingId
]
??
[];
$value
[
'sku_list'
]
=
$skuList
[
$marketingId
]
??
[];
}
}
unset
(
$value
);
unset
(
$value
);
$list
=
array_slice
(
$list
,
0
);
}
}
$list
=
array_slice
(
$list
,
0
);
return
$list
;
return
$list
;
}
}
...
...
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