diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ec166fb77..eb296badd 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -107,14 +107,14 @@ class PayNotifyLogic extends BaseLogic ]; self::dealGoodsLeft($checkArr, $order['uid'], $order['id']); } - if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) { - $params = [ - 'verify_code' => $order['verify_code'], - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'] - ]; - OrderLogic::writeOff($params); - } + // if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) { + // $params = [ + // 'verify_code' => $order['verify_code'], + // 'store_id' => $order['store_id'], + // 'staff_id' => $order['staff_id'] + // ]; + // OrderLogic::writeOff($params); + // } if (in_array($order['shipping_type'], [1, 2])) { PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -203,14 +203,14 @@ class PayNotifyLogic extends BaseLogic // } // self::addUserSing($order); self::afterPay($order); - if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) { - $params = [ - 'verify_code' => $order['verify_code'], - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'] - ]; - OrderLogic::writeOff($params); - } + // if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) { + // $params = [ + // 'verify_code' => $order['verify_code'], + // 'store_id' => $order['store_id'], + // 'staff_id' => $order['staff_id'] + // ]; + // OrderLogic::writeOff($params); + // } // self::dealProductLog($order); if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) { $checkArr = [ @@ -504,7 +504,8 @@ class PayNotifyLogic extends BaseLogic } $order->paid = 1; $order->pay_time = time(); - $order->status = 2; + $order->status = 1; + // $order->status = 2; if ($order['reservation'] == 1) { $order->status = 1; } @@ -519,14 +520,14 @@ class PayNotifyLogic extends BaseLogic $cashFlowLogic->insert($order['store_id'], $order['pay_price']); // self::dealProductLog($order); - if ($order && $order['store_id'] && $order['reservation'] != 1) { - $params = [ - 'verify_code' => $order['verify_code'], - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'] - ]; - OrderLogic::writeOff($params); - } + // if ($order && $order['store_id'] && $order['reservation'] != 1) { + // $params = [ + // 'verify_code' => $order['verify_code'], + // 'store_id' => $order['store_id'], + // 'staff_id' => $order['staff_id'] + // ]; + // OrderLogic::writeOff($params); + // } // Redis::send('push-platform-print', ['id' => $order['id']]); @@ -571,14 +572,14 @@ class PayNotifyLogic extends BaseLogic // else { // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); // } - if ($order->pay_type == 13) { - $params = [ - 'verify_code' => $order['verify_code'], - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'] - ]; - OrderLogic::writeOff($params); - } + // if ($order->pay_type == 13) { + // $params = [ + // 'verify_code' => $order['verify_code'], + // 'store_id' => $order['store_id'], + // 'staff_id' => $order['staff_id'] + // ]; + // OrderLogic::writeOff($params); + // } return true; } @@ -596,36 +597,20 @@ class PayNotifyLogic extends BaseLogic $branchProduct = StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id', $v['store_id'])->find(); if ($branchProduct) { $stock = bcsub($branchProduct['stock'], $v['cart_num'], 2); - onBeforeUpdate($branchProduct->toArray(), 'branch_product'); - - StoreBranchProduct::where('id', $branchProduct['id'])->update([ + StoreBranchProduct::update([ 'stock' => $stock, 'total_price' => bcmul($stock, $branchProduct['purchase'], 2), 'sales' => bcadd($branchProduct['sales'], $v['cart_num'], 2) - ]); - - $branchProduct = $branchProduct->toArray(); - $branchProduct['stock'] = $stock; - $branchProduct['total_price'] = bcmul($stock, $branchProduct['purchase'], 2); - $branchProduct['sales'] = bcadd($branchProduct['sales'], $v['cart_num'], 2); - onAfterUpdate($branchProduct, 'branch_product'); + ],['id'=>$branchProduct['id']]); } $storeProduct = StoreProduct::where('id', $v['product_id'])->find(); if ($storeProduct) { $stock = bcsub($storeProduct['stock'], $v['cart_num'], 2); - onBeforeUpdate($storeProduct->toArray(), 'product'); - - StoreProduct::where('id', $v['product_id'])->update([ + StoreProduct::update([ 'stock' => $stock, 'total_price' => bcmul($stock, $storeProduct['purchase'], 2), 'sales' => bcadd($storeProduct['sales'], $v['cart_num'], 2) - ]); - - $storeProduct = $storeProduct->toArray(); - $storeProduct['stock'] = $stock; - $storeProduct['total_price'] = bcmul($stock, $storeProduct['purchase'], 2); - $storeProduct['sales'] = bcadd($storeProduct['sales'], $v['cart_num'], 2); - onAfterUpdate($storeProduct, 'product'); + ],['id'=>$v['product_id']]); } } } catch (\Throwable $e) { @@ -668,11 +653,6 @@ class PayNotifyLogic extends BaseLogic return false; } - //如果是会员需要返回会员金额 - // if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) { - // $order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']); - // } - if($order['uid']>0){ $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find(); if ($address) { diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index d5b269ac7..e03a0b68f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -542,4 +542,24 @@ class StoreOrderController extends BaseAdminController return $this->fail('订单支付中'); } } + + /** + * 不配送核销 + */ + public function noDelivery(){ + $id=$this->request->post('id'); + if($id){ + $params = StoreOrder::where('id', $id)->find(); + if (!$params) { + return $this->fail('无该核销码请检查'); + } + $params['store_id'] = $this->adminInfo['store_id']; + $params['staff_id'] = $this->adminId; + $res = OrderLogic::writeOff($params); + if ($res) { + return $this->success('核销成功'); + } + return $this->fail('核销失败' . OrderLogic::getError()); + } + } }