|
@@ -84,14 +84,14 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
if !isSqlPage {
|
|
|
total = len(resultList)
|
|
|
if total > req.PageSize {
|
|
|
+ hasNextPage = true
|
|
|
start := (req.PageNum - 1) * req.PageSize
|
|
|
- end := start + req.PageSize
|
|
|
- if req.PageNum > 1 {
|
|
|
- resultList = resultList[start:end]
|
|
|
- } else {
|
|
|
- resultList = resultList[:req.PageSize]
|
|
|
+ end := req.PageNum * req.PageSize
|
|
|
+ if end > total {
|
|
|
+ end = total
|
|
|
+ hasNextPage = false
|
|
|
}
|
|
|
- hasNextPage = true
|
|
|
+ resultList = resultList[start:end]
|
|
|
} else {
|
|
|
hasNextPage = false
|
|
|
}
|
|
@@ -279,24 +279,26 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
|
|
|
}
|
|
|
}
|
|
|
countMap := make(map[string]int)
|
|
|
- str1, arr1 := common.WhArgs(buyerIds)
|
|
|
- info1, err := T.ClickhouseConn.Query(context.TODO(), fmt.Sprintf(sql_1, str1), arr1...)
|
|
|
- if err == nil {
|
|
|
- for info1.Next() {
|
|
|
- var buyerId string
|
|
|
- var count uint64
|
|
|
- _ = info1.Scan(&buyerId, &count)
|
|
|
- countMap[buyerId] = int(count)
|
|
|
- }
|
|
|
- }
|
|
|
- info2 := T.CrmMysql.SelectBySql(fmt.Sprintf(sql_3, str1), arr1...)
|
|
|
connMap := make(map[string]int)
|
|
|
- if info2 != nil && len(*info2) > 0 {
|
|
|
- for _, m := range *info2 {
|
|
|
- if req.PositionId == common.Int64All(m["position_id"]) {
|
|
|
- connMap[common.ObjToString(m["company_id"])] = 1 // 我的人脉
|
|
|
- } else {
|
|
|
- connMap[common.ObjToString(m["company_id"])] = 2
|
|
|
+ if buyerIds != nil && len(buyerIds) > 0 {
|
|
|
+ str1, arr1 := common.WhArgs(buyerIds)
|
|
|
+ info1, err := T.ClickhouseConn.Query(context.TODO(), fmt.Sprintf(sql_1, str1), arr1...)
|
|
|
+ if err == nil {
|
|
|
+ for info1.Next() {
|
|
|
+ var buyerId string
|
|
|
+ var count uint64
|
|
|
+ _ = info1.Scan(&buyerId, &count)
|
|
|
+ countMap[buyerId] = int(count)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info2 := T.CrmMysql.SelectBySql(fmt.Sprintf(sql_3, str1), arr1...)
|
|
|
+ if info2 != nil && len(*info2) > 0 {
|
|
|
+ for _, m := range *info2 {
|
|
|
+ if req.PositionId == common.Int64All(m["position_id"]) {
|
|
|
+ connMap[common.ObjToString(m["company_id"])] = 1 // 我的人脉
|
|
|
+ } else {
|
|
|
+ connMap[common.ObjToString(m["company_id"])] = 2
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|