作者 lyh

gx

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ImportChannel.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/9/25 15:31
  8 + */
  9 +
  10 +namespace App\Console\Commands;
  11 +use App\Helper\OaGlobalsoApi;
  12 +use App\Models\Channel\Channel;
  13 +use App\Models\Project\Project;
  14 +use Illuminate\Console\Command;
  15 +class ImportChannel extends Command
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'import_channel';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '更新渠道信息';
  30 +
  31 + /**
  32 + * @remark :导入5.0管理员数据
  33 + * @name :handle
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2023/8/7 17:49
  37 + */
  38 + public function handle(){
  39 + $projectModel = new Project();
  40 + $map = [
  41 + 'channel'=>['like','%"user_id": "0"%'],
  42 + ];
  43 + $lists = $projectModel->list($map);
  44 + var_dump($lists);
  45 + die();
  46 + foreach ($lists as $k => $v){
  47 + $order_id = $v['notice_order_id'];
  48 + $api = new OaGlobalsoApi();
  49 + $data = $api->order_info($order_id);
  50 + $data = $data['data'];
  51 + $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']);
  52 + $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]);
  53 + }
  54 + return 1;
  55 + }
  56 +}