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
6fc755e9
Commit
6fc755e9
authored
Sep 17, 2021
by
suntengda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 拼单小程序活动列表新版接口 并发调用订单接口
parent
02372220
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
5 deletions
+35
-5
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+3
-1
MarketingService.php
application/services/marketing/MarketingService.php
+32
-4
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
6fc755e9
...
...
@@ -190,7 +190,9 @@ class MarketingController extends Base
*/
public
function
pindan_active_and_ready_listAction
()
{
$list
=
MarketingService
::
getPindanActiveAndReadyList
();
$page
=
$this
->
params
[
'page'
]
??
1
;
$pageSize
=
$this
->
params
[
'page_size'
]
??
50
;
$list
=
MarketingService
::
getPindanActiveAndReadyList
(
$page
,
$pageSize
);
$this
->
success
([
'result'
=>
$list
]);
}
...
...
application/services/marketing/MarketingService.php
View file @
6fc755e9
...
...
@@ -541,17 +541,33 @@ class MarketingService
private
static
function
_fillSkuAndOrderInfo
(
$marketingIds
,
$list
)
{
//获取活动的sku列表
$skuList
=
self
::
getGoodsSkuListByMarketingIds
(
$marketingIds
);
//获取活动支付用户列表
$orderUser
=
self
::
getMarketingOrderUser
([
'marketing_id'
=>
$marketingIds
]);
//获取活动支付用户数
$buyNum
=
self
::
getHaveBuyGoodsUserCount
([
'marketing_id'
=>
$marketingIds
]);
//并行调用order统计接口
$urls
[
'order_user'
]
=
config
(
'interface'
,
'order.marketing.marketing_user'
);
$urls
[
'buy_num'
]
=
config
(
'interface'
,
'order.order.have_buy_goods_user_count'
);
$params
[
'order_user'
]
=
$params
[
'buy_num'
]
=
[
'marketing_id'
=>
$marketingIds
];
$encryptRes
=
HttpUtil
::
concurrencyPost
(
$urls
,
$params
);
if
(
!
empty
(
$encryptRes
))
{
foreach
(
$encryptRes
as
$key
=>
$item
)
{
if
(
!
empty
(
$item
[
"response"
]))
{
$data
[
$key
]
=
$item
[
'response'
][
'result'
];
}
}
}
//组合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
;
$value
[
'order_user'
]
=
$
data
[
'order_user'
]
[
$marketingId
]
??
[];
$value
[
'participate_number'
]
=
$
data
[
'buy_num'
]
[
$marketingId
]
??
0
;
}
unset
(
$value
);
$listPart
=
array_values
(
$listPart
);
...
...
@@ -1389,11 +1405,20 @@ class MarketingService
{
$marketingGoodsList
=
MarketingGoods
::
marketingGoodsList
([
'marketing_id'
=>
$marketingIds
,
"ORDER"
=>
[
"id"
=>
"ASC"
]]);
$goodsSkuList
=
[];
$goodsSkuList
=
$picUrl
=
[];
if
(
!
empty
(
$marketingGoodsList
))
{
$goodsSkuId
=
array_column
(
$marketingGoodsList
,
'goods_sku_id'
);
$goodsSkuList
=
PindanGoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
array_column
((
array
)
$goodsSkuList
,
null
,
"goods_sku_id"
);
$picIds
=
[];
if
(
!
empty
(
$goodsSkuList
))
{
foreach
(
$goodsSkuList
as
$index
=>
$item
)
{
$item
[
'desc_pic_url'
]
=
explode
(
','
,
$item
[
'desc_pic_url'
])
?:
[];
$picIds
=
array_merge
(
$picIds
,
$item
[
'desc_pic_url'
]);
}
$picUrl
=
Ks3Api
::
concurrencyPicEncryptUrl
(
$picIds
);
}
}
$list
=
[];
...
...
@@ -1409,7 +1434,10 @@ class MarketingService
$list
[
$value
[
'marketing_id'
]][
$key
]
=
$value
;
$item
=
$goodsSkuList
[
$value
[
"goods_sku_id"
]];
$list
[
$value
[
'marketing_id'
]][
$key
][
'goods_name'
]
=
$item
[
'goods_name'
];
$list
[
$value
[
'marketing_id'
]][
$key
][
"desc_pic_url_list"
]
=
GoodsService
::
getUrlList
(
$item
[
"desc_pic_url"
]);
foreach
(
$goodsSkuList
[
$value
[
"goods_sku_id"
]][
'desc_pic_url'
]
as
$picId
)
{
$list
[
$value
[
'marketing_id'
]][
$key
][
"desc_pic_url_list"
][]
=
$picUrl
[
$picId
];
}
$list
[
$value
[
'marketing_id'
]][
$key
][
"original_price"
]
=
empty
(
$item
[
"original_price"
])
?
''
:
sprintf
(
"%.2f"
,
(
int
)
$item
[
"original_price"
]
/
100
);
$list
[
$value
[
'marketing_id'
]][
$key
][
"price"
]
=
sprintf
(
"%.2f"
,
$item
[
"price"
]
/
100
);
$needSoldNum
&&
$list
[
$value
[
'marketing_id'
]][
$key
][
"all_have_buy_goods_count"
]
=
$soldNum
[
$value
[
"goods_sku_id"
]]
??
0
;
...
...
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