|
@ -3,6 +3,7 @@ namespace app\admin\service; |
|
|
|
|
|
|
|
|
use app\admin\service\AdminBaseService; |
|
|
use app\admin\service\AdminBaseService; |
|
|
use app\model\EmailTemplateModel; |
|
|
use app\model\EmailTemplateModel; |
|
|
|
|
|
use app\model\SmsTemplateModel; |
|
|
use app\model\VideoOnDemandModel; |
|
|
use app\model\VideoOnDemandModel; |
|
|
|
|
|
|
|
|
class ConfigService extends AdminBaseService |
|
|
class ConfigService extends AdminBaseService |
|
@ -52,12 +53,64 @@ class ConfigService extends AdminBaseService |
|
|
return $this->toData('500', '修改的模板数据不存在'); |
|
|
return $this->toData('500', '修改的模板数据不存在'); |
|
|
} |
|
|
} |
|
|
$emailTemplate->email = $param['email'] ?? ""; |
|
|
$emailTemplate->email = $param['email'] ?? ""; |
|
|
$emailTemplate->title = $param['title'] ?? ""; |
|
|
$emailTemplate->title = $param['title']; |
|
|
$emailTemplate->content = $param['content'] ?? ""; |
|
|
$emailTemplate->content = $param['content']; |
|
|
$emailTemplate->save(); |
|
|
$emailTemplate->save(); |
|
|
return $this->toData('0', 'success'); |
|
|
return $this->toData('0', 'success'); |
|
|
} catch (\Exception $e) { |
|
|
} catch (\Exception $e) { |
|
|
return $this->toData('500', 'The system is busy. Please try again later.', [$e->getMessage(), $e->getTrace()]); |
|
|
return $this->toData('500', 'The system is busy. Please try again later.', [$e->getMessage(), $e->getTrace()]); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 短息模板列表 |
|
|
|
|
|
public function smsTemplateList($param) |
|
|
|
|
|
{ |
|
|
|
|
|
try { |
|
|
|
|
|
if (empty($param['page']) || !is_numeric($param['page'])) { |
|
|
|
|
|
return $this->toData('400', '参错错误'); |
|
|
|
|
|
} |
|
|
|
|
|
if (empty($param['limit']) || !is_numeric($param['limit'])) { |
|
|
|
|
|
return $this->toData('400', '参错错误'); |
|
|
|
|
|
} |
|
|
|
|
|
$where = []; |
|
|
|
|
|
if (isset($param['tpl_type'])) { |
|
|
|
|
|
$where['tpl_type'] = $param['tpl_type']; |
|
|
|
|
|
} |
|
|
|
|
|
$list = SmsTemplateModel::where($where)->order('id', 'desc')->paginate([ |
|
|
|
|
|
'list_rows' => $param['limit'], |
|
|
|
|
|
'page' => $param['page'], |
|
|
|
|
|
]); |
|
|
|
|
|
return $this->toData('0', 'SUCCESS', [ |
|
|
|
|
|
'list' => $list->items(), |
|
|
|
|
|
'page' => $list->currentPage(), |
|
|
|
|
|
'total' => $list->total(), |
|
|
|
|
|
'last_page' => $list->lastPage(), |
|
|
|
|
|
]); |
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
return $this->toData('500', 'The system is busy. Please try again later.', [$e->getMessage(), $e->getTrace()]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 编辑短信模板 |
|
|
|
|
|
public function editSmsTemplate($param) |
|
|
|
|
|
{ |
|
|
|
|
|
try { |
|
|
|
|
|
if (empty($param['id']) || !is_numeric($param['id'])) { |
|
|
|
|
|
return $this->toData('400', '参错错误'); |
|
|
|
|
|
} |
|
|
|
|
|
if (empty($param['content'])) { |
|
|
|
|
|
return $this->toData('400', '参错错误'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$smsTemplate = SmsTemplateModel::where(['id'=>$param['id']])->find(); |
|
|
|
|
|
if (empty($smsTemplate)) { |
|
|
|
|
|
return $this->toData('500', '修改的模板数据不存在'); |
|
|
|
|
|
} |
|
|
|
|
|
$smsTemplate->content = $param['content']; |
|
|
|
|
|
$smsTemplate->save(); |
|
|
|
|
|
return $this->toData('0', 'success'); |
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
return $this->toData('500', 'The system is busy. Please try again later.', [$e->getMessage(), $e->getTrace()]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |