Commit 1efa1434 authored by chenweijian's avatar chenweijian

家族修改铭牌

parent 06790632
...@@ -120,7 +120,8 @@ func UpdateFamily(model *domain.Model, familyId uint64, name, nameplate, declara ...@@ -120,7 +120,8 @@ func UpdateFamily(model *domain.Model, familyId uint64, name, nameplate, declara
} }
if nameplate != "" { if nameplate != "" {
updateMap["nameplate"] = nameplate updateMap["nameplate"] = nameplate
db = db.Where("not exists (select id from group_power where nameplate = ?)", nameplate) db = db.Joins("left join (SELECT ? `id` FROM group_power WHERE nameplate=?) b on a.id = b.id", familyId, nameplate).
Where("b.id is null")
} }
if declaration != "" { if declaration != "" {
updateMap["declaration"] = declaration updateMap["declaration"] = declaration
...@@ -128,7 +129,7 @@ func UpdateFamily(model *domain.Model, familyId uint64, name, nameplate, declara ...@@ -128,7 +129,7 @@ func UpdateFamily(model *domain.Model, familyId uint64, name, nameplate, declara
if icon != "" { if icon != "" {
updateMap["icon"] = icon updateMap["icon"] = icon
} }
result := db.Where("id = ?", familyId).Updates(updateMap).Limit(1) result := db.Where("group_power.id = ?", familyId).Updates(updateMap).Limit(1)
if result.Error != nil { if result.Error != nil {
return myerr.WrapErr(result.Error) return myerr.WrapErr(result.Error)
} }
......
...@@ -768,6 +768,9 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -768,6 +768,9 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
} }
if groupInfo != nil { if groupInfo != nil {
info.Nameplate = groupInfo.Name info.Nameplate = groupInfo.Name
if len(info.Nameplate) > 6 {
info.Nameplate = info.Nameplate[:6]
}
} }
} }
// 家族月排名 // 家族月排名
...@@ -1420,7 +1423,7 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1420,7 +1423,7 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
return myContext, bizerr.GroupPowerChangeNameplate return myContext, bizerr.GroupPowerChangeNameplate
} }
// 检查铭牌长度和唯一性 // 检查铭牌长度和唯一性
if len(para.Nameplate) > 10 { if len(para.Nameplate) > 6 {
return myContext, bizerr.GroupPowerHaveTooLong return myContext, bizerr.GroupPowerHaveTooLong
} }
if groupPower_m.IsExistsNameplate(model, para.Nameplate) { if groupPower_m.IsExistsNameplate(model, para.Nameplate) {
......
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