|
@@ -32,8 +32,8 @@ type jlResult struct {
|
|
|
Msg string `json:"msg" `
|
|
|
}
|
|
|
type dataResult struct {
|
|
|
- Account map[string]interface{} `json:"account" `
|
|
|
- Project map[string]interface{} `json:"project" `
|
|
|
+ Account map[string]interface{} `json:"account,optional" `
|
|
|
+ Project map[string]interface{} `json:"project,optional" `
|
|
|
}
|
|
|
|
|
|
type jlAccountResult struct {
|
|
@@ -48,7 +48,7 @@ func NewJlzf() *Jlzf {
|
|
|
debug := utils.GetEnvInfo("DEBUG")
|
|
|
AuthUrl := "https://jl.smartcost.com.cn"
|
|
|
if debug == "qa" {
|
|
|
- AuthUrl = "http://192.168.1.76:7002"
|
|
|
+ AuthUrl = "http://192.168.1.43:7002"
|
|
|
} else if debug == "uat" {
|
|
|
AuthUrl = "http://jluat.smartcost.com.cn"
|
|
|
}
|
|
@@ -89,7 +89,6 @@ func (j *Jlzf) GetAccountList(code string) ([]map[string]interface{}, error) {
|
|
|
if tokenString, err = makeTokenString(claimsData); err != nil {
|
|
|
return nil, errors.New("生成请求token错误")
|
|
|
}
|
|
|
- fmt.Println(tokenString)
|
|
|
|
|
|
// 1-2.发送请求
|
|
|
if resultByte, err = utils.PullData("GET", j.AuthUrl+"/management/account/sync?auth="+tokenString, ""); err != nil {
|
|
@@ -154,8 +153,9 @@ func (j *Jlzf) LoginValid(loginData viewmodels.Login) error {
|
|
|
resultByte []byte
|
|
|
jlResult jlResult
|
|
|
)
|
|
|
+
|
|
|
// 1.生成请求数据
|
|
|
- expirationTime := time.Now().Add(3 * time.Second)
|
|
|
+ expirationTime := time.Now().Add(9000 * time.Second)
|
|
|
claimsData := jwt.MapClaims{
|
|
|
"data": map[string]string{"code": loginData.Code, "account": loginData.Account, "password": loginData.Password},
|
|
|
"exp": expirationTime.Unix(),
|
|
@@ -166,11 +166,12 @@ func (j *Jlzf) LoginValid(loginData viewmodels.Login) error {
|
|
|
return errors.New("生成请求token错误")
|
|
|
}
|
|
|
|
|
|
- // 1-2.发送请求 TODO 验证计量密码接口
|
|
|
+ // 1-2.发送请求 验证计量密码接口
|
|
|
if resultByte, err = utils.PullData("GET", j.AuthUrl+"/management/account/valid?auth="+tokenString, ""); err != nil {
|
|
|
return errors.New(fmt.Sprintf("计量错误,err= %s", err))
|
|
|
}
|
|
|
err = json.Unmarshal(resultByte, &jlResult)
|
|
|
+
|
|
|
if err != nil {
|
|
|
log.Println("请求解析失败, error=", err)
|
|
|
return errors.New("解析数据错误")
|