...
|
...
|
@@ -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
|
|
|
} |
...
|
...
|
|