|
@@ -4,9 +4,11 @@ package httpsession
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "strconv"
|
|
|
"sync"
|
|
|
"time"
|
|
|
|
|
|
+ . "app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
)
|
|
|
|
|
@@ -32,7 +34,7 @@ func (store *redisStore) SetMaxAge(maxAge time.Duration) {
|
|
|
|
|
|
//取数据,使用redis的超时,来控制session超时
|
|
|
func (store *redisStore) Get(id Id, key string) interface{} {
|
|
|
- return store.GetMultiple(id)[key]
|
|
|
+ return store.GetMultiple(id)
|
|
|
}
|
|
|
|
|
|
//同时获取多个值
|
|
@@ -52,6 +54,9 @@ func (store *redisStore) GetMultiple(id Id) map[string]interface{} {
|
|
|
redis.SetExpire("session", string(id), timeout)
|
|
|
store.last = time.Now()
|
|
|
lock(id).Unlock()
|
|
|
+ if m["userId"] != nil && Int64All(m["positionType"]) == 1 {
|
|
|
+ m["userId"] = strconv.FormatInt(Int64All(m["positionId"]), 10)
|
|
|
+ }
|
|
|
return m
|
|
|
}
|
|
|
|