| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace ghs\controllers;
- use bizGhs\shop\classes\ShopAdminClass;
- use bizGhs\stat\classes\StatKdClass;
- use common\components\util;
- use Yii;
- class StatKdController extends BaseController
- {
- //各渠道收入 ssh 20220711
- public function actionProfile()
- {
- ini_set('memory_limit', '5045M');
- set_time_limit(0);
- //查看财务的权限
- $lookMoney = ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
- if ($lookMoney == 0) {
- util::fail('无法查看');
- }
- //惠雅鲜花员工不能看收入情况
- $shopAdmin = $this->shopAdmin;
- $adminId = $shopAdmin->adminId ?? 0;
- if (in_array($adminId, [2366, 2812, 4004, 3405, 3407])) {
- util::fail('暂无权限');
- }
- $get = Yii::$app->request->get();
- $contain = $get['contain'] ?? 0;
- $return = StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
- $incomeList = $return['incomeList'];
- $staffAmountList = $return['staffAmountList'];
- $totalIncome = 0;
- if (!empty($incomeList)) {
- foreach ($incomeList as $item) {
- $amount = $item['amount'] ?? 0;
- $totalIncome = bcadd($totalIncome, $amount, 2);
- $totalIncome = floatval($totalIncome);
- }
- }
- util::success(['list' => $incomeList, 'totalIncome' => $totalIncome, 'staffAmountList' => $staffAmountList]);
- }
- }
|