| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace ghs\controllers;
- use bizGhs\custom\classes\CustomClass;
- use bizGhs\custom\classes\CustomDebtChangeClass;
- use common\components\dateUtil;
- use common\components\dict;
- use common\components\util;
- use Yii;
- class CustomDebtChangeController extends BaseController
- {
- public $guestAccess = [];
- //欠款变动明细
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $export = $get['export'] ?? 0;
- $where = [];
- $shopId = $this->shopId;
- $where['shopId'] = $shopId;
- $customId = $get['customId'] ?? 0;
- if (!empty($customId)) {
- $where['customId'] = $customId;
- }
- $searchTime = $get['searchTime'] ?? '';
- if (!empty($searchTime)) {
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
- $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
- } else {
- if ($export == 1) {
- util::fail('请选择时间');
- }
- }
- if ($export == 1) {
- ini_set('memory_limit', '2045M');
- set_time_limit(0);
- if (isset($where['addTime']) == false) {
- util::fail('请选时间段');
- }
- $start = $where['addTime'][1][0];
- $end = $where['addTime'][1][1];
- $monthTime = bcmul(31, 86400);
- $startArea = strtotime($start);
- $endArea = strtotime($end);
- $diff = bcsub($endArea, $startArea);
- if ($diff > $monthTime) {
- util::fail('最长可导出一个月');
- }
- }
- $respond = CustomDebtChangeClass::getChangeList($where);
- if ($export == 1) {
- CustomDebtChangeClass::exportData($respond, $this->mainId);
- }
- util::success($respond);
- }
- }
|