1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\admin\controller\wwh;
- use app\common\controller\Backend;
- class Base extends Backend
- {
- public function _initialize()
- {
- parent::_initialize();
- $addon_config = get_addon_config("wwh");
- $switch_lang = $addon_config['switch_lang'];
- $this->assignconfig('switch_lang',$switch_lang);
- $this->view->assign('switch_lang', $switch_lang);
- }
- /**
- * 查看
- */
- public function index()
- {
- //当前是否为关联查询
- $this->relationSearch = false;
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
- //如果发送的来源是Selectpage,则转发到Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- //获取是否启用英文配置
- $addon_config = get_addon_config("wwh");
- $switch_lang = $addon_config['switch_lang'];
- if ($switch_lang == 1){
- $lang = '1,2';
- }else{
- $lang = '1';
- }
- $list = $this->model
- ->where($where)
- ->whereIn('lang',$lang)
- ->order($sort, $order)
- ->paginate($limit);
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
- }
|