|
@@ -13,19 +13,19 @@ import (
|
|
|
)
|
|
|
|
|
|
// 验证TOKEY
|
|
|
-func Verification(GetCookie string, GetString string) (bool, Account.User, int) {
|
|
|
+func Verification(GetCookie string, GetString string) (error, Account.User, int) {
|
|
|
|
|
|
User_tokey := GetString
|
|
|
if len(User_tokey) == 0 {
|
|
|
User_tokey = GetCookie
|
|
|
}
|
|
|
if len(User_tokey) == 0 {
|
|
|
- return false, Account.User{}, 0
|
|
|
+ return errors.New("请重新登录!"), Account.User{}, 0
|
|
|
}
|
|
|
// 请求-响应, 向 verification 发布一个 `ToKey` 请求数据,设置超时间3秒,如果有多个响应,只接收第一个收到的消息
|
|
|
msg, err := lib.Nats.Request("Cold_User_verification", []byte(User_tokey), 3*time.Second)
|
|
|
if err != nil {
|
|
|
- return false, Account.User{}, 0
|
|
|
+ return errors.New("请稍后重试"), Account.User{}, 0
|
|
|
}
|
|
|
fmt.Printf("Cold_User_verification : %s\n", string(msg.Data))
|
|
|
type T_R struct {
|
|
@@ -39,10 +39,10 @@ func Verification(GetCookie string, GetString string) (bool, Account.User, int)
|
|
|
|
|
|
err = msgpack.Unmarshal(msg.Data, &t_R)
|
|
|
if err != nil {
|
|
|
- return false, Account.User{}, 0
|
|
|
+ return errors.New("请稍后重试"), Account.User{}, 0
|
|
|
}
|
|
|
|
|
|
- return true, t_R.Data, t_R.Pid
|
|
|
+ return nil, t_R.Data, t_R.Pid
|
|
|
|
|
|
}
|
|
|
|