wesmiler 2 ماه پیش
والد
کامیت
048e084045
2فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 3 2
      app/Services/Api/GoodsService.php
  2. 1 0
      app/Services/Api/OrderService.php

+ 3 - 2
app/Services/Api/GoodsService.php

@@ -226,9 +226,10 @@ class GoodsService extends BaseService
     {
         // 用户信息
         $userInfo = MemberModel::where(['id' => $userId, 'mark' => 1])
-            ->select(['id', 'discount_point', 'status'])
+            ->select(['id','openid', 'discount_point', 'status'])
             ->first();
         $status = isset($userInfo['status']) ? $userInfo['status'] : 0;
+        $openid = isset($userInfo['openid']) ? $userInfo['openid'] : 0;
         $discountPoint = isset($userInfo['discount_point']) ? $userInfo['discount_point'] : 0; // 折扣
         if (empty($userInfo) || $status != 1) {
             $this->error = 1045;
@@ -249,7 +250,7 @@ class GoodsService extends BaseService
         if($list){
             $skus = GoodsSkuModel::whereIn('goods_id', $ids)->select(['id','sku_name','price','stock'])->get()->keyBy('id');
             $skus = $skus?$skus->toArray() :[];
-            $result = ['store_id'=>0,'discount_total'=>0.00,'delivery_fee'=>0.00,'goods_total'=>0,'order_total'=>0,'count'=>0,'goods'=>[]];
+            $result = ['openid'=>$openid,'store_id'=>0,'discount_total'=>0.00,'delivery_fee'=>0.00,'goods_total'=>0,'order_total'=>0,'count'=>0,'goods'=>[]];
             foreach ($list as $item){
                 $item['order_no'] = $orderNo;
                 $id = isset($item['goods_id'])?$item['goods_id']:0;

+ 1 - 0
app/Services/Api/OrderService.php

@@ -218,6 +218,7 @@ class OrderService extends BaseService
                 return false;
             }
 
+            $openid = isset($result['openid']) ? $result['openid'] : '';
             $orderGoods = isset($result['goods']) ? $result['goods'] : [];
             $goodsTotal = isset($result['goods_total']) ? $result['goods_total'] : 0; // 商品总价
             $orderTotal = isset($result['order_total']) ? $result['order_total'] : 0; // 订单结算金额(折后)