Commit e17e7658 by huangchengyi

1.0

parent 82129546
The file could not be displayed because it is too large.
......@@ -25,7 +25,12 @@ func GetGoodsInfo(ctx *gin.Context,goodsIds []string) (goodsList []model.ApiGood
"power[newCustomer]": isNewCustomer,
"power[member]": isMember,
}
common.PrintDebugHtml(ctx,params)
goodsList, _, err = CurlGoodsInfo(ctx,goodsIdsStr, params)
common.PrintDebugHtml(ctx,goodsList)
return
}
......
......@@ -73,6 +73,7 @@ eg:
https://ichunt.com/optimum-9987_1.html?ev=brand_12042^2660_128036||128037
class_id2=9987 page=1 ev:属性id+属性值id
doc: https://www.tapd.cn/20210831/markdown_wikis/show/#1120210831001000440
*/
func (qs *OptimumService) GetOptimumAttr(ctx *gin.Context) (results model.LyResponse) {
qs.getQueryAttr(ctx)
......@@ -159,7 +160,7 @@ func (qs *OptimumService) GetOptimumAttr(ctx *gin.Context) (results model.LyResp
}
A.Set("aggs",aggs)
results.Data = aggs
results.Data = A
return
}
......@@ -197,9 +198,9 @@ func (qs *OptimumService) GetOptimumAttrInfo(ctx *gin.Context) (results model.Ly
A := orderedmap.New() //初始化有序map,拼接data 数据
results.ErrorCode = 0;
results.ErrorMsg = "查询成功";
page := PageClear(ctx,10,total);
page := PageClear(ctx,total);
page["took"] = gjson.Get(esResult, "took").Int()
A.Set("page_data",page) //分页信息
A.Set("page",page) //分页信息
//aggs := orderedmap.New() //拼接aggs
common.PrintDebugHtml(ctx,goodsIds)
......@@ -237,39 +238,29 @@ func (qs *OptimumService) GetOptimumAttrInfo(ctx *gin.Context) (results model.Ly
}
//處理分頁信息
func PageClear(ctx *gin.Context,pagesize int64,hitsTotal int64) map[string]interface{}{
totalPage := math.Ceil(float64(hitsTotal)/float64(pagesize))
var (
total int64
offsetInt int
err error
)
func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
page_size := ctx.Request.FormValue("page_size")
if page_size == "" {
page_size = "10";
}
totalPage := math.Ceil(float64(total)/common.MyFloat64(page_size))
page := make(map[string]interface{},0)
if totalPage > 1{
if hitsTotal > 10000 {
if total > 10000 {
total = 10000
}else{
total = hitsTotal
}
page := make(map[string]interface{},0)
if totalPage > 1{
p := ctx.Request.FormValue("page")
if p == ""{
p = "1"
}
offset := ctx.Request.FormValue("offset")
offsetInt, err = strconv.Atoi(offset)
if err == nil && offsetInt > 0{
offset = strconv.FormatInt(int64(offsetInt),10)
}else{
offsetInt = 10
offset = "10"
}
//如果是自营同步输出
//自定義分頁
page["orgin_search"] = REQUEST
page["total"] = strconv.FormatInt(total,10)
page["current_page"] = p
page["offset"] = offset
page["offset"] = page_size
if totalPage > 1000{
page["total_page"] = "1000"
}else{
......@@ -277,6 +268,8 @@ func PageClear(ctx *gin.Context,pagesize int64,hitsTotal int64) map[string]inter
}
pageData := make(map[int]int,0)
pInt := int(1)
var err error
pInt, err = strconv.Atoi(p)
if err != nil{
pInt = int(1)
......@@ -308,7 +301,9 @@ func PageClear(ctx *gin.Context,pagesize int64,hitsTotal int64) map[string]inter
}
page["page_data"] = common.MapSort(pageData)
}else{
page["total"] = 1
page["total"] = total
page["total_page"] = totalPage
page["page_data"] = ""
}
return page
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment