企微短剧业务系统

RepairReportData.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shensong
  5. * Date: 2023/7/21
  6. * Time: 14:10
  7. */
  8. namespace App\Console\Repair;
  9. use App\Log;
  10. use App\Models\OfficialWebUserActionSetId;
  11. use App\Service\PitcherService;
  12. use Illuminate\Console\Command;
  13. class RepairReportData extends Command
  14. {
  15. protected $signature = 'RepairReportData';
  16. protected $description = '处理历史账号回传配置';
  17. /**
  18. * Create a new command instance.
  19. *
  20. * @return void
  21. */
  22. public function __construct()
  23. {
  24. \DB::connection()->disableQueryLog();
  25. parent::__construct();
  26. }
  27. public function handle() {
  28. try{
  29. # 查询已开启回传配置的账号列表
  30. $confList = OfficialWebUserActionSetId::query()->get();
  31. foreach($confList as $conf) {
  32. $amountSetVale = json_decode($conf->amount_setvale, 1);
  33. if(empty($amountSetVale)) {
  34. continue;
  35. }
  36. foreach($amountSetVale as $setvale) {
  37. $newAmountSetVale = [];
  38. if(!isset($setvale['miss_setvale']) || !isset($setvale['miss_value'])) {
  39. continue;
  40. }
  41. switch($setvale['type']) {
  42. case 1:
  43. case 2:
  44. $newAmountSetVale[] = [
  45. 'start_amount' => $setvale['start_amount'],
  46. 'end_amount' => $setvale['end_amount'],
  47. 'type' => $setvale['type'],
  48. 'hour_setvale' => [],
  49. ];
  50. break;
  51. case 3:
  52. $newAmountSetVale[] = [
  53. 'start_amount' => $setvale['start_amount'],
  54. 'end_amount' => $setvale['end_amount'],
  55. 'type' => $setvale['type'],
  56. 'hour_setvale' => [
  57. [
  58. 'start_time' => '00:00',
  59. 'end_time' => '23:59',
  60. 'return_type'=> 3,
  61. 'miss_setvale'=>$setvale['miss_setvale'],
  62. 'miss_value' => $setvale['miss_value']
  63. ]
  64. ]
  65. ];
  66. break;
  67. }
  68. PitcherService::setAdqAccountReportRule([$conf->account_id], $conf->report_type, $conf->enable,
  69. $conf->purchase_enable, $conf->miss_enable, $conf->miss_setvale, $conf->sys_group_id, $conf->miss_value
  70. , 0, $conf->amount_enable, $newAmountSetVale, $conf->reset_enable, $conf->reset_setvale);
  71. }
  72. }
  73. } catch (\Exception $e) {
  74. $this->error('file:'.$e->getFile().' # line:'.$e->getLine().' # message:'.$e->getMessage());
  75. Log::logError('处理历史账号回传配置异常', [
  76. 'file' => $e->getFile(),
  77. 'line' => $e->getLine(),
  78. 'message'=>$e->getMessage(),
  79. 'trace'=> $e->getTraceAsString()
  80. ], 'RepairReportDataError');
  81. }
  82. }
  83. }