diff --git a/modules/caravan/api_refreshcity.go b/modules/caravan/api_refreshcity.go new file mode 100644 index 000000000..81d42cc39 --- /dev/null +++ b/modules/caravan/api_refreshcity.go @@ -0,0 +1,31 @@ +package caravan + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +//参数校验 +func (this *apiComp) RefreshCityCheck(session comm.IUserSession, req *pb.CaravanRefreshCityReq) (code pb.ErrorCode) { + + return +} + +// 刷新城市信息 +func (this *apiComp) RefreshCity(session comm.IUserSession, req *pb.CaravanRefreshCityReq) (code pb.ErrorCode, data *pb.ErrorData) { + var ( + resp *pb.CaravanRefreshCityResp + ) + resp = &pb.CaravanRefreshCityResp{} + if code = this.RefreshCityCheck(session, req); code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) + resp.Oldprice = list.Oldprice + // 刷新城市货物信息 + this.module.refreshCaravanCityInfo(session.GetUserId(), list) + resp.Goods = list.Goods + resp.City = list.City + session.SendMsg(string(this.module.GetType()), "refreshcity", resp) + return +} diff --git a/pb/caravan_msg.pb.go b/pb/caravan_msg.pb.go index 8e73f4fd6..b43cd4dfd 100644 --- a/pb/caravan_msg.pb.go +++ b/pb/caravan_msg.pb.go @@ -596,6 +596,108 @@ func (x *CaravanRankListResp) GetUserinfo() *CaravanRankInfo { return nil } +// 刷新城市信息 +type CaravanRefreshCityReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CaravanRefreshCityReq) Reset() { + *x = CaravanRefreshCityReq{} + if protoimpl.UnsafeEnabled { + mi := &file_caravan_caravan_msg_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CaravanRefreshCityReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CaravanRefreshCityReq) ProtoMessage() {} + +func (x *CaravanRefreshCityReq) ProtoReflect() protoreflect.Message { + mi := &file_caravan_caravan_msg_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CaravanRefreshCityReq.ProtoReflect.Descriptor instead. +func (*CaravanRefreshCityReq) Descriptor() ([]byte, []int) { + return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{11} +} + +type CaravanRefreshCityResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Goods map[int32]*Goods `protobuf:"bytes,1,rep,name=goods,proto3" json:"goods" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // key 货物ID + City map[int32]*CityInfo `protobuf:"bytes,2,rep,name=city,proto3" json:"city" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 城市信息 + Oldprice map[int32]int32 `protobuf:"bytes,3,rep,name=Oldprice,proto3" json:"Oldprice" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` +} + +func (x *CaravanRefreshCityResp) Reset() { + *x = CaravanRefreshCityResp{} + if protoimpl.UnsafeEnabled { + mi := &file_caravan_caravan_msg_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CaravanRefreshCityResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CaravanRefreshCityResp) ProtoMessage() {} + +func (x *CaravanRefreshCityResp) ProtoReflect() protoreflect.Message { + mi := &file_caravan_caravan_msg_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CaravanRefreshCityResp.ProtoReflect.Descriptor instead. +func (*CaravanRefreshCityResp) Descriptor() ([]byte, []int) { + return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{12} +} + +func (x *CaravanRefreshCityResp) GetGoods() map[int32]*Goods { + if x != nil { + return x.Goods + } + return nil +} + +func (x *CaravanRefreshCityResp) GetCity() map[int32]*CityInfo { + if x != nil { + return x.City + } + return nil +} + +func (x *CaravanRefreshCityResp) GetOldprice() map[int32]int32 { + if x != nil { + return x.Oldprice + } + return nil +} + var File_caravan_caravan_msg_proto protoreflect.FileDescriptor var file_caravan_caravan_msg_proto_rawDesc = []byte{ @@ -657,7 +759,34 @@ var file_caravan_caravan_msg_proto_rawDesc = []byte{ 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x17, 0x0a, 0x15, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x22, 0x8f, 0x03, 0x0a, 0x16, 0x43, 0x61, + 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x47, 0x6f, 0x6f, + 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x35, + 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x43, + 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x08, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, + 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, + 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x2e, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, + 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 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, 0x05, 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, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -672,7 +801,7 @@ func file_caravan_caravan_msg_proto_rawDescGZIP() []byte { return file_caravan_caravan_msg_proto_rawDescData } -var file_caravan_caravan_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_caravan_caravan_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_caravan_caravan_msg_proto_goTypes = []interface{}{ (*CaravanGetListReq)(nil), // 0: CaravanGetListReq (*CaravanGetListResp)(nil), // 1: CaravanGetListResp @@ -685,26 +814,38 @@ var file_caravan_caravan_msg_proto_goTypes = []interface{}{ (*CaravanTaskCompletePush)(nil), // 8: CaravanTaskCompletePush (*CaravanRankListReq)(nil), // 9: CaravanRankListReq (*CaravanRankListResp)(nil), // 10: CaravanRankListResp - nil, // 11: CaravanBuyOrSellReq.ItemsEntry - (*DBCaravan)(nil), // 12: DBCaravan - (*UserAssets)(nil), // 13: UserAssets - (*CaravanRankInfo)(nil), // 14: CaravanRankInfo + (*CaravanRefreshCityReq)(nil), // 11: CaravanRefreshCityReq + (*CaravanRefreshCityResp)(nil), // 12: CaravanRefreshCityResp + nil, // 13: CaravanBuyOrSellReq.ItemsEntry + nil, // 14: CaravanRefreshCityResp.GoodsEntry + nil, // 15: CaravanRefreshCityResp.CityEntry + nil, // 16: CaravanRefreshCityResp.OldpriceEntry + (*DBCaravan)(nil), // 17: DBCaravan + (*UserAssets)(nil), // 18: UserAssets + (*CaravanRankInfo)(nil), // 19: CaravanRankInfo + (*Goods)(nil), // 20: Goods + (*CityInfo)(nil), // 21: CityInfo } var file_caravan_caravan_msg_proto_depIdxs = []int32{ - 12, // 0: CaravanGetListResp.data:type_name -> DBCaravan - 11, // 1: CaravanBuyOrSellReq.items:type_name -> CaravanBuyOrSellReq.ItemsEntry - 12, // 2: CaravanBuyOrSellResp.data:type_name -> DBCaravan - 12, // 3: CaravanGotoCityResp.data:type_name -> DBCaravan - 12, // 4: CaravanGetStoryResp.data:type_name -> DBCaravan - 12, // 5: CaravanTaskCompletePush.data:type_name -> DBCaravan - 13, // 6: CaravanTaskCompletePush.reward:type_name -> UserAssets - 14, // 7: CaravanRankListResp.list:type_name -> CaravanRankInfo - 14, // 8: CaravanRankListResp.userinfo:type_name -> CaravanRankInfo - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 17, // 0: CaravanGetListResp.data:type_name -> DBCaravan + 13, // 1: CaravanBuyOrSellReq.items:type_name -> CaravanBuyOrSellReq.ItemsEntry + 17, // 2: CaravanBuyOrSellResp.data:type_name -> DBCaravan + 17, // 3: CaravanGotoCityResp.data:type_name -> DBCaravan + 17, // 4: CaravanGetStoryResp.data:type_name -> DBCaravan + 17, // 5: CaravanTaskCompletePush.data:type_name -> DBCaravan + 18, // 6: CaravanTaskCompletePush.reward:type_name -> UserAssets + 19, // 7: CaravanRankListResp.list:type_name -> CaravanRankInfo + 19, // 8: CaravanRankListResp.userinfo:type_name -> CaravanRankInfo + 14, // 9: CaravanRefreshCityResp.goods:type_name -> CaravanRefreshCityResp.GoodsEntry + 15, // 10: CaravanRefreshCityResp.city:type_name -> CaravanRefreshCityResp.CityEntry + 16, // 11: CaravanRefreshCityResp.Oldprice:type_name -> CaravanRefreshCityResp.OldpriceEntry + 20, // 12: CaravanRefreshCityResp.GoodsEntry.value:type_name -> Goods + 21, // 13: CaravanRefreshCityResp.CityEntry.value:type_name -> CityInfo + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_caravan_caravan_msg_proto_init() } @@ -847,6 +988,30 @@ func file_caravan_caravan_msg_proto_init() { return nil } } + file_caravan_caravan_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CaravanRefreshCityReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_caravan_caravan_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CaravanRefreshCityResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -854,7 +1019,7 @@ func file_caravan_caravan_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_caravan_caravan_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 17, NumExtensions: 0, NumServices: 0, },