74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Model\UserDoctor;
|
|
use Extend\Alibaba\Oss;
|
|
use Extend\Wechat\Wechat;
|
|
use Hyperf\Command\Command as HyperfCommand;
|
|
use Hyperf\Command\Annotation\Command;
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
/**
|
|
* 废弃
|
|
*/
|
|
#[Command]
|
|
class editDoctorQrCodeCommand extends HyperfCommand
|
|
{
|
|
public function __construct(protected ContainerInterface $container)
|
|
{
|
|
parent::__construct('editDoctorQrCode:command');
|
|
}
|
|
|
|
public function configure()
|
|
{
|
|
parent::configure();
|
|
$this->setDescription('修改医生分享二维码');
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$this->line('开始');
|
|
|
|
// 获取医生信息
|
|
$params = array();
|
|
$user_doctors = UserDoctor::getList($params);
|
|
if (empty($user_doctors)) {
|
|
$this->line('结束,无医生需处理');
|
|
return;
|
|
}
|
|
|
|
foreach ($user_doctors as $user_doctor){
|
|
if (!empty($user_doctor['qr_code'])){
|
|
$weChat = new Wechat(1);
|
|
|
|
$env_version = "release";
|
|
$app_env = \Hyperf\Support\env("APP_ENV",'dev');
|
|
if ($app_env == "dev"){
|
|
$env_version = "trial";
|
|
}
|
|
|
|
$options = [
|
|
"scene" => "?doctor_id=" . $user_doctor['doctor_id'],// query 参数
|
|
"page" => "pages/expertDetail/expertDetail",
|
|
"check_path" => false,
|
|
"env_version" => $env_version,
|
|
];
|
|
|
|
$img_buffer = $weChat->getUnlimitedQRCode($options);
|
|
|
|
$oss = new Oss();
|
|
|
|
$filename = "applet/doctor/card/" . $user_doctor['doctor_id'] . '.' . 'jpg';
|
|
|
|
$oss->putObject($filename, $img_buffer);
|
|
|
|
$this->line('结束:' . $user_doctor['user_name']);
|
|
}
|
|
}
|
|
$this->line('全部结束');
|
|
}
|
|
}
|