商队小道消息改造

This commit is contained in:
meixiongfeng 2023-07-14 13:39:09 +08:00
parent 2c7e328a8b
commit b847ffd8fd
4 changed files with 98 additions and 182 deletions

View File

@ -118,21 +118,6 @@ func (this *Caravan) InitCaravanItemData(uid string, data *pb.DBCaravan) {
} }
data.Oldprice[v.Itemid] = v.Goodsprice data.Oldprice[v.Itemid] = v.Goodsprice
} }
// 初始化下一轮价格
data.Next = make(map[string]*pb.Goods, 0)
for _, v := range items {
goods := &pb.Goods{
Period: 0, // 变动周期
CurPeriod: 2, // 当前变动周期
Price: 0, // 当前价格
}
if len(v.Changeperiod) == 2 {
goods.Period = data.Goods[v.Itemid].Period //comm.GetRandNum(v.Changeperiod[0], v.Changeperiod[1])
goods.Price = v.Goodsprice
data.Next[v.Itemid] = goods
}
}
} }
// 初始化门票和虚拟币 // 初始化门票和虚拟币
@ -181,13 +166,11 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) {
// } // }
} }
} }
update["city"] = caravan.City
icount := int32(subTime / changeTime) // 循环周期 icount := int32(subTime / changeTime) // 循环周期
caravan.Citystime += int64(changeTime * icount) caravan.Citystime += int64(changeTime * icount)
if subTime < changeTime*2 { // 是下一回合 直接 用next字段覆盖上一次刷新的数据 update["citystime"] = caravan.Citystime
caravan.Goods = caravan.Next // 下一次货物信息直接给上一次
this.CaravanNext(caravan) // 计算下一周期的货物信息
} else {
for k, v := range caravan.Goods { for k, v := range caravan.Goods {
if c, err := this.configure.GetCaravanGoods(k); err == nil { if c, err := this.configure.GetCaravanGoods(k); err == nil {
caravan.Oldprice[k] = v.Price caravan.Oldprice[k] = v.Price
@ -237,22 +220,16 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) {
} }
} }
} }
this.CaravanNext(caravan) update["goods"] = caravan.Goods
update["oldprice"] = caravan.Oldprice
} }
} endTime := utils.WeekIntervalTime(0)
if curTime >= caravan.Resettime { if caravan.Resettime != endTime {
sTime := int64(this.ModuleTools.GetGlobalConf().BusinessRewardday * 24 * 3600) // 单位s caravan.Resettime = endTime
openTime := this.service.GetOpentime().Unix() // 获取开服时间
subTime := curTime - openTime
caravan.Resettime = curTime - (subTime % sTime) + sTime
update["resettime"] = caravan.Resettime update["resettime"] = caravan.Resettime
bChange = true bChange = true
} }
if bChange { if bChange {
update["city"] = caravan.City
update["goods"] = caravan.Goods
update["oldprice"] = caravan.Oldprice
update["citystime"] = caravan.Citystime
this.modelCaravan.modifyCaravanDataByObjId(uid, update) this.modelCaravan.modifyCaravanDataByObjId(uid, update)
} }
} }
@ -471,46 +448,3 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
return return
} }
func (this *Caravan) CaravanNext(caravan *pb.DBCaravan) {
for k, v := range caravan.Next {
if c, err := this.configure.GetCaravanGoods(k); err == nil {
// 价格涨跌权重 PriceChangeWeight
bUp := false // true 涨
ipos := comm.GetRandW(c.PriceChangeWeight)
if ipos == 1 {
if comm.GetRandW(c.PriceChangeWeightOne) == 0 {
bUp = true
}
} else if ipos == 2 {
if comm.GetRandW(c.PriceChangeWeightTwo) == 0 {
bUp = true
}
} else if ipos == 3 {
if comm.GetRandW(c.PriceChangeWeightThree) == 0 {
bUp = true
}
}
if bUp { // 价格上涨
v.Price = int32(math.Floor(float64(v.Price) * (1.0 + float64(c.FluctuationRange)/1000.0)))
} else {
v.Price = int32(math.Floor(float64(v.Price) * (1.0 - float64(c.FluctuationRange)/1000.0)))
}
if v.Price < c.Pricemin { // 设置最小值
v.Price = c.Pricemin
}
if v.Price > c.Pricemax { // 设置最大值
v.Price = c.Pricemax
}
v.CurPeriod += 1 // 更新周期+1
if v.CurPeriod+1 > v.Period {
// 随机出新的变动周期
v.Period = comm.GetRandNum(c.Changeperiod[0], c.Changeperiod[1])
v.CurPeriod = 0
}
}
}
}

View File

@ -83,9 +83,9 @@ func (this *CaravanRank) Start() (err error) {
} }
func (this *CaravanRank) TimerSeason() { func (this *CaravanRank) TimerSeason() {
_, end := utils.WeekIntervalTime(0) endTime := utils.WeekIntervalTime(0)
this.module.Debugf("TimerSeason end: %d,cur time:%d", end, configure.Now().Unix()) this.module.Debugf("TimerSeason end: %d,cur time:%d", endTime, configure.Now().Unix())
if configure.Now().Unix()-end < 5 { if configure.Now().Unix()-endTime < 5 {
this.module.Debugf("TimerSeason start: %d", configure.Now().Unix()) this.module.Debugf("TimerSeason start: %d", configure.Now().Unix())
if err := this.service.RpcCall( if err := this.service.RpcCall(
context.Background(), context.Background(),

View File

@ -214,7 +214,6 @@ type DBCaravan struct {
Baglimit int32 `protobuf:"varint,14,opt,name=baglimit,proto3" json:"baglimit"` // 背包上限 Baglimit int32 `protobuf:"varint,14,opt,name=baglimit,proto3" json:"baglimit"` // 背包上限
Citystime int64 `protobuf:"varint,15,opt,name=citystime,proto3" json:"citystime"` // 城市刷新时间 玩家身上的货物同时刷新 Citystime int64 `protobuf:"varint,15,opt,name=citystime,proto3" json:"citystime"` // 城市刷新时间 玩家身上的货物同时刷新
Oldprice map[string]int32 `protobuf:"bytes,16,rep,name=oldprice,proto3" json:"oldprice" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 上一次价格 key 货物ID Oldprice map[string]int32 `protobuf:"bytes,16,rep,name=oldprice,proto3" json:"oldprice" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 上一次价格 key 货物ID
Next map[string]*Goods `protobuf:"bytes,17,rep,name=next,proto3" json:"next" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 下一次刷新的数据
} }
func (x *DBCaravan) Reset() { func (x *DBCaravan) Reset() {
@ -354,13 +353,6 @@ func (x *DBCaravan) GetOldprice() map[string]int32 {
return nil return nil
} }
func (x *DBCaravan) GetNext() map[string]*Goods {
if x != nil {
return x.Next
}
return nil
}
type CaravanRankInfo struct { type CaravanRankInfo struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -478,7 +470,7 @@ var file_caravan_caravan_db_proto_rawDesc = []byte{
0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a,
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72,
0x69, 0x63, 0x65, 0x22, 0xc1, 0x06, 0x0a, 0x09, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x69, 0x63, 0x65, 0x22, 0xd6, 0x05, 0x0a, 0x09, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61,
0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 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, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03,
@ -507,43 +499,36 @@ var file_caravan_caravan_db_proto_rawDesc = []byte{
0x34, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x10, 0x20, 0x03, 0x28, 0x34, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x10, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2e, 0x4f, 0x6c, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2e, 0x4f, 0x6c,
0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6f, 0x6c, 0x64, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6f, 0x6c, 0x64,
0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x18, 0x11, 0x20, 0x70, 0x72, 0x69, 0x63, 0x65, 0x1a, 0x42, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e,
0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2e,
0x4e, 0x65, 0x78, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x1a,
0x42, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x1e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
0x2e, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x42, 0x0a, 0x09, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x4f, 0x6c, 0x64,
0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x1a, 0x3f, 0x0a, 0x09, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x76, 0x61, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbf, 0x01, 0x0a, 0x0f, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, 0x0a, 0x47, 0x6f, 0x6f,
0x76, 0x61, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x42, 0x0a, 0x09, 0x43,
0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x76, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61,
0x72, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x69, 0x74, 0x79,
0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x74, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x3b, 0x0a, 0x0d, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x72, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x4c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x4c, 0x76, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbf, 0x01, 0x0a,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0f, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x76,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x76, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x05,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x65,
0x72, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0d, 0x6d, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x6d, 0x6f, 0x6e, 0x65, 0x79,
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x4c, 0x76, 0x18, 0x07, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x4c, 0x76, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -558,7 +543,7 @@ func file_caravan_caravan_db_proto_rawDescGZIP() []byte {
return file_caravan_caravan_db_proto_rawDescData return file_caravan_caravan_db_proto_rawDescData
} }
var file_caravan_caravan_db_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_caravan_caravan_db_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_caravan_caravan_db_proto_goTypes = []interface{}{ var file_caravan_caravan_db_proto_goTypes = []interface{}{
(*Goods)(nil), // 0: Goods (*Goods)(nil), // 0: Goods
(*CityInfo)(nil), // 1: CityInfo (*CityInfo)(nil), // 1: CityInfo
@ -570,7 +555,6 @@ var file_caravan_caravan_db_proto_goTypes = []interface{}{
nil, // 7: DBCaravan.GoodsEntry nil, // 7: DBCaravan.GoodsEntry
nil, // 8: DBCaravan.CityEntry nil, // 8: DBCaravan.CityEntry
nil, // 9: DBCaravan.OldpriceEntry nil, // 9: DBCaravan.OldpriceEntry
nil, // 10: DBCaravan.NextEntry
} }
var file_caravan_caravan_db_proto_depIdxs = []int32{ var file_caravan_caravan_db_proto_depIdxs = []int32{
5, // 0: CityInfo.count:type_name -> CityInfo.CountEntry 5, // 0: CityInfo.count:type_name -> CityInfo.CountEntry
@ -578,16 +562,14 @@ var file_caravan_caravan_db_proto_depIdxs = []int32{
7, // 2: DBCaravan.goods:type_name -> DBCaravan.GoodsEntry 7, // 2: DBCaravan.goods:type_name -> DBCaravan.GoodsEntry
8, // 3: DBCaravan.city:type_name -> DBCaravan.CityEntry 8, // 3: DBCaravan.city:type_name -> DBCaravan.CityEntry
9, // 4: DBCaravan.oldprice:type_name -> DBCaravan.OldpriceEntry 9, // 4: DBCaravan.oldprice:type_name -> DBCaravan.OldpriceEntry
10, // 5: DBCaravan.next:type_name -> DBCaravan.NextEntry 2, // 5: DBCaravan.ItemsEntry.value:type_name -> BagInfo
2, // 6: DBCaravan.ItemsEntry.value:type_name -> BagInfo 0, // 6: DBCaravan.GoodsEntry.value:type_name -> Goods
0, // 7: DBCaravan.GoodsEntry.value:type_name -> Goods 1, // 7: DBCaravan.CityEntry.value:type_name -> CityInfo
1, // 8: DBCaravan.CityEntry.value:type_name -> CityInfo 8, // [8:8] is the sub-list for method output_type
0, // 9: DBCaravan.NextEntry.value:type_name -> Goods 8, // [8:8] is the sub-list for method input_type
10, // [10:10] is the sub-list for method output_type 8, // [8:8] is the sub-list for extension type_name
10, // [10:10] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension extendee
10, // [10:10] is the sub-list for extension type_name 0, // [0:8] is the sub-list for field type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_caravan_caravan_db_proto_init() } func init() { file_caravan_caravan_db_proto_init() }
@ -663,7 +645,7 @@ func file_caravan_caravan_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_caravan_caravan_db_proto_rawDesc, RawDescriptor: file_caravan_caravan_db_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 11, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -165,7 +165,7 @@ func DiffDays(t1, t2 int64) int {
return diffDays return diffDays
} }
func WeekIntervalTime(week int) (startTime, endTime int64) { func WeekIntervalTime(week int) (endTime int64) {
now := time.Now() now := time.Now()
offset := int(time.Monday - now.Weekday()) offset := int(time.Monday - now.Weekday())
//周日做特殊判断 因为time.Monday = 0 //周日做特殊判断 因为time.Monday = 0
@ -175,8 +175,8 @@ func WeekIntervalTime(week int) (startTime, endTime int64) {
year, month, day := now.Date() year, month, day := now.Date()
thisWeek := time.Date(year, month, day, 0, 0, 0, 0, time.Local) thisWeek := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
startTime = thisWeek.AddDate(0, 0, offset+7*week).Unix() //startTime = thisWeek.AddDate(0, 0, offset+7*week).Unix()
endTime = thisWeek.AddDate(0, 0, offset+6+7*week).Unix() endTime = thisWeek.AddDate(0, 0, offset+6+7*week).Unix()
return startTime, endTime return endTime
} }