Ver código fonte

2023-5-22-1 新增服务区-2

yingzi 1 ano atrás
pai
commit
f5459e6b65
1 arquivos alterados com 26 adições e 4 exclusões
  1. 26 4
      app/api/controller/User.php

+ 26 - 4
app/api/controller/User.php

@@ -115,6 +115,15 @@ class User extends BaseController
         $post["page"]      = $post["page"]<=0     ? 1  : (int)$post["page"];
         $post["parent_uid"]= $request->user["uid"];
         $data = (new UserModel)->getDataList($post,"u.uid,u.mobile,u.nickname,u.avatar");
+        $list = $data["list"];
+        foreach ($list as &$item) {
+            $userInfo = $this->getUserInfo($item["uid"]);
+            $item["is_type_audit"] = $userInfo["is_type_audit"];
+            $item["ancestral_place"] = $userInfo["ancestral_place"];
+            $item["auth_info"] = $userInfo["auth_info"];
+            $item["user_work_type_id"] = $userInfo["user_work_type_id"];
+        }
+        $data["list"] = $list;
         return app('json')->success($data);
     }
 
@@ -1078,13 +1087,26 @@ class User extends BaseController
     }
 
     /**
-     * 获取用户总邀请人数
+     * 获取用户模板信息
      * @param int $uid 用户ID
-     * @return int 总邀请人数
+     * @return array
      */
-    public function getTotalInvites($uid)
+    private function getUserInfo($uid)
     {
-        return (new UserModel)->where('parent_uid', $uid)->count();
+        $userInfo = (new UserModel)->where('uid', $uid)->find();
+        $auth = (new InfoAudit)->where('uid', $uid)->find();
+        $user_work_type_title = (new UserWorkType)->where('id', $auth['user_work_type_id'])->find();
+        if ($auth) {
+            $auth_info = $auth->toArray();
+        } else {
+            $auth_info = null;
+        }
+        return [
+            'is_type_audit' => $auth && $auth['status'] == 1 ? 1 : 0,
+            'ancestral_place' => $auth ? $auth['ancestral_place'] : '',
+            'auth_info' => $auth_info,
+            'user_work_type_id' => $user_work_type_title['title'],
+        ];
     }