- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\controller\admin\v1\notification\sms;
|
|
|
|
use think\annotation\Inject;
|
|
use app\services\message\sms\SmsAdminServices;
|
|
use app\services\serve\ServeServices;
|
|
use crmeb\services\CacheService;
|
|
use app\controller\admin\AuthController;
|
|
use crmeb\services\SystemConfigService;
|
|
|
|
/**
|
|
* 短信配置
|
|
* Class SmsConfig
|
|
* @package app\admin\controller\sms
|
|
*/
|
|
class SmsConfig extends AuthController
|
|
{
|
|
|
|
/**
|
|
* @var SmsAdminServices
|
|
*/
|
|
#[Inject]
|
|
protected SmsAdminServices $services;
|
|
|
|
|
|
/**
|
|
* 保存短信配置
|
|
* @return mixed
|
|
*/
|
|
public function save_basics()
|
|
{
|
|
[$account, $token] = $this->request->postMore([
|
|
['sms_account', ''],
|
|
['sms_token', '']
|
|
], true);
|
|
|
|
$this->validate(['sms_account' => $account, 'sms_token' => $token], \app\validate\admin\notification\SmsConfigValidate::class);
|
|
if(sys_config('sms_account') && sys_config('sms_token')){
|
|
return $this->success('保存成功');
|
|
}
|
|
if ($this->services->updateSmsConfig($account, $token)) {
|
|
return $this->success('保存成功');
|
|
} else {
|
|
return $this->fail('保存失败');
|
|
}
|
|
}
|
|
|
|
}
|