quanwei
2026-01-17 e1e2fe5710a5b5cd9c19bd3aa99c998a1a613ca8
admin/app/api/model/order/Order.php
@@ -25,7 +25,7 @@
use app\common\service\order\OrderRefundService;
use app\common\model\supplier\Balance as supplierBalanceModel;
use app\common\model\supplier\Supplier as SupplierModel;
use app\common\model\payment\PaymentLog as PaymentLogModel;
/**
 * 普通订单模型
 */
@@ -222,11 +222,14 @@
        foreach ($productList as &$item) {
            // 商品单价
            $item['product_price'] = $item['product_sku']['product_price'];
            $item['settlement_price'] = $item['product_sku']['settlement_price'];
            // 商品购买数量
            $item['total_num'] = $params['product_num'];
            $item['spec_sku_id'] = $item['product_sku']['spec_sku_id'];
            // 商品购买总金额
            $item['total_price'] = helper::bcmul($item['product_price'], $params['product_num']);
            // 商品总结算价
            $item['total_settlement_price'] = helper::bcmul($item['settlement_price'], $params['product_num']);
        }
        $supplierData[] = [
            'shop_supplier_id' => $product['shop_supplier_id'],
@@ -344,9 +347,15 @@
        $model = new static();
        $where = ['order_id' => $order_id, 'user_id' => $user_id];
        if(strlen($order_id)>=14){ //按照微信支付的 预下单填入的out_trade_no
            $where = ['ins_order_sn' => $order_id, 'user_id' => $user_id];
            $where = ['trade_no' => $order_id, 'user_id' => $user_id];
            $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find();
            if(!$order){
                $where = ['ins_order_sn' => $order_id, 'user_id' => $user_id];
                $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find();
            }
        }else{
            $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find();
        }
        $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find();
        if (empty($order)) {
            throw new BaseException(['msg' => '订单不存在']);
        }
@@ -730,7 +739,15 @@
            } else {
                $orderInfo->save(['online_money' => $online_money]);
            }
        }
        }$payment = new PaymentLogModel();
        $paylog_data = [
            'app_id'        => $orderInfo['app_id'],
            'order_no'  => $order_no,
            'order_id'      => $orderInfo['order_id'],
            'online_money'  => $online_money,
            'order_source'  => $orderInfo['order_source']
        ];
        $payment->savePaymentLog($paylog_data);
        $online_money > 0 && $payment = self::onOrderPayment($user, $order_no, $payType, $params['pay_source'], $online_money, $multiple, $shop_supplier_id);
        $result['order_id'] = $params['order_id'];