From 8c00bd0245ca4756ca04483a4980ad202714e43e Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期四, 20 七月 2023 09:40:44 +0800 Subject: [PATCH] Merge branch 'release/v1.1.4发布' --- application/api/controller/User.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 3 deletions(-) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index c60bf0e..524cace 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -19,6 +19,9 @@ use app\api\logic\SettlementRecord as LogicSettlementRecord; use app\api\logic\UserMoneyLog as LogicUserMoneyLog; use think\log; +use app\api\logic\ActivityInfo as InfoActivityInfo; +use app\common\model\UserExtend as ModelUserExtend; +use think\Db; /** * 浼氬憳鎺ュ彛 @@ -100,7 +103,7 @@ $mobile = $this->request->post('mobile'); $captcha = $this->request->post('captcha'); $ismobouth=$this->request->post('ismobouth',false); - $push_cid=$this->request->post('push_cid',false); + $pushCid=$this->request->post('pushCid',false); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); } @@ -118,7 +121,7 @@ //濡傛灉宸茬粡鏈夎处鍙峰垯鐩存帴鐧诲綍 $ret = $this->auth->direct($user->id); } else { - $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, []); + $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, [],'',[],$pushCid); } if ($ret) { Sms::flush($mobile, 'login'); @@ -327,7 +330,7 @@ }else{ //鍒ゆ柇寰俊鏄惁宸茬粡缁戝畾 $find_third = $ModelThird->where(['openid'=>$wxUser['openid']])->find(); if(!empty($find_third)) $this->error('褰撳墠寰俊鍙峰凡缁戝畾鍏朵粬璐﹀彿'); - $ret = $this->auth->register('', Random::alnum(), '', $mobile, [],'wechat',$wxUser); + $ret = $this->auth->register('', Random::alnum(), '', $mobile, [],'wechat',$wxUser,$pushCid); } Sms::flush($mobile, 'changemobile'); if ($ret) { @@ -691,6 +694,7 @@ public function bind_invitation() { $invite_code = request()->param('invite_code',''); + $deviceid=request()->param('deviceid',''); if(empty($invite_code)) $this->error('閭�璇风爜涓嶈兘涓虹┖'); $is_official = false; $isOpenOfficialCode = config('site.isOpenOfficialCode'); @@ -711,6 +715,13 @@ if($f_user['status'] != 'normal')$this->error('閭�璇蜂汉甯愬彿宸茶閿佸畾锛屾殏鏃舵棤娉曢個璇�'); if($user['invitation_id'] != 0)$this->error('褰撳墠宸茬粦瀹氫笂绾х敤鎴�'); $save_data['invitation_id'] = $f_user['id']; + if(!empty($deviceid)) + {//璁惧id + $save_data['login_deviceid'] = $deviceid; + } + else{ + $save_data['login_deviceid'] = 'cus'.self::guid(); + } if($f_user['invitation_id'] != 0)$save_data['f_invitation_id'] = $f_user['invitation_id']; $res2 = $ModelUser->where(['id'=>$f_user['id']])->setInc('fans',1); if(!$res2){ @@ -724,7 +735,31 @@ $this->error('缁戝畾澶辫触'); } $ModelUser->commit(); + //鏇存柊鎷涘嫙娲诲姩淇℃伅 + $activityInfo=new InfoActivityInfo(); + $activityInfo->updateRecruitCount($save_data['invitation_id'] ); $this->success('缁戝畾鎴愬姛',[]); + } + + public function guid() + { + + if (function_exists('com_create_guid')) { + + return com_create_guid(); + + } else { + + mt_srand((double)microtime() * 10000); + $charid = strtoupper(md5(uniqid(rand(), true))); + $uuid = substr($charid, 0, 8) + . substr($charid, 8, 4) + . substr($charid, 12, 4) + . substr($charid, 16, 4) + . substr($charid, 20, 12); + return $uuid; + + } } /** @@ -1046,4 +1081,20 @@ $this->success('鑾峰彇鎴愬姛',$user); } + /** + * 妫�娴嬫槸鍚︽湁鍋忓ソ鍟嗗搧 + * + * @return void + */ + + public function check_preference_goods() + { + //鑾峰彇褰撳墠鐧诲綍浜虹敤鎴蜂俊鎭� + $user = $this->auth->getUser(); + $ModelUserExtend=new ModelUserExtend(); + $preference_goods=$ModelUserExtend->where(['id'=>$user['id']])->field('p_cids,p_platefrom')->find(); + if(empty($preference_goods)||empty($preference_goods['p_cids'])) $this->error('鏆傛棤鍋忓ソ鍟嗗搧'); + $this->success('鑾峰彇鎴愬姛',$preference_goods); + } + } -- Gitblit v1.9.3