DelayLogController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace addons\CloudStock\backend\controllers;
  3. use addons\CloudStock\common\models\CloudStockDelayLog;
  4. use Yii;
  5. class DelayLogController extends BaseController
  6. {
  7. public function actionIndex() {
  8. $request = Yii::$app->request;
  9. if ($request->isAjax) {
  10. $search = $request->get();
  11. // 检查提交的参数
  12. if (!Yii::$app->services->validate->validate($search, [
  13. [['keyword', 'order_no', 'capital_type', 'date_start', 'date_end'], 'string'],
  14. [['status'], 'safe'],
  15. [['user_id', 'page'], 'integer'],
  16. ])) {
  17. return $this->error(Yii::$app->services->validate->getErrorMessage());
  18. }
  19. $where = [['=', 'mall_id', $this->mall_id]];
  20. !empty($search['keyword']) && $where[] = ['or', ['like', 'wallet_desc', $search['keyword']], ['like', 'contributor_name', $search['keyword']]];
  21. !empty($search['user_id']) && $where[] = ['user_id' => $search['user_id']];
  22. !empty($search['order_no']) && $where[] = ['order_no' => $search['order_no']];
  23. isset($search['status']) && $search['status'] != '' && $where[] = ['status' => $search['status']];
  24. !empty($search['date_start']) && $where[] = ['>=', 'created_at', strtotime($search['date_start'])];
  25. !empty($search['date_end']) && $where[] = ['<=', 'created_at', strtotime($search['date_end'])];
  26. !empty($search['capital_type']) && $where[] = ['capital_type' => $search['capital_type']];
  27. $result = CloudStockDelayLog::listPage(['where' => $where, 'page' => $search['page'], 'with' => ['user'], 'limit' => $this->pageSize, 'order' => 'id desc']);
  28. if (!$result) return $this->error(CloudStockDelayLog::getStaticError());
  29. return $this->success('获取延时结算列表成功', $result);
  30. }
  31. return $this->render('index');
  32. }
  33. }