100 lines
3.3 KiB
PHP
100 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace app\index\controller;
|
|
|
|
use app\common\controller\Frontend;
|
|
use addons\third\library\Wechat;
|
|
use app\admin\model\Userwechat;
|
|
use think\Session;
|
|
use think\Config;
|
|
use app\admin\model\Renzheng;
|
|
use app\admin\model\ClubInvate as ClubInvateModel;
|
|
use app\admin\model\Club;
|
|
use app\admin\model\ClubPlayercheck;
|
|
use app\common\model\Players;
|
|
use app\admin\model\ClubMatchApply;
|
|
use think\Request;
|
|
|
|
class Clubinvate extends Frontend
|
|
{
|
|
|
|
protected $noNeedLogin = '*';
|
|
protected $noNeedRight = '*';
|
|
protected $layout = 'defaults';
|
|
|
|
|
|
public function index()
|
|
{
|
|
// $this->view->assign('clubinfo', '');
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
public function confirmed_player(){
|
|
$player = new Players();
|
|
$user_id = $this->auth->id;
|
|
$player_info = $player->where("member_id", $user_id)->find();
|
|
|
|
if (empty($player_info)){
|
|
$this->error(__("请先申请成为飞手!"), url('players/registeredflyers')) ;
|
|
}
|
|
|
|
if ($player_info['player_status'] != 9){
|
|
$this->error(__("您还不是正式飞手!"), url('user/index'));
|
|
}
|
|
}
|
|
|
|
public function confirmed_club(){
|
|
$club = new Club();
|
|
$user_id = $this->auth->id;
|
|
$club_info = $club->where("user_id", $user_id)->find();
|
|
|
|
if (empty($player_info)){
|
|
$this->error(__("请先申请成为队伍!"), url('players/registeredflyers')) ;
|
|
}
|
|
|
|
if ($player_info['player_status'] != 9){
|
|
$this->error(__("您还不是正式队伍!"), url('user/index'));
|
|
}
|
|
}
|
|
|
|
//飞手加入公会
|
|
public function join_sociaty(){
|
|
$this->confirmed_player();
|
|
$user_id = $this->auth->id;
|
|
// var_dump($user_id);exit;
|
|
$player = new Players();
|
|
$clubinvate = new ClubInvateModel();
|
|
$player_info = $player->where("member_id", $user_id)->find();
|
|
$res = $clubinvate->where('player_id',$player_info['id'])->where('status',6)->where('deletetime',null)->find();
|
|
// $res1 = $clubinvate->where('club_id',$club_info['id'])->where('player_id',$player_id)->where('status',4)->where('deletetime',null)->find();
|
|
$res2 = $clubinvate->where('player_id',$player_info['id'])->where('status',5)->where('deletetime',null)->find();
|
|
$res3 = $clubinvate->where('player_id',$player_info['id'])->where('status',9)->where('deletetime',null)->find();
|
|
if(!empty($res2)) $this->error('您已接受邀请等待平台审核');
|
|
if(!empty($res3)) $this->error('您已接受邀请等待队伍上传协议');
|
|
if(!empty($res)){
|
|
$this->error('您已成为某支队伍成员');
|
|
}
|
|
$player = new Players();
|
|
$player->save([
|
|
'is_sociaty' => 1,
|
|
'updated_at' => date('Y-m-d H:i:s',time()),
|
|
],['member_id'=>$user_id]);
|
|
$this->success('加入成功',url('players/index'));
|
|
}
|
|
|
|
//飞手退出公会
|
|
public function exit_sociaty(){
|
|
$this->confirmed_player();
|
|
$user_id = $this->auth->id;
|
|
$clubinvate = new ClubInvateModel();
|
|
$player = new Players();
|
|
$player->save([
|
|
'is_sociaty' => '',
|
|
'updated_at' => date('Y-m-d H:i:s',time()),
|
|
],['member_id'=>$user_id]);
|
|
$this->success('退出成功',url('players/index'));
|
|
}
|
|
|
|
|
|
}
|