mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-29 05:41:37 +08:00
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Smser;
|
|
|
|
use App\Repos\Account as AccountRepo;
|
|
use App\Repos\Chapter as ChapterRepo;
|
|
use App\Repos\Course as CourseRepo;
|
|
use App\Services\Smser;
|
|
|
|
class Live extends Smser
|
|
{
|
|
|
|
protected $templateCode = 'live';
|
|
|
|
/**
|
|
* @param int $chapterId
|
|
* @param int $userId
|
|
* @param int $startTime
|
|
* @return bool
|
|
*/
|
|
public function handle($chapterId, $userId, $startTime)
|
|
{
|
|
$accountRepo = new AccountRepo();
|
|
|
|
$account = $accountRepo->findById($userId);
|
|
|
|
if (!$account->phone) {
|
|
return false;
|
|
}
|
|
|
|
$chapterRepo = new ChapterRepo();
|
|
|
|
$chapter = $chapterRepo->findById($chapterId);
|
|
|
|
$courseRepo = new CourseRepo();
|
|
|
|
$course = $courseRepo->findById($chapter->course_id);
|
|
|
|
$params = [
|
|
$course->title,
|
|
$chapter->title,
|
|
$startTime,
|
|
];
|
|
|
|
$templateId = $this->getTemplateId($this->templateCode);
|
|
|
|
return $this->send($account->phone, $templateId, $params);
|
|
}
|
|
|
|
}
|