DaytoutiaoController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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\Daytoutiaoserver;
  11. use backend\server\Listclassnevserver;
  12. use backend\base\Help;
  13. use Yii;
  14. class DaytoutiaoController extends CommonController
  15. {
  16. /*
  17. * 今日头条报名列表也
  18. * */
  19. public function actionDaytoutiaoindex()
  20. {
  21. $server = new Listclassnevserver();
  22. $data = $server->getClassNevList(1, ['id', 'day_title']);
  23. return $this->render('daytoutiaoindex', ['data' => $data]);
  24. }
  25. /*
  26. * 添加报名
  27. * */
  28. public function actionDaytoutiaoadd()
  29. {
  30. $server = new Listclassnevserver();
  31. $data = $server->getClassNevList(1, ['id', 'day_title']);
  32. return $this->render('daytoutiaoadd', ['data' => $data]);
  33. }
  34. /*
  35. * 编辑
  36. * */
  37. public function actionDaytoutiaoedit()
  38. {
  39. $id = Yii::$app->request->get('id');
  40. $server = new Listclassnevserver();
  41. $lanmu = $server->getClassNevList(1, ['id', 'day_title']);
  42. $data = \common\models\DayToutiao::findOne($id);
  43. return $this->render('daytoutiaoedit', ['lanmu' => $lanmu, 'data' => $data]);
  44. }
  45. /*
  46. * 获取头条报名列表数据
  47. * */
  48. public function actionDaytoutiaoform()
  49. {
  50. $input = Yii::$app->request->post();
  51. $server = new Daytoutiaoserver();
  52. $data = $server->getList($input);
  53. if (!$data) return Help::JsonCode(Help::ERROR, '获取数据失败');
  54. return Help::JsonData(0, '获取数据成功', $data['count'], $data['data']);
  55. }
  56. /*
  57. * 处理编辑数据
  58. * */
  59. public function actionDaytoutiaoeditform()
  60. {
  61. $input = Yii::$app->request->post();
  62. $server = new Daytoutiaoserver();
  63. $data = $server->editData($input);
  64. if(!$data) return Help::JsonCode(Help::ERROR,'添加失败');
  65. return Help::JsonCode(Help::SUCCESS,$data);
  66. }
  67. /*
  68. * 报名数据添加
  69. * */
  70. public function actionDaytoutiaoaddform()
  71. {
  72. $input = Yii::$app->request->post();
  73. $server = new Daytoutiaoserver();
  74. $data = $server->addList($input);
  75. return Help::JsonCode(Help::SUCCESS, $data);
  76. }
  77. /*
  78. * 重新发送
  79. * */
  80. public function actionDaytoutiaoanewsend()
  81. {
  82. $id = Yii::$app->request->post('id');
  83. $server = new Daytoutiaoserver();
  84. $data = $server->anewSend($id);
  85. return Help::JsonCode(Help::SUCCESS, $data);
  86. }
  87. /*
  88. * 删除
  89. * */
  90. public function actionDaytoutiaodel()
  91. {
  92. $id = Yii::$app->request->post('id');
  93. $server = new Daytoutiaoserver();
  94. $data = $server->delOne($id);
  95. if ($data) return Help::JsonCode(Help::SUCCESS, '删除成功');
  96. return Help::JsonCode(Help::ERROR, '删除失败');
  97. }
  98. /*
  99. * 设为无效
  100. * */
  101. public function actionDaytoutiaosetwx()
  102. {
  103. $did = Yii::$app->request->post('did');
  104. $server = new Daytoutiaoserver();
  105. $data = $server->setWx($did);
  106. if ($data) return Help::JsonCode(Help::SUCCESS, '设置完成');
  107. return Help::JsonCode(Help::ERROR, '设置失败');
  108. }
  109. }