where(['id' => $this->auth->id])->find(); $this->view->assign([ "user" => $info, ]); return $this->fetch(); } function myhost() { $studio=db('studio')->where(['id'=>$this->auth->stuid])->find(); $total1=db('goods')->where(['stuid'=>$studio['id'],'on_sale'=>1])->count(); $total2=db('trade')->where(['status'=>0,'stuid'=>$studio['id']])->count(); $this->view->assign([ "studio" => $studio, "total1"=>$total1, "total2"=>$total2, ]); return $this->fetch(); } function safecenter() { return $this->fetch(); } function xieyi() { $list=db('article')->where(['catid'=>5])->select(); $this->view->assign([ "list" => $list, ]); return $this->fetch(); } /** * 注销登录 */ public function logout() { //注销本站 $this->auth->logout(); $this->redirect("/index/user/login"); } function userteam() { $user=db('user')->where(['id'=>$this->auth->id])->find(); $total=db('user')->where(['refereeids'=>['like','%,'.$this->auth->id.',%']])->count(); $total=db('user')->where(['refereeids'=>['like','%,'.$this->auth->id.',%'],'isuser'=>1])->count(); $today_cnt=db('user')->where(['refereeids'=>['like','%,'.$this->auth->id.',%'],'createtime'=>['gt',strtotime('today')]])->count(); $today_upload=db('user')->where(['refereeids'=>['like','%,'.$this->auth->id.',%'],'isuser'=>1,'intime'=>['gt',strtotime('today')]])->count(); $list=db('user')->where(['refereeid'=>$this->auth->id])->select(); if(empty($list)) { $list=[]; } $this->view->assign([ "list"=>$list, "total"=>$total, "total1"=>$total, "today_cnt"=>$today_cnt, 'today_upload'=>$today_upload, ]); return $this->view->fetch(); } function tjpv() { $uids=db('user')->where(['refereeids'=>['like','%,'.$this->auth->id.',%']])->column('id'); if($uids) { $total_nums=db('trade')->where(['status'=>['egt',3],'relevant_userid'=>['in',$uids]])->sum('nums'); $total_cnt=db('trade')->where(['status'=>['egt',3],'relevant_userid'=>['in',$uids]])->count(); $totalt_nums=db('trade')->where(['status'=>['egt',3],'create_time'=>strtotime('today'),'relevant_userid'=>['in',$uids]])->sum('nums'); $totalt_cnt=db('trade')->where(['status'=>['egt',3],'create_time'=>strtotime('today'),'relevant_userid'=>['in',$uids]])->count(); }else{ $total_nums=0; $total_cnt=0; $totalt_nums=0; $totalt_cnt=0; } $this->view->assign([ "total_nums"=>$total_nums, "total_cnt"=>$total_cnt, "totalt_nums"=>$totalt_nums, "totalt_cnt"=>$totalt_cnt, ]); return $this->view->fetch(); } function sonteam() { $id=input('id'); $list=db('user')->where(['refereeid'=>$id])->select(); if(empty($list)) { $list=[]; } $this->view->assign([ "list"=>$list, 'id'=>$id ]); return $this->view->fetch(); } function bonusdetailed() { $user=db('user')->where(['id'=>$this->auth->id])->find(); $zt=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>16])->sum('money'); $jt=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>20])->sum('money'); $manager=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>['in','17,18']])->sum('money'); //今日 $zt1=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>16,'create_time'=>['egt',strtotime('today')]])->sum('money'); $jt1=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>20,'create_time'=>['egt',strtotime('today')]])->sum('money'); $manager1=db('detailed_cash')->where(['userid'=>$this->auth->id,'type'=>['in','17,18'],'create_time'=>['egt',strtotime('today')]])->sum('money'); $this->view->assign([ 'user'=> $user, 'zt'=>$zt, 'jt'=>$jt, 'manager'=>$manager, 'zt1'=>$zt1, 'jt1'=>$jt1, 'manager1'=>$manager1, ]); return $this->view->fetch(); } function xieyidetail() { $id=input('id'); $info=db('article')->where("id",$id)->find(); $this->view->assign("info",$info); return $this->view->fetch(); } function sharelink() { $user = get_user_data($this->auth->id); $tjurl = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/index/user/register?code=' . $user['username']; $img_url = 'http://' . $_SERVER['HTTP_HOST'] . '/getqrcode.php?t=' . $tjurl; $save_path = 'uploads/tj/'; put_file_from_url_content($img_url, $user['id'] . ".png", $save_path); $this->assign("imgurl", 'http://' . $_SERVER['HTTP_HOST'] . '/uploads/tj/' . $user['id'] . '.png'); $this->view->assign("tjurl", $tjurl); $this->view->assign("user", $user); return $this->view->fetch(); } function setting() { $user = db('user')->where(['id' => $this->auth->id])->find(); $this->view->assign('user', $user); return $this->fetch(); } /*修改资料*/ function updatenickname() { $user=$this->auth->getUserinfo(); $this->view->assign("user",$user); return $this->view->fetch(); } /* 流水 */ function detailed() { $group = input('group'); $this->view->assign('group', $group); $this->view->assign('mate_title', get_detailed_type_text($group)); return $this->view->fetch(); } function updatepwd1() { return $this->view->fetch(); } function updatepwd2() { return $this->view->fetch(); } function isreal() { $user=db('user')->where(['id'=>$this->auth->id])->find(); $this->view->assign("user",$user); return $this->view->fetch(); } function profile() { $user=db('user')->where(['id'=>$this->auth->id])->find(); $this->view->assign("user",$user); return $this->view->fetch(); } function trans() { $user=get_user_data($this->auth->id); $this->view->assign("user",$user); $this->view->assign("money_type",input('money_type')); return $this->view->fetch(); } function transfer() { $user=get_user_data($this->auth->id); $this->view->assign("user",$user); return $this->view->fetch(); } function withdraw() { $tradeConfig = Config::getConfigByGroup('trade'); $config['withdraw_min'] = isset($tradeConfig['withdraw_min'])? $tradeConfig['withdraw_min']['value'] : 0; $config['withdraw_cap'] = isset($tradeConfig['withdraw_cap'])? $tradeConfig['withdraw_cap']['value'] : 0; $config['withdraw_fee'] = isset($tradeConfig['withdraw_fee'])? $tradeConfig['withdraw_fee']['value'] : 0; $this->view->assign("config",$config); $user=get_user_data($this->auth->id); $this->view->assign("user",$user); $this->view->assign("coinRate",CoinRate::getRate()); return $this->view->fetch(); } function withdrawdetaile() { return $this->view->fetch(); } function releaselog() { return $this->view->fetch(); } function bonuspage() { $user=get_user_data($this->auth->id); if($user['stuid']>0) { $studio=db('studio')->where(['id'=>$user['stuid']])->find(); $this->view->assign('studio',$studio); } $total=db('withdrawals')->where(['process_status'=>2,'userid'=>$user['id']])->sum('amount'); $fensi=db('user')->where(['refereeid'=>$user['id']])->count(); $loginStu=db('studio')->where(['title'=>$this->auth->login_studio])->find(); $this->view->assign([ "user"=>$user, 'total'=>$total, 'fensi'=>$fensi, 'login_studio'=>$loginStu['id'], ]); return $this->view->fetch(); } function viewwithdraw() { return $this->view->fetch(); } public function login() { if ($this->auth->id) { $this->redirect('shop/index/index'); } if ($this->request->isPost()) { $account = $this->request->post('account'); $password = $this->request->post('password'); $keeplogin = (int)$this->request->post('keeplogin'); $token = $this->request->post('__token__'); $rule = [ 'account' => 'require|length:3,50', 'password' => 'require|length:6,30', '__token__' => 'require|token', ]; $msg = [ 'account.require' => 'Account can not be empty', 'account.length' => 'Account must be 3 to 50 characters', 'password.require' => 'Password can not be empty', 'password.length' => 'Password must be 6 to 30 characters', ]; $data = [ 'account' => $account, 'password' => $password, '__token__' => $token, ]; $validate = new Validate($rule, $msg); $result = $validate->check($data); if (!$result) { $this->error(__($validate->getError()), null, ['token' => $this->request->token()]); return false; } if ($this->auth->login($account, $password)) { $this->success(__('Logged in successful'), url('shop/index/index')); } else { $this->error($this->auth->getError(), null, ['token' => $this->request->token()]); } } //判断来源 $referer = $this->request->server('HTTP_REFERER'); if ((strtolower(parse_url($referer, PHP_URL_HOST)) == strtolower($this->request->host())) && !preg_match("/(user\/login|user\/register|user\/logout)/i", $referer)) { $url = $referer; } $myset=config('site'); $this->view->assign("logoimg",$myset['web_site_logo']); return $this->view->fetch(); } /** * 注册会员 */ public function register() { $code=input('code'); if(empty($code)) { $code=''; } $this->view->assign('code',$code); return $this->view->fetch(); } function findpwd() { return $this->view->fetch(); } }