diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 4697609d3..61f5cffe9 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -156,7 +156,6 @@ class OrderLogic extends BaseLogic 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 'cost' => self::$cost, //成本价1- - 'profit' =>0, //利润 'pay_price' => $pay_price, //后期可能有降价抵扣 'vip_price' => 0, 'total_num' => count($cart_select), //总数 @@ -170,6 +169,7 @@ class OrderLogic extends BaseLogic 'activities' => self::$activity_price>0?1:0, 'deduction_price' => self::$activity_price, 'is_vip' => 0, + 'is_storage' => $params['is_storage']??0, ]; $order['default_delivery'] = 0; if ($params['store_id']) { diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ad000f294..b03b41809 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -7,6 +7,7 @@ use app\common\enum\OrderEnum; use app\common\enum\PayEnum; use app\common\enum\user\UserShipEnum; use app\common\enum\YesNoEnum; +use app\common\logic\user_product_storage\UserProductStorageLogic; use app\common\model\Config; use app\common\model\dict\DictType; use app\common\model\finance\CapitalFlow; @@ -73,6 +74,10 @@ class PayNotifyLogic extends BaseLogic if (!$order->save()) { throw new \Exception('订单保存出错'); } + if($order['is_storage']==1){ + $order->status=2; + UserProductStorageLogic::add($order); + } // 减去余额 $user->now_money = bcsub($user['now_money'], $order['pay_price'], 2); $user->save(); @@ -166,6 +171,10 @@ class PayNotifyLogic extends BaseLogic if (!$order->save()) { throw new \Exception('订单保存出错'); } + if($order['is_storage']==1){ + $order->status=2; + UserProductStorageLogic::add($order); + } // 减去采购款 $user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2); $user->save(); @@ -219,6 +228,7 @@ class PayNotifyLogic extends BaseLogic $user = User::where('id', $order['uid'])->find(); if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付 $order->status = 2; + $order->save(); self::afterPay($order, $extra['transaction_id']); } else { $capitalFlowDao = new CapitalFlowLogic($user); @@ -231,15 +241,6 @@ class PayNotifyLogic extends BaseLogic self::descStock($order['id']); } - // if ($order->pay_type == 9) { - // $extra['create_time'] = $order['create_time']; - // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); - // Redis::send('push-platform-print', ['id' => $order['id']]); - // } - // else { - // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); - // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); - // } if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 4); } diff --git a/app/common/logic/user_product_storage/UserProductStorageLogic.php b/app/common/logic/user_product_storage/UserProductStorageLogic.php new file mode 100644 index 000000000..5fc6199b9 --- /dev/null +++ b/app/common/logic/user_product_storage/UserProductStorageLogic.php @@ -0,0 +1,32 @@ +field('product_id,cart_num nums')->select(); + if($arr){ + $data=$arr; + $data_log=$arr; + + foreach ($data as $k=>$v){ + $data[$k]['uid']=$order['uid']; + $data[$k]['oid']=$order['id']; + $data[$k]['status']=1; + $data_log[$k]['uid']=$order['uid']; + $data_log[$k]['oid']=$order['id']; + $data_log[$k]['financial_pm']=1; + } + UserProductStorage::insertAll($data); + UserProductStorageLog::insertAll($data_log); + + } + } + +} \ No newline at end of file diff --git a/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php b/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php new file mode 100644 index 000000000..686bc0b0f --- /dev/null +++ b/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php @@ -0,0 +1,10 @@ +