Browse Source

fix:用户中心订单数据

super-yimizi 2 months ago
parent
commit
813816fb42
2 changed files with 5 additions and 4 deletions
  1. 1 1
      application/api/controller/Goods.php
  2. 4 3
      application/api/controller/User.php

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

@@ -135,7 +135,7 @@ class Goods extends Base
         // }
         // }
         // $row->coupon = $couponList;
         // $row->coupon = $couponList;
 
 
-        $row->visible(explode(',', 'id,title,subtitle,category_ids,price,marketprice,sales,views,
+        $row->visible(explode(',', 'id,title,type,spec_type,subtitle,category_ids,price,marketprice,sales,views,
         image,content,images,sku_spec,sku,comment,is_collect,guarantee,attributes,favor_rate,coupon'));
         image,content,images,sku_spec,sku,comment,is_collect,guarantee,attributes,favor_rate,coupon'));
         $row = $row->toArray();
         $row = $row->toArray();
         $row['content'] = \app\common\library\Service::formatTplToUniapp($row['content']);
         $row['content'] = \app\common\library\Service::formatTplToUniapp($row['content']);

+ 4 - 3
application/api/controller/User.php

@@ -2,6 +2,7 @@
 
 
 namespace app\api\controller;
 namespace app\api\controller;
 
 
+use app\common\Enum\OrderEnum;
 use app\common\model\Order;
 use app\common\model\Order;
 use think\Config;
 use think\Config;
 use app\common\Enum\UserEnum;
 use app\common\Enum\UserEnum;
@@ -36,9 +37,9 @@ class User extends Base
 
 
         $info = $this->auth->getUserInfo();
         $info = $this->auth->getUserInfo();
         $info['order'] = [
         $info['order'] = [
-            'created'  => Order::where('user_id', $this->auth->id)->where('orderstate', 0)->where('paystate', 0)->count(),
-            'paid'     => Order::where('user_id', $this->auth->id)->where('orderstate', 0)->where('paystate', 1)->where('shippingstate', 0)->count(),
-            'evaluate' => Order::where('user_id', $this->auth->id)->where('orderstate', 0)->where('paystate', 1)->where('shippingstate', 2)->count()
+            'created'  => Order::where('user_id', $this->auth->id)->where('status',OrderEnum::STATUS_CREATE)->count(),
+            'paid'     => Order::where('user_id', $this->auth->id)->where('status',OrderEnum::STATUS_PAY)->count(),
+            'evaluate' => Order::where('user_id', $this->auth->id)->where('status',OrderEnum::STATUS_CONFIRM)->count()
         ];
         ];
         $info['avatar'] = cdnurl($info['avatar'], true);
         $info['avatar'] = cdnurl($info['avatar'], true);
         $info['gender_text'] = UserEnum::getGenderText($this->auth->getUser()->gender ?? 0);
         $info['gender_text'] = UserEnum::getGenderText($this->auth->getUser()->gender ?? 0);