Commit 32a692bd authored by jianghaiming's avatar jianghaiming

update:set

parent a00d7975
......@@ -11,6 +11,7 @@ use Api\PhpUtils\Validate\Validate;
use Api\PhpServices\Idgen\Idgen;
use Api\PhpServices\Ksy\Ksyun;
use App\Exception\custom\MarketingException;
use App\Services\common\CommonService;
use Api\PhpServices\Sensitive\Sensitive;
class MarketingGoodsService
{
......@@ -47,12 +48,24 @@ class MarketingGoodsService
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = array_column($subShopList,null,'shop_id');
$marketingList = array_column($marketingList,null,'marketing_id');
$lifeAccountId = array_column($goodsSkuList, 'life_account_id');
$lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => $lifeAccountId]);
$list = [];
$i = 0;
foreach ($data as $key => $value) {
$list[$i] = $value;
$list[$i]['life_account_id'] = !empty($goodsSkuList[$value['goods_sku_id']]['life_account_id']) ? $goodsSkuList[$value['goods_sku_id']]['life_account_id'] : '';
$life_account_id = !empty($list[$i]['life_account_id']) ? $list[$i]['life_account_id'] : '';
$list[$i]['life_account_name'] = !empty($lifeAccountList[$life_account_id]['life_account_name']) ? $lifeAccountList[$life_account_id]['life_account_name'] : '';
$list[$i]['life_account_icon'] = !empty($lifeAccountList[$life_account_id]['life_account_icon']) ? $lifeAccountList[$life_account_id]['life_account_icon'] : '';
$list[$i]['shop_id'] = !empty($goodsSkuList[$value['goods_sku_id']]['shop_id']) ? $goodsSkuList[$value['goods_sku_id']]['shop_id'] : '';
$list[$i]['goods_name'] = !empty($goodsSkuList[$value['goods_sku_id']]['goods_name']) ? $goodsSkuList[$value['goods_sku_id']]['goods_name'] : '';
$list[$i]['goods_desc'] = !empty($goodsSkuList[$value['goods_sku_id']]['desc']) ? $goodsSkuList[$value['goods_sku_id']]['desc'] : '';
......@@ -65,6 +78,20 @@ class MarketingGoodsService
$shopId = !empty($list[$i]['shop_id']) ? $list[$i]['shop_id'] : '';
$list[$i]['shop_name'] = !empty($subShopList[$shopId]['shop_name']) ? $subShopList[$shopId]['shop_name'] : '';
$commissionMode = !empty($marketingList[$value['marketing_id']]['commission_mode']) ? $marketingList[$value['marketing_id']]['commission_mode'] : '';
$firstCommission = !empty($marketingList[$value['marketing_id']]['first_commission_value']) ? $marketingList[$value['marketing_id']]['first_commission_value'] : 0;
//比例
if (!empty($commissionMode) && $commissionMode == 1) {
$price = !empty($list[$i]['price']) ? $list[$i]['price'] : 0;
$list[$i]['share_price'] = $firstCommission*$price/100;
}
//固定
if (!empty($commissionMode) && $commissionMode == 2) {
$list[$i]['share_price'] = $firstCommission;
}
$i++;
}
......
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