Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
a1bf86b3aa
@ -167,5 +167,8 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
||||
this.module.SeTrollRankList(trolltrain.TotalEarn, session.GetUserId())
|
||||
session.SendMsg(string(this.module.GetType()), TrollBuyOrSellResp, &pb.TrollBuyOrSellResp{Data: trolltrain})
|
||||
if gold != 0 {
|
||||
this.module.record.AddTrollRecord(session.GetUserId(), gold, trolltrain.TarinPos)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -33,11 +33,12 @@ func (this *ModelRecord) GetTrollRecord(uid string) (result []*pb.DBTrollRecord,
|
||||
}
|
||||
|
||||
// 添加收益列表
|
||||
func (this *ModelRecord) AddTrollRecord(uid string, gold int32) (err error) {
|
||||
func (this *ModelRecord) AddTrollRecord(uid string, gold, pos int32) (err error) {
|
||||
troll := &pb.DBTrollRecord{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Gold: gold,
|
||||
Pos: pos,
|
||||
Time: time.Now().Unix(),
|
||||
}
|
||||
if err = this.AddList(uid, troll.Id, troll); err != nil {
|
||||
|
@ -178,7 +178,7 @@ func (this *Troll) SellAllItem(uid string, troll *pb.DBTrollTrain, price map[int
|
||||
troll.GridNum = 0 // 清空格子
|
||||
// 写统计
|
||||
if gold > 0 {
|
||||
this.record.AddTrollRecord(uid, gold)
|
||||
this.record.AddTrollRecord(uid, gold, troll.TarinPos)
|
||||
}
|
||||
|
||||
return
|
||||
@ -255,7 +255,7 @@ func (this *Troll) BuyAllItem(uid string, troll *pb.DBTrollTrain, price map[int3
|
||||
}
|
||||
// 写统计
|
||||
if gold != 0 {
|
||||
this.record.AddTrollRecord(uid, gold)
|
||||
this.record.AddTrollRecord(uid, gold, troll.TarinPos)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -229,7 +229,8 @@ type DBTrollRecord struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
Gold int32 `protobuf:"varint,3,opt,name=gold,proto3" json:"gold"` // 收益
|
||||
Time int64 `protobuf:"varint,4,opt,name=time,proto3" json:"time"` // 交易时间
|
||||
Pos int32 `protobuf:"varint,4,opt,name=pos,proto3" json:"pos"` // 商人位置
|
||||
Time int64 `protobuf:"varint,5,opt,name=time,proto3" json:"time"` // 交易时间
|
||||
}
|
||||
|
||||
func (x *DBTrollRecord) Reset() {
|
||||
@ -285,6 +286,13 @@ func (x *DBTrollRecord) GetGold() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTrollRecord) GetPos() int32 {
|
||||
if x != nil {
|
||||
return x.Pos
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTrollRecord) GetTime() int64 {
|
||||
if x != nil {
|
||||
return x.Time
|
||||
@ -355,14 +363,15 @@ var file_troll_troll_db_proto_rawDesc = []byte{
|
||||
0x53, 0x75, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x49, 0x44, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x59, 0x0a, 0x0d, 0x44,
|
||||
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x6b, 0x0a, 0x0d, 0x44,
|
||||
0x42, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x67, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x6f,
|
||||
0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6c, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x03, 0x70, 0x6f, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user