ListclassnevController.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 201901
  5. * Date: 2020/3/3
  6. * Time: 15:01
  7. */
  8. namespace backend\controllers;
  9. use backend\base\CommonController;
  10. use backend\server\Listclassnevserver;
  11. use backend\base\Help;
  12. use Yii;
  13. class ListclassnevController extends CommonController
  14. {
  15. /*
  16. * 2020.9.9 lyy 近日头条
  17. * */
  18. public function actionDaytoutiao()
  19. {
  20. return $this->render('daytoutiaoindex');
  21. }
  22. /*
  23. * 近日头条栏目添加页面
  24. * */
  25. public function actionDaytoutiaoadd()
  26. {
  27. return $this->render('daytoutiaoadd');
  28. }
  29. /*
  30. * 近日头条栏目修改页面
  31. * */
  32. public function actionDaytoutiaoedit()
  33. {
  34. $id = Yii::$app->request->get('id');
  35. $server = new Listclassnevserver();
  36. $data = $server->getFindOne($id);
  37. return $this->render('daytoutiaoedit',['data'=>$data]);
  38. }
  39. public function actionDaytoutiaoform()
  40. {
  41. $input = Yii::$app->request->post();
  42. $input['type'] = 1; //近日头条栏目类别 1 ;
  43. $server = new Listclassnevserver();
  44. $data = $server->getClassNevData($input);
  45. if ($data === false) return Help::JsonCode(Help::ERROR, '参数有误,请联系管理员咨询');
  46. return Help::JsonData(0, '获取成功', $data['count'], $data['data']);
  47. }
  48. public function actionDaytoutiaoaddform()
  49. {
  50. $input = Yii::$app->request->post();
  51. $input['type'] = 1;
  52. $server = new Listclassnevserver();
  53. $data = $server->addDayToutiao($input);
  54. if ($data) return Help::JsonCode(Help::SUCCESS, '添加成功');
  55. return Help::JsonCode(Help::ERROR, '添加失败');
  56. }
  57. public function actionDaytoutiaoeditform()
  58. {
  59. $input = Yii::$app->request->post();
  60. $server = new Listclassnevserver();
  61. $data = $server->editDayToutiao($input);
  62. if ($data) return Help::JsonCode(Help::SUCCESS, '编辑成功');
  63. return Help::JsonCode(Help::ERROR, '编辑失败');
  64. }
  65. public function actionDaytoutiaoset()
  66. {
  67. $input = Yii::$app->request->post();
  68. $server = new Listclassnevserver();
  69. $data = $server->setDayToutiao($input);
  70. if($data) return Help::JsonCode(Help::SUCCESS,'操作成功');
  71. return Help::JsonCode(Help::ERROR,'操作失败');
  72. }
  73. }