Browse Source

园区模糊搜索

chenhao 4 years ago
parent
commit
aa1ca4d227
1 changed files with 54 additions and 2 deletions
  1. 54 2
      application/api/controller/User.php

+ 54 - 2
application/api/controller/User.php

@@ -304,7 +304,7 @@ class User extends Api
 
             if (!empty($user['company'])) {
 
-                $data['tongshi'] = Db::name('user')->where('uid','neq',$user['id'])->where('company',$user['company'])->count();
+                $data['tongshi'] = Db::name('user')->where('id','neq',$user['id'])->where('company',$user['company'])->count();
 
             } else {
 
@@ -336,7 +336,7 @@ class User extends Api
 
             if (!empty($user['company'])) {
 
-                $data['tongshi'] = Db::name('user')->where('uid','neq',$user['id'])->where('company',$user['company'])->count();
+                $data['tongshi'] = Db::name('user')->where('id','neq',$user['id'])->where('company',$user['company'])->count();
 
             } else {
 
@@ -481,7 +481,59 @@ class User extends Api
         }
     }
 
+    /**
+     * 我的粉丝
+     */
+    public function fensi()
+    {
+        $user = $this->auth->getUser();
+
+        $fensi = Db::name('follow')->where('be_uid',$user['id'])->select();
+
+        if (!$fensi) return $this->success('',[]);
+
+        $res = [];
+        foreach ($fensi as $k=>$v) {
+
+            $userInfo = Db::name('user')->where('id',$v['uid'])->find();
+
+            $res[$k]['username'] = $userInfo['username'];
+
+            $res[$k]['uid'] = $userInfo['id'];
+
+            $res[$k]['position'] = $userInfo['position'];
 
+            $userCompany = Db::name('user')->where('company',$userInfo['company'])->where('group_id','>',0)->find();
+
+            $res[$k]['company'] = $userInfo['company'];
+
+            if ($userCompany && $userCompany['group_id'] == 1) {
+
+                $shangjia = Db::name('user_shangjia')->where('uid',$userCompany['id'])->find();
+
+                if ($shangjia) {
+                    $res[$k]['notice_str'] = mb_substr($shangjia['str'],0,10);
+                } else {
+                    $res[$k]['notice_str'] = '';
+                }
+
+            } else if ($userCompany && $userCompany['group_id'] == 2) {
+
+                $qiye = Db::name('user_qiye')->where('uid',$userCompany['id'])->find();
+
+                if ($qiye) {
+                    $res[$k]['notice_str'] = mb_substr($qiye['notice'],0,10);
+                } else {
+                    $res[$k]['notice_str'] = '';
+                }
+            } else {
+
+                $res[$k]['notice_str'] = '';
+
+            }
+        }
+        return $this->success('',$res);
+    }
 
 
     /**