修改分享二维码,。增加命令行
This commit is contained in:
parent
092fc0586c
commit
3b9a3a97a2
70
app/Command/editDoctorQrCodeCommand.php
Normal file
70
app/Command/editDoctorQrCodeCommand.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?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('全部结束');
|
||||
}
|
||||
}
|
||||
@ -1575,11 +1575,17 @@ class UserDoctorService extends BaseService
|
||||
if (empty($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" => "",
|
||||
"check_path" => false,
|
||||
"env_version" => "develop",
|
||||
"env_version" => $env_version,
|
||||
];
|
||||
|
||||
$img_buffer = $weChat->getUnlimitedQRCode($options);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user