|
@@ -208,6 +208,11 @@ class Guild extends Api
|
|
|
public function guildSaveInfo() {
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
+
|
|
|
+ if($this->auth->is_auth != 2){
|
|
|
+ $this->error('请先完成实名认证');
|
|
|
+ }
|
|
|
+
|
|
|
$guild_id = input("guild_id"); //公会id
|
|
|
$guild_name = input("guild_name"); //公会名
|
|
|
$guild_image = input("guild_image"); //logo
|
|
@@ -229,15 +234,35 @@ class Guild extends Api
|
|
|
$guildWhere['status'] = ['in',[0,1]];
|
|
|
$guildData = model('Guild')->where($guildWhere)->find();
|
|
|
if (!empty($guildData)) {
|
|
|
- throw new Exception('您已创建过公会!');
|
|
|
+ if($guildData['status'] == 1){
|
|
|
+ throw new Exception('您已创建过公会!');
|
|
|
+ }else{
|
|
|
+ throw new Exception('您创建的公会正在审核中!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查不能是其他家族的成员
|
|
|
+ $checkmember = model('GuildMember')->where('user_id',$this->auth->id)->find();
|
|
|
+ if (!empty($checkmember)) {
|
|
|
+ $this->error('您已经加入了其他公会');
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查删除这个人的所有加入申请
|
|
|
+ $joinData = model('Guildjoinin')->where('user_id',$this->auth->id)->where('status',0)->find();
|
|
|
+ if (!empty($joinData)) {
|
|
|
+ $this->error('您已经申请加入了其他公会,需等待被拒或退出,才能创建公会');
|
|
|
}
|
|
|
|
|
|
//准备创建
|
|
|
$guildInfo = new \app\common\model\Guild();
|
|
|
- $guildInfo->user_id = $user_id;
|
|
|
$ids = \app\common\model\Guild::column("g_id");
|
|
|
+
|
|
|
+ $guildInfo->user_id = $user_id;
|
|
|
$guildInfo->g_id = getUinqueId(4, [$ids]);
|
|
|
$guildInfo->status = 0;
|
|
|
+
|
|
|
+ //去环信建个房间
|
|
|
+ //去派对建个房间
|
|
|
} else {
|
|
|
// 获取公会信息
|
|
|
$guildInfo = \app\common\model\Guild::where(["id"=>$guild_id])->find();
|
|
@@ -253,6 +278,7 @@ class Guild extends Api
|
|
|
$guild_info && $guildInfo->info = $guild_info;
|
|
|
$province_id && $guildInfo->province_id = $province_id;
|
|
|
$city_id && $guildInfo->city_id = $city_id;
|
|
|
+
|
|
|
$res = $guildInfo->save();
|
|
|
|
|
|
if($res !== false) {
|