feat: device info and bind
CI / changes (push) Successful in 1m30s
CI / ad (push) Successful in 31s
CI / admin (push) Successful in 24s
CI / bff (push) Successful in 31s
CI / chore (push) Successful in 27s
CI / equipment (push) Successful in 21s
CI / express (push) Successful in 23s
CI / factory (push) Successful in 21s
CI / message (push) Successful in 21s
CI / order (push) Successful in 22s
CI / payment (push) Successful in 20s
CI / percutaneous (push) Successful in 20s
CI / product (push) Successful in 20s
CI / record (push) Successful in 19s
CI / sale (push) Successful in 19s
CI / support (push) Successful in 20s
CI / task (push) Successful in 19s
CI / user (push) Successful in 21s
CI / wecom (push) Successful in 22s
CI / changes (push) Successful in 1m30s
CI / ad (push) Successful in 31s
CI / admin (push) Successful in 24s
CI / bff (push) Successful in 31s
CI / chore (push) Successful in 27s
CI / equipment (push) Successful in 21s
CI / express (push) Successful in 23s
CI / factory (push) Successful in 21s
CI / message (push) Successful in 21s
CI / order (push) Successful in 22s
CI / payment (push) Successful in 20s
CI / percutaneous (push) Successful in 20s
CI / product (push) Successful in 20s
CI / record (push) Successful in 19s
CI / sale (push) Successful in 19s
CI / support (push) Successful in 20s
CI / task (push) Successful in 19s
CI / user (push) Successful in 21s
CI / wecom (push) Successful in 22s
This commit is contained in:
@@ -22,7 +22,7 @@ func parseValidityTime(date string) (utils.CustomTime, error) {
|
||||
return utils.CustomTime{Time: t}, nil
|
||||
}
|
||||
|
||||
func BindStoreAuth(userId, objId, storeId int64, validityTime string) error {
|
||||
func BindStoreAuth(userId, storeId int64, validityTime string) error {
|
||||
vt, err := parseValidityTime(validityTime)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -50,10 +50,48 @@ func BindStoreAuth(userId, objId, storeId int64, validityTime string) error {
|
||||
|
||||
return authModel.Create(&dao.UserStoreAuth{
|
||||
UserId: userId,
|
||||
ObjId: objId,
|
||||
StoreId: storeId,
|
||||
ValidityTime: vt,
|
||||
Status: dao.StatusEnabled,
|
||||
CreateTime: utils.Now(),
|
||||
CreatedAt: utils.Now(),
|
||||
})
|
||||
}
|
||||
|
||||
func ListStoreAuth(userId int64) ([]dao.UserStoreAuth, error) {
|
||||
var list []dao.UserStoreAuth
|
||||
err := model.UserStoreAuthModel{}.Init().Items(modelbase.Params{
|
||||
Eq: map[string]string{
|
||||
"user_id": strconv.FormatInt(userId, utils.NumberTen),
|
||||
"status": strconv.Itoa(int(dao.StatusEnabled)),
|
||||
},
|
||||
}, &list)
|
||||
return list, err
|
||||
}
|
||||
|
||||
func DisableStoreAuth(id, userId int64) (int64, error) {
|
||||
return model.UserStoreAuthModel{}.Init().Edit(modelbase.Params{
|
||||
Eq: map[string]string{
|
||||
"id": strconv.FormatInt(id, utils.NumberTen),
|
||||
"user_id": strconv.FormatInt(userId, utils.NumberTen),
|
||||
"status": strconv.Itoa(int(dao.StatusEnabled)),
|
||||
},
|
||||
}, map[string]interface{}{
|
||||
"status": dao.StatusDisabled,
|
||||
})
|
||||
}
|
||||
|
||||
func UpdateStoreAuthTime(id, userId int64, validityTime string) (int64, error) {
|
||||
vt, err := parseValidityTime(validityTime)
|
||||
if err != nil {
|
||||
return utils.NumberZero, err
|
||||
}
|
||||
return model.UserStoreAuthModel{}.Init().Edit(modelbase.Params{
|
||||
Eq: map[string]string{
|
||||
"id": strconv.FormatInt(id, utils.NumberTen),
|
||||
"user_id": strconv.FormatInt(userId, utils.NumberTen),
|
||||
"status": strconv.Itoa(int(dao.StatusEnabled)),
|
||||
},
|
||||
}, map[string]interface{}{
|
||||
"validity_time": vt,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user