商队埋点
This commit is contained in:
parent
72d18c8eb7
commit
d8bc36d47a
@ -247,17 +247,30 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
|
||||
|
||||
// 任务统计
|
||||
var szTask []*pb.BuriedParam
|
||||
if req.IsBuy {
|
||||
var buyCount int32
|
||||
for _, v := range req.Items {
|
||||
buyCount += v
|
||||
}
|
||||
|
||||
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype209, 1, buyCount))
|
||||
} else { // 卖
|
||||
//szTask = append(szTask, comm.GetBuriedParam(comm.Rtype300, 1, buyCount))
|
||||
var opCount int32
|
||||
for _, v := range req.Items {
|
||||
opCount += v
|
||||
}
|
||||
if req.IsBuy {
|
||||
|
||||
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype209, req.City, opCount))
|
||||
} else { // 卖
|
||||
//向指定X城市贩卖货物,贩卖货物价值需要X虚拟币以上
|
||||
var price int32
|
||||
for k, v := range req.Items {
|
||||
|
||||
price += caravan.Items[k].Price * v
|
||||
}
|
||||
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype210, req.City, price))
|
||||
|
||||
// 急需货物
|
||||
if v, ok := caravan.City[req.City]; ok {
|
||||
for range v.Exspecial {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype212, req.City)) // 接取任务后,商队抵达指定城市
|
||||
go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...)
|
||||
return
|
||||
}
|
||||
|
@ -379,21 +379,22 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
|
||||
|
||||
func (this *ModelUser) AddUserProfit(uid string, score int64) (err error) {
|
||||
var (
|
||||
model *db.DBModel
|
||||
value map[string]interface{}
|
||||
model *db.DBModel
|
||||
update map[string]interface{}
|
||||
)
|
||||
if score < 0 {
|
||||
return
|
||||
}
|
||||
user := &pb.DBUser{}
|
||||
value["profit"] = score
|
||||
update = make(map[string]interface{}, 0)
|
||||
update["profit"] = score
|
||||
if db.IsCross() {
|
||||
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err == nil {
|
||||
if err := this.Get(uid, user); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
value["profit"] = user.Profit + score
|
||||
return model.Change(uid, value)
|
||||
update["profit"] = user.Profit + score
|
||||
return model.Change(uid, update)
|
||||
} else {
|
||||
this.module.Errorln(err)
|
||||
return err
|
||||
@ -403,10 +404,10 @@ func (this *ModelUser) AddUserProfit(uid string, score int64) (err error) {
|
||||
if err := this.Get(uid, user); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
value["profit"] = user.Profit + score
|
||||
update["profit"] = user.Profit + score
|
||||
}
|
||||
|
||||
return this.Change(uid, value)
|
||||
return this.Change(uid, update)
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user