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
819 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 OrderFinish extends Smser
{
protected $templateCode = 'order_finish';
/**
* @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;
$templateId = $this->getTemplateId($this->templateCode);
$params = [
$params['order']['subject'],
$params['order']['sn'],
$params['order']['amount'],
];
return $this->send($account->phone, $templateId, $params);
}
}