|
|
@@ -657,7 +657,7 @@ func AdminInfo(c *gin.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
func RoleMediumList(c *gin.Context) { |
|
|
|
var req md.AppletApplicationMediumListReq |
|
|
|
var req md.AdminBindMediumListReq |
|
|
|
err := c.ShouldBindJSON(&req) |
|
|
|
if err != nil { |
|
|
|
err = validate.HandleValidateErr(err) |
|
|
@@ -667,8 +667,7 @@ func RoleMediumList(c *gin.Context) { |
|
|
|
} |
|
|
|
engine := svc.MasterDb(c) |
|
|
|
NewMediumDb := implement.NewMediumDb(engine) |
|
|
|
appId := svc.GetMediumIdStr(c, req.Name, req.Account) |
|
|
|
user := svc.GetUser(c) |
|
|
|
appId := svc.GetMediumIdStr(c, 0, req.Name, req.Account) |
|
|
|
list, total, _ := NewMediumDb.FindSuperAdminByMediumId(appId, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) |
|
|
|
data := make([]md.AdminBindMediumListData, 0) |
|
|
|
if len(list) > 0 { |
|
|
@@ -687,7 +686,7 @@ func RoleMediumList(c *gin.Context) { |
|
|
|
tmp.Name = GetMediumList.CompanyAbbreviation |
|
|
|
} |
|
|
|
} |
|
|
|
count, _ := engine.Where("medium_id=? and admin_id=?", v.MediumId, user.AdmId).Count(&model.AdminBindMedium{}) |
|
|
|
count, _ := engine.Where("medium_id=? and admin_id=?", v.MediumId, req.AdminId).Count(&model.AdminBindMedium{}) |
|
|
|
if count > 0 { |
|
|
|
tmp.IsBind = "1" |
|
|
|
} |
|
|
@@ -710,15 +709,14 @@ func RoleBindMedium(c *gin.Context) { |
|
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
user := svc.GetUser(c) |
|
|
|
NewAdminBindMediumDb := implement.NewAdminBindMediumDb(svc.MasterDb(c)) |
|
|
|
data := NewAdminBindMediumDb.GetAdminByMediumId(user.AdmId, utils.StrToInt(req.MediumId)) |
|
|
|
data := NewAdminBindMediumDb.GetAdminByMediumId(utils.StrToInt(req.AdminId), utils.StrToInt(req.MediumId)) |
|
|
|
if data != nil { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "已绑定该媒体")) |
|
|
|
return |
|
|
|
} |
|
|
|
tmp := model.AdminBindMedium{ |
|
|
|
AdminId: user.AdmId, |
|
|
|
AdminId: utils.StrToInt(req.AdminId), |
|
|
|
MediumId: utils.StrToInt(req.MediumId), |
|
|
|
CreateAt: time.Now(), |
|
|
|
UpdateAt: time.Now(), |
|
|
@@ -736,8 +734,7 @@ func RoleDelMedium(c *gin.Context) { |
|
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
user := svc.GetUser(c) |
|
|
|
svc.MasterDb(c).Where("medium_id=? and admin_id=?", req.MediumId, user.AdmId).Delete(&model.AdminBindMedium{}) |
|
|
|
svc.MasterDb(c).Where("medium_id=? and admin_id=?", req.MediumId, req.AdminId).Delete(&model.AdminBindMedium{}) |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |