| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <?php
- namespace backend\controllers;
- use common\services\xhMerchantCapitalService;
- use common\components\stringUtil;
- use common\services\xhUserUniteService;
- use common\services\xhUserAssetService;
- use common\services\xhUserAlipayService;
- use common\services\xhOrderService;
- use common\components\configDict;
- use common\components\util;
- use common\services\xhUserService;
- use common\models\xhUser;
- use common\services\xhMerchantService;
- use common\services\xhUserIntegralService;
- use Yii;
- use yii\web\Controller;
- use yii\data\Pagination;
- use common\models\xhMerchantCapital;
- use common\models\xhUserCapital;
- class CapitalController extends BackendController
- {
- /**
- * 商家的资金流水
- */
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $query = xhMerchantCapital::find();
- $query->where(['merchantId' => $this->merchantId, 'io' => 1]);
- if(isset($get['payWay']) && $get['payWay']!=-1){
- $query->andWhere(['payWay'=>$get['payWay']]);
- }
- if(isset($get['date']) && !empty($get['date'])){
- $arrDate = explode(' - ',$get['date']);
- $startTime = strtotime($arrDate[0]);
- $endTime = strtotime($arrDate[1]);
- $query->andWhere(['>=', 'addTime', $startTime]);
- $query->andWhere(['<','addTime',$endTime]);
- }
- $countQuery = clone $query;
- //总计
- $totalAmount = $countQuery->sum('amount');
- $totalCount = $countQuery->count();
- $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 50]);
- $models = $query->offset($pages->offset)->limit($pages->limit)->orderBy('addTime desc')->all();
- $payWay = configDict::getConfig('payWayName');
- $capitalTypeList = configDict::getConfig('capitalTypeList');
- return $this->render('list', ['models' => $models, 'pages' => $pages, 'payWay' => $payWay, 'capitalTypeList' => $capitalTypeList,'totalAmount'=>$totalAmount]);
- }
- public function actionBalance()
- {
- $query = xhMerchantCapital::find();
- $alipayWay = configDict::getConfig('payWay', 'alipay');
- $query->where(['merchantId' => $this->merchantId, 'affectBalance' => 1]);//查询会影响商家提现余额的流水
- $query->orderBy('id desc');
- $countQuery = clone $query;
- $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 20]);
- $models = $query->offset($pages->offset)->limit($pages->limit)->all();
- $payWay = configDict::getConfig('payWayName');
- $capitalTypeList = configDict::getConfig('capitalTypeList');
- return $this->render('balance', ['models' => $models, 'pages' => $pages, 'payWay' => $payWay, 'capitalTypeList' => $capitalTypeList]);
- }
- public function actionUser()
- {
- $get = Yii::$app->request->get();
- $userId = isset($get['id']) ? $get['id'] : 0;
- $user = xhUserService::getById($userId);
- if (empty($user) || $user['merchantId'] != $this->merchantId) {
- util::stop('出错了,请联系管理员哦');
- }
- $query = xhUserCapital::find();
- $query->where(['merchantId' => $this->merchantId, 'userId' => $userId]);
- $query->orderBy('id desc');
- $countQuery = clone $query;
- $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 20]);
- $models = $query->offset($pages->offset)->limit($pages->limit)->all();
- return $this->render('user', ['models' => $models, 'pages' => $pages, 'user' => $user]);
- }
- public function actionPaymentDetail()
- {
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : '';
- $payment = xhOrderService::getById($id);
- $payWay = configDict::getConfig('payWayFullName');
- $alipayWay = configDict::getConfig('payWay', 'alipay');
- $alipayInfo = [];
- if ($payment['payWay'] == $alipayWay) {
- $alipayId = $payment['alipayId'];
- $merchantId = $payment['merchantId'];
- $alipayInfo = xhUserAlipayService::getByIds($alipayId, $merchantId);
- }
- $userName = '游客';
- if (!empty($payment['userId'])) {
- $user = xhUserService::getById($payment['userId']);
- $userName = $user['userName'];
- }
- return $this->render('paymentDetail', ['payment' => $payment, 'userName' => $userName, 'alipayInfo' => $alipayInfo, 'payWay' => $payWay, 'alipayWay' => $alipayWay]);
- }
- public function actionOrderDetail()
- {
- return $this->render('orderDetail');
- }
- public function actionActiveOrderDetail()
- {
- return $this->render('activeOrderDetail');
- }
- public function actionCashPaymentDetail()
- {
- return $this->render('cashPaymentDetail');
- }
- public function actionDrawCash()
- {
- return $this->render('drawCash');
- }
- public function actionUserUnite()
- {
- return $this->render('userUnite');
- }
- }
|