diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index d27b03bd8..1cdece94e 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -594,6 +594,7 @@ class OrderLogic extends BaseLogic 'writeoff_time' => time(), 'is_writeoff' => YesNoEnum::YES, 'store_id' => $params['store_id'], + 'status' => 1, 'staff_id' => $params['staff_id'] ?? 0, 'update_time' => time(), ], ['oid' => $order['id']]); @@ -627,51 +628,6 @@ class OrderLogic extends BaseLogic } } - //不走二次分钱的核销 - public static function lessWriteOff($params): bool - { - $data = StoreOrder::with('store')->where([ - 'verify_code' => $params['verify_code'] - ])->find(); - if (empty($data)) { - return false; - } - Db::startTrans(); - try { - StoreOrder::update([ - 'verify_code' => $params['verify_code'] . '-1', - 'status' => OrderEnum::RECEIVED_GOODS, - 'is_writeoff' => OrderEnum::IS_OK, - 'update_time' => time(), - 'store_id' => $params['store_id'], - 'staff_id' => $params['staff_id'] ?? 0, - ], ['id' => $data['id']]); - (new StoreOrderCartInfo())->update([ - 'verify_code' => $params['verify_code'] . '-1', - 'writeoff_time' => time(), - 'is_writeoff' => YesNoEnum::YES, - 'store_id' => $params['store_id'], - 'staff_id' => $params['staff_id'] ?? 0, - 'update_time' => time(), - ], ['oid' => $data['id']]); - // $financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']); - // if (!empty($financeFlow)) { - // $capitalFlowLogic = new CapitalFlowLogic($data->store, 'store'); - // $capitalFlowLogic->storeIncome('store_order_income', 'order', $data['id'], $financeFlow['number']); - // } - $order = StoreOrder::where('id', $data['id'])->find(); - PayNotifyLogic::descSwap($order['id']); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - public static function write_count($info, $params) { diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 9184b6019..640bc4113 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -160,14 +160,6 @@ class PayNotifyLogic extends BaseLogic ]; UserSign::create($sing); - if ($order && $order['store_id']) { - $params = [ - 'verify_code' => $order['verify_code'], - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'] - ]; - OrderLogic::lessWriteOff($params); - } self::dealProductLog($order); } @@ -329,8 +321,8 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $deal_money = bcdiv($extra['amount']['refund'], 100, 2); //对应比例得退礼品券逻辑 - $discount = self::getDiscount($user->user_ship); - $total_price = bcmul($order->refund_price, $discount, 2); + // $discount = self::getDiscount($user->user_ship); + // $total_price = bcmul($order->refund_price, $discount, 2); if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) { if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额支付 $user->now_money = bcadd($user->now_money, $deal_money, 2); @@ -352,6 +344,8 @@ class PayNotifyLogic extends BaseLogic return true; } + //订单购物详情 + StoreOrderCartInfo::where('oid',$order['id'])->update(['status'=>OrderEnum::REFUND_STATUS_FINISH]); //积分 UserSignLogic::RefundOrder($order); //微信日志 user_order_refund @@ -394,6 +388,8 @@ class PayNotifyLogic extends BaseLogic $model->save(); //增加数量 self::addStock($order['id']); + StoreOrderCartInfo::where('oid',$order['id'])->update(['status'=>OrderEnum::REFUND_STATUS_FINISH]); + return true; } diff --git a/process/Task.php b/process/Task.php index c860a4658..a08bae717 100644 --- a/process/Task.php +++ b/process/Task.php @@ -2,6 +2,7 @@ namespace process; +use app\common\enum\OrderEnum; use app\common\logic\PayNotifyLogic; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; @@ -26,6 +27,8 @@ class Task $oid = StoreOrder::where($where)->column('id'); // 删除时间设置为当前时间,即删除 if ($oid) { StoreOrder::where('id', 'in', $oid)->update(['delete_time' => time()]); + StoreOrderCartInfo::where('oid','in',$oid)->update(['status'=>OrderEnum::REFUND_STATUS_FINISH]); + $arr = StoreOrderCartInfo::where('oid', 'in', $oid)->field('store_id,product_id,cart_num')->select(); $updateData = []; $updateDataTwo = [];