验证码优化
This commit is contained in:
parent
f3d088fa4d
commit
23a60155c0
@ -29,8 +29,9 @@ func IdVerify(UserName, Num string) (_err error) {
|
||||
// 自动路由服务。
|
||||
response, _err := Id2MetaVerifyAutoRoute(request)
|
||||
ret := util.ToJSONString(util.ToMap(response))
|
||||
console.Log(tea.String("最终结果(若此处为空,则所有服务点均异常,请逐步调试):" + tea.StringValue(ret)))
|
||||
|
||||
if _err != nil {
|
||||
console.Log(tea.String("最终结果(若此处为空,则所有服务点均异常,请逐步调试):" + tea.StringValue(ret)))
|
||||
}
|
||||
return _err
|
||||
}
|
||||
|
||||
@ -54,8 +55,8 @@ func Id2MetaVerifyAutoRoute(request *sdk.Id2MetaVerifyRequest) (_result *sdk.Id2
|
||||
return // 如果调用失败,继续下一个服务点。
|
||||
}
|
||||
// 节点调用结果
|
||||
ret := util.ToJSONString(util.ToMap(response))
|
||||
console.Log(tea.String("节点 " + tea.StringValue(endpoint) + " 结果:" + tea.StringValue(ret) + " "))
|
||||
//ret := util.ToJSONString(util.ToMap(response))
|
||||
//console.Log(tea.String("节点 " + tea.StringValue(endpoint) + " 结果:" + tea.StringValue(ret) + " "))
|
||||
// 有一个服务调用成功即返回。
|
||||
lastResponse = response
|
||||
if !tea.BoolValue(util.IsUnset(response)) && tea.BoolValue(util.EqualNumber(tea.ToInt(response.StatusCode), tea.Int(200))) {
|
||||
|
||||
@ -3,17 +3,18 @@ package MergeConst
|
||||
type ProtocolType int32
|
||||
|
||||
const (
|
||||
Protocol_Error_Account_Exist int32 = 100
|
||||
Protocol_Error_Account_OR_PWD_ERROR int32 = 101
|
||||
Protocol_Error_Account_OR_PWD_Short int32 = 102
|
||||
Protocol_Error_Account_Fail int32 = 103
|
||||
Protocol_Error_Account_NoExsit int32 = 104
|
||||
Protocol_Error_Account_Code_Error int32 = 105
|
||||
Protocol_Error_Account_Device_Error int32 = 106
|
||||
Protocol_Error_Id_Not_Verify int32 = 107
|
||||
Protocol_Error_Id_Verify_Error int32 = 108
|
||||
Protocol_Res_Buy_Cnt_Limit int32 = 110
|
||||
Protocol_Res_Buy_CD int32 = 111
|
||||
Protocol_Error_Account_Exist int32 = 100
|
||||
Protocol_Error_Account_OR_PWD_ERROR int32 = 101
|
||||
Protocol_Error_Account_OR_PWD_Short int32 = 102
|
||||
Protocol_Error_Account_Fail int32 = 103
|
||||
Protocol_Error_Account_NoExsit int32 = 104
|
||||
Protocol_Error_Account_Code_Error int32 = 105
|
||||
Protocol_Error_Account_Device_Error int32 = 106
|
||||
Protocol_Error_Id_Not_Verify int32 = 107
|
||||
Protocol_Error_Id_Verify_Error int32 = 108
|
||||
Protocol_Res_Buy_Cnt_Limit int32 = 110
|
||||
Protocol_Res_Buy_CD int32 = 111
|
||||
|
||||
Protocol_Email_Find_Fail int32 = 120
|
||||
Protocol_Active_No_Exsit int32 = 130
|
||||
Protocol_Active_7Day_Rewarded int32 = 131
|
||||
|
||||
@ -930,7 +930,7 @@ func GeneratedCode(Phone string) (string, error) {
|
||||
if value != "" {
|
||||
//return fmt.Errorf("验证码已发送,请稍后再试")
|
||||
}
|
||||
db.RedisSetKey(key, Code, time.Minute)
|
||||
db.RedisSetKey(key, Code, 5*time.Minute)
|
||||
err := GoUtil.SmsCode(Phone, Code)
|
||||
if err != nil {
|
||||
log.Error("发送验证码失败: %v", err)
|
||||
@ -943,11 +943,11 @@ func VerifyCode(Phone, Code string) error {
|
||||
key := "Code_" + Phone
|
||||
value, err := db.RedisGetKey(key)
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取验证码失败: %v", err)
|
||||
return fmt.Errorf("验证码已失效")
|
||||
}
|
||||
if value == Code {
|
||||
db.RedisDelKey(key)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("获取验证码失败: 不一致")
|
||||
return fmt.Errorf("验证码错误")
|
||||
}
|
||||
|
||||
@ -2095,6 +2095,7 @@ type ResLogin struct {
|
||||
DwUin int64 `protobuf:"varint,2,opt,name=dwUin,proto3" json:"dwUin,omitempty"`
|
||||
UserName string `protobuf:"bytes,3,opt,name=UserName,proto3" json:"UserName,omitempty"`
|
||||
FaceBookId string `protobuf:"bytes,4,opt,name=FaceBookId,proto3" json:"FaceBookId,omitempty"`
|
||||
Msg string `protobuf:"bytes,5,opt,name=Msg,proto3" json:"Msg,omitempty"` // 错误信息
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -2157,6 +2158,13 @@ func (x *ResLogin) GetFaceBookId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ResLogin) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReqChangePassword struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserName string `protobuf:"bytes,1,opt,name=UserName,proto3" json:"UserName,omitempty"`
|
||||
@ -23432,7 +23440,7 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"ResultCode\x18\x01 \x01(\x0e2\x12.tutorial.RES_CODER\n" +
|
||||
"ResultCode\x12\x10\n" +
|
||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\"|\n" +
|
||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\"\x8e\x01\n" +
|
||||
"\bResLogin\x12\x1e\n" +
|
||||
"\n" +
|
||||
"ResultCode\x18\x01 \x01(\x05R\n" +
|
||||
@ -23441,7 +23449,8 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
||||
"\bUserName\x18\x03 \x01(\tR\bUserName\x12\x1e\n" +
|
||||
"\n" +
|
||||
"FaceBookId\x18\x04 \x01(\tR\n" +
|
||||
"FaceBookId\"_\n" +
|
||||
"FaceBookId\x12\x10\n" +
|
||||
"\x03Msg\x18\x05 \x01(\tR\x03Msg\"_\n" +
|
||||
"\x11ReqChangePassword\x12\x1a\n" +
|
||||
"\bUserName\x18\x01 \x01(\tR\bUserName\x12\x16\n" +
|
||||
"\x06OldPwd\x18\x02 \x01(\tR\x06OldPwd\x12\x16\n" +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user