diff --git a/rpc/user/pb/user.pb.go b/rpc/user/pb/user.pb.go index b79e0cb..92f1417 100644 --- a/rpc/user/pb/user.pb.go +++ b/rpc/user/pb/user.pb.go @@ -1814,6 +1814,66 @@ func (x *BindMobileReq) GetCode() string { return "" } +type RebindMobileReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + OldMobile string `protobuf:"bytes,1,opt,name=old_mobile,json=oldMobile,proto3" json:"old_mobile,omitempty"` + NewMobile string `protobuf:"bytes,2,opt,name=new_mobile,json=newMobile,proto3" json:"new_mobile,omitempty"` + SmsCode string `protobuf:"bytes,3,opt,name=sms_code,json=smsCode,proto3" json:"sms_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RebindMobileReq) Reset() { + *x = RebindMobileReq{} + mi := &file_user_user_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RebindMobileReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RebindMobileReq) ProtoMessage() {} + +func (x *RebindMobileReq) ProtoReflect() protoreflect.Message { + mi := &file_user_user_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RebindMobileReq.ProtoReflect.Descriptor instead. +func (*RebindMobileReq) Descriptor() ([]byte, []int) { + return file_user_user_proto_rawDescGZIP(), []int{28} +} + +func (x *RebindMobileReq) GetOldMobile() string { + if x != nil { + return x.OldMobile + } + return "" +} + +func (x *RebindMobileReq) GetNewMobile() string { + if x != nil { + return x.NewMobile + } + return "" +} + +func (x *RebindMobileReq) GetSmsCode() string { + if x != nil { + return x.SmsCode + } + return "" +} + type InfoReq struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -1822,7 +1882,7 @@ type InfoReq struct { func (x *InfoReq) Reset() { *x = InfoReq{} - mi := &file_user_user_proto_msgTypes[28] + mi := &file_user_user_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1834,7 +1894,7 @@ func (x *InfoReq) String() string { func (*InfoReq) ProtoMessage() {} func (x *InfoReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[28] + mi := &file_user_user_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1847,7 +1907,7 @@ func (x *InfoReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InfoReq.ProtoReflect.Descriptor instead. func (*InfoReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{28} + return file_user_user_proto_rawDescGZIP(), []int{29} } type UpdateReq struct { @@ -1858,14 +1918,13 @@ type UpdateReq struct { Birthday string `protobuf:"bytes,4,opt,name=birthday,proto3" json:"birthday,omitempty"` Mobile string `protobuf:"bytes,5,opt,name=mobile,proto3" json:"mobile,omitempty"` RealName string `protobuf:"bytes,6,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` - SmsCode string `protobuf:"bytes,7,opt,name=sms_code,json=smsCode,proto3" json:"sms_code,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UpdateReq) Reset() { *x = UpdateReq{} - mi := &file_user_user_proto_msgTypes[29] + mi := &file_user_user_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1877,7 +1936,7 @@ func (x *UpdateReq) String() string { func (*UpdateReq) ProtoMessage() {} func (x *UpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[29] + mi := &file_user_user_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1890,7 +1949,7 @@ func (x *UpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead. func (*UpdateReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{29} + return file_user_user_proto_rawDescGZIP(), []int{30} } func (x *UpdateReq) GetName() string { @@ -1935,13 +1994,6 @@ func (x *UpdateReq) GetRealName() string { return "" } -func (x *UpdateReq) GetSmsCode() string { - if x != nil { - return x.SmsCode - } - return "" -} - type PasswordReq struct { state protoimpl.MessageState `protogen:"open.v1"` OldPassword string `protobuf:"bytes,1,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"` @@ -1952,7 +2004,7 @@ type PasswordReq struct { func (x *PasswordReq) Reset() { *x = PasswordReq{} - mi := &file_user_user_proto_msgTypes[30] + mi := &file_user_user_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1964,7 +2016,7 @@ func (x *PasswordReq) String() string { func (*PasswordReq) ProtoMessage() {} func (x *PasswordReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[30] + mi := &file_user_user_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1977,7 +2029,7 @@ func (x *PasswordReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PasswordReq.ProtoReflect.Descriptor instead. func (*PasswordReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{30} + return file_user_user_proto_rawDescGZIP(), []int{31} } func (x *PasswordReq) GetOldPassword() string { @@ -2005,7 +2057,7 @@ type ClientReq struct { func (x *ClientReq) Reset() { *x = ClientReq{} - mi := &file_user_user_proto_msgTypes[31] + mi := &file_user_user_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2017,7 +2069,7 @@ func (x *ClientReq) String() string { func (*ClientReq) ProtoMessage() {} func (x *ClientReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[31] + mi := &file_user_user_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2030,7 +2082,7 @@ func (x *ClientReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientReq.ProtoReflect.Descriptor instead. func (*ClientReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{31} + return file_user_user_proto_rawDescGZIP(), []int{32} } func (x *ClientReq) GetName() string { @@ -2063,7 +2115,7 @@ type GenerateQrcodeReq struct { func (x *GenerateQrcodeReq) Reset() { *x = GenerateQrcodeReq{} - mi := &file_user_user_proto_msgTypes[32] + mi := &file_user_user_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2075,7 +2127,7 @@ func (x *GenerateQrcodeReq) String() string { func (*GenerateQrcodeReq) ProtoMessage() {} func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[32] + mi := &file_user_user_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2088,7 +2140,7 @@ func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GenerateQrcodeReq.ProtoReflect.Descriptor instead. func (*GenerateQrcodeReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{32} + return file_user_user_proto_rawDescGZIP(), []int{33} } func (x *GenerateQrcodeReq) GetClientCode() string { @@ -2107,7 +2159,7 @@ type QrcodeScanReq struct { func (x *QrcodeScanReq) Reset() { *x = QrcodeScanReq{} - mi := &file_user_user_proto_msgTypes[33] + mi := &file_user_user_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2119,7 +2171,7 @@ func (x *QrcodeScanReq) String() string { func (*QrcodeScanReq) ProtoMessage() {} func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[33] + mi := &file_user_user_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2132,7 +2184,7 @@ func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message { // Deprecated: Use QrcodeScanReq.ProtoReflect.Descriptor instead. func (*QrcodeScanReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{33} + return file_user_user_proto_rawDescGZIP(), []int{34} } func (x *QrcodeScanReq) GetSessionId() string { @@ -2152,7 +2204,7 @@ type QrcodeLoginReq struct { func (x *QrcodeLoginReq) Reset() { *x = QrcodeLoginReq{} - mi := &file_user_user_proto_msgTypes[34] + mi := &file_user_user_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2164,7 +2216,7 @@ func (x *QrcodeLoginReq) String() string { func (*QrcodeLoginReq) ProtoMessage() {} func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[34] + mi := &file_user_user_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2177,7 +2229,7 @@ func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message { // Deprecated: Use QrcodeLoginReq.ProtoReflect.Descriptor instead. func (*QrcodeLoginReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{34} + return file_user_user_proto_rawDescGZIP(), []int{35} } func (x *QrcodeLoginReq) GetSessionId() string { @@ -2339,16 +2391,21 @@ const file_user_user_proto_rawDesc = "" + "\fGetOpenidReq\x12\x12\n" + "\x04code\x18\x01 \x01(\tR\x04code\"#\n" + "\rBindMobileReq\x12\x12\n" + - "\x04code\x18\x01 \x01(\tR\x04code\"\t\n" + - "\aInfoReq\"\xbb\x01\n" + + "\x04code\x18\x01 \x01(\tR\x04code\"j\n" + + "\x0fRebindMobileReq\x12\x1d\n" + + "\n" + + "old_mobile\x18\x01 \x01(\tR\toldMobile\x12\x1d\n" + + "\n" + + "new_mobile\x18\x02 \x01(\tR\tnewMobile\x12\x19\n" + + "\bsms_code\x18\x03 \x01(\tR\asmsCode\"\t\n" + + "\aInfoReq\"\xa0\x01\n" + "\tUpdateReq\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + "\x06avatar\x18\x02 \x01(\tR\x06avatar\x12\x16\n" + "\x06gender\x18\x03 \x01(\rR\x06gender\x12\x1a\n" + "\bbirthday\x18\x04 \x01(\tR\bbirthday\x12\x16\n" + "\x06mobile\x18\x05 \x01(\tR\x06mobile\x12\x1b\n" + - "\treal_name\x18\x06 \x01(\tR\brealName\x12\x19\n" + - "\bsms_code\x18\a \x01(\tR\asmsCode\"L\n" + + "\treal_name\x18\x06 \x01(\tR\brealName\"L\n" + "\vPasswordReq\x12!\n" + "\fold_password\x18\x01 \x01(\tR\voldPassword\x12\x1a\n" + "\bpassword\x18\x02 \x01(\tR\bpassword\"V\n" + @@ -2365,7 +2422,7 @@ const file_user_user_proto_rawDesc = "" + "\x0eQrcodeLoginReq\x12\x1d\n" + "\n" + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x12\n" + - "\x04type\x18\x02 \x01(\x05R\x04type2\x97\x0e\n" + + "\x04type\x18\x02 \x01(\x05R\x04type2\xf5\x0e\n" + "\x04User\x12F\n" + "\x05Login\x12\x0e.user.LoginReq\x1a\x0e.user.Response\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v3/user/login\x12b\n" + "\x0eGenerateQrcode\x12\x17.user.GenerateQrcodeReq\x1a\x0e.user.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/v3/user/qrcode/generate\x12V\n" + @@ -2377,7 +2434,8 @@ const file_user_user_proto_rawDesc = "" + "\bPassword\x12\x11.user.PasswordReq\x1a\x0e.user.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x1a\x15/api/v3/user/password\x12S\n" + "\tGetOpenid\x12\x12.user.GetOpenidReq\x1a\x0e.user.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/api/v3/user/getuseroid\x12Q\n" + "\n" + - "BindMobile\x12\x13.user.BindMobileReq\x1a\x0e.user.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/user/mobile\x12K\n" + + "BindMobile\x12\x13.user.BindMobileReq\x1a\x0e.user.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/user/mobile\x12\\\n" + + "\fRebindMobile\x12\x15.user.RebindMobileReq\x1a\x0e.user.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\x1a\x1a/api/v3/user/mobile/rebind\x12K\n" + "\x06Client\x12\x0f.user.ClientReq\x1a\x0e.user.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/user/client\x12P\n" + "\tUserItems\x12\x12.user.UserItemsReq\x1a\x0e.user.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/user/items\x12S\n" + "\n" + @@ -2405,7 +2463,7 @@ func file_user_user_proto_rawDescGZIP() []byte { return file_user_user_proto_rawDescData } -var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 35) +var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 36) var file_user_user_proto_goTypes = []any{ (*Response)(nil), // 0: user.Response (*LoginReq)(nil), // 1: user.LoginReq @@ -2435,63 +2493,66 @@ var file_user_user_proto_goTypes = []any{ (*InternalUsersByBizData)(nil), // 25: user.InternalUsersByBizData (*GetOpenidReq)(nil), // 26: user.GetOpenidReq (*BindMobileReq)(nil), // 27: user.BindMobileReq - (*InfoReq)(nil), // 28: user.InfoReq - (*UpdateReq)(nil), // 29: user.UpdateReq - (*PasswordReq)(nil), // 30: user.PasswordReq - (*ClientReq)(nil), // 31: user.ClientReq - (*GenerateQrcodeReq)(nil), // 32: user.GenerateQrcodeReq - (*QrcodeScanReq)(nil), // 33: user.QrcodeScanReq - (*QrcodeLoginReq)(nil), // 34: user.QrcodeLoginReq + (*RebindMobileReq)(nil), // 28: user.RebindMobileReq + (*InfoReq)(nil), // 29: user.InfoReq + (*UpdateReq)(nil), // 30: user.UpdateReq + (*PasswordReq)(nil), // 31: user.PasswordReq + (*ClientReq)(nil), // 32: user.ClientReq + (*GenerateQrcodeReq)(nil), // 33: user.GenerateQrcodeReq + (*QrcodeScanReq)(nil), // 34: user.QrcodeScanReq + (*QrcodeLoginReq)(nil), // 35: user.QrcodeLoginReq } var file_user_user_proto_depIdxs = []int32{ 7, // 0: user.InternalUsersByIdsData.items:type_name -> user.UserBriefItem 24, // 1: user.InternalUsersByBizData.items:type_name -> user.BizUserItem 1, // 2: user.User.Login:input_type -> user.LoginReq - 32, // 3: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq - 33, // 4: user.User.QrcodeScan:input_type -> user.QrcodeScanReq - 34, // 5: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq - 28, // 6: user.User.Info:input_type -> user.InfoReq - 29, // 7: user.User.Update:input_type -> user.UpdateReq - 30, // 8: user.User.Password:input_type -> user.PasswordReq + 33, // 3: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq + 34, // 4: user.User.QrcodeScan:input_type -> user.QrcodeScanReq + 35, // 5: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq + 29, // 6: user.User.Info:input_type -> user.InfoReq + 30, // 7: user.User.Update:input_type -> user.UpdateReq + 31, // 8: user.User.Password:input_type -> user.PasswordReq 26, // 9: user.User.GetOpenid:input_type -> user.GetOpenidReq 27, // 10: user.User.BindMobile:input_type -> user.BindMobileReq - 31, // 11: user.User.Client:input_type -> user.ClientReq - 2, // 12: user.User.UserItems:input_type -> user.UserItemsReq - 3, // 13: user.User.UserStatus:input_type -> user.UserStatusReq - 4, // 14: user.User.InternalCreate:input_type -> user.InternalCreateReq - 13, // 15: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq - 15, // 16: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq - 17, // 17: user.User.InternalUpdate:input_type -> user.InternalUpdateReq - 6, // 18: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq - 9, // 19: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq - 11, // 20: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq - 19, // 21: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq - 21, // 22: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq - 23, // 23: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq - 0, // 24: user.User.Login:output_type -> user.Response - 0, // 25: user.User.GenerateQrcode:output_type -> user.Response - 0, // 26: user.User.QrcodeScan:output_type -> user.Response - 0, // 27: user.User.QrcodeLogin:output_type -> user.Response - 0, // 28: user.User.Info:output_type -> user.Response - 0, // 29: user.User.Update:output_type -> user.Response - 0, // 30: user.User.Password:output_type -> user.Response - 0, // 31: user.User.GetOpenid:output_type -> user.Response - 0, // 32: user.User.BindMobile:output_type -> user.Response - 0, // 33: user.User.Client:output_type -> user.Response - 0, // 34: user.User.UserItems:output_type -> user.Response - 0, // 35: user.User.UserStatus:output_type -> user.Response - 5, // 36: user.User.InternalCreate:output_type -> user.InternalCreateData - 14, // 37: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData - 16, // 38: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData - 18, // 39: user.User.InternalUpdate:output_type -> user.InternalUpdateData - 8, // 40: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData - 10, // 41: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData - 12, // 42: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData - 20, // 43: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData - 22, // 44: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData - 25, // 45: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData - 24, // [24:46] is the sub-list for method output_type - 2, // [2:24] is the sub-list for method input_type + 28, // 11: user.User.RebindMobile:input_type -> user.RebindMobileReq + 32, // 12: user.User.Client:input_type -> user.ClientReq + 2, // 13: user.User.UserItems:input_type -> user.UserItemsReq + 3, // 14: user.User.UserStatus:input_type -> user.UserStatusReq + 4, // 15: user.User.InternalCreate:input_type -> user.InternalCreateReq + 13, // 16: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq + 15, // 17: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq + 17, // 18: user.User.InternalUpdate:input_type -> user.InternalUpdateReq + 6, // 19: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq + 9, // 20: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq + 11, // 21: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq + 19, // 22: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq + 21, // 23: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq + 23, // 24: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq + 0, // 25: user.User.Login:output_type -> user.Response + 0, // 26: user.User.GenerateQrcode:output_type -> user.Response + 0, // 27: user.User.QrcodeScan:output_type -> user.Response + 0, // 28: user.User.QrcodeLogin:output_type -> user.Response + 0, // 29: user.User.Info:output_type -> user.Response + 0, // 30: user.User.Update:output_type -> user.Response + 0, // 31: user.User.Password:output_type -> user.Response + 0, // 32: user.User.GetOpenid:output_type -> user.Response + 0, // 33: user.User.BindMobile:output_type -> user.Response + 0, // 34: user.User.RebindMobile:output_type -> user.Response + 0, // 35: user.User.Client:output_type -> user.Response + 0, // 36: user.User.UserItems:output_type -> user.Response + 0, // 37: user.User.UserStatus:output_type -> user.Response + 5, // 38: user.User.InternalCreate:output_type -> user.InternalCreateData + 14, // 39: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData + 16, // 40: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData + 18, // 41: user.User.InternalUpdate:output_type -> user.InternalUpdateData + 8, // 42: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData + 10, // 43: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData + 12, // 44: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData + 20, // 45: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData + 22, // 46: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData + 25, // 47: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData + 25, // [25:48] is the sub-list for method output_type + 2, // [2:25] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -2508,7 +2569,7 @@ func file_user_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_user_proto_rawDesc), len(file_user_user_proto_rawDesc)), NumEnums: 0, - NumMessages: 35, + NumMessages: 36, NumExtensions: 0, NumServices: 1, }, diff --git a/rpc/user/pb/user_grpc.pb.go b/rpc/user/pb/user_grpc.pb.go index 0725edf..2cf5a3b 100644 --- a/rpc/user/pb/user_grpc.pb.go +++ b/rpc/user/pb/user_grpc.pb.go @@ -28,6 +28,7 @@ const ( User_Password_FullMethodName = "/user.User/Password" User_GetOpenid_FullMethodName = "/user.User/GetOpenid" User_BindMobile_FullMethodName = "/user.User/BindMobile" + User_RebindMobile_FullMethodName = "/user.User/RebindMobile" User_Client_FullMethodName = "/user.User/Client" User_UserItems_FullMethodName = "/user.User/UserItems" User_UserStatus_FullMethodName = "/user.User/UserStatus" @@ -56,6 +57,7 @@ type UserClient interface { Password(ctx context.Context, in *PasswordReq, opts ...grpc.CallOption) (*Response, error) GetOpenid(ctx context.Context, in *GetOpenidReq, opts ...grpc.CallOption) (*Response, error) BindMobile(ctx context.Context, in *BindMobileReq, opts ...grpc.CallOption) (*Response, error) + RebindMobile(ctx context.Context, in *RebindMobileReq, opts ...grpc.CallOption) (*Response, error) Client(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*Response, error) UserItems(ctx context.Context, in *UserItemsReq, opts ...grpc.CallOption) (*Response, error) UserStatus(ctx context.Context, in *UserStatusReq, opts ...grpc.CallOption) (*Response, error) @@ -169,6 +171,16 @@ func (c *userClient) BindMobile(ctx context.Context, in *BindMobileReq, opts ... return out, nil } +func (c *userClient) RebindMobile(ctx context.Context, in *RebindMobileReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, User_RebindMobile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *userClient) Client(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*Response, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Response) @@ -312,6 +324,7 @@ type UserServer interface { Password(context.Context, *PasswordReq) (*Response, error) GetOpenid(context.Context, *GetOpenidReq) (*Response, error) BindMobile(context.Context, *BindMobileReq) (*Response, error) + RebindMobile(context.Context, *RebindMobileReq) (*Response, error) Client(context.Context, *ClientReq) (*Response, error) UserItems(context.Context, *UserItemsReq) (*Response, error) UserStatus(context.Context, *UserStatusReq) (*Response, error) @@ -362,6 +375,9 @@ func (UnimplementedUserServer) GetOpenid(context.Context, *GetOpenidReq) (*Respo func (UnimplementedUserServer) BindMobile(context.Context, *BindMobileReq) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method BindMobile not implemented") } +func (UnimplementedUserServer) RebindMobile(context.Context, *RebindMobileReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method RebindMobile not implemented") +} func (UnimplementedUserServer) Client(context.Context, *ClientReq) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method Client not implemented") } @@ -584,6 +600,24 @@ func _User_BindMobile_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _User_RebindMobile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RebindMobileReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).RebindMobile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: User_RebindMobile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).RebindMobile(ctx, req.(*RebindMobileReq)) + } + return interceptor(ctx, in, info, handler) +} + func _User_Client_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ClientReq) if err := dec(in); err != nil { @@ -861,6 +895,10 @@ var User_ServiceDesc = grpc.ServiceDesc{ MethodName: "BindMobile", Handler: _User_BindMobile_Handler, }, + { + MethodName: "RebindMobile", + Handler: _User_RebindMobile_Handler, + }, { MethodName: "Client", Handler: _User_Client_Handler, diff --git a/rpc/user/user.pb b/rpc/user/user.pb index f288b69..62fccce 100644 Binary files a/rpc/user/user.pb and b/rpc/user/user.pb differ diff --git a/rpc/user/user.proto b/rpc/user/user.proto index ac724d7..c9dff6b 100644 --- a/rpc/user/user.proto +++ b/rpc/user/user.proto @@ -60,6 +60,12 @@ service User { body: "*" }; } + rpc RebindMobile(RebindMobileReq) returns (Response) { + option (google.api.http) = { + put: "/api/v3/user/mobile/rebind" + body: "*" + }; + } rpc Client(ClientReq) returns (Response) { option (google.api.http) = { get: "/admin/v3/user/client" @@ -273,6 +279,12 @@ message BindMobileReq { string code = 1; } +message RebindMobileReq { + string old_mobile = 1; + string new_mobile = 2; + string sms_code = 3; +} + message InfoReq {} message UpdateReq { @@ -282,7 +294,6 @@ message UpdateReq { string birthday = 4; string mobile = 5; string real_name = 6; - string sms_code = 7; } message PasswordReq { diff --git a/services/chore/internal/logic/apiAnswerIProgressLogic.go b/services/chore/internal/logic/apiAnswerIProgressLogic.go index 8855048..33f619a 100644 --- a/services/chore/internal/logic/apiAnswerIProgressLogic.go +++ b/services/chore/internal/logic/apiAnswerIProgressLogic.go @@ -4,7 +4,7 @@ import ( "context" "lone-services/pkg/modelbase" "lone-services/pkg/utils" - "lone-services/rpc/chore/pb" + chore "lone-services/rpc/chore/pb" "lone-services/services/chore/internal/dao" "lone-services/services/chore/internal/model" "lone-services/services/chore/internal/svc" diff --git a/services/user/internal/logic/rebindMobileLogic.go b/services/user/internal/logic/rebindMobileLogic.go new file mode 100644 index 0000000..a27ebc1 --- /dev/null +++ b/services/user/internal/logic/rebindMobileLogic.go @@ -0,0 +1,93 @@ +package logic + +import ( + "context" + + "lone-services/pkg/utils" + "lone-services/pkg/validate" + user "lone-services/rpc/user/pb" + "lone-services/services/user/internal/dao" + "lone-services/services/user/internal/svc" + "lone-services/services/user/validator" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type RebindMobileLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewRebindMobileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RebindMobileLogic { + return &RebindMobileLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *RebindMobileLogic) RebindMobile(in *user.RebindMobileReq) (*user.Response, error) { + var req validator.RebindMobileValidator + if msg := validate.ValidateFromProto(in, &req); msg != utils.StringEmpty { + return outResponse(utils.ErrorParams, msg), nil + } + if req.OldMobile == req.NewMobile { + return outResponse(utils.ErrorParams, "新手机号不能与原手机号相同"), nil + } + + loginUser := utils.GetUserFromCtx(l.ctx) + if loginUser.ID < utils.NumberOne { + return failResponse(utils.ErrorNoLoginInfo), nil + } + + row, err := loadEnabledUser(loginUser.ID) + if err != nil { + l.Errorf("rebind mobile load user: %v", err) + return failResponse(utils.ErrorNotFund), nil + } + if row.Mobile == utils.StringEmpty { + return outResponse(utils.ErrorParams, "用户未绑定手机号"), nil + } + + oldEnc, encErr := utils.EncryptPhone(req.OldMobile) + if encErr != nil { + l.Errorf("rebind mobile encrypt old: %v", encErr) + return failResponse(utils.ErrorEncryptAesError), nil + } + if oldEnc != row.Mobile { + return outResponse(utils.ErrorParams, "原手机号不正确"), nil + } + + ok, verifyErr := verifyAndConsumeSmsCode(l.ctx, dao.SmsSceneRebindMobile, req.NewMobile, req.SmsCode) + if verifyErr != nil { + l.Errorf("rebind mobile verify sms: %v", verifyErr) + return failResponse(utils.Fail), nil + } + if !ok { + return outResponse(utils.ErrorParams, "验证码错误或已过期"), nil + } + + _, updateErr := NewInternalUpdateMobileLogic(l.ctx, l.svcCtx).InternalUpdateMobile(&user.InternalUpdateMobileReq{ + UserId: loginUser.ID, + Mobile: req.NewMobile, + }) + if updateErr != nil { + l.Errorf("rebind mobile update: %v", updateErr) + if st, ok := status.FromError(updateErr); ok { + switch st.Code() { + case codes.InvalidArgument: + return outResponse(utils.ErrorParams, st.Message()), nil + case codes.AlreadyExists: + return failResponse(utils.ErrorDataIsExist), nil + case codes.NotFound: + return failResponse(utils.ErrorNotFund), nil + } + } + return failResponse(utils.Fail), nil + } + + return okResponse(nil), nil +} diff --git a/services/user/internal/logic/updateLogic.go b/services/user/internal/logic/updateLogic.go index 8ce8a6d..88939cc 100644 --- a/services/user/internal/logic/updateLogic.go +++ b/services/user/internal/logic/updateLogic.go @@ -75,14 +75,6 @@ func (l *UpdateLogic) Update(in *user.UpdateReq) (*user.Response, error) { return failResponse(utils.ErrorEncryptAesError), nil } if enc != row.Mobile { - ok, verifyErr := verifyAndConsumeSmsCode(l.ctx, dao.SmsSceneRebindMobile, req.Mobile, req.SmsCode) - if verifyErr != nil { - l.Errorf("update verify sms: %v", verifyErr) - return failResponse(utils.Fail), nil - } - if !ok { - return outResponse(utils.ErrorParams, "验证码错误或已过期"), nil - } occupied, occErr := findUserByMobile(enc) if occErr != nil { l.Errorf("update mobile unique: %v", occErr) diff --git a/services/user/internal/server/userServer.go b/services/user/internal/server/userServer.go index d105481..4748ad6 100644 --- a/services/user/internal/server/userServer.go +++ b/services/user/internal/server/userServer.go @@ -68,6 +68,11 @@ func (s *UserServer) BindMobile(ctx context.Context, in *user.BindMobileReq) (*u return l.BindMobile(in) } +func (s *UserServer) RebindMobile(ctx context.Context, in *user.RebindMobileReq) (*user.Response, error) { + l := logic.NewRebindMobileLogic(ctx, s.svcCtx) + return l.RebindMobile(in) +} + func (s *UserServer) Client(ctx context.Context, in *user.ClientReq) (*user.Response, error) { l := logic.NewClientLogic(ctx, s.svcCtx) return l.Client(in) diff --git a/services/user/userClient/user.go b/services/user/userClient/user.go index 889e7b7..5688f8e 100644 --- a/services/user/userClient/user.go +++ b/services/user/userClient/user.go @@ -44,6 +44,7 @@ type ( PasswordReq = user.PasswordReq QrcodeLoginReq = user.QrcodeLoginReq QrcodeScanReq = user.QrcodeScanReq + RebindMobileReq = user.RebindMobileReq Response = user.Response UpdateReq = user.UpdateReq UserBriefItem = user.UserBriefItem @@ -60,6 +61,7 @@ type ( Password(ctx context.Context, in *PasswordReq, opts ...grpc.CallOption) (*Response, error) GetOpenid(ctx context.Context, in *GetOpenidReq, opts ...grpc.CallOption) (*Response, error) BindMobile(ctx context.Context, in *BindMobileReq, opts ...grpc.CallOption) (*Response, error) + RebindMobile(ctx context.Context, in *RebindMobileReq, opts ...grpc.CallOption) (*Response, error) Client(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*Response, error) UserItems(ctx context.Context, in *UserItemsReq, opts ...grpc.CallOption) (*Response, error) UserStatus(ctx context.Context, in *UserStatusReq, opts ...grpc.CallOption) (*Response, error) @@ -131,6 +133,11 @@ func (m *defaultUser) BindMobile(ctx context.Context, in *BindMobileReq, opts .. return client.BindMobile(ctx, in, opts...) } +func (m *defaultUser) RebindMobile(ctx context.Context, in *RebindMobileReq, opts ...grpc.CallOption) (*Response, error) { + client := user.NewUserClient(m.cli.Conn()) + return client.RebindMobile(ctx, in, opts...) +} + func (m *defaultUser) Client(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*Response, error) { client := user.NewUserClient(m.cli.Conn()) return client.Client(ctx, in, opts...) diff --git a/services/user/validator/user.go b/services/user/validator/user.go index 800fd5e..fd496c9 100644 --- a/services/user/validator/user.go +++ b/services/user/validator/user.go @@ -67,19 +67,16 @@ type UpdateValidator struct { Birthday string `validate:"omitempty,max=32"` Mobile string `validate:"omitempty,len=11"` RealName string `validate:"omitempty,max=64"` - SmsCode string `validate:"required_with=Mobile,omitempty,max=8"` } func (p UpdateValidator) GetMessage() validate.ValidatorMessages { return validate.ValidatorMessages{ - "Name.max": "昵称过长", - "Avatar.max": "头像地址过长", - "Gender.oneof": "性别不正确", - "Birthday.max": "生日过长", - "Mobile.len": "手机号格式不正确", - "RealName.max": "真实姓名过长", - "SmsCode.required_with": "修改手机号时验证码不能为空", - "SmsCode.max": "验证码过长", + "Name.max": "昵称过长", + "Avatar.max": "头像地址过长", + "Gender.oneof": "性别不正确", + "Birthday.max": "生日过长", + "Mobile.len": "手机号格式不正确", + "RealName.max": "真实姓名过长", } } @@ -120,6 +117,23 @@ func (p BindMobileValidator) GetMessage() validate.ValidatorMessages { } } +type RebindMobileValidator struct { + OldMobile string `validate:"required,len=11"` + NewMobile string `validate:"required,len=11"` + SmsCode string `validate:"required,max=8"` +} + +func (p RebindMobileValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "OldMobile.required": "原手机号不能为空", + "OldMobile.len": "原手机号格式不正确", + "NewMobile.required": "新手机号不能为空", + "NewMobile.len": "新手机号格式不正确", + "SmsCode.required": "验证码不能为空", + "SmsCode.max": "验证码过长", + } +} + type UserItemsValidator struct { Mobile string Page int32 `validate:"omitempty,min=1"`