aa
This commit is contained in:
@@ -5087,3 +5087,35 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
|
||||
func GetStoreMapAudit(ctx *jxcontext.Context, storeIDs, vendorIDs, auditStatuss []int, fromTime, toTime string, offset, pageSize int) (page *model.PagedInfo, err error) {
|
||||
return dao.GetStoreMapAudit(dao.GetDB(), storeIDs, vendorIDs, auditStatuss, utils.Str2Time(fromTime), utils.Str2Time(toTime), offset, pageSize)
|
||||
}
|
||||
|
||||
func GetBrandUser(ctx *jxcontext.Context, brandID int) (brandUsers []*model.BrandUser, err error) {
|
||||
return dao.GetBrandUser(dao.GetDB(), brandID, "")
|
||||
}
|
||||
|
||||
func UpdateBrandUser(ctx *jxcontext.Context, brandID int, userID string, isDel bool) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
brandUsers, err := dao.GetBrandUser(db, brandID, userID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !isDel {
|
||||
if len(brandUsers) > 0 {
|
||||
return fmt.Errorf("此用户已经绑定了该品牌!")
|
||||
}
|
||||
brandUser := &model.BrandUser{
|
||||
BrandID: brandID,
|
||||
UserID: userID,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(brandUser, ctx.GetUserName())
|
||||
dao.CreateEntity(db, brandUser)
|
||||
} else {
|
||||
if len(brandUsers) == 0 {
|
||||
return fmt.Errorf("此用户没有绑定该品牌!")
|
||||
}
|
||||
brandUsers[0].DeletedAt = time.Now()
|
||||
dao.UpdateEntity(db, brandUsers[0], "DeletedAt")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user