|
@@ -81,13 +81,12 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
//if req.SaleStatus == "0" {
|
|
|
// isSqlPage = true // 是否sql分页
|
|
|
//}
|
|
|
-
|
|
|
+ countSql, findSql := getQuerySql(req, true, buyerArr, plist)
|
|
|
// 缓存
|
|
|
rkey := "projectList-" + common.GetMd5String(fmt.Sprintf("%+v", req))
|
|
|
if ret, err := redis.GetBytes("newother", rkey); err == nil {
|
|
|
err = json.Unmarshal(*ret, &resultList)
|
|
|
} else {
|
|
|
- countSql, findSql := getQuerySql(req, true, buyerArr, plist)
|
|
|
logx.Info("findSql: ", findSql)
|
|
|
logx.Info("countSql: ", countSql)
|
|
|
rows, err := T.ClickhouseConn.Query(context.TODO(), findSql)
|
|
@@ -105,26 +104,26 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
|
|
|
resultList = filterData(req, resultList, nil, mmp, true)
|
|
|
//if !isSqlPage {
|
|
|
- total = len(resultList)
|
|
|
+ //total = len(resultList)
|
|
|
+ //if total > req.PageSize {
|
|
|
+ // hasNextPage = true
|
|
|
+ // start := (req.PageNum - 1) * req.PageSize
|
|
|
+ // end := req.PageNum * req.PageSize
|
|
|
+ // if end > total {
|
|
|
+ // end = total
|
|
|
+ // hasNextPage = false
|
|
|
+ // }
|
|
|
+ // resultList = resultList[start:end]
|
|
|
+ //} else {
|
|
|
+ // hasNextPage = false
|
|
|
+ //}
|
|
|
+ //} else {
|
|
|
+ total = int(T.NetworkCom.Count(countSql))
|
|
|
if total > req.PageSize {
|
|
|
hasNextPage = true
|
|
|
- start := (req.PageNum - 1) * req.PageSize
|
|
|
- end := req.PageNum * req.PageSize
|
|
|
- if end > total {
|
|
|
- end = total
|
|
|
- hasNextPage = false
|
|
|
- }
|
|
|
- resultList = resultList[start:end]
|
|
|
} else {
|
|
|
hasNextPage = false
|
|
|
}
|
|
|
- //} else {
|
|
|
- // total = int(T.NetworkCom.Count(countSql))
|
|
|
- // if total > req.PageSize {
|
|
|
- // hasNextPage = true
|
|
|
- // } else {
|
|
|
- // hasNextPage = false
|
|
|
- // }
|
|
|
//}
|
|
|
moreInfo(req, plist, resultList) // 补充信息
|
|
|
|