feat: 添加商城权限自动回收机制
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -29,6 +29,8 @@ type BaseSysUserService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
const ShopRoleID uint = 27
|
||||
|
||||
// Person 方法 返回不带密码的用户信息
|
||||
func (s *BaseSysUserService) Person(userId uint) (res gdb.Record, err error) {
|
||||
m := cool.DBM(s.Model)
|
||||
@@ -70,6 +72,19 @@ func (s *BaseSysUserService) SetdepartmentId(userId, departmentId uint32) (res *
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s *BaseSysUserService) CancelShopPermission(ctx context.Context, userId uint) error {
|
||||
_, err := cool.DBM(model.NewBaseSysUserRole()).
|
||||
Where("userId", userId).
|
||||
Where("roleId", ShopRoleID).
|
||||
Delete()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return NewBaseSysPermsService().RefreshPerms(ctx, userId)
|
||||
}
|
||||
|
||||
func (s *BaseSysUserService) DuihuanFreeGold(userId uint32, gold, free int64) {
|
||||
m := cool.DBM(s.Model).Where("id", userId)
|
||||
m.Data(g.Map{
|
||||
|
||||
Reference in New Issue
Block a user