| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace addons\CloudStock\backend\controllers;
- use addons\CloudStock\common\models\CloudStockDelayLog;
- use Yii;
- class DelayLogController extends BaseController
- {
- public function actionIndex() {
- $request = Yii::$app->request;
- if ($request->isAjax) {
- $search = $request->get();
- // 检查提交的参数
- if (!Yii::$app->services->validate->validate($search, [
- [['keyword', 'order_no', 'capital_type', 'date_start', 'date_end'], 'string'],
- [['status'], 'safe'],
- [['user_id', 'page'], 'integer'],
- ])) {
- return $this->error(Yii::$app->services->validate->getErrorMessage());
- }
- $where = [['=', 'mall_id', $this->mall_id]];
- !empty($search['keyword']) && $where[] = ['or', ['like', 'wallet_desc', $search['keyword']], ['like', 'contributor_name', $search['keyword']]];
- !empty($search['user_id']) && $where[] = ['user_id' => $search['user_id']];
- !empty($search['order_no']) && $where[] = ['order_no' => $search['order_no']];
- isset($search['status']) && $search['status'] != '' && $where[] = ['status' => $search['status']];
- !empty($search['date_start']) && $where[] = ['>=', 'created_at', strtotime($search['date_start'])];
- !empty($search['date_end']) && $where[] = ['<=', 'created_at', strtotime($search['date_end'])];
- !empty($search['capital_type']) && $where[] = ['capital_type' => $search['capital_type']];
- $result = CloudStockDelayLog::listPage(['where' => $where, 'page' => $search['page'], 'with' => ['user'], 'limit' => $this->pageSize, 'order' => 'id desc']);
- if (!$result) return $this->error(CloudStockDelayLog::getStaticError());
- return $this->success('获取延时结算列表成功', $result);
- }
- return $this->render('index');
- }
- }
|