mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-07 02:12:25 +08:00
数据列表自动读取+细节优化
This commit is contained in:
@ -52,32 +52,6 @@ class GoodsParamsTemplate extends Common
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 总数
|
||||
$total = GoodsParamsService::GoodsParamsTemplateTotal($this->form_where);
|
||||
|
||||
// 分页
|
||||
$page_params = [
|
||||
'number' => $this->page_size,
|
||||
'total' => $total,
|
||||
'where' => $this->data_request,
|
||||
'page' => $this->page,
|
||||
'url' => MyUrl('admin/goodsparamstemplate/index'),
|
||||
];
|
||||
$page = new \base\Page($page_params);
|
||||
|
||||
// 获取列表
|
||||
$data_params = [
|
||||
'where' => $this->form_where,
|
||||
'm' => $page->GetPageStarNumber(),
|
||||
'n' => $this->page_size,
|
||||
'order_by' => $this->form_order_by['data'],
|
||||
];
|
||||
$ret = GoodsParamsService::GoodsParamsTemplateList($data_params);
|
||||
|
||||
// 基础参数赋值
|
||||
MyViewAssign('params', $this->data_request);
|
||||
MyViewAssign('page_html', $page->GetPageHtml());
|
||||
MyViewAssign('data_list', $ret['data']);
|
||||
return MyView();
|
||||
}
|
||||
|
||||
@ -91,29 +65,15 @@ class GoodsParamsTemplate extends Common
|
||||
*/
|
||||
public function Detail()
|
||||
{
|
||||
if(!empty($this->data_request['id']))
|
||||
{
|
||||
// 条件
|
||||
$where = [
|
||||
['id', '=', intval($this->data_request['id'])],
|
||||
];
|
||||
// 数据
|
||||
$data = $this->data_detail;
|
||||
|
||||
// 获取列表
|
||||
$data_params = [
|
||||
'm' => 0,
|
||||
'n' => 1,
|
||||
'where' => $where,
|
||||
];
|
||||
$ret = GoodsParamsService::GoodsParamsTemplateList($data_params);
|
||||
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
|
||||
MyViewAssign('data', $data);
|
||||
// 商品参数类型
|
||||
MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list'));
|
||||
|
||||
// 商品参数类型
|
||||
MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list'));
|
||||
// 参数配置
|
||||
MyViewAssign('parameters', empty($data['config_data']) ? [] : $data['config_data']);
|
||||
|
||||
// 参数配置
|
||||
MyViewAssign('parameters', empty($data['config_data']) ? [] : $data['config_data']);
|
||||
}
|
||||
return MyView();
|
||||
}
|
||||
|
||||
@ -131,19 +91,7 @@ class GoodsParamsTemplate extends Common
|
||||
$params = $this->data_request;
|
||||
|
||||
// 数据
|
||||
$data = [];
|
||||
if(!empty($params['id']))
|
||||
{
|
||||
// 获取列表
|
||||
$data_params = array(
|
||||
'm' => 0,
|
||||
'n' => 1,
|
||||
'where' => ['id'=>intval($params['id'])],
|
||||
'field' => '*',
|
||||
);
|
||||
$ret = GoodsParamsService::GoodsParamsTemplateList($data_params);
|
||||
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
|
||||
}
|
||||
$data = $this->data_detail;
|
||||
|
||||
// 商品参数类型
|
||||
MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list'));
|
||||
|
||||
Reference in New Issue
Block a user