From 67fe8e754219d9d810850cc162d41547d2742b99 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期三, 14 六月 2023 16:43:05 +0800 Subject: [PATCH] no message --- application/api/controller/User.php | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 109 insertions(+), 6 deletions(-) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 5aa60e7..ca225c3 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -18,12 +18,14 @@ use app\api\logic\UserWithdrawal as LogicUserWithdrawal; use app\api\logic\SettlementRecord as LogicSettlementRecord; use app\api\logic\UserMoneyLog as LogicUserMoneyLog; +use think\log; + /** * 浼氬憳鎺ュ彛 */ class User extends Api { - protected $noNeedLogin = ['login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register']; + protected $noNeedLogin = ['GetRecomInviter','login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register']; protected $noNeedRight = '*'; public function _initialize() @@ -83,13 +85,14 @@ { $mobile = $this->request->post('mobile'); $captcha = $this->request->post('captcha'); + $ismobouth=$this->request->post('ismobouth',false); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); } if (!Validate::regex($mobile, "^1\d{10}$")) { $this->error(__('Mobile is incorrect')); } - if (!Sms::check($mobile, $captcha, 'login')) { + if (!$ismobouth&&!Sms::check($mobile, $captcha, 'login')) { $this->error(__('Captcha is incorrect')); } $user = \app\common\model\User::getByMobile($mobile); @@ -281,16 +284,21 @@ if(empty($wxUser)) $this->error('寰俊鎺堟潈淇℃伅鑾峰彇澶辫触'); $mobile = $this->request->post('mobile'); $captcha = $this->request->post('captcha'); - if (!$mobile || !$captcha) { + $isyj=$this->request->post('isyj',false); + if (!$mobile || (!$isyj&&!$captcha)) { $this->error(__('Invalid parameters')); } if (!Validate::regex($mobile, "^1\d{10}$")) { $this->error('璇疯緭鍏ユ纭墜鏈哄彿'); } - $result = Sms::check($mobile, $captcha, 'changemobile'); - if (!$result) { - $this->error(__('Captcha is incorrect')); + if(!$isyj) + { + $result = Sms::check($mobile, $captcha, 'changemobile'); + if (!$result) { + $this->error(__('Captcha is incorrect')); + } } + $ModelThird = new ModelThird(); $LogicUser = new LogicUser(); //鍒ゆ柇褰撳墠鎵嬫満鍙锋槸鍚﹀凡缁忕粦瀹氬井淇� @@ -427,6 +435,46 @@ if($res === false) $this->error($LogicUserBrowse->getError()); $this->success([],'鍒犻櫎鎴愬姛'); + } + + + /** + * 鏍囪娴忚0鍏冭喘鍟嗗搧璁板綍 + * + * @return void + */ + public function update_first_free_browse() + { + $ids = request()->param('goodsid',''); + + $new_goodsId = request()->param('new_goodsId',''); + + $LogicUserBrowse = new LogicUserBrowse(); + + $res = $LogicUserBrowse->updatefirstfreelog(USERID,$ids,$new_goodsId); + + if($res === false) $this->error($LogicUserBrowse->getError()); + + $this->success([],'娣诲姞鎴愬姛'); + } + + /** + * 妫�娴嬫槸鍚﹂鍗� + * + * @return void + */ + + public function check_isfirst_free() + { + + $LogicUserBrowse = new LogicUserBrowse(); + + $res = $LogicUserBrowse->checkIsFirstFree(USERID); + + if($res === false) $this->error($LogicUserBrowse->getError()); + Log::write('妫�娴嬫槸鍚﹂鍗曪細'.json_encode($res)); + if(empty($res)) $this->success(['info'=>1],'棣栧崟瀹㈡埛'); + $this->success(['info'=>0],'闈為鍗曞鎴�'); } @@ -742,6 +790,7 @@ $user_jjcj_num = $ModelUser->where(['f_invitation_id'=>USERID,'level'=>1])->count(); //闂存帴鍒濈骇浜烘暟 $user_zszj_num = $ModelUser->where(['invitation_id'=>USERID,'level'=>2])->count(); //鐩村睘涓骇浜烘暟 $user_jjzj_num = $ModelUser->where(['f_invitation_id'=>USERID,'level'=>2])->count(); //闂存帴涓骇浜烘暟 + $user_zong_num = $ModelUser->where(['invitation_id'=>USERID])->count(); //鎬婚個璇蜂汉鏁� $user_monthly_commission = LogicUser::getUserCommission($user['id'],'month'); //鑾峰彇杩�30浣i噾 $user_total_commission = LogicUser::getUserCommission($user['id'],'total'); //鑾峰彇绱浣i噾 $data = [ @@ -750,6 +799,7 @@ 'user_jjcj_num' => $user_jjcj_num, 'user_zszj_num' => $user_zszj_num, 'user_jjzj_num' => $user_jjzj_num, + 'user_zong_num'=>$user_zong_num, 'user_monthly_commission' => $user_monthly_commission, 'total_commission' => $user_total_commission ], @@ -922,6 +972,59 @@ $res = $LogicUser->unboundWechat(USERID); $this->success('瑙g粦鎴愬姛',[]); } + + /** + * 淇敼閭�璇风爜 + * + * @return void + */ + public function changecode(){ + $user = $this->auth->getUser(); + if($user->level<2){ + $this->error('褰撳墠绛夌骇涓嶈兘淇敼閭�璇风爜'); + } + //鍒ゆ柇鏄惁鏈変慨鏀硅褰� + if (\app\common\model\user\CodeChangeHistory::getByUserId($user->id)) { + $this->error('閭�璇风爜鍙兘淇敼涓�娆″摝'); + } + $invitation_code = request()->param('invite_code',''); + if (!$invitation_code ) { + $this->error(__('璇疯緭鍏ラ個璇风爜')); + } + if(strlen($invitation_code)<4){ + $this->error('閭�璇风爜涓嶈兘灏戜簬4浣�'); + } + if(strlen($invitation_code)>9){ + $this->error('閭�璇风爜涓嶈兘瓒呰繃8浣�'); + + } + if (\app\common\model\User::where('invitation_code', $invitation_code)->where('id', '<>', $user->id)->find()) { + $this->error('閭�璇风爜宸插瓨鍦�'); + } + $user->invitation_code = $invitation_code; + $user->save(); + //淇濆瓨淇敼璁板綍 + \app\common\model\user\CodeChangeHistory::create([ + 'user_id' => $user->id, + 'before_code' => $user->invitation_code, + 'after_code' =>$invitation_code, + 'create_time' => time() + ]); + $this->success(); + } + /** + * + *鑾峰彇鎺ㄨ崘閭�璇蜂汉 + */ + public function getRecomInviter() + { + $ModelUser=new ModelUser(); + $user = $ModelUser->join('recommend_inviter', 't_user.id=t_recommend_inviter.user_id') + ->field('t_user.id,t_user.avatar,t_user.invitation_code,t_user.nickname') + ->order('recommend_inviter.order_inde asc') + ->select(); + $this->success('鑾峰彇鎴愬姛',$user); + } } -- Gitblit v1.9.3