| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace addons\Store\client\controllers;
- use addons\JoinPay\common\global_func\payment_logic\JoinPayFastPay;
- use addons\JoinPay\common\models\JoinPayUserBankcard;
- use addons\Store\common\models\Store;
- use addons\Store\common\models\StoreBank;
- use addons\Store\common\models\StoreCashierOrder;
- use addons\Store\common\models\StoreCommission;
- use addons\Store\common\models\StoreCommissionCheck;
- use addons\Store\common\models\StoreSettings;
- use addons\Store\common\models\StoreStatistics;
- use addons\Store\common\models\StoreWithdrawLog;
- use Cassandra\Date;
- use common\enums\AddonsEnum;
- use common\enums\ApiStatusEnum;
- use common\enums\StatusEnum;
- use common\enums\UserWalletEnum;
- use common\helpers\ArrayHelper;
- use common\helpers\BankCardHelper;
- use common\helpers\StringHelper;
- use common\models\common\UserBankCard;
- use common\models\mall\MallAddons;
- use common\models\user\User;
- use common\models\user\UserWithdrawLog;
- use services\common\UserWalletService;
- use addons\Store\common\enums\StoreEnum;
- use addons\Store\common\services\StoreFinanceService;
- use common\enums\DownloadEnum;
- use common\globals\GlobalInvoke;
- use common\enums\WithdrawWayEnum;
- use common\helpers\csv\CsvExportHelper;
- use common\models\common\PlatformSetting;
- use Exception;
- use Yii;
- use yii\helpers\Json;
- class StoreFinanceController extends BaseController
- {
- public function actionIndex()
- {
- $request = Yii::$app->request;
- if ($request->isAjax) {
- try {
- if ($request->isGet) {
- $get = $request->get();
- $res = Yii::$app->services->validate->validate($get, [
- [['page', 'limit'], 'integer'],
- [['keyword', 'goods_keyword', 'tabname'], 'string'],
- [['date'], 'safe'],
- ]);
- if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage());
- $get['store_id'] = $this->store_id;
- $list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->getClientFinanceData($get);
- if ($get['tabname'] == 'order-detail') {
- $export_list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->storeFinanceDetailFieldList();
- } else if ($get['tabname'] == 'cashier') {
- $export_list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->cashierFinanceDetailFieldList();
- }
- $list['export_list'] = $export_list;
- return $this->success('获取成功', $list);
- }
- if ($request->isPost) {
- if (\Yii::$app->request->post('flag') == 'EXPORT') {
- $post = \Yii::$app->request->post();
- $post['mall_id'] = $this->mall_id;
- $post['store_id'] = $this->store_id;
- $filename = 'o2o门店财务明细-' . date('YmdHis') . '_' . rand(10000, 99999);
- $func_model = 'exportStoreFinanceData';
- if ($post['tabname'] == 'cashier') {
- $func_model = 'exportCashierFinanceData';
- }
- $res = CsvExportHelper::exportDownLoadCenter($this->mall_id, $filename, DownloadEnum::TYPE_STORE_FINANCE, StoreFinanceService::class, $func_model, $post, 0, $this->store_id);
- if ($res === false) return $this->error('加入导出任务失败' . CsvExportHelper::getStaticError());
- return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!');
- }
- }
- } catch (\Exception $e) {
- return $this->error($e->getMessage());
- }
- }
- return $this->render($this->action->id);
- }
- public function actionGetStoreStatics()
- {
- $request = Yii::$app->request;
- if ($request->isAjax && $request->isGet) {
- try {
- $get = $request->get();
- $res = Yii::$app->services->validate->validate($get, [
- [['store_id'], 'integer'],
- [['date'], 'safe'],
- ]);
- if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage());
- $get['store_id'] = $this->store_id;
- $info = (new StoreFinanceService(['mall_id' => $this->mall_id]))->getStoreStatics($get);
- return $this->success('获取成功', $info);
- } catch (\Exception $e) {
- return $this->error($e->getMessage());
- }
- }
- }
- }
|