|
|
@ -31,22 +31,24 @@ func GetUserByToken(dbname, token string, url ...string) (map[string]string, err |
|
|
|
|
|
|
|
if res.GetUserId() != "" { |
|
|
|
return map[string]string{ |
|
|
|
"UserId": res.GetUserId(), |
|
|
|
"Username": res.GetUsername(), |
|
|
|
"Nickname": res.GetNickname(), |
|
|
|
"Mobile": res.GetMobile(), |
|
|
|
"Email": res.GetEmail(), |
|
|
|
"Status": res.GetStatus(), |
|
|
|
"BusinessId": res.GetBusinessId(), |
|
|
|
"StoreId": res.GetStoreId(), |
|
|
|
"FansTo": res.GetFansTo(), |
|
|
|
"IsVip": res.GetIsVip(), |
|
|
|
"Usercode": res.GetUsercode(), |
|
|
|
"GroupId": res.GetGroupId(), |
|
|
|
"Type": res.GetType(), |
|
|
|
"ThirdId": res.GetThirdId(), |
|
|
|
"Platform": res.GetPlatform(), |
|
|
|
"LockFans": res.GetLockFans(), |
|
|
|
"UserId": res.GetUserId(), |
|
|
|
"Username": res.GetUsername(), |
|
|
|
"Nickname": res.GetNickname(), |
|
|
|
"Mobile": res.GetMobile(), |
|
|
|
"Email": res.GetEmail(), |
|
|
|
"Status": res.GetStatus(), |
|
|
|
"BusinessId": res.GetBusinessId(), |
|
|
|
"StoreId": res.GetStoreId(), |
|
|
|
"FansTo": res.GetFansTo(), |
|
|
|
"IsVip": res.GetIsVip(), |
|
|
|
"Usercode": res.GetUsercode(), |
|
|
|
"GroupId": res.GetGroupId(), |
|
|
|
"Type": res.GetType(), |
|
|
|
"ThirdId": res.GetThirdId(), |
|
|
|
"Platform": res.GetPlatform(), |
|
|
|
"LockFans": res.GetLockFans(), |
|
|
|
"CompanyId": res.GetCompanyId(), |
|
|
|
"DepartmentId": res.GetDepartmentId(), |
|
|
|
}, nil |
|
|
|
} |
|
|
|
|
|
|
@ -193,3 +195,51 @@ func GetById(site_id, dbname, user_id string, url ...string) (map[string]string, |
|
|
|
|
|
|
|
return HandleUserRes(res) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新用户缓存 |
|
|
|
* 2021/11/23 |
|
|
|
* linsen |
|
|
|
*/ |
|
|
|
func UpdateUserCache(site_id, dbname, user_id string, url ...string) (map[string]string, error) { |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
data := GetUserReq{} |
|
|
|
data.SiteId = site_id |
|
|
|
data.Dbname = dbname |
|
|
|
data.UserId = user_id |
|
|
|
|
|
|
|
data_json, err := json.Marshal(data) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
encryData := crypter.DesEn(string(data_json), DES_KEY) |
|
|
|
|
|
|
|
now_int64 := time.Now().Unix() |
|
|
|
|
|
|
|
now := strconv.FormatInt(now_int64, 10) |
|
|
|
|
|
|
|
sign := Sign(encryData, now) |
|
|
|
|
|
|
|
req := &Request{ |
|
|
|
proto.String(encryData), |
|
|
|
proto.String(now), |
|
|
|
proto.String(sign), |
|
|
|
nil} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.UpdateUserCache(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
return HandleUserRes(res) |
|
|
|
} |