1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-27 21:10:24 +08:00
2020-04-03 19:20:46 +08:00

40 lines
766 B
PHP

<?php
namespace App\Services\Smser;
use App\Models\Refund as RefundModel;
use App\Repos\Account as AccountRepo;
use App\Services\Smser;
class Refund extends Smser
{
protected $templateCode = 'refund';
/**
* @param RefundModel $refund
* @return bool
*/
public function handle(RefundModel $refund)
{
$accountRepo = new AccountRepo();
$account = $accountRepo->findById($refund->user_id);
if (!$account->phone) {
return false;
}
$templateId = $this->getTemplateId($this->templateCode);
$params = [
$refund->subject,
$refund->sn,
$refund->amount,
];
return $this->send($account->phone, $templateId, $params);
}
}