123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- /**
- * Created by PhpStorm.
- * User: shensong
- * Date: 2023/7/21
- * Time: 14:10
- */
- namespace App\Console\Repair;
- use App\Log;
- use App\Models\OfficialWebUserActionSetId;
- use App\Service\PitcherService;
- use Illuminate\Console\Command;
- class RepairReportData extends Command
- {
- protected $signature = 'RepairReportData';
- protected $description = '处理历史账号回传配置';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- \DB::connection()->disableQueryLog();
- parent::__construct();
- }
- public function handle() {
- try{
- # 查询已开启回传配置的账号列表
- $confList = OfficialWebUserActionSetId::query()->get();
- foreach($confList as $conf) {
- $amountSetVale = json_decode($conf->amount_setvale, 1);
- if(empty($amountSetVale)) {
- continue;
- }
- foreach($amountSetVale as $setvale) {
- $newAmountSetVale = [];
- if(!isset($setvale['miss_setvale']) || !isset($setvale['miss_value'])) {
- continue;
- }
- switch($setvale['type']) {
- case 1:
- case 2:
- $newAmountSetVale[] = [
- 'start_amount' => $setvale['start_amount'],
- 'end_amount' => $setvale['end_amount'],
- 'type' => $setvale['type'],
- 'hour_setvale' => [],
- ];
- break;
- case 3:
- $newAmountSetVale[] = [
- 'start_amount' => $setvale['start_amount'],
- 'end_amount' => $setvale['end_amount'],
- 'type' => $setvale['type'],
- 'hour_setvale' => [
- [
- 'start_time' => '00:00',
- 'end_time' => '23:59',
- 'return_type'=> 3,
- 'miss_setvale'=>$setvale['miss_setvale'],
- 'miss_value' => $setvale['miss_value']
- ]
- ]
- ];
- break;
- }
- PitcherService::setAdqAccountReportRule([$conf->account_id], $conf->report_type, $conf->enable,
- $conf->purchase_enable, $conf->miss_enable, $conf->miss_setvale, $conf->sys_group_id, $conf->miss_value
- , 0, $conf->amount_enable, $newAmountSetVale, $conf->reset_enable, $conf->reset_setvale);
- }
- }
- } catch (\Exception $e) {
- $this->error('file:'.$e->getFile().' # line:'.$e->getLine().' # message:'.$e->getMessage());
- Log::logError('处理历史账号回传配置异常', [
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'message'=>$e->getMessage(),
- 'trace'=> $e->getTraceAsString()
- ], 'RepairReportDataError');
- }
- }
- }
|