feat: 修改了商品相关的API,增加了商品属性值的查询和处理逻辑

This commit is contained in:
mkm 2024-09-14 17:48:29 +08:00
parent e965ec0711
commit 046b9a9cce
10 changed files with 131 additions and 92 deletions

View File

@ -12,6 +12,7 @@ use app\common\model\store_product\StoreProduct;
use app\common\lists\ListsExcelInterface;
use app\common\model\store_category\StoreCategory;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\system_store\SystemStore;
use app\common\model\user\User;
@ -51,9 +52,10 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
public function lists(): array
{
return StoreOrderCartInfo::where($this->searchWhere)
->field('id,oid,uid,product_id,store_id,cart_num,price,total_price,create_time')->limit($this->limitOffset, $this->limitLength)
->field('id,oid,uid,product_id,store_id,cart_num,price,total_price,create_time,attr_value_id')->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item) {
$find=StoreProduct::where('id',$item['product_id'])->field('image,unit,store_name,store_info')->find();
$find=StoreProduct::where('id',$item['product_id'])->field('image,store_name')->find();
$attr_value=StoreProductAttrValue::where('id',$item['attr_value_id'])->find();
if($find){
if($item['uid']>0){
$user=User::where('id',$item['uid'])->field('real_name,mobile')->find();
@ -72,20 +74,18 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
$item['image']=$find['image'];//商品图片
$item['system_store']=SystemStore::where('id',$item['store_id'])->value('name')??"";
$item['store_name']=$find['store_name'];//商品名称
$item['store_info']=$find['store_info'];//商品规格
$item['sku_name']=$attr_value['sku_name']??'';//商品规格
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name')??"";
$item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name')??"";
$item['pay_price'] =$item['total_price'];
$item['cart_info'] = $item->toArray()??[];
}else{
$item['image']='';//商品图片
$item['unit_name']='';//商品图片
$item['cate_name']='';//商品图片
$item['store_name']='';//商品名称
$item['store_info']='';//商品规格-(数据库叫商品简介)
$item['sku_name']='';//商品规格-(数据库叫商品简介)
$item['nickname']='';
$item['system_store']='';
$item['cart_info']=[];
}
return $item; //返回处理后的数据。
})
@ -132,7 +132,7 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
'store_name' => '商品名称',
'system_store' => '门店',
'nickname' => '用户',
'store_info' => '规格',
'sku_name' => '规格',
'unit_name' => '单位',
'cate_name' => '分类',
'cart_num' => '数量',

View File

@ -31,7 +31,7 @@ class CartController extends BaseApiController
{
$params = (new CartValidate())->post()->goCheck('add');
$params['uid'] = $this->request->userId;
$result = Cart::where(['uid' => $params['uid'], 'store_id' => $params['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0, 'delete_time' => null])->find();
$result = Cart::where(['uid' => $params['uid'], 'store_id' => $params['store_id'], 'product_id' => $params['product_id'], 'attr_value_id' => $params['attr_value_id'], 'is_fail' => 0, 'is_pay' => 0, 'delete_time' => null])->find();
$params['cart_num']=bcadd($params['cart_num'],0,2);
//判断起批发价
$branchProduct = StoreProduct::where(
@ -55,7 +55,7 @@ class CartController extends BaseApiController
}
//数量下单判断
$count = Cart::where(['uid' => $params['uid'], 'delete_time' => null, 'is_pay' => 0])->count();
$count = Cart::where(['uid' => $params['uid'], 'is_pay' => 0])->count();
if ($count > 100) {
return $this->fail('购物车商品不能大于100个请先结算');
}

View File

@ -65,16 +65,18 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
->toArray();
$off_activity = Config::where('name', 'off_activity')->value('value');
$user_ship = User::where('id', $userId)->value('user_ship');
$field = 'id,id product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id,batch';
if (in_array($user_ship, [4, 6, 7])) {
$field = 'id,id product_id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id,batch';
}
$field = 'image,store_name';
// if (in_array($user_ship, [4, 6, 7])) {
// $field = 'id,id product_id,image,store_name,unit,top_cate_id,batch';
// }
$this->user_ship = $user_ship;
$this->off_activity = $off_activity;
foreach ($list as $key => &$item) {
$find = StoreProduct::where(['id' => $item['product_id']])
->field($field)
->find();
// $find = StoreProduct::where(['id' => $item['product_id']])
// ->field($field)
// ->find();
$find = StoreProductAttrValue::where(['id'=>$item['attr_value_id']])
->find();
if ($find) {
if ($off_activity == 1) {
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
@ -82,13 +84,15 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
if ($off_activity == 0 && $user_ship == 5 && $find['top_cate_id'] == 15189) {
$find['price'] = $find['cost'];
}
$product_info=StoreProduct::where(['id' => $item['product_id']])->field($field)->find();
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
$item['batch'] = $find['batch'];
$item['imgs'] = $find['image'];
$item['imgs'] = $product_info['image'];
$item['price'] = $find['price'];
$item['cost'] = $find['cost'];
$item['goods_name'] = $find['store_name'];
$item['goods_name'] = $product_info['store_name'];
$item['sku_name'] = $find['sku_name'];
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
}
}

View File

@ -7,6 +7,9 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use Picqer\Barcode\BarcodeGeneratorPNG;
/**
@ -52,22 +55,19 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
->select()
->each(function ($item) {
$item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id'])
->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,cart_info')->limit(3)->select()
->each(function ($v) use ($item) {
$v['store_name'] = '';
$v['image'] = '';
$v['price'] = '';
$v['unit_name']='';
$v['cart_num']=floatval($v['cart_num']);
if(isset($v['cart_info'])){
// foreach( $v['cart_info'] as $k=>$vv){
$v['store_name'] =$v['cart_info']['name'];
$v['image'] =$v['cart_info'] ['image'];
$v['price'] = $v['cart_info']['price'];
$v['unit_name']=$v['cart_info']['unit_name']??'';
// }
->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,attr_value_id,price')->limit(3)->select()
->each(function ($v){
$find=StoreProduct::where('id', $v['product_id'])->field('store_name,image')->find();
$attr_value=StoreProductAttrValue::where('id',$v['attr_value_id'])->find();
$name='';
if($attr_value){
$name=StoreProductUnit::where('id',$attr_value['unit'])->value('name');
}
$v['store_name'] = $find['store_name'] ?? '';
$v['sku_name'] = $attr_value['sku_name'] ?? '';
$v['image'] = $find['image'] ?? '';
$v['price'] = $v['price']??'';
$v['unit_name']=$name;
});
$item['goods_count'] = count(explode(',', $item['cart_id']));
if ($item['refund_reason_time']) {

View File

@ -7,6 +7,9 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use Picqer\Barcode\BarcodeGeneratorPNG;
/**
@ -54,21 +57,19 @@ class StoreOrderList extends BaseAdminDataLists implements ListsSearchInterface
->select()
->each(function ($item) {
$item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id'])
->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,cart_info')->limit(3)->select()
->field('product_id,price,cart_num,verify_code,is_writeoff,writeoff_time,attr_value_id')->limit(3)->select()
->each(function ($v) use ($item) {
$v['store_name'] = '';
$v['image'] = '';
$v['price'] = '';
$v['unit_name']='';
if(isset($v['cart_info'])){
// foreach( $v['cart_info'] as $k=>$vv){
$v['store_name'] =$v['cart_info']['name'];
$v['image'] =$v['cart_info'] ['image'];
$v['price'] = $v['cart_info']['price'];
$v['unit_name']=$v['cart_info']['unit_name']??'';
// }
$find=StoreProduct::where('id', $v['product_id'])->field('store_name,image')->find();
$attr_value=StoreProductAttrValue::where('id',$v['attr_value_id'])->find();
$name='';
if($attr_value){
$name=StoreProductUnit::where('id',$attr_value['unit'])->value('name');
}
$v['store_name'] = $find['store_name'] ?? '';
$v['sku_name'] = $attr_value['sku_name'] ?? '';
$v['image'] = $find['image'] ?? '';
$v['price'] = $v['price']??'';
$v['unit_name']=$name??'';
});
$item['goods_count'] = count(explode(',', $item['cart_id']));
if ($item['refund_reason_time']) {

View File

@ -10,6 +10,7 @@ use app\common\model\store_product\StoreProduct;
use app\common\lists\ListsSearchInterface;
use app\common\model\Config;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\user\User;
//use app\common\model\goods\GoodsLabel;
use think\facade\Db;
@ -117,7 +118,10 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
->limit($this->limitOffset, $this->limitLength)
->order($order)
->select()->each(function ($item) use ($tag, $off_activity, $user_ship) {
$item['attr_value']=StoreProductAttrValue::where('product_id', $item['product_id'])->limit(6)->select();
$item['attr_value']=StoreProductAttrValue::where('product_id', $item['product_id'])->limit(6)->select()->each(function($items){
$items['unit_name']=StoreProductUnit::where('id', $items['unit'])->value('name');
return $items;
});
if ($off_activity == 0 && $user_ship == 5 && $item['top_cate_id'] == 15189) {
$item['price'] = $item['cost'];
}

View File

@ -39,6 +39,7 @@ class CartLogic extends BaseLogic
'uid' => $params['uid'],
'store_id' => $params['store_id'],
'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id'],
'is_pay' => 0,
'source' => $source,
])->field('id')->find();
@ -55,6 +56,7 @@ class CartLogic extends BaseLogic
'staff_id' => $params['staff_id'] ?? 0,
'cart_num' => $params['cart_num'],
'is_new' => $params['is_new'] ?? 0,
'attr_value_id' => $params['attr_value_id'] ?? 0,
'source' =>$source,
]);
}
@ -91,13 +93,15 @@ class CartLogic extends BaseLogic
Cart::where([
'uid' => $params['uid'],
'store_id' => $params['store_id'],
'product_id' => $params['product_id']
'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id']
])->inc('cart_num')->update();
}else{
Cart::where([
'uid' => $params['uid'],
'store_id' => $params['store_id'],
'product_id' => $params['product_id']
'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id']
])->update(['cart_num' => $params['cart_num']]);
}
Db::commit();

View File

@ -69,12 +69,12 @@ class OrderLogic extends BaseLogic
if (empty($params['store_id']) || $params['store_id'] <= 0) {
throw new BusinessException('请选择门店');
}
$source=0;
if (isset($params['source']) && $params['source'] >0) {
$source=$params['source'];
$source = 0;
if (isset($params['source']) && $params['source'] > 0) {
$source = $params['source'];
}
$where = ['is_pay' => 0];
$cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,cart_num,source')->select()->toArray();
$cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,attr_value_id,cart_num,source')->select()->toArray();
if (empty($cart_select)) {
throw new BusinessException('购物车为空');
}
@ -90,17 +90,19 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额
/** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
// $field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
foreach ($cart_select as $k => $v) {
if ($source == 2) {
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
} else {
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
}
// if ($source == 2) {
// $field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
// $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
// } else {
// $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
// }
$find = StoreProductAttrValue::where(['id' => $v['attr_value_id']])->find();
if (!$find) {
throw new BusinessException('商品不存在');
}
$product = StoreProduct::where(['id' => $find['product_id'],])->find();
if (convertNumber($v['cart_num']) == false) {
$is_bulk = StoreProductUnit::where('id', $find['unit'])->value('is_bulk');
if ($is_bulk == 0) {
@ -149,12 +151,12 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //商户价
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2) ?? 0; //vip售价
$cart_select[$k]['vip_price'] = 0; //vip售价
if ($cart_select[$k]['total_price'] > $cart_select[$k]['pay_price']) {
$deduction_price = bcsub($cart_select[$k]['total_price'], $cart_select[$k]['pay_price'], 2);
$cart_select[$k]['deduction_price'] = $deduction_price; //抵扣金额
}
$cart_select[$k]['product_id'] = $find['id'];
$cart_select[$k]['product_id'] = $product['id'];
$cart_select[$k]['old_cart_id'] = $v['id'];
$cart_select[$k]['cart_num'] = floatval($v['cart_num']);
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
@ -173,12 +175,14 @@ class OrderLogic extends BaseLogic
// }
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
$cartInfo = $cart_select[$k];
$cartInfo['name'] = $find['store_name'];
$cartInfo['image'] = $find['image'];
$cartInfo['name'] = $product['store_name'];
$cartInfo['sku_name'] = $find['sku_name'];
$cartInfo['image'] = $product['image'];
$cart_select[$k]['cart_info'] = json_encode($cartInfo);
//理论上每笔都是拆分了
$cart_select[$k]['name'] = $find['store_name'];
$cart_select[$k]['imgs'] = $find['image'];
$cart_select[$k]['name'] = $product['store_name'];
$cart_select[$k]['sku_name'] = $find['sku_name'];
$cart_select[$k]['imgs'] = $product['image'];
$cart_select[$k]['store_id'] = $params['store_id'] ?? 0;
$cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name');
$cart_select[$k]['total_price'] = $cart_select[$k]['pay_price'];
@ -263,6 +267,7 @@ class OrderLogic extends BaseLogic
$alert = '当前时间超过配送截止时间16:00,若下单,物品送达时间为' . date('Y-m-d', strtotime($currentDate . '+2 days'));
}
} catch (\Throwable $e) {
d($e);
throw new BusinessException($e->getMessage());
}
return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store'], 'alert' => $alert];
@ -498,13 +503,15 @@ class OrderLogic extends BaseLogic
if ($find) {
$find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
->field('product_id,cart_num nums,store_id')->select()->each(function ($item) use ($find) {
$find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
->field('product_id,cart_num nums,store_id,attr_value_id,price')->select()->each(function ($item) {
$find = StoreProductAttrValue::where('id', $item['attr_value_id'])->find();
$product = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
$item['store_name'] = $find['store_name'];
$item['store_name'] = $product['store_name'];
$item['sku_name'] = $find['sku_name'];
$item['nums'] = floatval($item['nums']);
$item['image'] = $find['image'];
$item['price'] = $find['price'];
$item['image'] = $product['image'];
$item['price'] = $item['price'];
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? '';
$item['msg'] = '预计48小时发货';
return $item;
@ -522,21 +529,21 @@ class OrderLogic extends BaseLogic
$find['verify_base64'] = 'data:image/png;base64,' . base64_encode($tmpFilename);
}
//处理返回最近的店铺
if ($param['lat'] && $param['long']) {
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
$nearestStore = null;
$minDistance = PHP_FLOAT_MAX;
foreach ($storeAll as $value) {
$value['distance'] = haversineDistance($value['latitude'], $value['longitude'], $param['lat'], $param['long']);
if ($value['distance'] < $minDistance) {
$minDistance = $value['distance'];
$nearestStore = $value;
}
}
if ($nearestStore) {
$find['near_store'] = $nearestStore;
}
}
// if ($param['lat'] && $param['long']) {
// $storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
// $nearestStore = null;
// $minDistance = PHP_FLOAT_MAX;
// foreach ($storeAll as $value) {
// $value['distance'] = haversineDistance($value['latitude'], $value['longitude'], $param['lat'], $param['long']);
// if ($value['distance'] < $minDistance) {
// $minDistance = $value['distance'];
// $nearestStore = $value;
// }
// }
// if ($nearestStore) {
// $find['near_store'] = $nearestStore;
// }
// }
}
return $find;
}

View File

@ -7,6 +7,7 @@ use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\model\user\User;
use PDO;
use support\Log;
@ -23,23 +24,25 @@ class CommissionProductLogic extends BaseLogic
*/
function calculate_product_flow($find, $order, $village_uid = 0, $brigade_uid = 0, $user_ship = 0, $spread_user_ship = 0)
{
$attrValue = StoreProductAttrValue::where('id', $find['attr_value_id'])->find();
$product = StoreProduct::where('id', $find['product_id'])->find();
if ($product) {
if ($attrValue) {
if ($product['product_type'] == 4) {
$this->c($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
$this->c($find, $order, $village_uid, $brigade_uid, $user_ship, $attrValue);
return true;
} else {
if ($user_ship == 5) {
$top_cate_id = $product['top_cate_id'];
if ($top_cate_id == 15189) {
$this->b($find, $order, $product, $user_ship);
$this->b($find, $order, $attrValue, $user_ship);
return true;
}
} elseif ($user_ship == 0) {
$this->b($find, $order, $product, $user_ship);
$this->b($find, $order, $attrValue, $user_ship);
return true;
} else {
$this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
$this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $attrValue);
}
}
@ -93,6 +96,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => $nickname,
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'price' => $price,
'other_uid' => $uid,
'total_price' => $purchase_price,
@ -111,6 +115,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => $nickname,
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $uid,
'price' => $price,
'total_price' => $purchase_price,
@ -136,6 +141,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售队长',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -152,6 +158,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售村长',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $brigade_number,
@ -168,6 +175,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售门店',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $total_price,
@ -184,6 +192,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售平台',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -200,6 +209,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售消耗',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -249,6 +259,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价队长预留',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -265,6 +276,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价村长预留',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $brigade_number,
@ -281,6 +293,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价门店',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $total_price,
@ -297,6 +310,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价平台',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -313,6 +327,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价消耗',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $purchase_price,
@ -355,6 +370,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动队长',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $brigade_uid,
'price' => $price,
'total_price' => $total_price,
@ -371,6 +387,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动村长',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $village_uid,
'price' => $price,
'total_price' => $brigade_number,
@ -387,6 +404,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动门店',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $store_number,
@ -403,6 +421,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动平台',
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0,
'price' => $price,
'total_price' => $platform_number,

View File

@ -682,7 +682,7 @@ class PayNotifyLogic extends BaseLogic
}
try {
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,attr_value_id,product_id,cart_num')->select();
$comm = new CommissionProductLogic();
foreach ($info as $k => $v) {
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);