123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 201901
- * Date: 2020/3/3
- * Time: 15:01
- */
- namespace backend\controllers;
- use backend\base\CommonController;
- use backend\server\Daytoutiaoserver;
- use backend\server\Listclassnevserver;
- use backend\base\Help;
- use Yii;
- class DaytoutiaoController extends CommonController
- {
- /*
- * 今日头条报名列表也
- * */
- public function actionDaytoutiaoindex()
- {
- $server = new Listclassnevserver();
- $data = $server->getClassNevList(1, ['id', 'day_title']);
- return $this->render('daytoutiaoindex', ['data' => $data]);
- }
- /*
- * 添加报名
- * */
- public function actionDaytoutiaoadd()
- {
- $server = new Listclassnevserver();
- $data = $server->getClassNevList(1, ['id', 'day_title']);
- return $this->render('daytoutiaoadd', ['data' => $data]);
- }
- /*
- * 编辑
- * */
- public function actionDaytoutiaoedit()
- {
- $id = Yii::$app->request->get('id');
- $server = new Listclassnevserver();
- $lanmu = $server->getClassNevList(1, ['id', 'day_title']);
- $data = \common\models\DayToutiao::findOne($id);
- return $this->render('daytoutiaoedit', ['lanmu' => $lanmu, 'data' => $data]);
- }
- /*
- * 获取头条报名列表数据
- * */
- public function actionDaytoutiaoform()
- {
- $input = Yii::$app->request->post();
- $server = new Daytoutiaoserver();
- $data = $server->getList($input);
- if (!$data) return Help::JsonCode(Help::ERROR, '获取数据失败');
- return Help::JsonData(0, '获取数据成功', $data['count'], $data['data']);
- }
- /*
- * 处理编辑数据
- * */
- public function actionDaytoutiaoeditform()
- {
- $input = Yii::$app->request->post();
- $server = new Daytoutiaoserver();
- $data = $server->editData($input);
- if(!$data) return Help::JsonCode(Help::ERROR,'添加失败');
- return Help::JsonCode(Help::SUCCESS,$data);
- }
- /*
- * 报名数据添加
- * */
- public function actionDaytoutiaoaddform()
- {
- $input = Yii::$app->request->post();
- $server = new Daytoutiaoserver();
- $data = $server->addList($input);
- return Help::JsonCode(Help::SUCCESS, $data);
- }
- /*
- * 重新发送
- * */
- public function actionDaytoutiaoanewsend()
- {
- $id = Yii::$app->request->post('id');
- $server = new Daytoutiaoserver();
- $data = $server->anewSend($id);
- return Help::JsonCode(Help::SUCCESS, $data);
- }
- /*
- * 删除
- * */
- public function actionDaytoutiaodel()
- {
- $id = Yii::$app->request->post('id');
- $server = new Daytoutiaoserver();
- $data = $server->delOne($id);
- if ($data) return Help::JsonCode(Help::SUCCESS, '删除成功');
- return Help::JsonCode(Help::ERROR, '删除失败');
- }
- /*
- * 设为无效
- * */
- public function actionDaytoutiaosetwx()
- {
- $did = Yii::$app->request->post('did');
- $server = new Daytoutiaoserver();
- $data = $server->setWx($did);
- if ($data) return Help::JsonCode(Help::SUCCESS, '设置完成');
- return Help::JsonCode(Help::ERROR, '设置失败');
- }
- }
|