|
@@ -25,9 +25,12 @@ func ComponentInit() {
|
25
|
25
|
d := "0"
|
26
|
26
|
if !conf.ExpiresDate.IsZero() {
|
27
|
27
|
now := time.Now()
|
28
|
|
- d = string(conf.ExpiresDate.Sub(now))
|
|
28
|
+ subd := conf.ExpiresDate.Sub(now)
|
|
29
|
+ beego.Error(d)
|
|
30
|
+ d = string(subd)
|
29
|
31
|
}
|
30
|
32
|
|
|
33
|
+ beego.Error("过期时间:", d)
|
31
|
34
|
var cert = map[string]string{
|
32
|
35
|
"appid": conf.Appid,
|
33
|
36
|
"aeskey": conf.Aeskey,
|
|
@@ -51,10 +54,11 @@ func UpdateComponentToken(token map[string]interface{}) {
|
51
|
54
|
Token: token["accessToken"].(string),
|
52
|
55
|
}
|
53
|
56
|
|
54
|
|
- expires := token["expire_in"].(int)
|
55
|
|
- beego.Error(expires)
|
56
|
|
- if expires > 0 {
|
57
|
|
- expriesTime := time.Now().Local().Add(time.Duration(expires))
|
|
57
|
+ expire := token["expire_in"].(int64)
|
|
58
|
+ if expire > 0 {
|
|
59
|
+ beego.Error(time.Now())
|
|
60
|
+ expriesTime := time.Now().Local().Add(time.Duration(expire) * time.Second)
|
|
61
|
+ beego.Error(expriesTime)
|
58
|
62
|
conf.ExpiresDate = expriesTime
|
59
|
63
|
sql := `update sys_component_conf set token=?,expires_date=?`
|
60
|
64
|
_, err := DBEngine.Exec(sql, conf.Token, conf.ExpiresDate)
|