IndexpushController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: LYY
  5. * Date: 2020/10/21
  6. * Time: 15:01
  7. */
  8. namespace backend\controllers\listnews;
  9. use Yii;
  10. use backend\base\CommonController;
  11. use backend\base\Help;
  12. use backend\server\ListnewsServer;
  13. class IndexpushController extends CommonController
  14. {
  15. //数据设置
  16. public function actionSet()
  17. {
  18. $server = new ListnewsServer();
  19. $state = $server->setList();
  20. return Help::JsonCode($state['code'], $state['msg']);
  21. }
  22. //咨询推荐位-------------------------------------------------------------------------------------------------
  23. public function actionOnepushnews()
  24. {
  25. $list_id = Yii::$app->request->get('list_id');
  26. return $this->render('onepushnews',['list_id'=>$list_id]);
  27. }
  28. //获取数据
  29. public function actionOnepushnewsform()
  30. {
  31. $server = new ListnewsServer();
  32. $state = $server->getListNews();
  33. return Help::JsonData(0, $state['msg'], $state['count'], $state['data']);
  34. }
  35. //添加数据
  36. public function actionOnepushnewsadd()
  37. {
  38. $list_id = Yii::$app->request->get('list_id');
  39. return $this->render('onepushnewsadd',['list_id'=>$list_id]);
  40. }
  41. //数据
  42. public function actionOnepushnewsaddform()
  43. {
  44. $server = new ListnewsServer();
  45. //------------------数据验证----------------------
  46. $state = $server->varcherListInfo();
  47. if ($state['code'] == 200) {
  48. $state = $server->addListNews();
  49. }
  50. return Help::JsonCode($state['code'], $state['msg']);
  51. }
  52. }