mirror of
https://github.com/xinliangnote/go-gin-api.git
synced 2024-04-21 12:31:46 +00:00
- 将 middleware 命名为 interceptor - 将 deploy 命名为 deployments - 移除 pkg/errno - 使用 proposal 目录 - 优化代码
30 lines
754 B
Go
30 lines
754 B
Go
package admin
|
|
|
|
import (
|
|
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
|
"github.com/xinliangnote/go-gin-api/internal/repository/mysql"
|
|
"github.com/xinliangnote/go-gin-api/internal/repository/mysql/admin"
|
|
)
|
|
|
|
type ModifyData struct {
|
|
Nickname string // 昵称
|
|
Mobile string // 手机号
|
|
}
|
|
|
|
func (s *service) ModifyPersonalInfo(ctx core.Context, id int32, modifyData *ModifyData) (err error) {
|
|
data := map[string]interface{}{
|
|
"nickname": modifyData.Nickname,
|
|
"mobile": modifyData.Mobile,
|
|
"updated_user": ctx.SessionUserInfo().UserName,
|
|
}
|
|
|
|
qb := admin.NewQueryBuilder()
|
|
qb.WhereId(mysql.EqualPredicate, id)
|
|
err = qb.Updates(s.db.GetDbW().WithContext(ctx.RequestContext()), data)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return
|
|
}
|