🎨 优化部分用户管理接口
This commit is contained in:
parent
e074395859
commit
5faff4afa0
@ -44,6 +44,7 @@ type GetUserListReq struct {
|
|||||||
Type int `json:"type" form:"type"`
|
Type int `json:"type" form:"type"`
|
||||||
UserLabel string `json:"user_label" form:"user_label" `
|
UserLabel string `json:"user_label" form:"user_label" `
|
||||||
Status int `json:"status" form:"status"`
|
Status int `json:"status" form:"status"`
|
||||||
|
Name string `json:"name" form:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetBalanceReq struct {
|
type SetBalanceReq struct {
|
||||||
|
@ -103,6 +103,10 @@ func (u *UserService) GetUserList(p request.GetUserListReq) (userList []user.Use
|
|||||||
db = db.Where("status = ?", p.Status)
|
db = db.Where("status = ?", p.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Name != "" {
|
||||||
|
db = db.Where("nick_name like ?", "%"+p.Name+"%")
|
||||||
|
}
|
||||||
|
|
||||||
err = db.Count(&total).Error
|
err = db.Count(&total).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -207,7 +211,12 @@ func (u *UserService) Register(req request.RegisterReq) (err error) {
|
|||||||
Status: 1,
|
Status: 1,
|
||||||
UserType: req.UserType,
|
UserType: req.UserType,
|
||||||
}
|
}
|
||||||
|
if req.UserLabel != 0 {
|
||||||
|
user.IsVip = 1
|
||||||
|
date := time.Now().Truncate(24*time.Hour).AddDate(0, 0, 30)
|
||||||
|
//将date转为string
|
||||||
|
user.VipExpireTime = date.Format("2006-01-02 15:04:05")
|
||||||
|
}
|
||||||
err = global.GVA_DB.Save(&user).Error
|
err = global.GVA_DB.Save(&user).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.GVA_LOG.Error("创建用户失败", zap.Error(err))
|
global.GVA_LOG.Error("创建用户失败", zap.Error(err))
|
||||||
|
Loading…
Reference in New Issue
Block a user