作者 李忠强
1 个管道 的构建 通过 耗费 1 秒

更新

@@ -8,6 +8,7 @@ use app\admin\model\Third; @@ -8,6 +8,7 @@ use app\admin\model\Third;
8 use app\common\controller\Api; 8 use app\common\controller\Api;
9 use fast\Http; 9 use fast\Http;
10 use think\Config; 10 use think\Config;
  11 +use think\Db;
11 12
12 /** 13 /**
13 * 登录 14 * 登录
@@ -54,7 +55,9 @@ class Login extends Api @@ -54,7 +55,9 @@ class Login extends Api
54 $this->auth->direct($userid); 55 $this->auth->direct($userid);
55 $this->success('登录成功',['token'=>$this->auth->getToken()]); 56 $this->success('登录成功',['token'=>$this->auth->getToken()]);
56 }else{ 57 }else{
57 - if ($this->auth->register($nickname,'','','',['avatar'=>$avatar])){ 58 + $userid = $this->auth->register($nickname,'','','',['avatar'=>$avatar]);
  59 + if ($userid){
  60 + $third->save(['openid'=>$wxapi['openid'],'user_id'=>$userid]);
58 $this->success('登陆成功',['token'=>$this->auth->getToken()]); 61 $this->success('登陆成功',['token'=>$this->auth->getToken()]);
59 }else{ 62 }else{
60 $this->error('注册失败'); 63 $this->error('注册失败');
@@ -75,8 +75,22 @@ class Mycenter extends Api @@ -75,8 +75,22 @@ class Mycenter extends Api
75 */ 75 */
76 public function myPage() 76 public function myPage()
77 { 77 {
78 - $userlist = Db::name('user')->field('SUM(idea_number)')->find();  
79 - $percentage = round($this->auth->idea_number/$userlist['SUM(idea_number)'],1); 78 +// $userlist = Db::name('user')->field('SUM(idea_number)')->find();
  79 +// $percentage = round($this->auth->idea_number/$userlist['SUM(idea_number)'],1);
  80 + $ideaUserScore = Db::name('user_idea_score')->where('user_id',1)->field('F_analysis,W_diplomat,B_protect,T_explore,L_romantic')->find();
  81 + $max = [];
  82 + foreach ($ideaUserScore as $key => $value){
  83 + if ($value < 1) continue;
  84 + if (!isset($arr)){
  85 + $arr = $value;
  86 + continue;
  87 + }
  88 + if ($arr < $value){
  89 + $max[$key] = $value;
  90 + $arr = $value;
  91 + }
  92 + }
  93 + var_dump($max);exit();
80 $idealist = Db::name('user_idea_record')->where('user_id',$this->auth->id)->where('type',1)->select(); 94 $idealist = Db::name('user_idea_record')->where('user_id',$this->auth->id)->where('type',1)->select();
81 95
82 $this->success('联系客服',['data'=>$userlist]); 96 $this->success('联系客服',['data'=>$userlist]);
@@ -198,7 +198,7 @@ class Auth @@ -198,7 +198,7 @@ class Auth
198 Db::rollback(); 198 Db::rollback();
199 return false; 199 return false;
200 } 200 }
201 - return true; 201 + return $user->id;
202 } 202 }
203 203
204 /** 204 /**