| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace addons\Agent\backend\controllers;
- use addons\Agent\common\models\AgentDelayLog;
- use common\models\common\CapitalLog;
- 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', 'date_start', 'date_end'], 'string'],
- [['status'], 'safe'],
- [['user_id', 'page', 'limit'], 'integer'],
- ])) {
- return $this->error(Yii::$app->services->validate->getErrorMessage());
- }
- $where = [['=', 'mall_id', $this->mall_id], ['status' => [CapitalLog::STATUS_WAIT_SEND, CapitalLog::STATUS_SEND]]];
- !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'])];
- $result = AgentDelayLog::listPage(['where' => $where, 'page' => $search['page'], 'with' => ['user'], 'limit' => $this->pageSize, 'order' => 'id desc']);
- if (!$result) return $this->error(AgentDelayLog::getStaticError());
- $result['wallet_types'] = AgentDelayLog::WALLET_TYPES;
- return $this->success('获取延时结算列表成功', $result);
- }
- return $this->render('index');
- }
- }
|