Browse Source

根据市场ID 获取banner

master
Lemon 5 years ago
parent
commit
38c6f9a605
  1. 6
      app/Controller/PurchaseLimitController.php
  2. 61
      app/Service/PurchaseLimitService.php
  3. 2
      app/Service/PurchaseLimitServiceInterface.php
  4. 1
      config/routes.php

6
app/Controller/PurchaseLimitController.php

@ -22,6 +22,12 @@ class PurchaseLimitController extends BaseController
return $this->success($res);
}
public function getBannerByMarketId()
{
$res = $this->purchaseLimitService->getBannerByMarketId($this->request->all());
return $this->success($res);
}
public function ssdbPurchaseRecord()
{
$res = $this->purchaseLimitService->ssdbPurchaseRecord($this->request->all(),214,156813021196050432);

61
app/Service/PurchaseLimitService.php

@ -24,31 +24,76 @@ class PurchaseLimitService implements PurchaseLimitServiceInterface
*/
protected $paramsTokenService;
/**
* @Inject
* @var AdServiceInterface
*/
protected $adService;
public function getStoreIdByMarketId($params)
{
$market_id = $params['market_id'];
$res = [];
//获取ssdb上的首页banner logo 列表
$logo_list = $this->paramsTokenService->analyze('banner_logo_list');
if (false === $logo_list) {
return $res;
}
//获取ssdb上的首页banner 市场 列表
$market_list = $this->paramsTokenService->analyze('banner_market_list');
if (false === $market_list) {
return $res;
}
//根据前端指定的指获取店铺id 字符串 并拆分成数组
$store_list = $market_list['market_id_'.$market_id];
$store_list = explode(',',$store_list);
if(isset($market_list['market_id_'.$market_id])) {
$store_list = $market_list['market_id_' . $market_id];
$store_list = explode(',', $store_list);
//遍历店铺
foreach ($store_list as $store_id){
foreach ($store_list as $store_id) {
$res[] = [
'id' => 7,
'id' => $store_id,
'item' => 1,
'item_text' => 'page',
'logo' => $logo_list['store_id_'.$store_id],
'redirect_url' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid='.$store_id,
'src' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid='.$store_id,
'src2' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid='.$store_id,
'logo' => $logo_list['store_id_' . $store_id],
'redirect_url' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
'src' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
'src2' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
];
}
}
return $res;
}
public function getBannerByMarketId($params)
{
$market_id = $params['market_id'];
//获取ssdb上的首页banner logo 列表
$logo_list = $this->paramsTokenService->analyze('banner_logo_list');
//获取ssdb上的首页banner 市场 列表
$market_list = $this->paramsTokenService->analyze('banner_market_list');
//根据前端指定的指获取店铺id 字符串 并拆分成数组
if(isset($market_list['market_id_'.$market_id])) {
$store_list = $market_list['market_id_' . $market_id];
$store_list = explode(',', $store_list);
//遍历店铺
foreach ($store_list as $store_id) {
$banners[] = [
'id' => $store_id,
'item' => 1,
'item_text' => 'page',
'logo' => $logo_list['store_id_' . $store_id],
'redirect_url' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
'src' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
'src2' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=' . $store_id,
];
}
}else{
$banners = $this->adService->banners();
}
return $banners;
}
public function ssdbPurchaseRecord($data,$user_id,$global_order_id)
{
foreach ($data as $k => $v){

2
app/Service/PurchaseLimitServiceInterface.php

@ -8,6 +8,8 @@ interface PurchaseLimitServiceInterface
{
public function getStoreIdByMarketId($params);
public function getBannerByMarketId($params);
public function ssdbPurchaseRecord($params,$user_id,$global_order_id);
public function delSsdbPurchaseRecord($global_order_id);

1
config/routes.php

@ -66,6 +66,7 @@ Router::addGroup('/v1/',function (){
Router::post('PurchaseLimit/getStoreIdByMarketId', 'App\Controller\PurchaseLimitController@getStoreIdByMarketId');
Router::post('OrderList/storeOrderList', 'App\Controller\OrderListController@storeOrderList');
Router::post('OrderList/userOrderList', 'App\Controller\OrderListController@userOrderList');
Router::post('PurchaseLimit/getBannerByMarketId', 'App\Controller\PurchaseLimitController@getBannerByMarketId');
},['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]);

Loading…
Cancel
Save