| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\admin\controller\service;
- use app\common\controller\Backend;
- use think\Db;
- /**
- * 商品sku管理
- *
- * @icon fa fa-circle-o
- */
- class Packagesku extends Backend
- {
- /**
- * Packagesku模型对象
- * @var \app\admin\model\service\Packagesku
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\service\Packagesku;
- $this->view->assign("typeList", $this->model->getTypeList());
- $this->view->assign("statusList", $this->model->getStatusList());
- }
- public function index()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if (false === $this->request->isAjax()) {
- return $this->view->fetch();
- }
- //如果发送的来源是 Selectpage,则转发到 Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- [$where, $sort, $order, $offset, $limit] = $this->buildparams();
- $list = $this->model
- ->where($where)
- ->where('type',1)
- ->where('status','normal')
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as &$val)
- {
- $val->goodsname = \app\admin\model\service\Goods::where('id',$val->goods_id)->value('name');
- }
- $result = ['total' => $list->total(), 'rows' => $list->items()];
- return json($result);
- }
- }
|