Commit c2880d32 authored by chenweijian's avatar chenweijian

申请加入家族

parent 982b8d0f
......@@ -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
......@@ -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
}
// 插入申请表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment