|
@@ -822,119 +822,4 @@ class Family extends Api
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- ///////////////没用到的///////////
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 开厅申请
|
|
|
|
- */
|
|
|
|
- public function guildApply() {
|
|
|
|
- $user_id = $this->auth->id;
|
|
|
|
- // 获取用户实名认证信息
|
|
|
|
- $authUserRealname = \app\common\model\UserAuth::where(["user_id"=>$user_id])->value("realname");
|
|
|
|
- if(!$authUserRealname) $this->error("未查询到实名认证信息,请实名认证先!");
|
|
|
|
- // 获取用户信息
|
|
|
|
- $userInfo = \app\common\model\User::field("id,mobile,nickname")->where(["id"=>$user_id])->find();
|
|
|
|
- $data = [];
|
|
|
|
- $data["user_id"] = $user_id;
|
|
|
|
- // 查看是否申请过
|
|
|
|
- $applyInfo = \app\common\model\GuildApply::where($data)->find();
|
|
|
|
- if($applyInfo && $applyInfo->status>=0) $this->error("您已经发送过开厅申请了,请勿重复发送!");
|
|
|
|
- // 查看是否有加入公会的申请
|
|
|
|
- $joinInfo = \app\common\model\GuildJoinin::where(["user_id"=>$user_id,"status"=>0])->find();
|
|
|
|
- if($joinInfo) $this->error("您存在申请加入公会信息,请联系工会长处理完毕后方可申请开厅!");
|
|
|
|
- // 查看是已经是公会成员
|
|
|
|
- $memberInfo = \app\common\model\GuildMember::where(["user_id"=>$user_id,"status"=>1,"sign_time"=>["gt",time()]])->find();
|
|
|
|
- if($memberInfo) $this->error("您已存在签约中的公会,无法开新厅!");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- Db::startTrans();
|
|
|
|
- try{
|
|
|
|
- $data["user_name"] = $authUserRealname;
|
|
|
|
- $data["user_nickname"] = $userInfo->nickname;
|
|
|
|
- $data["user_mobile"] = $userInfo->mobile;
|
|
|
|
- $data["createtime"] = time();
|
|
|
|
- $res1 = \app\common\model\GuildApply::insert($data);
|
|
|
|
- // 更新用户状态
|
|
|
|
- $userInfo->is_guild = 1;
|
|
|
|
- $res2 = $userInfo->save();
|
|
|
|
- if($res1 && $res2) {
|
|
|
|
- Db::commit();
|
|
|
|
- $this->success("申请发送成功!");
|
|
|
|
- } else {
|
|
|
|
- $this->error("网络错误,请稍后重试!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }catch (ValidateException $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- } catch (PDOException $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 公会申请页面信息
|
|
|
|
- */
|
|
|
|
- public function guildApplyInfo() {
|
|
|
|
- $guild_id = input("guild_id"); //公会ID
|
|
|
|
- if($guild_id <= 0) $this->error("参数缺失!");
|
|
|
|
- $guildInfo = \app\common\model\Guild::alias("a")
|
|
|
|
- ->join("hx_user u","u.id = a.user_id","inner")
|
|
|
|
- ->field("a.id,a.image,a.name,a.g_id,a.user_id,u.avatar,u.nickname,u.u_id")
|
|
|
|
- ->where(["a.id"=>$guild_id])
|
|
|
|
- ->find();
|
|
|
|
-
|
|
|
|
- $guildInfo["status"] = 0;
|
|
|
|
- // 获取申请用户是否已经有正在申请的记录
|
|
|
|
- $user_id = $this->auth->id;
|
|
|
|
- $joinStatus = \app\common\model\GuildJoinin::where(["user_id"=>$user_id])->value("status");
|
|
|
|
- if($joinStatus === 0) $guildInfo["status"] = 1;
|
|
|
|
-
|
|
|
|
- $Member = \app\common\model\GuildMember::where(["user_id"=>$user_id,"status"=>1,"sign_time"=>["gt",time()]])->value("id");
|
|
|
|
- if($Member > 0) $guildInfo["status"] = 2;
|
|
|
|
-
|
|
|
|
- $this->success("获取成功!",$guildInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 公会助手列表
|
|
|
|
- */
|
|
|
|
- public function guildAssistantList() {
|
|
|
|
- $user_id = $this->auth->id;
|
|
|
|
- // 获取公会信息
|
|
|
|
- $guildInfo = \app\common\model\Guild::where(["user_id"=>$user_id])->find();
|
|
|
|
- if(!$guildInfo) $this->error("公会信息获取失败!");
|
|
|
|
- // 先获取申请列表
|
|
|
|
- $where = [];
|
|
|
|
- $where["guild_id"] = $guildInfo->id;
|
|
|
|
- $where["status"] = 0;
|
|
|
|
- $joinList = \app\common\model\GuildJoinin::field("id,user_avatar,user_nickname,guild_name,createtime")->where($where)->order("createtime","desc")->select();
|
|
|
|
- if($joinList) foreach($joinList as $k => $v) {
|
|
|
|
- $joinList[$k]["createtime"] = date("Y-m-d H:i",$v["createtime"]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 再获取审核记录
|
|
|
|
- $where = [];
|
|
|
|
- $where["a.guild_id"] = $guildInfo->id;
|
|
|
|
- $where["a.user_id"] = $user_id;
|
|
|
|
- $joinlogList = \app\common\model\GuildJoininLog::alias("a")
|
|
|
|
- ->field("a.id,a.user_nickname,a.user_u_id,a.guild_name,a.guild_g_id,a.sign_time_slot,a.status,u.nickname as operator,a.createtime")
|
|
|
|
- ->join("hx_user u","a.operator = u.id")
|
|
|
|
- ->whereOr($where)
|
|
|
|
- ->order("a.createtime","desc")
|
|
|
|
- ->select();
|
|
|
|
- if($joinlogList) foreach($joinlogList as $k => $v) {
|
|
|
|
- $joinlogList[$k]["createtime"] = date("Y-m-d H:i",$v["createtime"]);
|
|
|
|
- }
|
|
|
|
- $res = [];
|
|
|
|
- $res["joinList"] = $joinList;
|
|
|
|
- $res["joinlogList"] = $joinlogList;
|
|
|
|
- $this->success("获取成功!",$res);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|