| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace addons\QiShangTong\backend\controllers;
- use addons\QiShangTong\common\service\NoticeService;
- use Yii;
- class NoticeController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- if (\Yii::$app->request->isAjax && \Yii::$app->request->isGet) {
- $data = Yii::$app->request->get();
- $valid = Yii::$app->services->validate->validate($data, [
- [['limit', 'page'], 'integer'],
- [['keyword', 'type'], 'string'],
- ]);
- if ($valid === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $ret = (new NoticeService())->page($this->mall_id, $data);
- return is_string($ret) ? $this->error($ret) : $this->success('获取成功', $ret);
- }
- return $this->render('index',[]);
- }
- public function actionCompensate()
- {
- if (\Yii::$app->request->isAjax && \Yii::$app->request->isGet) {
- $data = Yii::$app->request->get();
- $valid = Yii::$app->services->validate->validate($data, [
- [['id'], 'integer'],
- [['id'], 'required'],
- ]);
- if ($valid === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $ret = (new NoticeService())->compensate($this->mall_id, $data['id']);
- return is_string($ret) ? $this->error($ret) : $this->success('操作成功', $ret);
- }
- }
- }
|