diff --git a/mysql/3.5.0.sql b/mysql/3.5.0.sql index 327a92a0bccf79321103ad688883ebf50bce159d..418d74a3c58bf010148a3ddaee1693868a26fed6 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 aaa9c089fcc76b4fb36acd708e63ce9c23aeaf05..1373cda1b5e2c71ac83b31560208e2102a638f12 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 } // 插入申请表