上传任务宝箱领取代码
This commit is contained in:
parent
9d100dbfdb
commit
cc24f33eac
@ -98,6 +98,11 @@ func (this *MCompModel) Change(uid string, data map[string]interface{}, opt ...d
|
|||||||
return this.DBModel.Change(uid, data, opt...)
|
return this.DBModel.Change(uid, data, opt...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改数据多个字段 id 作为主键
|
||||||
|
func (this *MCompModel) ChangeById(id string, data map[string]interface{}, opt ...db.DBOption) (err error) {
|
||||||
|
return this.DBModel.ChangeById(id, data, opt...)
|
||||||
|
}
|
||||||
|
|
||||||
// 修改数据多个字段 uid 作为主键
|
// 修改数据多个字段 uid 作为主键
|
||||||
func (this *MCompModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...db.DBOption) (err error) {
|
func (this *MCompModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...db.DBOption) (err error) {
|
||||||
return this.DBModel.ChangeList(uid, _id, data, opt...)
|
return this.DBModel.ChangeList(uid, _id, data, opt...)
|
||||||
|
@ -39,11 +39,11 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.GuildGveInfoReq) (e
|
|||||||
|
|
||||||
if !utils.IsToday(member.Refreshtime) {
|
if !utils.IsToday(member.Refreshtime) {
|
||||||
if conf, errdata = this.module.ModuleTools.GetPlayerlvConf(session.GetUserId()); errdata != nil {
|
if conf, errdata = this.module.ModuleTools.GetPlayerlvConf(session.GetUserId()); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
member.Boosticket = conf.GuildBossCeiling
|
member.Boosticket = conf.GuildBossCeiling
|
||||||
member.Refreshtime = configure.Now().Unix()
|
member.Refreshtime = configure.Now().Unix()
|
||||||
this.module.modelGuildMember.updateGuildMember(member)
|
this.module.modelGuildMember.updateGuildMember(member)
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if roulette, err = this.module.modelUnionroulette.getUnionRoulette(req.Guildid); err != nil {
|
if roulette, err = this.module.modelUnionroulette.getUnionRoulette(req.Guildid); err != nil {
|
||||||
|
@ -49,7 +49,7 @@ func (this *ModelUnionroulette) getUnionRoulette(Guildid string) (results *pb.DB
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelUnionroulette) updateUnionRoulette(data *pb.DBGuildRouletteRecord) (err error) {
|
func (this *ModelUnionroulette) updateUnionRoulette(data *pb.DBGuildRouletteRecord) (err error) {
|
||||||
if err = this.Change(data.Guildid, map[string]interface{}{
|
if err = this.ChangeById(data.Guildid, map[string]interface{}{
|
||||||
"roulette": data.Roulette,
|
"roulette": data.Roulette,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
this.module.Error("更新用户任务数据 错误!", log.Field{Key: "err", Value: err.Error()})
|
this.module.Error("更新用户任务数据 错误!", log.Field{Key: "err", Value: err.Error()})
|
||||||
|
@ -91,7 +91,7 @@ func (this *ModelUniongve) getGuildGve(guildid string) (results *pb.DBGuildGve,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelUniongve) updateGuildGve(data *pb.DBGuildGve) (err error) {
|
func (this *ModelUniongve) updateGuildGve(data *pb.DBGuildGve) (err error) {
|
||||||
if err = this.Change(data.Guildid, map[string]interface{}{
|
if err = this.ChangeById(data.Guildid, map[string]interface{}{
|
||||||
"fire": data.Fire,
|
"fire": data.Fire,
|
||||||
"notice": data.Notice,
|
"notice": data.Notice,
|
||||||
"currstage": data.Currstage,
|
"currstage": data.Currstage,
|
||||||
|
@ -75,7 +75,7 @@ func (this *apiComp) ReceiveAward(session comm.IUserSession, req *pb.MainlineRec
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
awardid = (chapterconf.Starreward)
|
awardid = chapterconf.Starreward
|
||||||
} else {
|
} else {
|
||||||
if award, ok = info.Groupaward[req.Group]; !ok || award.Stage < req.Stage {
|
if award, ok = info.Groupaward[req.Group]; !ok || award.Stage < req.Stage {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -46,8 +46,8 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok = false
|
ok = false
|
||||||
for _, v := range box.Boxs {
|
for k, _ := range box.Boxs {
|
||||||
if v == req.Boxid {
|
if k == req.Boxid {
|
||||||
ok = true
|
ok = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,21 @@ func (this *apiComp) ExchangeCheck(session comm.IUserSession, req *pb.WTaskExcha
|
|||||||
|
|
||||||
// /获取系统公告
|
// /获取系统公告
|
||||||
func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeReq) (errdata *pb.ErrorData) {
|
||||||
var ()
|
var (
|
||||||
|
err error
|
||||||
|
)
|
||||||
if errdata = this.ExchangeCheck(session, req); errdata != nil {
|
if errdata = this.ExchangeCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err = this.module.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,10 @@ type GameTrendChoseData struct {
|
|||||||
Chosetxt string
|
Chosetxt string
|
||||||
Chosetype int32
|
Chosetype int32
|
||||||
Chosenum int32
|
Chosenum int32
|
||||||
Get []*Gameatn
|
Startstory int32
|
||||||
|
Constory int32
|
||||||
|
Get []int32
|
||||||
|
Aginstory int32
|
||||||
Lose []*Gameatn
|
Lose []*Gameatn
|
||||||
Jump int32
|
Jump int32
|
||||||
Num int32
|
Num int32
|
||||||
@ -53,20 +56,23 @@ func (_v *GameTrendChoseData)Deserialize(_buf map[string]interface{}) (err error
|
|||||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["chosetxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Chosetxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Chosetxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["chosetxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Chosetxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Chosetxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosetype"].(float64); !_ok_ { err = errors.New("chosetype error"); return }; _v.Chosetype = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosetype"].(float64); !_ok_ { err = errors.New("chosetype error"); return }; _v.Chosetype = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosenum"].(float64); !_ok_ { err = errors.New("chosenum error"); return }; _v.Chosenum = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosenum"].(float64); !_ok_ { err = errors.New("chosenum error"); return }; _v.Chosenum = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["startstory"].(float64); !_ok_ { err = errors.New("startstory error"); return }; _v.Startstory = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["constory"].(float64); !_ok_ { err = errors.New("constory error"); return }; _v.Constory = int32(_tempNum_) }
|
||||||
{
|
{
|
||||||
var _arr_ []interface{}
|
var _arr_ []interface{}
|
||||||
var _ok_ bool
|
var _ok_ bool
|
||||||
if _arr_, _ok_ = _buf["get"].([]interface{}); !_ok_ { err = errors.New("get error"); return }
|
if _arr_, _ok_ = _buf["get"].([]interface{}); !_ok_ { err = errors.New("get error"); return }
|
||||||
|
|
||||||
_v.Get = make([]*Gameatn, 0, len(_arr_))
|
_v.Get = make([]int32, 0, len(_arr_))
|
||||||
|
|
||||||
for _, _e_ := range _arr_ {
|
for _, _e_ := range _arr_ {
|
||||||
var _list_v_ *Gameatn
|
var _list_v_ int32
|
||||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||||
_v.Get = append(_v.Get, _list_v_)
|
_v.Get = append(_v.Get, _list_v_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["aginstory"].(float64); !_ok_ { err = errors.New("aginstory error"); return }; _v.Aginstory = int32(_tempNum_) }
|
||||||
{
|
{
|
||||||
var _arr_ []interface{}
|
var _arr_ []interface{}
|
||||||
var _ok_ bool
|
var _ok_ bool
|
||||||
|
@ -313,6 +313,23 @@ func (this *DBModel) Change(uid string, data map[string]interface{}, opt ...DBOp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改数据多个字段 uid 作为主键
|
||||||
|
func (this *DBModel) ChangeById(id string, data map[string]interface{}, opt ...DBOption) (err error) {
|
||||||
|
//defer log.Debug("DBModel Change", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data})
|
||||||
|
if err = this.Redis.HMSet(this.ukey(id), data); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
option := newDBOption(opt...)
|
||||||
|
if option.IsMgoLog {
|
||||||
|
err = this.UpdateModelLogs(this.TableName, "", bson.M{"_id": id}, data)
|
||||||
|
}
|
||||||
|
if this.Expired > 0 {
|
||||||
|
this.conn.UpDateModelExpired(this.ukey(id), nil, this.Expired)
|
||||||
|
// this.Redis.Expire(this.ukey(uid), option.Expire)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// 修改列表中一个数据
|
// 修改列表中一个数据
|
||||||
func (this *DBModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...DBOption) (err error) {
|
func (this *DBModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...DBOption) (err error) {
|
||||||
//defer log.Debug("DBModel ChangeList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "_id", Value: _id}, log.Field{Key: "data", Value: data})
|
//defer log.Debug("DBModel ChangeList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "_id", Value: _id}, log.Field{Key: "data", Value: data})
|
||||||
|
Loading…
Reference in New Issue
Block a user