|
@@ -293,17 +293,11 @@ class Guild extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 公会签约申请
|
|
|
*/
|
|
|
public function guildJoinin() {
|
|
|
- $join_time = input("join_time",1); //签约时长:1=3个月,2=6个月,3=12个月
|
|
|
$guild_id = input("guild_id"); //公会ID
|
|
|
- //if(!in_array($join_time,[1,2,3]) || !$guild_id) $this->error("参数错误!");
|
|
|
|
|
|
// 一个身份证号只能申请一次
|
|
|
$user_id = $this->auth->id;
|
|
@@ -312,8 +306,14 @@ class Guild extends Api
|
|
|
$this->error("请完成实名认证!");
|
|
|
}
|
|
|
|
|
|
- // 获取用户实名认证信息
|
|
|
- $authUserIdcard = \app\common\model\UserAuth::where(["user_id"=>$user_id])->value("idcard");
|
|
|
+ $check = \app\common\model\Guild::where(["user_id"=>$this->auth->id])->find();
|
|
|
+ if($check){
|
|
|
+ if($check['status'] == 1){
|
|
|
+ $this->error('您已经有自己的公会了');
|
|
|
+ }elseif($check['status'] == 0){
|
|
|
+ $this->error('您已经申请了自己的公会了');
|
|
|
+ }
|
|
|
+ }
|
|
|
// 搜索签约申请中是否有此身份证号
|
|
|
$idcardfind = \app\common\model\GuildJoinin::where(["user_id"=>$user_id,'guild_id'=>$guild_id,"status"=>0])->find();
|
|
|
if($idcardfind) $this->error("当前账号正在审核,请耐心等待!");
|
|
@@ -321,30 +321,14 @@ class Guild extends Api
|
|
|
$memberfind = \app\common\model\GuildMember::where(["user_id"=>$user_id])->find();
|
|
|
if($memberfind) $this->error("一个账号只能加入一个公会哟!");
|
|
|
|
|
|
- // 查看是否申请过
|
|
|
- /*$applyInfo = \app\common\model\GuildApply::where(["user_id"=>$user_id,"status"=>0])->find();
|
|
|
- if($applyInfo && $applyInfo->status>=0) $this->error("您已经发送过开厅申请了,请勿重复发送!");*/
|
|
|
|
|
|
-// // 获取公会信息
|
|
|
-// $guildInfo = \app\common\model\Guild::where(["user_id"=>$user_id,"status"=>1])->find();
|
|
|
-// // 验证更新条件
|
|
|
-// if($guildInfo) $this->error("您存在公会会长身份,请先解散相应的公会才可申请");
|
|
|
-
|
|
|
- // 获取公会信息
|
|
|
- $guildName = \app\common\model\Guild::where(["id"=>$guild_id])->value("name");
|
|
|
- // 获取用户信息
|
|
|
- $userInfo = \app\common\model\User::field("id,avatar,nickname")->where(["id"=>$user_id])->find();
|
|
|
// 添加数据
|
|
|
$data = [];
|
|
|
$data["user_id"] = $user_id;
|
|
|
$data["guild_id"] = $guild_id;
|
|
|
- //$data["join_time"] = $join_time;
|
|
|
-
|
|
|
$data["createtime"] = time();
|
|
|
$res = \app\common\model\GuildJoinin::insert($data);
|
|
|
if($res) {
|
|
|
- // +message
|
|
|
-// \app\common\model\Message::addMessage($user_id,"公会消息","申请加入公会消息");
|
|
|
$this->success("申请发送成功!");
|
|
|
} else {
|
|
|
$this->error("网络错误,请稍后重试!");
|
|
@@ -374,7 +358,7 @@ class Guild extends Api
|
|
|
|
|
|
//判断重复
|
|
|
$memberfind = \app\common\model\GuildMember::where(["user_id"=>$joininInfo['user_id']])->find();
|
|
|
- if($memberfind) $this->error("该用户已有公会!");
|
|
|
+ if($memberfind) $this->error("该用户已有公会!");//包括成员,副会,会长角色
|
|
|
|
|
|
//清理其他公会未审核的数据
|
|
|
if ($is_pass == 1) {
|
|
@@ -388,8 +372,6 @@ class Guild extends Api
|
|
|
// 计算签约时间段
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
-
|
|
|
-
|
|
|
// 更新申请状态
|
|
|
$joininInfo->status = $is_pass;
|
|
|
$joininInfo->updatetime = time();
|
|
@@ -401,7 +383,6 @@ class Guild extends Api
|
|
|
$data["guild_id"] = $guildInfo->id;
|
|
|
$data["user_id"] = $joininInfo->user_id;
|
|
|
$data["role"] = 0;
|
|
|
- $data["status"] = 1;
|
|
|
$data["createtime"] = time();
|
|
|
$res3 = \app\common\model\GuildMember::insert($data);
|
|
|
$res4 = \app\common\model\Guild::where(["id"=>$guildInfo->id])->setInc("member");
|
|
@@ -475,7 +456,6 @@ class Guild extends Api
|
|
|
}
|
|
|
}
|
|
|
$this->success("获取成功",$result);
|
|
|
- $this->success("获取成功",$result);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -484,15 +464,12 @@ class Guild extends Api
|
|
|
*/
|
|
|
public function guildMember() {
|
|
|
$guild_id = input("guild_id",0,"intval"); //公会ID
|
|
|
- $page = input('page',1); // 分页
|
|
|
- $pageNum = input('listrow',10); // 分页
|
|
|
- // 分页搜索构建
|
|
|
- $pageStart = ($page-1)*$pageNum;
|
|
|
+
|
|
|
if($guild_id <= 0) $this->error("参数错误!");
|
|
|
+
|
|
|
$where = [];
|
|
|
$where["a.guild_id"] = $guild_id;
|
|
|
- $where["a.status"] = 1;
|
|
|
- //$where["a.sign_time"] = ["gt",time()];
|
|
|
+
|
|
|
// 获取公会成员总数
|
|
|
$guildMemberCount = \app\common\model\GuildMember::alias("a")->where($where)->count("id");
|
|
|
// 获取公会成员列表
|
|
@@ -500,7 +477,7 @@ class Guild extends Api
|
|
|
->field("a.id,a.user_id,u.avatar,u.nickname,u.gender,a.role,u.is_online,u.onlinetime")
|
|
|
->join("user u","a.user_id = u.id")
|
|
|
->where($where)
|
|
|
- ->limit($pageStart,$pageNum)
|
|
|
+ ->autopage()
|
|
|
->order("a.role","desc")
|
|
|
->select();
|
|
|
|