Browse Source

fix:去掉多余的枚举

super-yimizi 1 month ago
parent
commit
084656458b

+ 9 - 25
application/admin/controller/shop/Order.php

@@ -41,24 +41,24 @@ class Order extends Backend
         // 视图赋值
         // 视图赋值
         $this->view->assign("orderStatusList", OrderEnum::getOrderStatusList());
         $this->view->assign("orderStatusList", OrderEnum::getOrderStatusList());
         $this->view->assign("statusList", $this->model->getStatusList());
         $this->view->assign("statusList", $this->model->getStatusList());
-        $this->view->assign("payModeList", OrderEnum::getPayModeList());
+        // $this->view->assign("payModeList", OrderEnum::getPayModeList());
         $this->view->assign("payTypeList", PayEnum::getPayMethodList());
         $this->view->assign("payTypeList", PayEnum::getPayMethodList());
         $this->view->assign("orderTypeList", OrderEnum::getOrderTypeList());
         $this->view->assign("orderTypeList", OrderEnum::getOrderTypeList());
         $this->view->assign("deliveryTypeList", OrderEnum::getDeliveryTypeList());
         $this->view->assign("deliveryTypeList", OrderEnum::getDeliveryTypeList());
         $this->view->assign("invoiceStatusList", OrderEnum::getInvoiceStatusList());
         $this->view->assign("invoiceStatusList", OrderEnum::getInvoiceStatusList());
-        $this->view->assign("activityTypeList", OrderEnum::getActivityTypeList());
+        // $this->view->assign("activityTypeList", OrderEnum::getActivityTypeList());
         $this->view->assign("actionTypeList", OrderActionEnum::getActionTypeList());
         $this->view->assign("actionTypeList", OrderActionEnum::getActionTypeList());
         $this->view->assign("saleStatusList", GoodsEnum::getSaleStatusMap());
         $this->view->assign("saleStatusList", GoodsEnum::getSaleStatusMap());
         
         
         // 前端配置
         // 前端配置
         $this->assignconfig('orderStatusList', json_encode(OrderEnum::getOrderStatusList()));
         $this->assignconfig('orderStatusList', json_encode(OrderEnum::getOrderStatusList()));
-        $this->assignconfig('payModeList', json_encode(OrderEnum::getPayModeList()));
+        // $this->assignconfig('payModeList', json_encode(OrderEnum::getPayModeList()));
         $this->assignconfig('payTypeList', json_encode(PayEnum::getPayMethodList()));
         $this->assignconfig('payTypeList', json_encode(PayEnum::getPayMethodList()));
         $this->assignconfig('statusList', json_encode($this->model->getStatusList()));
         $this->assignconfig('statusList', json_encode($this->model->getStatusList()));
         $this->assignconfig('orderTypeList', json_encode(OrderEnum::getOrderTypeList()));
         $this->assignconfig('orderTypeList', json_encode(OrderEnum::getOrderTypeList()));
         $this->assignconfig('deliveryTypeList', json_encode(OrderEnum::getDeliveryTypeList()));
         $this->assignconfig('deliveryTypeList', json_encode(OrderEnum::getDeliveryTypeList()));
         $this->assignconfig('invoiceStatusList', json_encode(OrderEnum::getInvoiceStatusList()));
         $this->assignconfig('invoiceStatusList', json_encode(OrderEnum::getInvoiceStatusList()));
-        $this->assignconfig('activityTypeList', json_encode(OrderEnum::getActivityTypeList()));
+        // $this->assignconfig('activityTypeList', json_encode(OrderEnum::getActivityTypeList()));
         $this->assignconfig('actionTypeList', json_encode(OrderActionEnum::getActionTypeList()));
         $this->assignconfig('actionTypeList', json_encode(OrderActionEnum::getActionTypeList()));
         $this->assignconfig('saleStatusList', json_encode(GoodsEnum::getSaleStatusMap()));
         $this->assignconfig('saleStatusList', json_encode(GoodsEnum::getSaleStatusMap()));
         
         
@@ -212,15 +212,15 @@ class Order extends Backend
         $rowData['source_text'] = ChannelEnum::getChannelText($rowData['source'] ?? '');
         $rowData['source_text'] = ChannelEnum::getChannelText($rowData['source'] ?? '');
         $rowData['type_text'] = $this->getTypeText($rowData['type']);
         $rowData['type_text'] = $this->getTypeText($rowData['type']);
         $rowData['pay_type_text'] = $this->getPayTypeText($rowData['pay_type']);
         $rowData['pay_type_text'] = $this->getPayTypeText($rowData['pay_type']);
-        $rowData['pay_mode_text'] = $this->getPayModeText($rowData['pay_mode']);
+        // $rowData['pay_mode_text'] = $this->getPayModeText($rowData['pay_mode']);
         $rowData['delivery_type_text'] = $this->getDeliveryTypeText($rowData['delivery_type']);
         $rowData['delivery_type_text'] = $this->getDeliveryTypeText($rowData['delivery_type']);
         
         
         if (!empty($rowData['invoice_status'])) {
         if (!empty($rowData['invoice_status'])) {
             $rowData['invoice_status_text'] = $this->getInvoiceStatusText($rowData['invoice_status']);
             $rowData['invoice_status_text'] = $this->getInvoiceStatusText($rowData['invoice_status']);
         }
         }
-        if (!empty($rowData['activity_type'])) {
-            $rowData['activity_type_text'] = $this->getActivityTypeText($rowData['activity_type']);
-        }
+        // if (!empty($rowData['activity_type'])) {
+        //     $rowData['activity_type_text'] = $this->getActivityTypeText($rowData['activity_type']);
+        // }
         
         
         // 处理订单商品的规格信息和售后状态文本
         // 处理订单商品的规格信息和售后状态文本
         if (!empty($rowData['order_goods'])) {
         if (!empty($rowData['order_goods'])) {
@@ -278,14 +278,7 @@ class Order extends Backend
         return PayEnum::getPayMethodText($payType);
         return PayEnum::getPayMethodText($payType);
     }
     }
 
 
-    /**
-     * 获取支付模式文本
-     */
-    private function getPayModeText($payMode)
-    {
-        // 直接使用OrderEnum的支付模式枚举
-        return OrderEnum::getPayModeText($payMode);
-    }
+
 
 
     /**
     /**
      * 获取发货方式文本
      * 获取发货方式文本
@@ -303,15 +296,6 @@ class Order extends Backend
         return OrderEnum::getInvoiceStatusText($invoiceStatus);
         return OrderEnum::getInvoiceStatusText($invoiceStatus);
     }
     }
 
 
-    /**
-     * 获取活动类型文本
-     */
-    private function getActivityTypeText($activityType)
-    {
-        return OrderEnum::getActivityTypeText($activityType);
-    }
-
-
 
 
     /**
     /**
      * 获取售后状态文本
      * 获取售后状态文本

+ 1 - 44
application/admin/model/shop/Order.php

@@ -41,7 +41,6 @@ class Order extends Model
         'cancel_time_text',
         'cancel_time_text',
         'status_text',
         'status_text',
         'order_status_text',
         'order_status_text',
-        'pay_mode_text',
         'pay_type_text',
         'pay_type_text',
     ];
     ];
 
 
@@ -114,12 +113,6 @@ class Order extends Model
         return $list[$value] ?? '';
         return $list[$value] ?? '';
     }
     }
 
 
-    public function getPayModeTextAttr($value, $data)
-    {
-        $value = $value ?: ($data['pay_mode'] ?? '');
-        return OrderEnum::getPayModeText($value);
-    }
-
     public function getPayTypeTextAttr($value, $data)
     public function getPayTypeTextAttr($value, $data)
     {
     {
         $value = $value ?: ($data['pay_type'] ?? '');
         $value = $value ?: ($data['pay_type'] ?? '');
@@ -215,43 +208,7 @@ class Order extends Model
         });
         });
     }
     }
 
 
-    /**
-     * 退款
-     */
-    public static function refund($order_sn, $paytype, $payamount)
-    {
-        $config = Service::getConfig($paytype);
-        try {
-            $order = Order::getByOrderSn($order_sn);
-            if ($paytype == 'wechat') {
-                $response = Pay::wechat($config)->refund([
-                    'type'          => in_array($order['method'], ['miniapp', 'app']) ? $order['method'] : '',
-                    'out_trade_no'  => $order_sn,
-                    'out_refund_no' => time(),
-                    'total_fee'     => bcmul($order['payamount'], 100),
-                    'refund_fee'    => bcmul($payamount, 100)
-                ]);
-                if (!$response['result_code'] || $response['result_code'] != 'SUCCESS') {
-                    throw new \Exception(($response['err_code'] ?? '') . ':' . ($response['err_code_des'] ?? '未知退款错误'));
-                }
-            } elseif ($paytype == 'alipay') {
-                $response = Pay::alipay($config)->refund([
-                    'out_trade_no'  => $order_sn,
-                    'refund_amount' => $payamount,
-                ]);
-                if (!$response['code'] || $response['code'] != '10000') {
-                    throw new \Exception(($response['code'] ?? '') . ':' . ($response['msg'] ?? '未知退款错误'));
-                }
-            }
-        } catch (\Exception $e) {
-            Log::write("[shop][refund][{$order_sn}]同步退款失败,失败原因:" . $e->getMessage(), 'refund');
-            throw new \Exception("同步退款失败,失败原因:" . $e->getMessage());
-        }
-
-        //发送通知
-        // TemplateMsg::sendTempMsg(2, $order_sn);
-        return true;
-    }
+
 
 
     public function User()
     public function User()
     {
     {

+ 0 - 14
application/admin/view/shop/page/add.html

@@ -14,20 +14,6 @@
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label for="c-flag" class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
-        <div class="col-xs-12 col-sm-8">
-
-            <!--@formatter:off-->
-            <select  id="c-flag" data-rule="" class="form-control selectpicker" multiple="" name="row[flag][]">
-                {foreach name="flagList" item="vo"}
-                    <option value="{$key|htmlentities}" {in name="key" value=""}selected{/in}>{$vo|htmlentities}</option>
-                {/foreach}
-            </select>
-            <!--@formatter:on-->
-
-        </div>
-    </div>
-    <div class="form-group">
         <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
         <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
             <div class="input-group">
             <div class="input-group">

+ 0 - 12
application/admin/view/shop/page/edit.html

@@ -14,18 +14,6 @@
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label for="c-flag" class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
-        <div class="col-xs-12 col-sm-8">
-
-            <select id="c-flag" data-rule="" class="form-control selectpicker" multiple="" name="row[flag][]">
-                {foreach name="flagList" item="vo"}
-                <option value="{$key|htmlentities}" {in name="key" value="$row.flag" }selected{/in}>{$vo|htmlentities}</option>
-                {/foreach}
-            </select>
-
-        </div>
-    </div>
-    <div class="form-group">
         <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
         <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
             <div class="input-group">
             <div class="input-group">

+ 1 - 1
application/api/controller/Order.php

@@ -118,7 +118,7 @@ class Order extends Base
                 
                 
                 // 先转换购物车为商品列表
                 // 先转换购物车为商品列表
                 $goods_list = CartService::convertCartToGoodsList($cart_ids, $userId);
                 $goods_list = CartService::convertCartToGoodsList($cart_ids, $userId);
-                
+
                 // 创建订单
                 // 创建订单
                 $order = OrderService::createOrder($address_id, $userId, $goods_list, $user_coupon_id, $remark);
                 $order = OrderService::createOrder($address_id, $userId, $goods_list, $user_coupon_id, $remark);
                 
                 

+ 3 - 0
application/api/controller/inspection/Index.php

@@ -114,4 +114,7 @@ class Index extends Base
          }
          }
      }
      }
 
 
+
+     // 
+
 }
 }

+ 11 - 5
application/api/controller/inspection/Order.php

@@ -7,6 +7,7 @@ use app\common\Service\OrderService;
 use app\common\Enum\OrderEnum;
 use app\common\Enum\OrderEnum;
 use app\common\Service\OrderActionService;
 use app\common\Service\OrderActionService;
 use app\common\Enum\OrderActionEnum;
 use app\common\Enum\OrderActionEnum;
+use app\common\Service\Order\OrderShipService;
 /**
 /**
  * 验货端订单接口
  * 验货端订单接口
  * 
  * 
@@ -47,7 +48,7 @@ class Order extends Base
           // $order->append(['status_text']);
           // $order->append(['status_text']);
           // $order->hidden(explode(',', 'method,transactionid,updatetime,deletetime'));
           // $order->hidden(explode(',', 'method,transactionid,updatetime,deletetime'));
           // $order->expiretime = $order->expiretime - time();
           // $order->expiretime = $order->expiretime - time();
-          $order->order_status_text = OrderEnum::STATUS_TEXT_MAP[$order->order_status];
+          $order->order_status_text = OrderEnum::STATUS_TEXT_MAP_INSPECTION[$order->order_status];
           $this->success('', $order);
           $this->success('', $order);
       }
       }
   
   
@@ -68,8 +69,7 @@ class Order extends Base
           $param['page_size'] = $param['page_size'] ?? 10;
           $param['page_size'] = $param['page_size'] ?? 10;
           $status   = $param['status'] ?? 0; // 默认为0(全部订单)
           $status   = $param['status'] ?? 0; // 默认为0(全部订单)
           $param['keywords'] = $param['keywords'] ?? '';
           $param['keywords'] = $param['keywords'] ?? '';
-          $status   = OrderEnum::SHOW_TYPE_STATUS_MAP[$status];
-         
+          $status   = OrderEnum::SHOW_INSPECTION_TYPE_STATUS_MAP[$status];         
 
 
           // 查询对应的工厂 信息
           // 查询对应的工厂 信息
           $supplierId = $this->application->supplier_id;
           $supplierId = $this->application->supplier_id;
@@ -78,7 +78,7 @@ class Order extends Base
              // $item->append(['order_status_text']);
              // $item->append(['order_status_text']);
               $field = 'id,order_sn,amount,goods_price,order_amount,express_name,express_no,order_goods,order_status_text,order_status';
               $field = 'id,order_sn,amount,goods_price,order_amount,express_name,express_no,order_goods,order_status_text,order_status';
               $item->visible(explode(',', $field));
               $item->visible(explode(',', $field));
-              $item->order_status_text = OrderEnum::STATUS_TEXT_MAP[$item->order_status];
+              $item->order_status_text = OrderEnum::STATUS_TEXT_MAP_INSPECTION[$item->order_status];
           }
           }
           $this->success('获取成功', $list);
           $this->success('获取成功', $list);
       }
       }
@@ -286,7 +286,7 @@ class Order extends Base
           $this->success('日期范围获取成功', $data);
           $this->success('日期范围获取成功', $data);
       }
       }
       
       
-             /**
+       /**
         * 获取历史趋势数据
         * 获取历史趋势数据
         */
         */
        public function getTrendData()
        public function getTrendData()
@@ -327,4 +327,10 @@ class Order extends Base
           $this->success('趋势数据获取成功', $trendData);
           $this->success('趋势数据获取成功', $trendData);
       }
       }
 
 
+      // 获取快递公司列表
+      public function getExpressCompany(){
+        $list = OrderShipService::getExpressCompany();
+        $this->success('快递公司列表获取成功', $list);
+      }
+
 }
 }

+ 23 - 5
application/common/Enum/OrderEnum.php

@@ -183,13 +183,31 @@ class OrderEnum
         ],
         ],
     ];
     ];
 
 
+    const SHOW_TYPE_WAIT_INSPECTION = 1;//待验收订单
+    const SHOW_TYPE_WAIT_INSPECTION_SHIP = 2;//待发货订单
+    const SHOW_TYPE_WAIT_INSPECTION_CONFIRM = 3;//待收货订单
+
     // 验货端 前端传的参数
     // 验货端 前端传的参数
-    const SHOW_INSPECTION_TYPE_STATUS_MAP = [
-        self::SHOW_TYPE_WAIT_PAY => [self::STATUS_CREATE],
-        self::SHOW_TYPE_WAIT_DELIVERY => [self::STATUS_INSPECTION_PASS],
-        self::SHOW_TYPE_WAIT_RECEIPT => [self::STATUS_SHIP],
-        self::SHOW_TYPE_WAIT_COMMENT => [self::STATUS_CONFIRM],
+    const SHOW_INSPECTION_TYPE_STATUS_MAP = [   
+        self::SHOW_TYPE_WAIT_INSPECTION => [
+            self::STATUS_PAY
+        ],
+        self::SHOW_TYPE_WAIT_INSPECTION_SHIP => [
+            self::STATUS_INSPECTION_PASS
+        ],
+        self::SHOW_TYPE_WAIT_INSPECTION_CONFIRM => [
+            self::STATUS_SHIP
+        ],
     ];
     ];
 
 
+    const STATUS_TEXT_MAP_INSPECTION = [
+        self::STATUS_INSPECTION => "待验货",
+        self::STATUS_INSPECTION_PASS => "验货通过",
+        self::STATUS_INSPECTION_FAIL => "验货不通过",
+        self::STATUS_PAY => "待验货",
+        self::STATUS_SHIP => "待收货",
+    ];
+
+
 
 
 }
 }

+ 2 - 1
application/common/Service/CartService.php

@@ -5,6 +5,7 @@ namespace app\common\Service;
 use app\common\model\Carts;
 use app\common\model\Carts;
 use think\Exception;
 use think\Exception;
 use app\common\Enum\GoodsEnum;
 use app\common\Enum\GoodsEnum;
+use app\common\exception\BusinessException;
 class CartService
 class CartService
 {
 {
         /**
         /**
@@ -22,7 +23,7 @@ class CartService
             ->select();
             ->select();
             
             
         if (empty($cartItems)) {
         if (empty($cartItems)) {
-            throw new Exception("购物车数据不存在");
+            throw new BusinessException("购物车数据不存在");
         }
         }
         
         
         $goods_list = [];
         $goods_list = [];

+ 17 - 0
application/common/Service/Order/OrderShipService.php

@@ -0,0 +1,17 @@
+<?php
+namespace app\common\Service\Order;
+use app\common\model\Shipper;
+
+class OrderShipService
+{
+    /**
+     * 获取快递公司列表
+     * @return bool|string|\PDOStatement|\think\Collection
+     */
+    public static function getExpressCompany(){
+        $list = Shipper::order('id desc')->select();
+        return $list;
+    }
+    
+
+}

+ 8 - 12
application/common/Service/OrderService.php

@@ -35,7 +35,7 @@ class OrderService
      * @param int $area_id 地区ID
      * @param int $area_id 地区ID
      * @param int $user_coupon_id 优惠券ID
      * @param int $user_coupon_id 优惠券ID
      * @return array
      * @return array
-     * @throws Exception
+     * @throws      
      */
      */
     protected static function computeGoods(&$orderInfo, $goodsList, $userId, $areaId, $userCouponId = 0)
     protected static function computeGoods(&$orderInfo, $goodsList, $userId, $areaId, $userCouponId = 0)
     {
     {
@@ -105,12 +105,12 @@ class OrderService
             $nums = $item['nums'];
             $nums = $item['nums'];
 
 
             if ($nums <= 0) {
             if ($nums <= 0) {
-                throw new Exception("商品数量必须大于0");
+                throw new BusinessException("商品数量必须大于0");
             }
             }
 
 
             // 检查商品是否存在
             // 检查商品是否存在
             if (!isset($goodsData[$goods_id])) {
             if (!isset($goodsData[$goods_id])) {
-                throw new Exception("商品已下架");
+                throw new   ("商品已下架");
             }
             }
             $goods = $goodsData[$goods_id];
             $goods = $goodsData[$goods_id];
 
 
@@ -206,9 +206,6 @@ class OrderService
                 'sale_status'          => 0, // 销售状态:0=待申请
                 'sale_status'          => 0, // 销售状态:0=待申请
                 'comment_status'       => 0, // 评论状态:0=未评论
                 'comment_status'       => 0, // 评论状态:0=未评论
                 'status'               => 1, // 状态
                 'status'               => 1, // 状态
-                // 添加分类和品牌信息用于优惠券计算 (临时字段,不会保存到数据库)
-                // 'category_id'          => $item->goods->category_ids,
-                'brand_id'             => $item->goods->brand_id,
             ];
             ];
             
             
             $orderItem[] = $orderItemData;
             $orderItem[] = $orderItemData;
@@ -268,17 +265,17 @@ class OrderService
      * @param string $memo 备注
      * @param string $memo 备注
      * @param array $cart_ids 购物车ID数组(如果是购物车模式需要清空)
      * @param array $cart_ids 购物车ID数组(如果是购物车模式需要清空)
      * @return Order
      * @return Order
-     * @throws Exception
+     * @throws BusinessException
      */
      */
-    public static function createOrder($addressId, $userId, $goodsList, $userCouponId = 0, $remark = '')
+    public static function createOrder($addressId, $userId, $goodsList, $userCouponId = 0, $remark = '',$supplierId = 0)
     {
     {
         $address = Address::get($addressId);
         $address = Address::get($addressId);
         if (!$address || $address['user_id'] != $userId) {
         if (!$address || $address['user_id'] != $userId) {
-            throw new Exception("地址未找到");
+            throw new BusinessException("地址未找到");
         }
         }
 
 
         if (empty($goodsList)) {
         if (empty($goodsList)) {
-            throw new Exception("商品列表不能为空");
+            throw new BusinessException("商品列表不能为空");
         }
         }
 
 
         $config = get_addon_config('shop');
         $config = get_addon_config('shop');
@@ -287,7 +284,6 @@ class OrderService
         // 订单主表信息 (基于新表结构)
         // 订单主表信息 (基于新表结构)
         $orderInfo = [
         $orderInfo = [
             'type'                 => 1, // 1:普通订单
             'type'                 => 1, // 1:普通订单
-            'source'               => request()->header('platform', 'H5'), // 订单来源 (暂定H5,可根据实际情况调整)
             'order_sn'             => $orderSn,
             'order_sn'             => $orderSn,
             'user_id'              => $userId,
             'user_id'              => $userId,
             'amount'               => 0, // 订单应付金额
             'amount'               => 0, // 订单应付金额
@@ -304,7 +300,7 @@ class OrderService
             'remark'               => $remark, // 用户备注
             'remark'               => $remark, // 用户备注
             'user_coupon_id'       => $userCouponId ?: null,
             'user_coupon_id'       => $userCouponId ?: null,
             'ip'                   => request()->ip(), // IP地址
             'ip'                   => request()->ip(), // IP地址
-            'status'               => 'normal'
+            'status'               => 'normal', 
         ];
         ];
         $orderInfo['platform']  = request()->header('platform', 'H5');
         $orderInfo['platform']  = request()->header('platform', 'H5');
 
 

+ 2 - 1
application/common/service/CartService.php

@@ -5,6 +5,7 @@ namespace app\common\Service;
 use app\common\model\Carts;
 use app\common\model\Carts;
 use think\Exception;
 use think\Exception;
 use app\common\Enum\GoodsEnum;
 use app\common\Enum\GoodsEnum;
+use app\common\exception\BusinessException;
 class CartService
 class CartService
 {
 {
         /**
         /**
@@ -22,7 +23,7 @@ class CartService
             ->select();
             ->select();
             
             
         if (empty($cartItems)) {
         if (empty($cartItems)) {
-            throw new Exception("购物车数据不存在");
+            throw new BusinessException("购物车数据不存在");
         }
         }
         
         
         $goods_list = [];
         $goods_list = [];

+ 8 - 12
application/common/service/OrderService.php

@@ -35,7 +35,7 @@ class OrderService
      * @param int $area_id 地区ID
      * @param int $area_id 地区ID
      * @param int $user_coupon_id 优惠券ID
      * @param int $user_coupon_id 优惠券ID
      * @return array
      * @return array
-     * @throws Exception
+     * @throws      
      */
      */
     protected static function computeGoods(&$orderInfo, $goodsList, $userId, $areaId, $userCouponId = 0)
     protected static function computeGoods(&$orderInfo, $goodsList, $userId, $areaId, $userCouponId = 0)
     {
     {
@@ -105,12 +105,12 @@ class OrderService
             $nums = $item['nums'];
             $nums = $item['nums'];
 
 
             if ($nums <= 0) {
             if ($nums <= 0) {
-                throw new Exception("商品数量必须大于0");
+                throw new BusinessException("商品数量必须大于0");
             }
             }
 
 
             // 检查商品是否存在
             // 检查商品是否存在
             if (!isset($goodsData[$goods_id])) {
             if (!isset($goodsData[$goods_id])) {
-                throw new Exception("商品已下架");
+                throw new   ("商品已下架");
             }
             }
             $goods = $goodsData[$goods_id];
             $goods = $goodsData[$goods_id];
 
 
@@ -206,9 +206,6 @@ class OrderService
                 'sale_status'          => 0, // 销售状态:0=待申请
                 'sale_status'          => 0, // 销售状态:0=待申请
                 'comment_status'       => 0, // 评论状态:0=未评论
                 'comment_status'       => 0, // 评论状态:0=未评论
                 'status'               => 1, // 状态
                 'status'               => 1, // 状态
-                // 添加分类和品牌信息用于优惠券计算 (临时字段,不会保存到数据库)
-                // 'category_id'          => $item->goods->category_ids,
-                'brand_id'             => $item->goods->brand_id,
             ];
             ];
             
             
             $orderItem[] = $orderItemData;
             $orderItem[] = $orderItemData;
@@ -268,17 +265,17 @@ class OrderService
      * @param string $memo 备注
      * @param string $memo 备注
      * @param array $cart_ids 购物车ID数组(如果是购物车模式需要清空)
      * @param array $cart_ids 购物车ID数组(如果是购物车模式需要清空)
      * @return Order
      * @return Order
-     * @throws Exception
+     * @throws BusinessException
      */
      */
-    public static function createOrder($addressId, $userId, $goodsList, $userCouponId = 0, $remark = '')
+    public static function createOrder($addressId, $userId, $goodsList, $userCouponId = 0, $remark = '',$supplierId = 0)
     {
     {
         $address = Address::get($addressId);
         $address = Address::get($addressId);
         if (!$address || $address['user_id'] != $userId) {
         if (!$address || $address['user_id'] != $userId) {
-            throw new Exception("地址未找到");
+            throw new BusinessException("地址未找到");
         }
         }
 
 
         if (empty($goodsList)) {
         if (empty($goodsList)) {
-            throw new Exception("商品列表不能为空");
+            throw new BusinessException("商品列表不能为空");
         }
         }
 
 
         $config = get_addon_config('shop');
         $config = get_addon_config('shop');
@@ -287,7 +284,6 @@ class OrderService
         // 订单主表信息 (基于新表结构)
         // 订单主表信息 (基于新表结构)
         $orderInfo = [
         $orderInfo = [
             'type'                 => 1, // 1:普通订单
             'type'                 => 1, // 1:普通订单
-            'source'               => request()->header('platform', 'H5'), // 订单来源 (暂定H5,可根据实际情况调整)
             'order_sn'             => $orderSn,
             'order_sn'             => $orderSn,
             'user_id'              => $userId,
             'user_id'              => $userId,
             'amount'               => 0, // 订单应付金额
             'amount'               => 0, // 订单应付金额
@@ -304,7 +300,7 @@ class OrderService
             'remark'               => $remark, // 用户备注
             'remark'               => $remark, // 用户备注
             'user_coupon_id'       => $userCouponId ?: null,
             'user_coupon_id'       => $userCouponId ?: null,
             'ip'                   => request()->ip(), // IP地址
             'ip'                   => request()->ip(), // IP地址
-            'status'               => 'normal'
+            'status'               => 'normal', 
         ];
         ];
         $orderInfo['platform']  = request()->header('platform', 'H5');
         $orderInfo['platform']  = request()->header('platform', 'H5');