Ver código fonte

feat 增加积分排序

wzh 3 meses atrás
pai
commit
0e2c908bba

+ 2 - 0
crmeb/app/adminapi/controller/v1/user/User.php

@@ -46,6 +46,7 @@ class User extends AuthController
             ['order', ''],
             ['data', ''],
             ['user_type', ''],
+            ['goods_user_type', ''],
             ['country', ''],
             ['province', ''],
             ['city', ''],
@@ -65,6 +66,7 @@ class User extends AuthController
             ['pay_count_money', []],
             ['recharge_count', []],
             ['agent_level', 0],
+            ['score_sort', 0],
         ]);
         $where['label_id'] = toIntArray($where['label_id']);
         return app('json')->success($this->services->index($where));

+ 6 - 0
crmeb/app/dao/user/UserWechatUserDao.php

@@ -255,6 +255,12 @@ class UserWechatUserDao extends BaseDao
                 $model = $model->where($userAlias . 'user_type', $where['user_type']);
             }
         }
+        if (isset($where['goods_user_type']) && $where['goods_user_type']) {
+            $model = $model->where($wechatUserAlias . 'goods_user_type', $where['goods_user_type']);
+        }else{
+            $model = $model->where($wechatUserAlias . 'goods_user_type', 0);
+        }
+
         //用户性别
         if (isset($where['sex']) && $where['sex'] !== '' && in_array($where['sex'], [0, 1, 2])) {
             $model = $model->where($wechatUserAlias . 'sex', $where['sex']);

+ 6 - 0
crmeb/app/services/user/UserWechatuserServices.php

@@ -14,6 +14,7 @@ namespace app\services\user;
 
 use app\services\BaseServices;
 use app\dao\user\UserWechatUserDao;
+use think\facade\Log;
 
 /**
  *
@@ -56,6 +57,11 @@ class UserWechatuserServices extends BaseServices
         if (isset($where['now_money']) && in_array($where['now_money'], $order_arr)) {
             $order_string = $where['now_money'] == 'ascending' ? 'now_money asc' : 'now_money desc';
         }
+        if (isset($where['score_sort']) && $where['score_sort']) {
+            $order_string = ' integral desc ';
+        }
+        Log::error(1222211);
+        Log::error($order_string);
         $list = $this->dao->getListByModel($where, $field, $order_string, $page, $limit);
         $count = $this->dao->getCountByWhere($where);
         return [$list, $count];