代码拉取完成,页面将自动刷新
package model
import (
"gitee.com/wanjimao/dongli-kit/orm/nosql"
"gitee.com/wanjimao/dongli-kit/orm/nosql/diface"
"google.golang.org/protobuf/proto"
pb "gitee.com/wanjimao/dongli-platform/api/gen/profile/api"
)
type Dao struct {
nosql.DocumentBase `bson:"-"`
Data *pb.Profile `bson:"data"`
}
func (d *Dao) Init(id string, doc diface.ICollection, cache diface.ICache) error {
key, e := NewProfileKey(id)
if e != nil {
return e
}
d.initData()
d.DocumentBase.InitWithCache(&d.Data, d.clear, doc, key, cache)
return nil
}
func (d *Dao) ToProto() *pb.Profile {
return proto.Clone(d.Data).(*pb.Profile)
}
func (d *Dao) UpdateData(profile *pb.Profile) bool {
if profile.Nickname != "" {
d.Data.Nickname = profile.Nickname
}
if profile.Avatar != "" {
d.Data.Avatar = profile.Avatar
}
if profile.Phone != "" {
d.Data.Phone = profile.Phone
}
if profile.Email != "" {
d.Data.Email = profile.Email
}
if profile.RechargeAmount > 0 {
d.Data.RechargeAmount += profile.RechargeAmount
}
return true
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。