Commit 8323311c authored by 顾文旭's avatar 顾文旭

七牛图片获取

parent f56a963d
...@@ -30,13 +30,14 @@ class MarketingService ...@@ -30,13 +30,14 @@ class MarketingService
const ONLINE_LIFE_ACCOUNT_ID = "19019625839230981"; const ONLINE_LIFE_ACCOUNT_ID = "19019625839230981";
const ONLINE_LIFE_ACCOUNT_ID_TEST = "17963416161910792"; const ONLINE_LIFE_ACCOUNT_ID_TEST = "17963416161910792";
const CHARGEFEE = 0.006; const CHARGEFEE = 0.006;
/** /**
* 写死的自营生活号 * 写死的自营生活号
* @return string * @return string
*/ */
public static function getPublicLifeAccountId() public static function getPublicLifeAccountId()
{ {
$lifeAccountId = config('lifeaccount','life_account_id'); $lifeAccountId = config('lifeaccount', 'life_account_id');
return $lifeAccountId; return $lifeAccountId;
} }
...@@ -46,7 +47,7 @@ class MarketingService ...@@ -46,7 +47,7 @@ class MarketingService
* @param $params * @param $params
* @return array|mixed * @return array|mixed
*/ */
public static function marketingGooodsList($params='') public static function marketingGooodsList($params = '')
{ {
$startTime = !empty($params['start_time']) ? $params['start_time'] : ''; $startTime = !empty($params['start_time']) ? $params['start_time'] : '';
$endTime = !empty($params['end_time']) ? $params['end_time'] : ''; $endTime = !empty($params['end_time']) ? $params['end_time'] : '';
...@@ -54,11 +55,11 @@ class MarketingService ...@@ -54,11 +55,11 @@ class MarketingService
$lifeAccountId = !empty($params['life_account_id']) ? $params['life_account_id'] : ''; $lifeAccountId = !empty($params['life_account_id']) ? $params['life_account_id'] : '';
if (empty($startTime)) { if (empty($startTime)) {
throw new MarketingException(['cus'=>8]); throw new MarketingException(['cus' => 8]);
} }
if (empty($endTime)) { if (empty($endTime)) {
throw new MarketingException(['cus'=>9]); throw new MarketingException(['cus' => 9]);
} }
// if ($startTime <= date("Y-m-d")) { // if ($startTime <= date("Y-m-d")) {
...@@ -66,11 +67,11 @@ class MarketingService ...@@ -66,11 +67,11 @@ class MarketingService
// } // }
if ($endTime <= date("Y-m-d")) { if ($endTime <= date("Y-m-d")) {
throw new MarketingException(['cus'=>11]); throw new MarketingException(['cus' => 11]);
} }
if ($startTime >= $endTime) { if ($startTime >= $endTime) {
throw new MarketingException(['cus'=>14]); throw new MarketingException(['cus' => 14]);
} }
$goodsData = [ $goodsData = [
...@@ -170,15 +171,15 @@ class MarketingService ...@@ -170,15 +171,15 @@ class MarketingService
$capitalPoolList = $capitalPoolList['response']['result'] ?: []; $capitalPoolList = $capitalPoolList['response']['result'] ?: [];
$poolTotal = $poolUsed = $poolLock = 0; $poolTotal = $poolUsed = $poolLock = 0;
foreach ($lists as &$val) { foreach ($lists as &$val) {
if($capitalPoolList[$val['capital_pool_id']]) { if ($capitalPoolList[$val['capital_pool_id']]) {
$val['capital_pool'] = $capitalPoolList[$val['capital_pool_id']]; $val['capital_pool'] = $capitalPoolList[$val['capital_pool_id']];
foreach (['capital_pool_total','capital_pool_lock','capital_pool_used'] as $key){ foreach (['capital_pool_total', 'capital_pool_lock', 'capital_pool_used'] as $key) {
$val['capital_pool'][$key] = sprintf("%0.02f",$val['capital_pool'][$key]/100); $val['capital_pool'][$key] = sprintf("%0.02f", $val['capital_pool'][$key] / 100);
} }
$poolTotal += $val['capital_pool']['capital_pool_total']; $poolTotal += $val['capital_pool']['capital_pool_total'];
$poolUsed += $val['capital_pool']['capital_pool_used']; $poolUsed += $val['capital_pool']['capital_pool_used'];
$poolLock += $val['capital_pool']['capital_pool_lock']; $poolLock += $val['capital_pool']['capital_pool_lock'];
}else { } else {
$val['capital_pool'] = []; $val['capital_pool'] = [];
} }
$val['online_status_desc'] = Marketing::$onlineStatusDesc[$val['online_status']]; $val['online_status_desc'] = Marketing::$onlineStatusDesc[$val['online_status']];
...@@ -188,9 +189,9 @@ class MarketingService ...@@ -188,9 +189,9 @@ class MarketingService
} }
$poolbalance = $poolTotal - $poolUsed - $poolLock; $poolbalance = $poolTotal - $poolUsed - $poolLock;
$poolAnalysis = ['total'=>$poolTotal,'used'=>$poolUsed,'lock'=>$poolLock,'balance'=>$poolbalance]; $poolAnalysis = ['total' => $poolTotal, 'used' => $poolUsed, 'lock' => $poolLock, 'balance' => $poolbalance];
return ['anlysis'=>$poolAnalysis,'list' => $lists]; return ['anlysis' => $poolAnalysis, 'list' => $lists];
} }
/** /**
...@@ -222,12 +223,12 @@ class MarketingService ...@@ -222,12 +223,12 @@ class MarketingService
foreach ($params['online_status'] as $key => $valu) { foreach ($params['online_status'] as $key => $valu) {
if (!empty($valu)) { if (!empty($valu)) {
$where['online_status'][$key] = $valu; $where['online_status'][$key] = $valu;
}else{ } else {
$where['online_status'] = [1,2]; $where['online_status'] = [1, 2];
break; break;
} }
} }
}else{ } else {
$where['online_status'] = $params['online_status']; $where['online_status'] = $params['online_status'];
} }
} }
...@@ -238,10 +239,10 @@ class MarketingService ...@@ -238,10 +239,10 @@ class MarketingService
if (empty($marketingGoodsList)) { if (empty($marketingGoodsList)) {
$where['marketing_id'] = "-1"; $where['marketing_id'] = "-1";
}else{ } else {
$marketingId = array_column($marketingGoodsList, 'marketing_id'); $marketingId = array_column($marketingGoodsList, 'marketing_id');
if (!empty($where['marketing_id'])) { if (!empty($where['marketing_id'])) {
array_push($marketingId,$where['marketing_id']); array_push($marketingId, $where['marketing_id']);
} }
$where['marketing_id'] = $marketingId; $where['marketing_id'] = $marketingId;
} }
...@@ -254,13 +255,13 @@ class MarketingService ...@@ -254,13 +255,13 @@ class MarketingService
$lists = []; $lists = [];
foreach ($list as $key => $value) { foreach ($list as $key => $value) {
$lists[$key] = $value; $lists[$key] = $value;
$lists[$key]['first_commission_value'] = !empty($value['first_commission_value']) ? $value['first_commission_value']/100 : 0; $lists[$key]['first_commission_value'] = !empty($value['first_commission_value']) ? $value['first_commission_value'] / 100 : 0;
$lists[$key]['second_commission_value'] = !empty($value['second_commission_value']) ? $value['second_commission_value']/100 : 0; $lists[$key]['second_commission_value'] = !empty($value['second_commission_value']) ? $value['second_commission_value'] / 100 : 0;
} }
unset($where['LIMIT']); unset($where['LIMIT']);
unset($where['ORDER']); unset($where['ORDER']);
$count = Marketing::getCount($where); $count = Marketing::getCount($where);
$data = ['result' => $lists,'count' => $count]; $data = ['result' => $lists, 'count' => $count];
return $data; return $data;
} }
...@@ -282,10 +283,10 @@ class MarketingService ...@@ -282,10 +283,10 @@ class MarketingService
$sortType = isset($params['sort_type']) ? strtoupper($params['sort_type']) : 'desc'; $sortType = isset($params['sort_type']) ? strtoupper($params['sort_type']) : 'desc';
//验证sort合法性 //验证sort合法性
if(!in_array($params['sort_field'],['create_time','update_time','end_time','start_time'])) { if (!in_array($params['sort_field'], ['create_time', 'update_time', 'end_time', 'start_time'])) {
$sortField = 'update_time'; $sortField = 'update_time';
} }
if(!in_array($params['sort_type'],['asc','desc'])) { if (!in_array($params['sort_type'], ['asc', 'desc'])) {
$sortType = 'DESC'; $sortType = 'DESC';
} }
...@@ -312,7 +313,7 @@ class MarketingService ...@@ -312,7 +313,7 @@ class MarketingService
} }
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_START_TODAY) {//今日上新-未开始 } elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_START_TODAY) {//今日上新-未开始
$where["start_time[>]"] = $now; $where["start_time[>]"] = $now;
$where["start_time[<=]"] = date("Y-m-d 00:00:00",strtotime('+1 days')); $where["start_time[<=]"] = date("Y-m-d 00:00:00", strtotime('+1 days'));
$where["end_time[>=]"] = $now; $where["end_time[>=]"] = $now;
} }
...@@ -331,14 +332,14 @@ class MarketingService ...@@ -331,14 +332,14 @@ class MarketingService
$marketingIds[] = $value["marketing_id"]; $marketingIds[] = $value["marketing_id"];
} }
//参与人数:当前拼单成功支付的订单总数量 //参与人数:当前拼单成功支付的订单总数量
if(isset($params['need_buy_num']) && $params['need_buy_num']) { if (isset($params['need_buy_num']) && $params['need_buy_num']) {
$userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]); $userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]);
}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 = []; $priceData = [];
if (!empty($marketingPindanData)) { if (!empty($marketingPindanData)) {
...@@ -362,7 +363,11 @@ class MarketingService ...@@ -362,7 +363,11 @@ class MarketingService
$lists[$key]["life_account_name"] = $lifeAccountList[$currentLifeAccountId]["life_account_name"]; $lists[$key]["life_account_name"] = $lifeAccountList[$currentLifeAccountId]["life_account_name"];
} }
if (substr($priceData[$value["marketing_id"]]["pindan_pic"], 0, 2) === "SHQ") {
$picUrl = GoodsService::getUrlList($priceData[$value["marketing_id"]]["pindan_pic"]); $picUrl = GoodsService::getUrlList($priceData[$value["marketing_id"]]["pindan_pic"]);
} else {
$picUrl = "https://pingouimg.jwshq.cn/" . $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; $lists[$key]["pindan_pic_url"] = $picUrl;
...@@ -382,7 +387,7 @@ class MarketingService ...@@ -382,7 +387,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];
} }
/** /**
...@@ -419,8 +424,8 @@ class MarketingService ...@@ -419,8 +424,8 @@ class MarketingService
$marketingName = !empty($params['marketing_name']) ? $params['marketing_name'] : ''; $marketingName = !empty($params['marketing_name']) ? $params['marketing_name'] : '';
$firstCommissionRate = !empty($params['first_commission_value']) ? $params['first_commission_value']*100 : 0; $firstCommissionRate = !empty($params['first_commission_value']) ? $params['first_commission_value'] * 100 : 0;
$secondCommissionRate = !empty($params['second_commission_value']) ? $params['second_commission_value']*100 : 0; $secondCommissionRate = !empty($params['second_commission_value']) ? $params['second_commission_value'] * 100 : 0;
$createUserEmail = !empty($params['op_cur_user']) ? $params['op_cur_user'] : ''; $createUserEmail = !empty($params['op_cur_user']) ? $params['op_cur_user'] : '';
$startTime = !empty($params['start_time']) ? $params['start_time'] : ''; $startTime = !empty($params['start_time']) ? $params['start_time'] : '';
$endTime = !empty($params['end_time']) ? $params['end_time'] : ''; $endTime = !empty($params['end_time']) ? $params['end_time'] : '';
...@@ -430,16 +435,16 @@ class MarketingService ...@@ -430,16 +435,16 @@ class MarketingService
if ($commissionMode == 1) { if ($commissionMode == 1) {
$rate = $firstCommissionRate + $secondCommissionRate; $rate = $firstCommissionRate + $secondCommissionRate;
if ($rate > 5000) { if ($rate > 5000) {
throw new MarketingException(['cus'=>15]); throw new MarketingException(['cus' => 15]);
} }
} }
if (empty($goodsSkuId)) { if (empty($goodsSkuId)) {
throw new MarketingException(['cus'=>12]); throw new MarketingException(['cus' => 12]);
} }
if (empty($marketingName)) { if (empty($marketingName)) {
throw new MarketingException(['cus'=>0]); throw new MarketingException(['cus' => 0]);
} }
// if (empty($firstCommissionRate)) { // if (empty($firstCommissionRate)) {
...@@ -447,19 +452,19 @@ class MarketingService ...@@ -447,19 +452,19 @@ class MarketingService
// } // }
if (empty($secondCommissionRate)) { if (empty($secondCommissionRate)) {
throw new MarketingException(['cus'=>4]); throw new MarketingException(['cus' => 4]);
} }
if (self::utf8Strlen($marketingName) > 50) { if (self::utf8Strlen($marketingName) > 50) {
throw new MarketingException(['cus'=>1]); throw new MarketingException(['cus' => 1]);
} }
if (empty($startTime)) { if (empty($startTime)) {
throw new MarketingException(['cus'=>8]); throw new MarketingException(['cus' => 8]);
} }
if (empty($endTime)) { if (empty($endTime)) {
throw new MarketingException(['cus'=>9]); throw new MarketingException(['cus' => 9]);
} }
// if ($startTime <= date("Y-m-d")) { // if ($startTime <= date("Y-m-d")) {
...@@ -467,14 +472,14 @@ class MarketingService ...@@ -467,14 +472,14 @@ class MarketingService
// } // }
if ($endTime <= date("Y-m-d")) { if ($endTime <= date("Y-m-d")) {
throw new MarketingException(['cus'=>11]); throw new MarketingException(['cus' => 11]);
} }
if ($startTime >= $endTime) { if ($startTime >= $endTime) {
throw new MarketingException(['cus'=>14]); throw new MarketingException(['cus' => 14]);
} }
$lifeAccountId = config('lifeaccount','life_account_id'); $lifeAccountId = config('lifeaccount', 'life_account_id');
$tmpMarketingId = []; $tmpMarketingId = [];
$tmpGoodsSkuId = []; $tmpGoodsSkuId = [];
...@@ -501,7 +506,7 @@ class MarketingService ...@@ -501,7 +506,7 @@ class MarketingService
if (!empty($tmpGoodsSkuId)) { if (!empty($tmpGoodsSkuId)) {
if (array_intersect($goodsSkuId, $tmpGoodsSkuId)) { if (array_intersect($goodsSkuId, $tmpGoodsSkuId)) {
throw new MarketingException(['cus'=>13]); throw new MarketingException(['cus' => 13]);
} }
} }
...@@ -513,7 +518,7 @@ class MarketingService ...@@ -513,7 +518,7 @@ class MarketingService
]; ];
$sensitive = (new Sensitive)->detect($detectParams); $sensitive = (new Sensitive)->detect($detectParams);
if (!empty($sensitive['data'])) { if (!empty($sensitive['data'])) {
throw new MarketingException(['cus'=>2]); throw new MarketingException(['cus' => 2]);
} }
// //判断重复 // //判断重复
...@@ -552,44 +557,43 @@ class MarketingService ...@@ -552,44 +557,43 @@ class MarketingService
foreach ($goodsSkuList as $key => $value) { foreach ($goodsSkuList as $key => $value) {
$clearPrice = !empty($value["clear_price"]) ? $value["clear_price"] : 0; $clearPrice = !empty($value["clear_price"]) ? $value["clear_price"] : 0;
$price = !empty($value["price"]) ? $value["price"] : 0; $price = !empty($value["price"]) ? $value["price"] : 0;
$chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分) $chargeFee = !empty($price) ? (float)bcmul($price, self::CHARGEFEE, 2) : 0; //手续费 (分)
if ($chargeFee < 1) { if ($chargeFee < 1) {
$chargeFee = 0; $chargeFee = 0;
} }
if (!empty($clearPrice) && $clearPrice > 0) { if (!empty($clearPrice) && $clearPrice > 0) {
if ($commissionMode == Marketing::COMMISSION_MODE_RATE) { if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price; $commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price;
if (($price - $commissionTotal-$chargeFee) < $clearPrice) { if (($price - $commissionTotal - $chargeFee) < $clearPrice) {
throw new GoodsException(['cus' => 48]); throw new GoodsException(['cus' => 48]);
} }
} }
if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) { if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate); $commissionTotal = ($firstCommissionRate + $secondCommissionRate);
if (($price - $commissionTotal - $chargeFee)< $clearPrice) { if (($price - $commissionTotal - $chargeFee) < $clearPrice) {
throw new GoodsException(['cus' => 48]); throw new GoodsException(['cus' => 48]);
} }
} }
}else{ } else {
//比例计算 //比例计算
if ($commissionMode == Marketing::COMMISSION_MODE_RATE) { if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price; $commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price;
if ($price < ($commissionTotal+$chargeFee)) { if ($price < ($commissionTotal + $chargeFee)) {
throw new MarketingException(['cus'=>33]); throw new MarketingException(['cus' => 33]);
} }
} }
//固定金额 //固定金额
if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) { if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate); $commissionTotal = ($firstCommissionRate + $secondCommissionRate);
if ($price < ($commissionTotal+$chargeFee)) { if ($price < ($commissionTotal + $chargeFee)) {
throw new MarketingException(['cus'=>33]); throw new MarketingException(['cus' => 33]);
} }
} }
} }
$colums[$key]['marketing_id'] = $marketingId; $colums[$key]['marketing_id'] = $marketingId;
$colums[$key]['goods_spu_id'] = $value['goods_spu_id']; $colums[$key]['goods_spu_id'] = $value['goods_spu_id'];
$colums[$key]['goods_sku_id'] = $value['goods_sku_id']; $colums[$key]['goods_sku_id'] = $value['goods_sku_id'];
...@@ -607,7 +611,7 @@ class MarketingService ...@@ -607,7 +611,7 @@ class MarketingService
if (!empty($srt)) { if (!empty($srt)) {
Marketing::commit(); Marketing::commit();
return $srt; return $srt;
}else{ } else {
Marketing::rollback(); Marketing::rollback();
throw new MarketingException(['cus' => 5]); throw new MarketingException(['cus' => 5]);
} }
...@@ -631,7 +635,7 @@ class MarketingService ...@@ -631,7 +635,7 @@ class MarketingService
$goodsSkuId = !empty($params['goods_sku_id']) ? explode(",", $params['goods_sku_id']) : []; $goodsSkuId = !empty($params['goods_sku_id']) ? explode(",", $params['goods_sku_id']) : [];
$takePlaceIds = !empty($params['take_place_ids']) ? explode(",", $params['take_place_ids']) : []; $takePlaceIds = !empty($params['take_place_ids']) ? explode(",", $params['take_place_ids']) : [];
//$publicLifeAccountId = self::getPublicLifeAccountId(); //$publicLifeAccountId = self::getPublicLifeAccountId();
$lifeAccountId = config('lifeaccount','life_account_id'); $lifeAccountId = config('lifeaccount', 'life_account_id');
if (empty($marketingName)) { if (empty($marketingName)) {
throw new MarketingException(['cus' => 0]); throw new MarketingException(['cus' => 0]);
} }
...@@ -861,7 +865,7 @@ class MarketingService ...@@ -861,7 +865,7 @@ class MarketingService
$marketingGoods = MarketingGoods::getRecords(["marketing_id" => $marketingId]); $marketingGoods = MarketingGoods::getRecords(["marketing_id" => $marketingId]);
if (!empty($marketingGoods)) { if (!empty($marketingGoods)) {
$ids = array_column($marketingGoods, "id"); $ids = array_column($marketingGoods, "id");
$delRes = MarketingGoods::delete(["id"=>$ids]); $delRes = MarketingGoods::delete(["id" => $ids]);
if ($delRes == 0) { if ($delRes == 0) {
throw new MarketingException(['cus' => 7]); throw new MarketingException(['cus' => 7]);
} }
...@@ -883,7 +887,7 @@ class MarketingService ...@@ -883,7 +887,7 @@ class MarketingService
$marketingTakePlaces = MarketingTakePlace::getRecords(["marketing_id" => $marketingId]); $marketingTakePlaces = MarketingTakePlace::getRecords(["marketing_id" => $marketingId]);
if (!empty($marketingTakePlaces)) { if (!empty($marketingTakePlaces)) {
$ids = array_column($marketingTakePlaces, "marketing_take_place_id"); $ids = array_column($marketingTakePlaces, "marketing_take_place_id");
$delRes = MarketingTakePlace::delete(["marketing_take_place_id"=>$ids]); $delRes = MarketingTakePlace::delete(["marketing_take_place_id" => $ids]);
if ($delRes == 0) { if ($delRes == 0) {
throw new MarketingException(['cus' => 7]); throw new MarketingException(['cus' => 7]);
} }
...@@ -916,7 +920,7 @@ class MarketingService ...@@ -916,7 +920,7 @@ class MarketingService
'activityId' => $marketingId, 'activityId' => $marketingId,
'startDate' => $startTime, 'startDate' => $startTime,
'endDate' => $endTime, 'endDate' => $endTime,
'userId' => config('lifeaccount','life_account_id'), 'userId' => config('lifeaccount', 'life_account_id'),
'activityName' => $marketingName, 'activityName' => $marketingName,
'text' => $pindanDesc, 'text' => $pindanDesc,
'imageId' => $picList[0] ?? '', 'imageId' => $picList[0] ?? '',
...@@ -960,7 +964,7 @@ class MarketingService ...@@ -960,7 +964,7 @@ class MarketingService
'activityId' => $marketingId, 'activityId' => $marketingId,
'startDate' => $marketing['start_time'], 'startDate' => $marketing['start_time'],
'endDate' => $endTime, 'endDate' => $endTime,
'userId' => config('lifeaccount','life_account_id'), 'userId' => config('lifeaccount', 'life_account_id'),
'activityName' => $marketing['marketing_name'], 'activityName' => $marketing['marketing_name'],
'text' => $marketingPindan['pindan_desc'], 'text' => $marketingPindan['pindan_desc'],
'imageId' => $picList[0] ?? '', 'imageId' => $picList[0] ?? '',
...@@ -979,9 +983,9 @@ class MarketingService ...@@ -979,9 +983,9 @@ class MarketingService
* @param $onlineStatus * @param $onlineStatus
* @return \Api\PhpUtils\Mysql\MysqlBase * @return \Api\PhpUtils\Mysql\MysqlBase
*/ */
public static function toogleOnlineStatus($marketingId,$onlineStatus) public static function toogleOnlineStatus($marketingId, $onlineStatus)
{ {
if(!in_array($onlineStatus,array_keys(Marketing::$onlineStatusDesc))) { if (!in_array($onlineStatus, array_keys(Marketing::$onlineStatusDesc))) {
return 0; return 0;
} }
...@@ -1023,7 +1027,7 @@ class MarketingService ...@@ -1023,7 +1027,7 @@ class MarketingService
$goodsSkuList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id']]); $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]);
...@@ -1045,8 +1049,8 @@ class MarketingService ...@@ -1045,8 +1049,8 @@ class MarketingService
} }
} }
$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;
...@@ -1081,7 +1085,7 @@ class MarketingService ...@@ -1081,7 +1085,7 @@ class MarketingService
$marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id'], "ORDER" => ["id" => "ASC"]]); $marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id'], "ORDER" => ["id" => "ASC"]]);
if (!empty($marketingGoodsList)) { if (!empty($marketingGoodsList)) {
$goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id'); $goodsSkuId = array_column($marketingGoodsList, 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
} }
empty($goodsSkuList) && $goodsSkuList = []; empty($goodsSkuList) && $goodsSkuList = [];
...@@ -1195,7 +1199,7 @@ class MarketingService ...@@ -1195,7 +1199,7 @@ class MarketingService
public static function getMarketingList($params) public static function getMarketingList($params)
{ {
$where['marketing_id'] = !empty($params['marketing_id']) ? $params['marketing_id'] : ''; $where['marketing_id'] = !empty($params['marketing_id']) ? $params['marketing_id'] : '';
if(!empty($params['marketing_type'])){ if (!empty($params['marketing_type'])) {
$where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : ''; $where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : '';
} }
$marketing_list = Marketing::getMarketingList($where); $marketing_list = Marketing::getMarketingList($where);
...@@ -1214,7 +1218,7 @@ class MarketingService ...@@ -1214,7 +1218,7 @@ class MarketingService
$goodsSkuList = []; $goodsSkuList = [];
if (!empty($marketingGoodsList)) { if (!empty($marketingGoodsList)) {
$goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id'); $goodsSkuId = array_column($marketingGoodsList, 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = array_column((array)$goodsSkuList, null, "goods_sku_id"); $goodsSkuList = array_column((array)$goodsSkuList, null, "goods_sku_id");
} }
...@@ -1241,7 +1245,7 @@ class MarketingService ...@@ -1241,7 +1245,7 @@ class MarketingService
//没有库存的放在最下面 //没有库存的放在最下面
foreach ($list as $marketingId => $item) { foreach ($list as $marketingId => $item) {
foreach($item as $key=>$value) { foreach ($item as $key => $value) {
if ($value["inventory_rest"] == 0) { if ($value["inventory_rest"] == 0) {
unset($list[$marketingId][$key]); unset($list[$marketingId][$key]);
array_push($list[$marketingId], $value); array_push($list[$marketingId], $value);
...@@ -1278,7 +1282,8 @@ class MarketingService ...@@ -1278,7 +1282,8 @@ class MarketingService
*判断长度 *判断长度
* *
*/ */
public static function utf8Strlen($string = null) { public static function utf8Strlen($string = null)
{
// 将字符串分解为单元 // 将字符串分解为单元
preg_match_all("/./us", $string, $match); preg_match_all("/./us", $string, $match);
// // 返回单元个数 // // 返回单元个数
......
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