作者 yangfu

机会池排序修改

... ... @@ -267,7 +267,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i
sql := `select a.*,b.images,speechs,videos
from (
select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1
where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or approve_time<?) and enable_status=1 and status=1
) a left JOIN chance_data b on a.id =b.chance_id
order by create_at desc
limit ?
... ... @@ -316,7 +316,7 @@ select * from (
select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
) a inner join chance b on a.chance_id = b.id
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or create_at<%v) and a.enable_status=1 and status=1
) a left JOIN chance_data b on a.id =b.chance_id
order by create_at desc
limit %v
... ... @@ -391,7 +391,7 @@ select * from (
select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
) a inner join chance b on a.chance_id = b.id
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or create_at<%v) and a.enable_status=1 and status=1
) a left JOIN chance_data b on a.id =b.chance_id
order by create_at desc
limit %v
... ... @@ -468,7 +468,7 @@ select * from (
select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
) a inner join chance b on a.chance_id = b.id
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or create_at<%v) and a.enable_status=1 and status=1
) a left JOIN chance_data b on a.id =b.chance_id
order by create_at desc
limit %v
... ... @@ -525,7 +525,7 @@ select * from (
select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
) a inner join chance b on a.chance_id = b.id
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or create_at<%v) and a.enable_status=1 and status=1
) a left JOIN chance_data b on a.id =b.chance_id
order by create_at desc
limit %v
... ...
... ... @@ -15,6 +15,7 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int,
specialDIds []int64
userDIds []int64
user *models.User
chance *models.Chance
)
if user, err = models.GetUserByCompanyId(cid); err != nil {
log.Error(err)
... ... @@ -35,6 +36,13 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int,
specialDIds = append(specialDIds, 0)
}
}
if lastId > 0 {
if chance, err = models.GetChanceById(lastId); err != nil {
log.Error("机会不存在", lastId, err)
return
}
lastId = chance.ApproveTime.Unix()
}
log.Debug(fmt.Sprintf("user:%v check:%v is_amdin:%v", uid, check, user.Id == uid))
switch check {
case OpportunityCheckLv1:
... ...