| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace backend\modules\admin\controllers;
- use backend\controllers\AdminController;
- use common\enums\PayTypeEnum;
- use common\enums\platform\PlatformEnum;
- use common\enums\StatusEnum;
- use common\models\addons\AddonsOrder;
- use common\models\backend\Admin;
- use common\models\common\PlatformSetting;
- use common\models\finance\PlatformFinanceLog;
- use common\models\mall\Mall;
- use common\models\platform\PlatformFinanceDay;
- use common\models\platform\PlatformOrder;
- use Yii;
- /**
- *
- * 商城控制器
- * @Author ltm
- * @DateTime 2021-08-13 15:29:41
- * @copyright: Copyright (c) 2020 广东七件事集团
- */
- class FinanceController extends AdminController
- {
- public function actionIndex($keyword = null, $is_recycle = 0)
- {
- $retuest = Yii::$app->request;
- if ($retuest->isAjax) {
- if ($retuest->isPost) {
- $post = Yii::$app->request->post();
- // 检查提交的参数
- $res = Yii::$app->services->validate->validate($post,[
- [['id','level'], 'integer'],
- [['out_trade_no','date_end','date_start'], 'safe'],
- [['limit'],'default','value' => '15'],
- ]);
- if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $post = PlatformFinanceLog::exceptNullVal($post);
- if($post['date_start'] && $post['date_end']) $where[] = ['between', 'created_at', strtotime($post['date_start']),strtotime($post['date_end'])];
- if($post['out_trade_no']) $where[] = ['like', 'out_trade_no', $post['out_trade_no']];
- $where[] = ['>=','status',StatusEnum::DISABLED];
- $order = 'id desc';
- $params = array('where' => $where, 'order'=>$order, 'limit' => $post['limit']);
- $list = PlatformFinanceLog::listPage($params, false, true);
- $select = 'sum(add_money) as add_money,sum(sub_money) as sub_money';
- $statics = PlatformFinanceDay::getOne('',true,'','id desc',$select);
- $list['statistics'] = $statics;
- $list['change_type'] = PlatformEnum::getChangeTypeMap();
- $list['from_type'] = PlatformEnum::getFromTypeMap();
- $list['payment_type'] = PayTypeEnum::getMap();
- $this->success('获取成功', $list);
- }
- } else {
- return $this->render($this->action->id);
- }
- }
- }
|