zxczxc 1 tahun lalu
induk
melakukan
9ad2e47153
3 mengubah file dengan 11 tambahan dan 32 penghapusan
  1. 7 3
      app/api/controller/Pub.php
  2. 2 28
      app/api/controller/User.php
  3. 2 1
      app/model/api/User.php

+ 7 - 3
app/api/controller/Pub.php

@@ -223,7 +223,7 @@ class Pub extends BaseController
         foreach ($data['list'] as &$item) {
             $infoAuditDb = new InfoAudit();
             $infoData = $infoAuditDb->getItem(["status"=>1,"uid"=>$item["uid"]]);
-            $item['is_type_audit'] = !empty($infoData['is_type_audit']) ? $infoData['is_type_audit'] : '';
+            $item['is_type_audit'] = $item['is_type_audit']==1?1:0;
             $item['ancestral_place'] = !empty($infoData['ancestral_place']) ? $infoData['ancestral_place'] : '';
         }
         return app('json')->success($data);
@@ -319,14 +319,18 @@ class Pub extends BaseController
         $rankList = [];
         foreach ($list as $key => $value) {
             $userInfo = (new UserModel)->where('uid', $value['uid'])->find();
+            $auth = (new InfoAudit)->where('uid',$value['uid'])->find();
             $template = $this->getShowTemplateItem($value['uid']);
             $rankList[] = [
                 'rank' => $key + 1,
                 'uid' => $value['uid'],
-                'nickname' => $userInfo['nickname'],
+                'name' => $userInfo['name'],
                 'avatar' => $userInfo['avatar'],
-                'card_look_count' => $value['card_look_count'],
+                'card_look_count' => $value['card_look_count']*18,
                 'template' => $template,
+                'is_type_audit'=>$auth['status']==1?1:0,
+                'ancestral_place'=>$auth['ancestral_place'],
+                'auth_info' => $auth->toArray(),
             ];
         }
         return app('json')->success($rankList);

+ 2 - 28
app/api/controller/User.php

@@ -117,37 +117,11 @@ class User extends BaseController
 
         $data = (new UserModel)->getDataList($post, "u.uid,u.mobile,u.nickname,u.avatar");
 
-        $rankNum = $request->input('rankNum', 50); // 排行榜显示个数,默认为50
-        $rankType = $request->input('rankType', 2); // 排行榜分类方式,默认为总邀请人数
-
-        // 生成总邀请人数的排行榜
-        $rankList = [];
-        $userList = (new UserModel)->where('parent_uid', $request->user["uid"])->select('uid', 'nickname')->get();
-        foreach ($userList as $user) {
-            $count = $this->getTotalInvites($user->uid);
-            $rankList[] = [
-                'uid' => $user->uid,
-                'nickname' => $user->nickname,
-                'count' => $count,
-            ];
-        }
-
-        if ($rankType == 1) {
-            usort($rankList, function ($a, $b) {
-                return $b['count'] - $a['count'];
-            });
-        } else {
-            usort($rankList, function ($a, $b) {
-                return strtotime($a['created_at']) - strtotime($b['created_at']);
-            });
-        }
-
-        // 返回排行榜数据
-        $rankList = array_slice($rankList, 0, $rankNum);
-        $data['rankList'] = $rankList;
 
         return app('json')->success($data);
     }
+    
+    
 
     /**
      * 设置用户信息

+ 2 - 1
app/model/api/User.php

@@ -269,7 +269,8 @@ class User extends BaseModel
         if($totalCount>0){
             $data = $this
                 ->alias("u")
-                ->field("u.uid,ut.show_template_id,u.is_type_audit,u.ancestral_place")
+                ->field("u.uid,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
+                ->leftJoin("info_audit a","u.uid=a.uid")
                 ->leftJoin("user_show_template ut", "ut.uid  = u.uid and ut.is_default = 1")//默认模板
                 ->where($where)
                 ->order("u.show_temp_seq", "desc")