| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace app\modules\client\controllers\v1;
- use app\modules\client\controllers\BaseController;
- use app\modules\client\models\v1\QAndAForm;
- use app\modules\client\models\v1\QuestionTemplateListForm;
- class QuestionTemplateController extends BaseController
- {
- public function behaviors()
- {
- return parent::behaviors();
- }
- public function actionIndex()
- {
- $form = new QuestionTemplateListForm();
- $form->attributes = post_params();
- $form->user = get_user();
- return $this->asJson($form->index());
- }
- /**
- * 列表
- */
- public function actionList()
- {
- $form = new QuestionTemplateListForm();
- $form->attributes = get_params();
- return $this->asJson($form->list());
- }
- /**
- * 获取热门问答
- */
- public function actionHotList()
- {
- $form = new QuestionTemplateListForm();
- $form->attributes = get_params();
- return $this->asJson($form->hot_list());
- }
- /**
- * 获取模版页列表
- */
- public function actionTemplateList($id = null)
- {
- $form = new QuestionTemplateListForm();
- $form->attributes = get_params();
- return $this->asJson($form->template_list());
- }
- /**
- * 提问
- */
- public function actionQuestion()
- {
- $form = new QAndAForm();
- $form->attributes = post_params();
- $form->user = get_user();
- return $this->asJson($form->save());
- }
- public function actionQuestionList()
- {
- $form = new QuestionTemplateListForm();
- $form->attributes = get_params();
- $form->user = get_user();
- return $this->asJson($form->question_list());
- }
- public function actionDelQuestion()
- {
- $form = new QuestionTemplateListForm();
- $id = post_params('id');
- return $this->asJson($form->del_question($id));
- }
- public function actionAddIntegral()
- {
- $form = new QuestionTemplateListForm();
- return $this->asJson($form->add_integral());
- }
- }
|