www.maiwd.cn // +---------------------------------------------------------------------- namespace app\api\controller\wdsxh; use app\common\controller\Api; class Faq extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; protected $model = null; public function _initialize() { parent::_initialize(); $this->model = new \app\api\model\wdsxh\Faq(); } /** * Desc 常见问题列表 * Create on 2024/3/13 15:57 * Create by @小趴菜 */ public function index(){ $param = $this->request->param(); $page = isset($param['page']) ? $param['page'] : ''; $limit = isset($param['limit']) ? $param['limit'] : 10; $where = []; $where['status'] = array('eq',1); $total = $this->model->where($where)->count(); $data = $this->model ->where($where) ->field('id,title') ->page($page,$limit) ->order('weigh desc,createtime desc') ->select(); $this->success('请求成功',['total' => $total,'data' => $data]); } /** * Desc 常见问题详情 * Create on 2024/3/13 16:10 * Create by @小趴菜 */ public function details(){ $param = $this->request->param(); $where = []; $where['id'] = array('eq',$param['id']); $data = $this->model ->where($where) ->field('id,title,reply') ->find(); $this->success('请求成功',$data); } }