From c2880d32b1b101f699041aba64e8a8e1433a756b Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Fri, 10 Mar 2023 18:11:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5=E5=AE=B6?= =?UTF-8?q?=E6=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql/3.5.0.sql | 3 +-- route/group_power_r/group_power.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mysql/3.5.0.sql b/mysql/3.5.0.sql index 327a92a..418d74a 100644 --- a/mysql/3.5.0.sql +++ b/mysql/3.5.0.sql @@ -27,7 +27,6 @@ CREATE TABLE `group_power_apply_join` ( `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `is_accept` tinyint NOT NULL DEFAULT '0' COMMENT '是否已经接受', PRIMARY KEY (`id`), - UNIQUE KEY `user_group` (`user_id`,`group_power_id`), - UNIQUE KEY `u_apply` (`user_id`,`group_power_id`,`is_accept`) USING BTREE, + UNIQUE KEY `u_apply` (`user_id`,`group_power_id`) USING BTREE, KEY `group_power_id` (`group_power_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='申请加入家族'; \ No newline at end of file diff --git a/route/group_power_r/group_power.go b/route/group_power_r/group_power.go index aaa9c08..1373cda 100644 --- a/route/group_power_r/group_power.go +++ b/route/group_power_r/group_power.go @@ -872,7 +872,16 @@ func GroupPowerApplyJoin(c *gin.Context) (*mycontext.MyContext, error) { return myContext, err } if gpInfo == nil || gpInfo.ID <= 0 { - return myContext, bizerr.InvalidParameter + return myContext, bizerr.GroupPowerNotExist + } + // 判断是否加入了家族 + gpU := groupPower_m.GroupPowerUser{UserId: userId} + uList, err := gpU.Get(model.Db) + if err != nil { + return myContext, err + } + if len(uList) > 0 { + return myContext, bizerr.GroupPowerHasJoinOther } // 插入申请表 -- 2.22.0