44 行
1.2 KiB
PHP
44 行
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\shopro\split;
|
|
|
|
use app\admin\controller\shopro\Base;
|
|
|
|
class Rule extends Base
|
|
{
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \addons\shopro\model\split\Rule;
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->request->filter(['strip_tags']);
|
|
if ($this->request->isAjax()) {
|
|
list($where, $sort, $order, $offset, $limit) = $this->custombuildparams();
|
|
$total = $this->model->where($where)->count();
|
|
$list = $this->model->where($where)->order('priority desc,id desc')->limit($offset, $limit)->select();
|
|
return $this->success('操作成功', null, ['total' => $total, 'rows' => $list]);
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
public function edit($ids = null)
|
|
{
|
|
$row = $this->model->get($ids);
|
|
if (!$row) {
|
|
$this->error('记录不存在');
|
|
}
|
|
if ($this->request->isPost()) {
|
|
$params = $this->request->post('row/a');
|
|
$row->save($params);
|
|
$this->success('保存成功');
|
|
}
|
|
$this->view->assign('row', $row);
|
|
return $this->view->fetch();
|
|
}
|
|
}
|