go_dreamfactory/modules/user/api_changetips.go
2023-06-06 09:52:44 +08:00

38 lines
984 B
Go

package user
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
//参数校验
func (this *apiComp) ChangeTipsCheck(session comm.IUserSession, req *pb.UserChangeTipsReq) (errdata *pb.ErrorData) {
return
}
//修改提示次数
func (this *apiComp) ChangeTips(session comm.IUserSession, req *pb.UserChangeTipsReq) (errdata *pb.ErrorData) {
update := make(map[string]interface{}, 0)
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
if conf := this.module.ModuleTools.GetGlobalConf().DailyTips; conf.N > 0 {
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{conf}, true); code != pb.ErrorCode_Success {
return
}
}
sign.Tips += 1 // 记录总的提示次数
update["tips"] = sign.Tips
this.module.modelSign.Change(session.GetUserId(), update)
session.SendMsg(string(this.module.GetType()), "changetips", &pb.UserChangeTipsResp{
Data: sign,
})
}
return
}