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
02372220
Commit
02372220
authored
Sep 17, 2021
by
suntengda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 拼单小程序活动列表新版接口 并发获取图片
parent
984dd218
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
26 deletions
+39
-26
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+1
-0
MarketingService.php
application/services/marketing/MarketingService.php
+38
-26
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
02372220
...
@@ -174,6 +174,7 @@ class MarketingController extends Base
...
@@ -174,6 +174,7 @@ class MarketingController extends Base
/**
/**
* 正在进行中的活动简单信息列表
* 正在进行中的活动简单信息列表
* @throws \App\Exception\custom\InterfaceException
*/
*/
public
function
pindan_active_basic_listAction
()
public
function
pindan_active_basic_listAction
()
{
{
...
...
application/services/marketing/MarketingService.php
View file @
02372220
...
@@ -26,6 +26,7 @@ use Daemon\Goods;
...
@@ -26,6 +26,7 @@ use Daemon\Goods;
use
App\Exception\custom\GoodsException
;
use
App\Exception\custom\GoodsException
;
use
Api\PhpUtils\Redis\RedisUtil
;
use
Api\PhpUtils\Redis\RedisUtil
;
use
Api\PhpUtils\Log\FileLog
;
use
Api\PhpUtils\Log\FileLog
;
use
Helpers\DebugLog
;
class
MarketingService
class
MarketingService
{
{
...
@@ -302,14 +303,11 @@ class MarketingService
...
@@ -302,14 +303,11 @@ class MarketingService
$where
+=
self
::
getStartEndTimeFilter
(
$params
[
'activity_status'
],
$params
[
'from'
]);
$where
+=
self
::
getStartEndTimeFilter
(
$params
[
'activity_status'
],
$params
[
'from'
]);
$where
[
'life_account_id'
]
=
self
::
getPublicLifeAccountId
();
$where
[
'life_account_id'
]
=
self
::
getPublicLifeAccountId
();
$where
[
'ORDER'
]
=
[
$sortField
=>
$sortType
];
$where
[
'ORDER'
]
=
[
$sortField
=>
$sortType
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$list
=
Marketing
::
select
([
"marketing_id"
,
"marketing_name"
,
"start_time"
,
"end_time"
,
$list
=
Marketing
::
select
([
"marketing_id"
,
"marketing_name"
,
"start_time"
,
"end_time"
,
"online_status"
,
"update_time"
,
"create_time"
]
"online_status"
,
"update_time"
,
"create_time"
]
,
$where
);
,
$where
);
$lists
=
[];
$lists
=
[];
if
(
!
empty
(
$list
))
{
if
(
!
empty
(
$list
))
{
$marketingIds
=
[];
$marketingIds
=
[];
...
@@ -322,20 +320,27 @@ class MarketingService
...
@@ -322,20 +320,27 @@ class MarketingService
}
else
{
}
else
{
$userCount
=
[];
$userCount
=
[];
}
}
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"publish_life_account_id"
,
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"publish_life_account_id"
,
"min_price"
,
"max_price"
,
"pindan_desc"
,
"participate_number"
,
"pindan_pic"
]
"min_price"
,
"max_price"
,
"pindan_desc"
,
"participate_number"
,
"pindan_pic"
]
,
[
"marketing_id"
=>
$marketingIds
]);
,
[
"marketing_id"
=>
$marketingIds
]);
$priceData
=
[];
if
(
empty
(
$marketingPindanData
))
{
if
(
!
empty
(
$marketingPindanData
))
{
return
[
'result'
=>
[],
'count'
=>
0
];
}
$priceData
=
$picIds
=
[];
foreach
(
$marketingPindanData
as
$item
)
{
foreach
(
$marketingPindanData
as
$item
)
{
$priceData
[
$item
[
"marketing_id"
]]
=
$item
;
$priceData
[
$item
[
"marketing_id"
]]
=
$item
;
$priceData
[
$item
[
"marketing_id"
]][
'pindan_pic'
]
=
$item
[
'pindan_pic'
]
?
explode
(
','
,
$item
[
'pindan_pic'
])
:
[];
$picIds
=
array_merge
(
$picIds
,
$priceData
[
$item
[
"marketing_id"
]][
'pindan_pic'
]);
}
}
}
//获取图片
$picUrl
=
Ks3Api
::
concurrencyPicEncryptUrl
(
$picIds
);
//获取生活号信息
$publishLifeAccountIds
=
array_unique
(
array_column
(
$marketingPindanData
,
"publish_life_account_id"
));
$publishLifeAccountIds
=
array_unique
(
array_column
(
$marketingPindanData
,
"publish_life_account_id"
));
$lifeAccountList
=
CommonService
::
getlifeAccountList
([
'life_account_id'
=>
$publishLifeAccountIds
]);
$lifeAccountList
=
CommonService
::
getlifeAccountList
([
'life_account_id'
=>
$publishLifeAccountIds
]);
$defaultPic
=
"SHQ_goods_0_012Xh1AQcMqu"
;
$defaultPic
=
"SHQ_goods_0_012Xh1AQcMqu"
;
foreach
(
$list
as
$key
=>
$value
)
{
foreach
(
$list
as
$key
=>
$value
)
{
$lists
[
$key
]
=
$value
;
$lists
[
$key
]
=
$value
;
$lists
[
$key
][
"online_status_desc"
]
=
Marketing
::
$onlineStatusDesc
[
$value
[
"online_status"
]];
$lists
[
$key
][
"online_status_desc"
]
=
Marketing
::
$onlineStatusDesc
[
$value
[
"online_status"
]];
...
@@ -348,10 +353,16 @@ class MarketingService
...
@@ -348,10 +353,16 @@ class MarketingService
$lists
[
$key
][
"life_account_name"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_name"
];
$lists
[
$key
][
"life_account_name"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_name"
];
}
}
$picUrl
=
GoodsService
::
getUrlList
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
]);
$lists
[
$key
][
"min_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"min_price"
]
/
100
);
$lists
[
$key
][
"min_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"min_price"
]
/
100
);
$lists
[
$key
][
"max_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
]
/
100
);
$lists
[
$key
][
"max_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
]
/
100
);
$lists
[
$key
][
"pindan_pic_url"
]
=
$picUrl
;
if
(
$priceData
[
$value
[
"marketing_id"
]][
'pindan_pic'
])
{
foreach
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
]
as
$picId
)
{
$lists
[
$key
][
"pindan_pic_url"
][]
=
$picUrl
[
$picId
];
}
}
else
{
$lists
[
$key
][
"pindan_pic_url"
]
=
[];
}
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
$lists
[
$key
][
"participate_number"
]
=
empty
(
$userCount
[
$value
[
'marketing_id'
]])
?
0
:
$userCount
[
$value
[
'marketing_id'
]];
$lists
[
$key
][
"participate_number"
]
=
empty
(
$userCount
[
$value
[
'marketing_id'
]])
?
0
:
$userCount
[
$value
[
'marketing_id'
]];
...
@@ -368,6 +379,7 @@ class MarketingService
...
@@ -368,6 +379,7 @@ class MarketingService
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
unset
(
$where
[
'ORDER'
]);
$count
=
Marketing
::
count
(
"*"
,
$where
);
$count
=
Marketing
::
count
(
"*"
,
$where
);
return
[
'result'
=>
$lists
,
'count'
=>
$count
];
return
[
'result'
=>
$lists
,
'count'
=>
$count
];
}
}
...
@@ -425,7 +437,7 @@ class MarketingService
...
@@ -425,7 +437,7 @@ class MarketingService
}
}
//获取活动sku列表
//获取活动sku列表
if
(
$needSkuList
)
{
if
(
$needSkuList
)
{
$skuList
=
self
::
getGoodsSkuListByMarketingIds
(
array_keys
(
$list
));
$skuList
=
self
::
getGoodsSkuListByMarketingIds
(
array_keys
(
$list
)
,
false
);
foreach
(
$list
as
$marketingId
=>
&
$value
)
{
foreach
(
$list
as
$marketingId
=>
&
$value
)
{
$value
[
'sku_list'
]
=
$skuList
[
$marketingId
]
??
[];
$value
[
'sku_list'
]
=
$skuList
[
$marketingId
]
??
[];
...
@@ -1400,7 +1412,7 @@ class MarketingService
...
@@ -1400,7 +1412,7 @@ class MarketingService
$list
[
$value
[
'marketing_id'
]][
$key
][
"desc_pic_url_list"
]
=
GoodsService
::
getUrlList
(
$item
[
"desc_pic_url"
]);
$list
[
$value
[
'marketing_id'
]][
$key
][
"desc_pic_url_list"
]
=
GoodsService
::
getUrlList
(
$item
[
"desc_pic_url"
]);
$list
[
$value
[
'marketing_id'
]][
$key
][
"original_price"
]
=
empty
(
$item
[
"original_price"
])
?
''
:
sprintf
(
"%.2f"
,
(
int
)
$item
[
"original_price"
]
/
100
);
$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
);
$list
[
$value
[
'marketing_id'
]][
$key
][
"price"
]
=
sprintf
(
"%.2f"
,
$item
[
"price"
]
/
100
);
$list
[
$value
[
'marketing_id'
]][
$key
][
"all_have_buy_goods_count"
]
=
$soldNum
[
$value
[
"goods_sku_id"
]]
??
0
;
$
needSoldNum
&&
$
list
[
$value
[
'marketing_id'
]][
$key
][
"all_have_buy_goods_count"
]
=
$soldNum
[
$value
[
"goods_sku_id"
]]
??
0
;
$list
[
$value
[
'marketing_id'
]][
$key
][
'inventory_rest'
]
=
$item
[
'inventory_rest'
];
$list
[
$value
[
'marketing_id'
]][
$key
][
'inventory_rest'
]
=
$item
[
'inventory_rest'
];
}
}
...
...
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