Exemplo n.º 1
0
 public function index($params)
 {
     $this->data = array('input' => $params);
     $beforeResult = $this->beforeIndex();
     if (!is_succ_pack($beforeResult)) {
         return $beforeResult;
     }
     $model = $this->getModel();
     $serviceResult = $model->getPagedList($this->data['input']);
     if (false === $serviceResult) {
         return data_pack(get_code('FIND_DATA_FAIL'), get_lang('OPERATION_FAIL'));
     }
     $this->data['origin'] = $serviceResult;
     return $this->afterIndex();
 }
 public function index()
 {
     $valiRes = $this->runValidate();
     if (!$valiRes['result']) {
         return $this->isAjax() ? $this->ajaxReturn(get_code('PARAM_VALI_FAIL'), $valiRes['error']) : $this->showError($valiRes['error']);
     }
     $params = $this->runBefore($valiRes['data']);
     $service = $this->getService();
     $result = $service->index($params);
     if (!is_succ_pack($result)) {
         return $this->isAjax() ? $this->ajaxReturn($result) : $this->showError($result['error']);
     }
     $this->runAfter($params, $result['data']);
 }