作者 yangfu

基础路由修改

... ... @@ -2,6 +2,7 @@ package models
import (
"fmt"
"opp/internal/utils"
"time"
"github.com/astaxie/beego/orm"
... ... @@ -88,3 +89,29 @@ func DeleteChance(id int64) (err error) {
}
return
}
//我的机会列表
func GetChanceMyChance(uid, cid int64, reviewStatus int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
sql := `select a.*,b.images,speechs,videos
from (
select id,user_id,create_at,source_content from chance
where user_id=? and company_id=? and review_status =? and (?=0 or id>?)
order by create_at desc
limit ?
) a left JOIN chance_data b on a.id =b.chance_id`
sqlCount := `select count(0) from (
select id,user_id,create_at,source_content from chance
where user_id=? and company_id=? and review_status =?
order by create_at desc
) a left JOIN chance_data b on a.id =b.chance_id`
if err = utils.ExecuteQueryOne(&total, sqlCount, uid, cid, reviewStatus); err != nil {
return
}
if v != nil {
if err = utils.ExecuteQueryAll(v, sql, uid, cid, reviewStatus, lastId, lastId, pageSize); err != nil {
return
}
}
return
}
... ...
... ... @@ -165,7 +165,6 @@ type ChanceTotalItem struct {
/*MyChance 我的机会*/
type MyChanceRequest struct {
Xxx string `json:"xxx" valid:"Required"`
}
type MyChanceResponse struct {
}
... ...
... ... @@ -215,7 +215,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)
userAuth.RefreshTokenExp = time.Now().Add(protocol.TokenExpire * time.Second * 2)
if err = models.UpdateUserAuthById(userAuth); err != nil {
log.Error(err)
return
... ... @@ -244,7 +244,11 @@ func RefreshToken(request *protocol.RefreshTokenRequest) (rsp *protocol.RefreshT
protocol.NewErrWithMessage(4139, err)
return
}
//userAuth.AccessToken = uid.NewV1().StringNoDash()
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)
if err = models.UpdateUserAuthById(userAuth); err != nil {
return
}
... ...