正在显示
1 个修改的文件
包含
56 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\AyrShare; | ||
| 4 | + | ||
| 5 | +use App\Helper\AyrShare as AyrShareHelper; | ||
| 6 | +use App\Models\AyrShare\AyrShare as AyrShareModel; | ||
| 7 | +use Illuminate\Console\Command; | ||
| 8 | + | ||
| 9 | +class ShareConfig extends Command | ||
| 10 | +{ | ||
| 11 | + public $error = 0; | ||
| 12 | + /** | ||
| 13 | + * The name and signature of the console command. | ||
| 14 | + * | ||
| 15 | + * @var string | ||
| 16 | + */ | ||
| 17 | + protected $signature = 'share_config'; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * The console command description. | ||
| 21 | + * | ||
| 22 | + * @var string | ||
| 23 | + */ | ||
| 24 | + protected $description = '更新用户Ayr_share配置'; | ||
| 25 | + /** | ||
| 26 | + * @name :(定时执行更新用户配置)handle | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2023/5/12 14:48 | ||
| 30 | + */ | ||
| 31 | + public function handle() | ||
| 32 | + { | ||
| 33 | + $ayrShareModel = new AyrShareModel(); | ||
| 34 | + //更新用户配置 | ||
| 35 | + $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','profile_key','bind_plat_from']); | ||
| 36 | + foreach ($lists['list'] as $k => $v){ | ||
| 37 | + if(empty($v['profile_key'])){ | ||
| 38 | + continue; | ||
| 39 | + } | ||
| 40 | + //获取当前用户配置 | ||
| 41 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 42 | + $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']); | ||
| 43 | + if(!isset($share_info['activeSocialAccounts'])){ | ||
| 44 | + continue; | ||
| 45 | + } | ||
| 46 | + $str = json_encode($share_info['activeSocialAccounts']); | ||
| 47 | + if($str != $v['bind_plat_from']){ | ||
| 48 | + $rs = $ayrShareModel->edit(['bind_plat_from'=>$str],['id'=>$v['id']]); | ||
| 49 | + if($rs === false){ | ||
| 50 | + $this->error++; | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + echo $this->error; | ||
| 55 | + } | ||
| 56 | +} |
-
请 注册 或 登录 后发表评论