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