| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace addons\Seed\backend\controllers;
- use addons\Seed\common\enums\SeedEnum;
- use addons\Seed\common\logic\SeedLogic;
- use addons\Seed\common\models\SeedCapitalStatistics;
- use addons\Seed\common\models\SeedEnergyPool;
- use addons\Seed\common\models\SeedOrder;
- use addons\Seed\common\models\SeedUser;
- use common\enums\StatusEnum;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\Seed\backend\controllers
- */
- class DefaultController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- return $this->render('index',[
- ]);
- }
- /**
- * 手动释放
- * @Author: lun
- * @DateTime: 2022/8/29 0029 16:31
- * @Copyright: copyright (c) 2021 广东七件事集团
- */
- public function actionRelease()
- {
- SeedLogic::release($this->mall_id);
- }
- /**
- * 查询数据是否正确
- * @Author: lun
- * @DateTime: 2022/8/24 0024 19:15
- * @Copyright: copyright (c) 2021 广东七件事集团
- */
- public function actionTest()
- {
- $time = time();
- // 用户统计查询
- $select = 'sum(total_seed_num) seed_num,sum(collect_seed_num) collect,sum(refund_seed_num) refund';
- $user_seed = SeedUser::find()->select($select)->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])->asArray()->one();
- $user_seed_num = $user_seed['seed_num'] ?? 0;// 统计用户种子金总数
- $user_collect = $user_seed['collect'] ?? 0;// 统计用户已收取种子金总数
- $user_refund = $user_seed['refund'] ?? 0;// 统计用户退款种子金总数
- // 统计用户未到释放时间种子金总数
- $no_release = SeedOrder::find()->where(['mall_id' => $this->mall_id, 'seed_status' => StatusEnum::ENABLED, 'status' => StatusEnum::ENABLED])->andWhere(['>','can_send_at',$time])->andWhere(['=','last_send_at',0])->sum('seed_num') ?? 0;
- // 用户冻结种子金
- $frozen_seed = SeedOrder::find()->where(['mall_id' => $this->mall_id, 'seed_status' => StatusEnum::DISABLED, 'status' => StatusEnum::ENABLED])->sum('seed_num') ?? 0;
- // 进入能量池总额
- $user_pool = SeedOrder::find()->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])->sum('join_pool_money') ?? 0;
- // 商城种子金统计信息
- $statistics = SeedCapitalStatistics::find()->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])->asArray()->one();
- // 实际释放能量池总额
- $actual_release = SeedEnergyPool::find()->where(['mall_id' => $this->mall_id, 'release_status' => 1, 'status' => StatusEnum::ENABLED])->sum("release_energy_pool") ?? 0;
- // 停止增长种子金
- $stop_seed_num = SeedOrder::find()->where(['mall_id' => $this->mall_id, 'seed_status' => SeedEnum::SEED_STOP, 'status' => StatusEnum::ENABLED])->sum("seed_num") ?? 0;
- echo "用户种子金总数:{$user_seed_num}<br>";
- echo "用户收取种子金总数:{$user_collect}<br>";
- echo "用户退款种子金总数:{$user_refund}<br>";
- echo "用户未到释放时间种子金总数:{$no_release}<br>";
- echo "用户冻结种子金总数:{$frozen_seed}<br>";
- echo "订单进入能量池总额:{$user_pool}<br>";
- echo '<br>';
- echo "种子金总数:{$statistics['total_seed_num']}<br>";
- echo "收取种子金总数:{$statistics['collect_seed_num']}<br>";
- echo "退款种子金总数:{$statistics['refund_seed_num']}<br>";
- echo "坏账(冻结)种子金总数:{$statistics['bad_seed_num']}<br>";
- echo "停止增长种子金总数:{$stop_seed_num}<br>";
- echo "可释放种子金总数:".($statistics['total_seed_num'] - $statistics['collect_seed_num'] - $statistics['refund_seed_num'] - $statistics['bad_seed_num'] - $stop_seed_num)."<br>";
- echo '<br>';
- echo "当前能量池总额:".floatval($statistics['total_energy_pool']).",理论上当前能量池:".floatval($statistics['cumulative_energy_pool'] - $actual_release)."<br>";
- echo "已释放能量池总额:".floatval($statistics['release_energy_pool']).",实际释放能量池总额:{$actual_release}<br>";
- echo "计算累计能量池总额:".floatval($statistics['total_energy_pool'] + $statistics['release_energy_pool'])."<br>";
- echo "累计能量池总额:".floatval($statistics['cumulative_energy_pool'])."<br>";
- exit;
- }
- }
|