1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use Think\Db;
- class Topicdongtai extends Backend
- {
-
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Topicdongtai;
- $this->view->assign("isHiddenList", $this->model->getIsHiddenList());
- $this->view->assign("isShowRealList", $this->model->getIsShowRealList());
- $this->view->assign("typeList", $this->model->getTypeList());
- $this->view->assign("auitStatusList", $this->model->getAuitStatusList());
- }
- public function import()
- {
- parent::import();
- }
-
-
-
- public function index()
- {
-
- $this->relationSearch = true;
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
-
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $list = $this->model
- ->with(['topichub','user'])
- ->where($where)
- ->where(['mt_topic_dongtai.status' => 0])
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as $row) {
-
- $row->getRelation('topichub')->visible(['name']);
- $row->getRelation('user')->visible(['nickname','mobile']);
- }
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
-
- public function del($ids = "")
- {
- if (!$this->request->isPost()) {
- $this->error(__("Invalid parameters"));
- }
- $ids = $ids ? $ids : $this->request->post("ids");
- $rs = Db::name('topic_dongtai')->where(['id' => $ids])->setField('status', 1);
- $this->success('删除成功');
- }
- }
|