1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-03 15:36:48 +08:00
2020-12-20 17:28:13 +08:00

39 lines
835 B
PHP

<?php
namespace App\Services\Sms\Notice;
use App\Models\User as UserModel;
use App\Repos\Account as AccountRepo;
use App\Services\Smser;
class LiveBegin extends Smser
{
protected $templateCode = 'live_begin';
/**
* @param UserModel $user
* @param array $params
* @return bool|null
*/
public function handle(UserModel $user, array $params)
{
$accountRepo = new AccountRepo();
$account = $accountRepo->findById($user->id);
if (!$account->phone) return null;
$params = [
$params['course']['title'],
$params['chapter']['title'],
date('H:i', $params['live']['start_time']),
];
$templateId = $this->getTemplateId($this->templateCode);
return $this->send($account->phone, $templateId, $params);
}
}