Commit c682fcaa authored by luhongguang's avatar luhongguang

update:拼单商品info

parent e7fb431a
...@@ -58,29 +58,4 @@ class CommonService ...@@ -58,29 +58,4 @@ class CommonService
return $goodsShareId; return $goodsShareId;
} }
public static function getUrlList($picUrlStr)
{
$data = $ksyunParams = [];
$strList = explode(",", $picUrlStr);
foreach ($strList as $key => $str) {
$arr = explode("/", $str);
if (count($arr) != 2) {
if (preg_match("/^http[s]{0,1}:\/\/([\w.]+\/?)\S*/", $str)) {
$data[] = $str;
} else {
continue;
}
} else {
$bucket = $arr[0];
$objectId = $arr[1];
$url = Ksyun::getPicUrl("merchant-b", 'goods_temp', $bucket . '/' . $objectId, 200, 200, 'jpeg');
$data[] = $url;
}
}
return $data;
}
} }
\ No newline at end of file
...@@ -12,12 +12,13 @@ use App\Exception\custom\MarketingException; ...@@ -12,12 +12,13 @@ use App\Exception\custom\MarketingException;
use Api\PhpServices\Sensitive\Sensitive; use Api\PhpServices\Sensitive\Sensitive;
use App\Models\marketing\mysql\MarketingPindan; use App\Models\marketing\mysql\MarketingPindan;
use App\Services\common\CommonService; use App\Services\common\CommonService;
use App\Services\goods\GoodsService;
use Daemon\Goods; use Daemon\Goods;
class MarketingService class MarketingService
{ {
const PUBLIC_LIFE_ACCOUNT_ID = 111; const PUBLIC_LIFE_ACCOUNT_ID = "15238011155677187";
/** /**
* op 后台获取活动需要参加的商品 * op 后台获取活动需要参加的商品
...@@ -626,17 +627,41 @@ class MarketingService ...@@ -626,17 +627,41 @@ class MarketingService
return true; return true;
} }
/**
* 分销活动详情
* @param $params
* @return array|mixed
* @throws \App\Exception\custom\InterfaceException
*/
public static function marketingInfo($params) public static function marketingInfo($params)
{ {
$where['marketing_id'] = !empty($params['marketing_id']) ? $params['marketing_id'] : ''; $marketingType = !empty($params['marketing_type']) ? $params['marketing_type'] : Marketing::MARKETING_TYPE_FENXIAO;
$marketing_info = Marketing::getRecord($where); if ($marketingType == Marketing::MARKETING_TYPE_FENXIAO) {
return self::fenxiaoMarketingInfo($params);
} else if ($marketingType == Marketing::MARKETING_TYPE_TUANGOU) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_MIAOSHA) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_PINDAN) {
return self::pindanMarketingInfo($params);
}
}
/**
* 分销活动详情
* @param $params
* @return mixed
* @throws \App\Exception\custom\InterfaceException
*/
private static function fenxiaoMarketingInfo($params)
{
$marketing_info = Marketing::getRecord(['marketing_id' => $params['marketing_id'], "marketing_type" => Marketing::MARKETING_TYPE_FENXIAO]);
$goodsSkuList = MarketingGoods::marketingGoodsList($where); $goodsSkuList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id']]);
$goodsSkuId = array_column($goodsSkuList , 'goods_sku_id'); $goodsSkuId = array_column($goodsSkuList , 'goods_sku_id');
$goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
$lifeAccountIds = []; $lifeAccountIds = [];
...@@ -652,18 +677,62 @@ class MarketingService ...@@ -652,18 +677,62 @@ class MarketingService
$list[$key]['goods_spu_id'] = $value['goods_spu_id']; $list[$key]['goods_spu_id'] = $value['goods_spu_id'];
$list[$key]['life_account_id'] = $value['life_account_id']; $list[$key]['life_account_id'] = $value['life_account_id'];
$list[$key]['goods_name'] = $value['goods_name']; $list[$key]['goods_name'] = $value['goods_name'];
$list[$key]['life_account_name'] = !empty($lifeAccountList[$value['life_account_id']]['life_account_name']) ? $lifeAccountList[$value['life_account_id']]['life_account_name'] : ''; $list[$key]['life_account_name'] = !empty($lifeAccountList[$value['life_account_id']]['life_account_name']) ? $lifeAccountList[$value['life_account_id']]['life_account_name'] : '';
} }
} }
$marketing_info['first_commission_value'] = !empty($marketing_info['first_commission_value']) ? $marketing_info['first_commission_value']/100 : 0; $marketing_info['first_commission_value'] = !empty($marketing_info['first_commission_value']) ? $marketing_info['first_commission_value']/100 : 0;
$marketing_info['second_commission_value'] = !empty($marketing_info['second_commission_value']) ? $marketing_info['second_commission_value']/100 : 0; $marketing_info['second_commission_value'] = !empty($marketing_info['second_commission_value']) ? $marketing_info['second_commission_value']/100 : 0;
$info['marketing_info'] = $marketing_info; $info['marketing_info'] = $marketing_info;
$info['goods_list'] = $list; $info['goods_list'] = $list;
return $info; return $info;
} }
/**
* 拼单活动详情
* @param $params
* @return mixed
* @throws \App\Exception\custom\InterfaceException
*/
private static function pindanMarketingInfo($params)
{
$marketingInfo = Marketing::getRecord(['marketing_id' => $params['marketing_id'], "marketing_type" => Marketing::MARKETING_TYPE_PINDAN]);
$pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]);
$lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]);
$goodsSkuList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id']]);
$goodsSkuId = array_column($goodsSkuList , 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['pindan_goods_sku_id' => $goodsSkuId]);
$marketingData["life_account_name"] = $lifeAccountList[$pindanMarketing["publish_life_account_id"]]["life_account_name"];
$marketingData["life_account_icon"] = $lifeAccountList[$pindanMarketing["publish_life_account_id"]]["life_account_icon"];
$marketingData["id"] = $marketingInfo["marketing_id"];
$marketingData["marketing_name"] = $marketingInfo["marketing_name"];
$marketingData["good_count"] = $marketingInfo["good_count"];
$marketingData["start_time"] = $marketingInfo["start_time"];
$marketingData["end_time"] = $marketingInfo["end_time"];
$marketingData["online_status"] = $marketingInfo["online_status"];
$marketingData["marketing_type"] = $marketingInfo["marketing_type"];
$marketingData["publish_life_account_id"] = $pindanMarketing["publish_life_account_id"];
$marketingData["pindan_pic"] = $pindanMarketing["pindan_pic"];
$marketingData["pindan_pic_url"] = GoodsService::getUrlList($marketingData["pindan_pic"]);
$marketingData["pindan_desc"] = $pindanMarketing["pindan_desc"];
$marketingData["max_price"] = $pindanMarketing["max_price"];
$marketingData["min_price"] = $pindanMarketing["min_price"];
$marketingData["participate_number"] = $pindanMarketing["participate_number"];
$info['marketing_info'] = $marketingData;
if (!empty($goodsSkuList)) {
foreach ($goodsSkuList as $key => $item) {
$goodsSkuList[$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]);
}
}
$info['goods_list'] = $goodsSkuList;
return $info;
}
public static function getMarketingList($params) public static function getMarketingList($params)
{ {
...@@ -672,9 +741,6 @@ class MarketingService ...@@ -672,9 +741,6 @@ class MarketingService
return $marketing_list; return $marketing_list;
} }
/** /**
*判断长度 *判断长度
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment