feat: 迁移plant
This commit is contained in:
@@ -3,6 +3,7 @@ package logic
|
||||
import (
|
||||
"context"
|
||||
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
|
||||
@@ -23,8 +24,21 @@ func NewUpdateUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新用户资料
|
||||
func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateProfileReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CommonResp{}, nil
|
||||
updateMap := map[string]interface{}{}
|
||||
if in.NickName != "" {
|
||||
updateMap["nick_name"] = in.NickName
|
||||
}
|
||||
if in.AvatarId != "" {
|
||||
updateMap["avatar_id"] = in.AvatarId
|
||||
}
|
||||
if len(updateMap) == 0 {
|
||||
return &plant.CommonResp{Code: 0, Msg: "nothing to update"}, nil
|
||||
}
|
||||
if err := l.svcCtx.DB.Model(&plantModel.UserProfile{}).Where("user_id = ?", in.UserId).
|
||||
Updates(updateMap).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &plant.CommonResp{Code: 0, Msg: "ok"}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user