41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Models\PatientRecord;
|
|
use Overtrue\LaravelWeChat\EasyWeChat;
|
|
|
|
class PatientRecordNotify extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'patient-record:notify';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = '病历记录: 通知医生';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
$list = PatientRecord::where('is_notified', 0)->whereNotNul('notify_user_id')->whereNotNul('notify_at')->get();
|
|
$app = EasyWeChat::officialAccount();
|
|
$app->setAccessToken(new \App\Services\WechatOfficialAccessToken(
|
|
appId: $this->getAccount()->getAppId(),
|
|
secret: $this->getAccount()->getSecret(),
|
|
cache: $this->getCache(),
|
|
httpClient: $this->getHttpClient(),
|
|
stable: $this->config->get('use_stable_access_token', false),
|
|
));
|
|
}
|
|
}
|