Quellcode durchsuchen

发送验证码

wfz vor 3 Jahren
Ursprung
Commit
4e8044b885
7 geänderte Dateien mit 318 neuen und 138 gelöschten Zeilen
  1. 167 86
      api/user/user.pb.go
  2. 15 5
      api/user/user.proto
  3. 60 24
      api/user/user_grpc.pb.go
  4. 60 17
      api/user/user_http.pb.go
  5. 2 0
      errors/account.go
  6. 9 5
      js/api/user/user_http_pb.ts
  7. 5 1
      js/api/user/user_pb.ts

+ 167 - 86
api/user/user.pb.go

@@ -172,7 +172,7 @@ func (x *UpdateUserInformationRequest) GetSex() int64 {
 	return 0
 }
 
-type UpdatePhoneRequest struct {
+type SendPhoneCodeRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
@@ -180,8 +180,8 @@ type UpdatePhoneRequest struct {
 	Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone"`
 }
 
-func (x *UpdatePhoneRequest) Reset() {
-	*x = UpdatePhoneRequest{}
+func (x *SendPhoneCodeRequest) Reset() {
+	*x = SendPhoneCodeRequest{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_user_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -189,13 +189,13 @@ func (x *UpdatePhoneRequest) Reset() {
 	}
 }
 
-func (x *UpdatePhoneRequest) String() string {
+func (x *SendPhoneCodeRequest) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*UpdatePhoneRequest) ProtoMessage() {}
+func (*SendPhoneCodeRequest) ProtoMessage() {}
 
-func (x *UpdatePhoneRequest) ProtoReflect() protoreflect.Message {
+func (x *SendPhoneCodeRequest) ProtoReflect() protoreflect.Message {
 	mi := &file_user_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -207,18 +207,73 @@ func (x *UpdatePhoneRequest) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use UpdatePhoneRequest.ProtoReflect.Descriptor instead.
-func (*UpdatePhoneRequest) Descriptor() ([]byte, []int) {
+// Deprecated: Use SendPhoneCodeRequest.ProtoReflect.Descriptor instead.
+func (*SendPhoneCodeRequest) Descriptor() ([]byte, []int) {
 	return file_user_proto_rawDescGZIP(), []int{2}
 }
 
-func (x *UpdatePhoneRequest) GetPhone() string {
+func (x *SendPhoneCodeRequest) GetPhone() string {
 	if x != nil {
 		return x.Phone
 	}
 	return ""
 }
 
+type CheckPhoneCodeRequest struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone"`
+	Code  string `protobuf:"bytes,2,opt,name=code,proto3" json:"code"`
+}
+
+func (x *CheckPhoneCodeRequest) Reset() {
+	*x = CheckPhoneCodeRequest{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_user_proto_msgTypes[3]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *CheckPhoneCodeRequest) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CheckPhoneCodeRequest) ProtoMessage() {}
+
+func (x *CheckPhoneCodeRequest) ProtoReflect() protoreflect.Message {
+	mi := &file_user_proto_msgTypes[3]
+	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 CheckPhoneCodeRequest.ProtoReflect.Descriptor instead.
+func (*CheckPhoneCodeRequest) Descriptor() ([]byte, []int) {
+	return file_user_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CheckPhoneCodeRequest) GetPhone() string {
+	if x != nil {
+		return x.Phone
+	}
+	return ""
+}
+
+func (x *CheckPhoneCodeRequest) GetCode() string {
+	if x != nil {
+		return x.Code
+	}
+	return ""
+}
+
 type DebugLoginRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -231,7 +286,7 @@ type DebugLoginRequest struct {
 func (x *DebugLoginRequest) Reset() {
 	*x = DebugLoginRequest{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_user_proto_msgTypes[3]
+		mi := &file_user_proto_msgTypes[4]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -244,7 +299,7 @@ func (x *DebugLoginRequest) String() string {
 func (*DebugLoginRequest) ProtoMessage() {}
 
 func (x *DebugLoginRequest) ProtoReflect() protoreflect.Message {
-	mi := &file_user_proto_msgTypes[3]
+	mi := &file_user_proto_msgTypes[4]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -257,7 +312,7 @@ func (x *DebugLoginRequest) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use DebugLoginRequest.ProtoReflect.Descriptor instead.
 func (*DebugLoginRequest) Descriptor() ([]byte, []int) {
-	return file_user_proto_rawDescGZIP(), []int{3}
+	return file_user_proto_rawDescGZIP(), []int{4}
 }
 
 func (x *DebugLoginRequest) GetUserId() string {
@@ -285,7 +340,7 @@ type LoginRequest struct {
 func (x *LoginRequest) Reset() {
 	*x = LoginRequest{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_user_proto_msgTypes[4]
+		mi := &file_user_proto_msgTypes[5]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -298,7 +353,7 @@ func (x *LoginRequest) String() string {
 func (*LoginRequest) ProtoMessage() {}
 
 func (x *LoginRequest) ProtoReflect() protoreflect.Message {
-	mi := &file_user_proto_msgTypes[4]
+	mi := &file_user_proto_msgTypes[5]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -311,7 +366,7 @@ func (x *LoginRequest) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
 func (*LoginRequest) Descriptor() ([]byte, []int) {
-	return file_user_proto_rawDescGZIP(), []int{4}
+	return file_user_proto_rawDescGZIP(), []int{5}
 }
 
 func (x *LoginRequest) GetJsCode() string {
@@ -332,7 +387,7 @@ type LoginReply struct {
 func (x *LoginReply) Reset() {
 	*x = LoginReply{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_user_proto_msgTypes[5]
+		mi := &file_user_proto_msgTypes[6]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -345,7 +400,7 @@ func (x *LoginReply) String() string {
 func (*LoginReply) ProtoMessage() {}
 
 func (x *LoginReply) ProtoReflect() protoreflect.Message {
-	mi := &file_user_proto_msgTypes[5]
+	mi := &file_user_proto_msgTypes[6]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -358,7 +413,7 @@ func (x *LoginReply) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.
 func (*LoginReply) Descriptor() ([]byte, []int) {
-	return file_user_proto_rawDescGZIP(), []int{5}
+	return file_user_proto_rawDescGZIP(), []int{6}
 }
 
 func (x *LoginReply) GetToken() string {
@@ -392,54 +447,65 @@ var file_user_proto_rawDesc = []byte{
 	0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72,
 	0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55,
 	0x72, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x03, 0x73, 0x65, 0x78, 0x22, 0x2a, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68,
-	0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68,
-	0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65,
-	0x22, 0x3f, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65,
-	0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a,
-	0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
-	0x65, 0x22, 0x26, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
-	0x74, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x06, 0x6a, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x4c, 0x6f, 0x67,
-	0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf7, 0x03,
-	0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c,
-	0x6f, 0x67, 0x69, 0x6e, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e,
-	0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
-	0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67,
-	0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22,
-	0x10, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2f, 0x64, 0x65, 0x62, 0x75,
-	0x67, 0x3a, 0x01, 0x2a, 0x12, 0x4c, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x16, 0x2e,
-	0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65,
-	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72,
-	0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x15, 0x82, 0xd3, 0xe4,
-	0x93, 0x02, 0x0f, 0x22, 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x3a,
-	0x01, 0x2a, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
-	0x72, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x2e, 0x61,
-	0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73,
-	0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x27, 0x82, 0xd3,
-	0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f,
-	0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x6a, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55,
-	0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52,
-	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21,
-	0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65,
-	0x72, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x3a, 0x01,
-	0x2a, 0x12, 0x54, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
-	0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
-	0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x19, 0x82, 0xd3,
-	0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f,
-	0x69, 0x6e, 0x66, 0x6f, 0x3a, 0x01, 0x2a, 0x42, 0x3d, 0x0a, 0x08, 0x61, 0x70, 0x69, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x2e, 0x69, 0x6b, 0x75, 0x62, 0x61,
-	0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x77, 0x2d,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65,
-	0x72, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x03, 0x73, 0x65, 0x78, 0x22, 0x2c, 0x0a, 0x14, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x68, 0x6f, 0x6e,
+	0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05,
+	0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f,
+	0x6e, 0x65, 0x22, 0x41, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65,
+	0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70,
+	0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e,
+	0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x3f, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f,
+	0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
+	0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
+	0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x26, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x73, 0x43, 0x6f, 0x64, 0x65,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6a, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x22,
+	0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05,
+	0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b,
+	0x65, 0x6e, 0x32, 0xe0, 0x04, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x0a, 0x44,
+	0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+	0x75, 0x73, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65,
+	0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1b, 0x82, 0xd3,
+	0xe4, 0x93, 0x02, 0x15, 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e,
+	0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x3a, 0x01, 0x2a, 0x12, 0x4c, 0x0a, 0x05, 0x4c, 0x6f, 0x67,
+	0x69, 0x6e, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f,
+	0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69,
+	0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79,
+	0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c,
+	0x6f, 0x67, 0x69, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61,
+	0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
+	0x6e, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64,
+	0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
+	0x79, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f,
+	0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x6f,
+	0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x54, 0x0a, 0x0b, 0x47, 0x65,
+	0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
+	0x79, 0x1a, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65,
+	0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f,
+	0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x3a, 0x01, 0x2a,
+	0x12, 0x67, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64,
+	0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e,
+	0x64, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+	0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+	0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+	0x18, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64,
+	0x65, 0x2f, 0x73, 0x65, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x6a, 0x0a, 0x0e, 0x43, 0x68, 0x65,
+	0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x70,
+	0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e,
+	0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
+	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
+	0x6d, 0x70, 0x74, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x61,
+	0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x63, 0x68, 0x65,
+	0x63, 0x6b, 0x3a, 0x01, 0x2a, 0x42, 0x3d, 0x0a, 0x08, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65,
+	0x72, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x2e, 0x69, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e,
+	0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x77, 0x2d, 0x70, 0x72,
+	0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x3b,
+	0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -454,29 +520,32 @@ func file_user_proto_rawDescGZIP() []byte {
 	return file_user_proto_rawDescData
 }
 
-var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
 var file_user_proto_goTypes = []interface{}{
 	(*UserInfo)(nil),                     // 0: api.user.UserInfo
 	(*UpdateUserInformationRequest)(nil), // 1: api.user.UpdateUserInformationRequest
-	(*UpdatePhoneRequest)(nil),           // 2: api.user.UpdatePhoneRequest
-	(*DebugLoginRequest)(nil),            // 3: api.user.DebugLoginRequest
-	(*LoginRequest)(nil),                 // 4: api.user.LoginRequest
-	(*LoginReply)(nil),                   // 5: api.user.LoginReply
-	(*emptypb.Empty)(nil),                // 6: google.protobuf.Empty
+	(*SendPhoneCodeRequest)(nil),         // 2: api.user.SendPhoneCodeRequest
+	(*CheckPhoneCodeRequest)(nil),        // 3: api.user.CheckPhoneCodeRequest
+	(*DebugLoginRequest)(nil),            // 4: api.user.DebugLoginRequest
+	(*LoginRequest)(nil),                 // 5: api.user.LoginRequest
+	(*LoginReply)(nil),                   // 6: api.user.LoginReply
+	(*emptypb.Empty)(nil),                // 7: google.protobuf.Empty
 }
 var file_user_proto_depIdxs = []int32{
-	3, // 0: api.user.User.DebugLogin:input_type -> api.user.DebugLoginRequest
-	4, // 1: api.user.User.Login:input_type -> api.user.LoginRequest
+	4, // 0: api.user.User.DebugLogin:input_type -> api.user.DebugLoginRequest
+	5, // 1: api.user.User.Login:input_type -> api.user.LoginRequest
 	1, // 2: api.user.User.UpdateUserInformation:input_type -> api.user.UpdateUserInformationRequest
-	2, // 3: api.user.User.UpdateUserPhone:input_type -> api.user.UpdatePhoneRequest
-	6, // 4: api.user.User.GetUserInfo:input_type -> google.protobuf.Empty
-	5, // 5: api.user.User.DebugLogin:output_type -> api.user.LoginReply
-	5, // 6: api.user.User.Login:output_type -> api.user.LoginReply
-	6, // 7: api.user.User.UpdateUserInformation:output_type -> google.protobuf.Empty
-	6, // 8: api.user.User.UpdateUserPhone:output_type -> google.protobuf.Empty
+	7, // 3: api.user.User.GetUserInfo:input_type -> google.protobuf.Empty
+	2, // 4: api.user.User.SendPhoneCode:input_type -> api.user.SendPhoneCodeRequest
+	3, // 5: api.user.User.CheckPhoneCode:input_type -> api.user.CheckPhoneCodeRequest
+	6, // 6: api.user.User.DebugLogin:output_type -> api.user.LoginReply
+	6, // 7: api.user.User.Login:output_type -> api.user.LoginReply
+	7, // 8: api.user.User.UpdateUserInformation:output_type -> google.protobuf.Empty
 	0, // 9: api.user.User.GetUserInfo:output_type -> api.user.UserInfo
-	5, // [5:10] is the sub-list for method output_type
-	0, // [0:5] is the sub-list for method input_type
+	7, // 10: api.user.User.SendPhoneCode:output_type -> google.protobuf.Empty
+	7, // 11: api.user.User.CheckPhoneCode:output_type -> google.protobuf.Empty
+	6, // [6:12] is the sub-list for method output_type
+	0, // [0:6] is the sub-list for method input_type
 	0, // [0:0] is the sub-list for extension type_name
 	0, // [0:0] is the sub-list for extension extendee
 	0, // [0:0] is the sub-list for field type_name
@@ -513,7 +582,7 @@ func file_user_proto_init() {
 			}
 		}
 		file_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*UpdatePhoneRequest); i {
+			switch v := v.(*SendPhoneCodeRequest); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -525,7 +594,7 @@ func file_user_proto_init() {
 			}
 		}
 		file_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*DebugLoginRequest); i {
+			switch v := v.(*CheckPhoneCodeRequest); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -537,7 +606,7 @@ func file_user_proto_init() {
 			}
 		}
 		file_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*LoginRequest); i {
+			switch v := v.(*DebugLoginRequest); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -549,6 +618,18 @@ func file_user_proto_init() {
 			}
 		}
 		file_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*LoginRequest); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*LoginReply); i {
 			case 0:
 				return &v.state
@@ -567,7 +648,7 @@ func file_user_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_user_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   6,
+			NumMessages:   7,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 15 - 5
api/user/user.proto

@@ -29,15 +29,21 @@ service User {
       body:"*"
     };
   };
-  rpc UpdateUserPhone (UpdatePhoneRequest) returns (google.protobuf.Empty){
+  rpc GetUserInfo (google.protobuf.Empty) returns (UserInfo){
     option (google.api.http) = {
-      post: "/api/user/update/phone",
+      post: "/api/user/info",
       body:"*"
     };
   };
-  rpc GetUserInfo (google.protobuf.Empty) returns (UserInfo){
+  rpc SendPhoneCode (SendPhoneCodeRequest) returns (google.protobuf.Empty){
     option (google.api.http) = {
-      post: "/api/user/info",
+      post: "/api/user/code/send",
+      body:"*"
+    };
+  };
+  rpc CheckPhoneCode (CheckPhoneCodeRequest) returns (google.protobuf.Empty){
+    option (google.api.http) = {
+      post: "/api/user/code/check",
       body:"*"
     };
   };
@@ -58,9 +64,13 @@ message UpdateUserInformationRequest {
   int64 sex = 3;
 }
 
-message UpdatePhoneRequest {
+message SendPhoneCodeRequest {
   string phone = 1;
 }
+message CheckPhoneCodeRequest {
+  string phone = 1;
+  string code = 2;
+}
 
 message DebugLoginRequest {
   string userId = 1;

+ 60 - 24
api/user/user_grpc.pb.go

@@ -22,8 +22,9 @@ type UserClient interface {
 	DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
 	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
 	UpdateUserInformation(ctx context.Context, in *UpdateUserInformationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
-	UpdateUserPhone(ctx context.Context, in *UpdatePhoneRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
 	GetUserInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserInfo, error)
+	SendPhoneCode(ctx context.Context, in *SendPhoneCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+	CheckPhoneCode(ctx context.Context, in *CheckPhoneCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
 }
 
 type userClient struct {
@@ -61,18 +62,27 @@ func (c *userClient) UpdateUserInformation(ctx context.Context, in *UpdateUserIn
 	return out, nil
 }
 
-func (c *userClient) UpdateUserPhone(ctx context.Context, in *UpdatePhoneRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+func (c *userClient) GetUserInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserInfo, error) {
+	out := new(UserInfo)
+	err := c.cc.Invoke(ctx, "/api.user.User/GetUserInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *userClient) SendPhoneCode(ctx context.Context, in *SendPhoneCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
 	out := new(emptypb.Empty)
-	err := c.cc.Invoke(ctx, "/api.user.User/UpdateUserPhone", in, out, opts...)
+	err := c.cc.Invoke(ctx, "/api.user.User/SendPhoneCode", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
 	return out, nil
 }
 
-func (c *userClient) GetUserInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserInfo, error) {
-	out := new(UserInfo)
-	err := c.cc.Invoke(ctx, "/api.user.User/GetUserInfo", in, out, opts...)
+func (c *userClient) CheckPhoneCode(ctx context.Context, in *CheckPhoneCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+	out := new(emptypb.Empty)
+	err := c.cc.Invoke(ctx, "/api.user.User/CheckPhoneCode", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -86,8 +96,9 @@ type UserServer interface {
 	DebugLogin(context.Context, *DebugLoginRequest) (*LoginReply, error)
 	Login(context.Context, *LoginRequest) (*LoginReply, error)
 	UpdateUserInformation(context.Context, *UpdateUserInformationRequest) (*emptypb.Empty, error)
-	UpdateUserPhone(context.Context, *UpdatePhoneRequest) (*emptypb.Empty, error)
 	GetUserInfo(context.Context, *emptypb.Empty) (*UserInfo, error)
+	SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error)
+	CheckPhoneCode(context.Context, *CheckPhoneCodeRequest) (*emptypb.Empty, error)
 	mustEmbedUnimplementedUserServer()
 }
 
@@ -104,12 +115,15 @@ func (UnimplementedUserServer) Login(context.Context, *LoginRequest) (*LoginRepl
 func (UnimplementedUserServer) UpdateUserInformation(context.Context, *UpdateUserInformationRequest) (*emptypb.Empty, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method UpdateUserInformation not implemented")
 }
-func (UnimplementedUserServer) UpdateUserPhone(context.Context, *UpdatePhoneRequest) (*emptypb.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UpdateUserPhone not implemented")
-}
 func (UnimplementedUserServer) GetUserInfo(context.Context, *emptypb.Empty) (*UserInfo, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
 }
+func (UnimplementedUserServer) SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method SendPhoneCode not implemented")
+}
+func (UnimplementedUserServer) CheckPhoneCode(context.Context, *CheckPhoneCodeRequest) (*emptypb.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CheckPhoneCode not implemented")
+}
 func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
 
 // UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
@@ -177,38 +191,56 @@ func _User_UpdateUserInformation_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
-func _User_UpdateUserPhone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(UpdatePhoneRequest)
+func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(emptypb.Empty)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
-		return srv.(UserServer).UpdateUserPhone(ctx, in)
+		return srv.(UserServer).GetUserInfo(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/api.user.User/UpdateUserPhone",
+		FullMethod: "/api.user.User/GetUserInfo",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserServer).UpdateUserPhone(ctx, req.(*UpdatePhoneRequest))
+		return srv.(UserServer).GetUserInfo(ctx, req.(*emptypb.Empty))
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
-func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(emptypb.Empty)
+func _User_SendPhoneCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(SendPhoneCodeRequest)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
-		return srv.(UserServer).GetUserInfo(ctx, in)
+		return srv.(UserServer).SendPhoneCode(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/api.user.User/GetUserInfo",
+		FullMethod: "/api.user.User/SendPhoneCode",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserServer).GetUserInfo(ctx, req.(*emptypb.Empty))
+		return srv.(UserServer).SendPhoneCode(ctx, req.(*SendPhoneCodeRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _User_CheckPhoneCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(CheckPhoneCodeRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserServer).CheckPhoneCode(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/api.user.User/CheckPhoneCode",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserServer).CheckPhoneCode(ctx, req.(*CheckPhoneCodeRequest))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -232,14 +264,18 @@ var User_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "UpdateUserInformation",
 			Handler:    _User_UpdateUserInformation_Handler,
 		},
-		{
-			MethodName: "UpdateUserPhone",
-			Handler:    _User_UpdateUserPhone_Handler,
-		},
 		{
 			MethodName: "GetUserInfo",
 			Handler:    _User_GetUserInfo_Handler,
 		},
+		{
+			MethodName: "SendPhoneCode",
+			Handler:    _User_SendPhoneCode_Handler,
+		},
+		{
+			MethodName: "CheckPhoneCode",
+			Handler:    _User_CheckPhoneCode_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "user.proto",

+ 60 - 17
api/user/user_http.pb.go

@@ -27,11 +27,12 @@ var _ = new(base.Html)
 const _ = http.SupportPackageIsVersion1
 
 type UserHTTPServer interface {
+	CheckPhoneCode(context.Context, *CheckPhoneCodeRequest) (*emptypb.Empty, error)
 	DebugLogin(context.Context, *DebugLoginRequest) (*LoginReply, error)
 	GetUserInfo(context.Context, *emptypb.Empty) (*UserInfo, error)
 	Login(context.Context, *LoginRequest) (*LoginReply, error)
+	SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error)
 	UpdateUserInformation(context.Context, *UpdateUserInformationRequest) (*emptypb.Empty, error)
-	UpdateUserPhone(context.Context, *UpdatePhoneRequest) (*emptypb.Empty, error)
 }
 
 func RegisterUserHTTPServer(s *http.Server, srv UserHTTPServer) {
@@ -39,8 +40,9 @@ func RegisterUserHTTPServer(s *http.Server, srv UserHTTPServer) {
 	r.POST("/api/login/debug", _User_DebugLogin0_HTTP_Handler(srv))
 	r.POST("/api/login", _User_Login0_HTTP_Handler(srv))
 	r.POST("/api/user/update/information", _User_UpdateUserInformation0_HTTP_Handler(srv))
-	r.POST("/api/user/update/phone", _User_UpdateUserPhone0_HTTP_Handler(srv))
 	r.POST("/api/user/info", _User_GetUserInfo0_HTTP_Handler(srv))
+	r.POST("/api/user/code/send", _User_SendPhoneCode0_HTTP_Handler(srv))
+	r.POST("/api/user/code/check", _User_CheckPhoneCode0_HTTP_Handler(srv))
 }
 
 func _User_DebugLogin0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
@@ -124,18 +126,18 @@ func _User_UpdateUserInformation0_HTTP_Handler(srv UserHTTPServer) func(ctx http
 	}
 }
 
-func _User_UpdateUserPhone0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
+func _User_GetUserInfo0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
 	return func(ctx http.Context) error {
-		var in UpdatePhoneRequest
+		var in emptypb.Empty
 		if err := ctx.Bind(&in); err != nil {
 			return err
 		}
 		if err := ctx.BindQuery(&in); err != nil {
 			return err
 		}
-		http.SetOperation(ctx, "/api.user.User/UpdateUserPhone")
+		http.SetOperation(ctx, "/api.user.User/GetUserInfo")
 		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
-			return srv.UpdateUserPhone(ctx, req.(*UpdatePhoneRequest))
+			return srv.GetUserInfo(ctx, req.(*emptypb.Empty))
 		})
 		out, err := h(ctx, &in)
 		if err != nil {
@@ -151,18 +153,45 @@ func _User_UpdateUserPhone0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Conte
 	}
 }
 
-func _User_GetUserInfo0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
+func _User_SendPhoneCode0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
 	return func(ctx http.Context) error {
-		var in emptypb.Empty
+		var in SendPhoneCodeRequest
 		if err := ctx.Bind(&in); err != nil {
 			return err
 		}
 		if err := ctx.BindQuery(&in); err != nil {
 			return err
 		}
-		http.SetOperation(ctx, "/api.user.User/GetUserInfo")
+		http.SetOperation(ctx, "/api.user.User/SendPhoneCode")
 		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
-			return srv.GetUserInfo(ctx, req.(*emptypb.Empty))
+			return srv.SendPhoneCode(ctx, req.(*SendPhoneCodeRequest))
+		})
+		out, err := h(ctx, &in)
+		if err != nil {
+			return err
+		}
+		success := &reply.SuccessReply{
+			Code: 0,
+		}
+		if out != nil {
+			success.Data = out
+		}
+		return ctx.Result(200, success)
+	}
+}
+
+func _User_CheckPhoneCode0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
+	return func(ctx http.Context) error {
+		var in CheckPhoneCodeRequest
+		if err := ctx.Bind(&in); err != nil {
+			return err
+		}
+		if err := ctx.BindQuery(&in); err != nil {
+			return err
+		}
+		http.SetOperation(ctx, "/api.user.User/CheckPhoneCode")
+		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
+			return srv.CheckPhoneCode(ctx, req.(*CheckPhoneCodeRequest))
 		})
 		out, err := h(ctx, &in)
 		if err != nil {
@@ -179,11 +208,12 @@ func _User_GetUserInfo0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context)
 }
 
 type UserHTTPClient interface {
+	CheckPhoneCode(ctx context.Context, req *CheckPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
 	DebugLogin(ctx context.Context, req *DebugLoginRequest, opts ...http.CallOption) (rsp *LoginReply, err error)
 	GetUserInfo(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *UserInfo, err error)
 	Login(ctx context.Context, req *LoginRequest, opts ...http.CallOption) (rsp *LoginReply, err error)
+	SendPhoneCode(ctx context.Context, req *SendPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
 	UpdateUserInformation(ctx context.Context, req *UpdateUserInformationRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
-	UpdateUserPhone(ctx context.Context, req *UpdatePhoneRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
 }
 
 type UserHTTPClientImpl struct {
@@ -194,6 +224,19 @@ func NewUserHTTPClient(client *http.Client) UserHTTPClient {
 	return &UserHTTPClientImpl{client}
 }
 
+func (c *UserHTTPClientImpl) CheckPhoneCode(ctx context.Context, in *CheckPhoneCodeRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
+	var out emptypb.Empty
+	pattern := "/api/user/code/check"
+	path := binding.EncodeURL(pattern, in, false)
+	opts = append(opts, http.Operation("/api.user.User/CheckPhoneCode"))
+	opts = append(opts, http.PathTemplate(pattern))
+	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return &out, err
+}
+
 func (c *UserHTTPClientImpl) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...http.CallOption) (*LoginReply, error) {
 	var out LoginReply
 	pattern := "/api/login/debug"
@@ -233,11 +276,11 @@ func (c *UserHTTPClientImpl) Login(ctx context.Context, in *LoginRequest, opts .
 	return &out, err
 }
 
-func (c *UserHTTPClientImpl) UpdateUserInformation(ctx context.Context, in *UpdateUserInformationRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
+func (c *UserHTTPClientImpl) SendPhoneCode(ctx context.Context, in *SendPhoneCodeRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
 	var out emptypb.Empty
-	pattern := "/api/user/update/information"
+	pattern := "/api/user/code/send"
 	path := binding.EncodeURL(pattern, in, false)
-	opts = append(opts, http.Operation("/api.user.User/UpdateUserInformation"))
+	opts = append(opts, http.Operation("/api.user.User/SendPhoneCode"))
 	opts = append(opts, http.PathTemplate(pattern))
 	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
 	if err != nil {
@@ -246,11 +289,11 @@ func (c *UserHTTPClientImpl) UpdateUserInformation(ctx context.Context, in *Upda
 	return &out, err
 }
 
-func (c *UserHTTPClientImpl) UpdateUserPhone(ctx context.Context, in *UpdatePhoneRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
+func (c *UserHTTPClientImpl) UpdateUserInformation(ctx context.Context, in *UpdateUserInformationRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
 	var out emptypb.Empty
-	pattern := "/api/user/update/phone"
+	pattern := "/api/user/update/information"
 	path := binding.EncodeURL(pattern, in, false)
-	opts = append(opts, http.Operation("/api.user.User/UpdateUserPhone"))
+	opts = append(opts, http.Operation("/api.user.User/UpdateUserInformation"))
 	opts = append(opts, http.PathTemplate(pattern))
 	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
 	if err != nil {

+ 2 - 0
errors/account.go

@@ -6,4 +6,6 @@ import (
 
 var (
 	ErrorUserNotExist = codes.Error(401, "用户不存在")
+	ErrorPhotoNotTrue = codes.Error(10001, "手机号格式错误")
+	ErrorCodeNotMate  = codes.Error(10002, "验证码不匹配")
 )

+ 9 - 5
js/api/user/user_http_pb.ts

@@ -1,6 +1,6 @@
 // @ts-ignore
 import { request } from 'ice';
-import {DebugLoginRequest,LoginReply,LoginRequest,UpdateUserInformationRequest,UpdatePhoneRequest,UserInfo} from "./user_pb";
+import {DebugLoginRequest,LoginReply,LoginRequest,UpdateUserInformationRequest,UserInfo,SendPhoneCodeRequest,CheckPhoneCodeRequest} from "./user_pb";
 
 const UserService = {
   DebugLogin: async (req?: DebugLoginRequest) => {
@@ -15,14 +15,18 @@ const UserService = {
 	const res = await request.post('/api/user/update/information', req);
     return res.data;
   },
-  UpdateUserPhone: async (req?: UpdatePhoneRequest) => {
-	const res = await request.post('/api/user/update/phone', req);
-    return res.data;
-  },
   GetUserInfo: async (req?: undefined) => {
 	const res = await request.post<{ data: UserInfo, code: string, message: string }>('/api/user/info', req);
     return res.data;
   },
+  SendPhoneCode: async (req?: SendPhoneCodeRequest) => {
+	const res = await request.post('/api/user/code/send', req);
+    return res.data;
+  },
+  CheckPhoneCode: async (req?: CheckPhoneCodeRequest) => {
+	const res = await request.post('/api/user/code/check', req);
+    return res.data;
+  },
 
 };
 

+ 5 - 1
js/api/user/user_pb.ts

@@ -17,9 +17,13 @@ export interface UpdateUserInformationRequest{
     avatarUrl?:string;
     sex?:number;
 }
-export interface UpdatePhoneRequest{
+export interface SendPhoneCodeRequest{
     phone?:string;
 }
+export interface CheckPhoneCodeRequest{
+    phone?:string;
+    code?:string;
+}
 export interface DebugLoginRequest{
     userId?:string;
     code?:string;