feat: 修改了订单逻辑和佣金产品逻辑,增加了对商品的库存检查,并优化了支付通知逻辑。
This commit is contained in:
parent
522af410cd
commit
17464ff077
@ -83,14 +83,12 @@ class OrderLogic extends BaseLogic
|
|||||||
self::$fresh_price = 0; //生鲜金额
|
self::$fresh_price = 0; //生鲜金额
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose';
|
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])
|
||||||
|
->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose')->find();
|
||||||
if (!$find) {
|
if (!$find) {
|
||||||
// unset($cart_select[$k]);
|
$find = StoreProduct::where(['id' => $v['product_id']])
|
||||||
// continue;
|
->field('store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info,rose')->find();
|
||||||
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info,rose';
|
|
||||||
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
|
||||||
if ($find) {
|
if ($find) {
|
||||||
$cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid');
|
$cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid');
|
||||||
if ($cate_id > 0) {
|
if ($cate_id > 0) {
|
||||||
@ -103,7 +101,6 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cart_select[$k]['status'] = 1; //缺货标识
|
|
||||||
}
|
}
|
||||||
unset($cart_select[$k]['id']);
|
unset($cart_select[$k]['id']);
|
||||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||||
@ -152,7 +149,7 @@ class OrderLogic extends BaseLogic
|
|||||||
$cartInfo['name'] = $find['store_name'];
|
$cartInfo['name'] = $find['store_name'];
|
||||||
$cartInfo['image'] = $find['image'];
|
$cartInfo['image'] = $find['image'];
|
||||||
$cart_select[$k]['cart_info'] = json_encode($cartInfo);
|
$cart_select[$k]['cart_info'] = json_encode($cartInfo);
|
||||||
$cart_select[$k]['branch_product_id'] = $find['branch_product_id'];
|
$cart_select[$k]['branch_product_id'] = $find['branch_product_id']??0;
|
||||||
//理论上每笔都是拆分了
|
//理论上每笔都是拆分了
|
||||||
$cart_select[$k]['name'] = $find['store_name'];
|
$cart_select[$k]['name'] = $find['store_name'];
|
||||||
$cart_select[$k]['imgs'] = $find['image'];
|
$cart_select[$k]['imgs'] = $find['image'];
|
||||||
|
@ -55,6 +55,7 @@ class CommissionProductLogic extends BaseLogic
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
|
'other_uid'=>0,
|
||||||
'number' => bcmul($total_price, $Distribution['store'], 2),
|
'number' => bcmul($total_price, $Distribution['store'], 2),
|
||||||
'oid' => $order['id'],
|
'oid' => $order['id'],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
@ -64,6 +65,7 @@ class CommissionProductLogic extends BaseLogic
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
|
'other_uid'=>0,
|
||||||
'number' => bcmul($total_price, $Distribution['platform'], 2),
|
'number' => bcmul($total_price, $Distribution['platform'], 2),
|
||||||
'oid' => $order['id'],
|
'oid' => $order['id'],
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
@ -139,6 +141,7 @@ class CommissionProductLogic extends BaseLogic
|
|||||||
$data = [
|
$data = [
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
|
'other_uid'=>0,
|
||||||
'number' => $total,
|
'number' => $total,
|
||||||
'oid' => $order['id'],
|
'oid' => $order['id'],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
@ -150,6 +153,7 @@ class CommissionProductLogic extends BaseLogic
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
|
'other_uid'=>0,
|
||||||
'number' => $number,
|
'number' => $number,
|
||||||
'oid' => $order['id'],
|
'oid' => $order['id'],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
@ -159,6 +163,7 @@ class CommissionProductLogic extends BaseLogic
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
|
'other_uid'=>0,
|
||||||
'number' => $commission,
|
'number' => $commission,
|
||||||
'oid' => $order['id'],
|
'oid' => $order['id'],
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
@ -646,7 +646,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||||
$comm = new CommissionProductLogic();
|
$comm = new CommissionProductLogic();
|
||||||
foreach ($info as $v) {
|
foreach ($info as $k=>$v) {
|
||||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid,$user_ship,$spread_user_ship);
|
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid,$user_ship,$spread_user_ship);
|
||||||
}
|
}
|
||||||
CommissionLogic::setStore($order,$village_uid, $brigade_uid, $transaction_id);
|
CommissionLogic::setStore($order,$village_uid, $brigade_uid, $transaction_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user