返回数据格式优化
parent
a46c5c5be9
commit
84b5fcb648
|
|
@ -50,17 +50,17 @@ class Search extends Common
|
|||
SearchService::SearchAdd($this->data_post);
|
||||
|
||||
// 获取数据
|
||||
$result = SearchService::GoodsList($this->data_post);
|
||||
$ret = SearchService::GoodsList($this->data_post);
|
||||
|
||||
// 分类
|
||||
if(!empty($this->data_post['category_id']))
|
||||
{
|
||||
$result['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]);
|
||||
$ret['data']['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]);
|
||||
} else {
|
||||
$result['category'] = [];
|
||||
$ret['data']['category'] = [];
|
||||
}
|
||||
|
||||
return DataReturn('success', 0, $result);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -130,10 +130,11 @@ class SearchService
|
|||
$page = intval(input('page', 1));
|
||||
$n = 10;
|
||||
$m = intval(($page-1)*$n);
|
||||
$result['data'] = GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>$m, 'n'=>$n, 'order_by'=>$order_by]);
|
||||
$goods = GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>$m, 'n'=>$n, 'order_by'=>$order_by]);
|
||||
$result['data'] = $goods['data'];
|
||||
$result['page_total'] = ceil($result['total']/$n);
|
||||
}
|
||||
return $result;
|
||||
return DataReturn('处理成功', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue