作者 yangfu

refresh 过期时间修改

... ... @@ -184,7 +184,7 @@ from audit_flow_process where uid=? and review_status in (%v) and enable_status
func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
select a.*,b.user_id chance_user_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
select id collect_id,source_id,update_at,collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
select id collect_id,source_id,update_at,collect_time,chance_id from chance_favorite where (0=? or unix_timestamp(collect_time)<?) and user_id =? and enable_status=1
and source_type=1
and (mark_flag&2)>0
)a left outer join chance b on a.source_id = b.id
... ... @@ -207,7 +207,7 @@ limit ?`)
func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
select a.*,b.user_id chance_user_id,b.id chance_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
select id collect_id,source_id,update_at,zan_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
select id collect_id,source_id,update_at,zan_time from chance_favorite where (0=? or unix_timestamp(zan_time)<?) and user_id =? and enable_status=1
and source_type=1
and (mark_flag&1)>0
)a left outer join chance b on a.source_id = b.id
... ...
... ... @@ -16,6 +16,7 @@ const (
)
const TokenExpire = 3600
const RefreshTokenExipre = 3600 * 24 * 30 * 3 //刷新token 三个月过期
const SmscodeDayLimitTime = 10 //短信验证码每天最多发10次
... ...
... ... @@ -220,7 +220,7 @@ func AccessToken(request *protocol.AccessTokenRequest) (rsp *protocol.AccessToke
userAuth.AccessToken = uid.NewV1().StringNoDash()
userAuth.RefreshToken = uid.NewV1().StringNoDash()
userAuth.AccessTokenExp = time.Now().Add(protocol.TokenExpire * time.Second)
userAuth.RefreshTokenExp = time.Now().Add(protocol.TokenExpire * time.Second * 2)
userAuth.RefreshTokenExp = time.Now().Add(protocol.RefreshTokenExipre * time.Second)
if err = models.UpdateUserAuthById(userAuth); err != nil {
log.Error(err)
return
... ... @@ -253,7 +253,7 @@ func RefreshToken(request *protocol.RefreshTokenRequest) (rsp *protocol.RefreshT
userAuth.AccessToken = uid.NewV1().StringNoDash()
userAuth.RefreshToken = uid.NewV1().StringNoDash()
userAuth.AccessTokenExp = time.Now().Add(protocol.TokenExpire * time.Second)
userAuth.RefreshTokenExp = time.Now().Add(protocol.TokenExpire * time.Second * 2)
userAuth.RefreshTokenExp = time.Now().Add(protocol.RefreshTokenExipre * time.Second)
if err = models.UpdateUserAuthById(userAuth); err != nil {
return
}
... ...
... ... @@ -1541,7 +1541,15 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect
myChances []protocol.ChanceCollectItemOrm
total int
provider *protocol.BaseUserInfo
favorite *models.ChanceFavorite
)
if request.LastId > 0 {
if favorite, err = models.GetChanceFavoriteById(request.LastId); err != nil {
log.Error("不存在", request.LastId, err)
return
}
request.LastId = favorite.CollectTime.Unix()
}
if total, err = models.GetChanceCollect(header.UserId, request.LastId, request.PageSize, &myChances); err != nil {
if err == orm.ErrNoRows {
err = nil
... ... @@ -1624,7 +1632,15 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp
myChances []protocol.ChanceThumbUpItemOrm
total int
provider *protocol.BaseUserInfo
favorite *models.ChanceFavorite
)
if request.LastId > 0 {
if favorite, err = models.GetChanceFavoriteById(request.LastId); err != nil {
log.Error("不存在", request.LastId, err)
return
}
request.LastId = favorite.ZanTime.Unix()
}
if total, err = models.GetChanceThumbUp(header.UserId, request.LastId, request.PageSize, &myChances); err != nil {
if err == orm.ErrNoRows {
err = nil
... ...