chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
54
app/services/message/sms/SmsAdminServices.php
Normal file
54
app/services/message/sms/SmsAdminServices.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\message\sms;
|
||||
|
||||
|
||||
use app\dao\system\config\SystemConfigDao;
|
||||
use app\services\BaseServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\services\CacheService;
|
||||
use crmeb\services\HttpService;
|
||||
use crmeb\services\sms\Sms;
|
||||
use crmeb\services\SystemConfigService;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 短信平台注册登陆
|
||||
* Class SmsAdminServices
|
||||
* @package app\services\message\sms
|
||||
* @mixin SystemConfigDao
|
||||
*/
|
||||
class SmsAdminServices extends BaseServices
|
||||
{
|
||||
/**
|
||||
* @var SystemConfigDao
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemConfigDao $dao;
|
||||
|
||||
/**
|
||||
* 更新短信配置
|
||||
* @param string $account
|
||||
* @param string $password
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateSmsConfig(string $account, string $password)
|
||||
{
|
||||
return $this->transaction(function () use ($account, $password) {
|
||||
$this->dao->update('sms_account', ['value' => json_encode($account)], 'menu_name');
|
||||
$this->dao->update('sms_token', ['value' => json_encode($password)], 'menu_name');
|
||||
\crmeb\services\SystemConfigService::clear();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
70
app/services/message/sms/SmsRecordServices.php
Normal file
70
app/services/message/sms/SmsRecordServices.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\message\sms;
|
||||
|
||||
|
||||
use app\dao\message\sms\SmsRecordDao;
|
||||
use app\services\BaseServices;
|
||||
use app\services\serve\ServeServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 短信发送记录
|
||||
* Class SmsRecordServices
|
||||
* @package app\services\message\sms
|
||||
* @mixin SmsRecordDao
|
||||
*/
|
||||
class SmsRecordServices extends BaseServices
|
||||
{
|
||||
/**
|
||||
* @var SmsRecordDao
|
||||
*/
|
||||
#[Inject]
|
||||
protected SmsRecordDao $dao;
|
||||
|
||||
/**
|
||||
* 获取短信发送列表
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getRecordList(array $where)
|
||||
{
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$data = $this->dao->getRecordList($where, $page, $limit);
|
||||
$count = $this->dao->count($where);
|
||||
return compact('data', 'count');
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改短信发送记录短信状态
|
||||
*/
|
||||
public function modifyResultCode()
|
||||
{
|
||||
$recordIds = $this->dao->getCodeNull();
|
||||
if (count($recordIds)) {
|
||||
/** @var ServeServices $smsHandle */
|
||||
$smsHandle = app()->make(ServeServices::class);
|
||||
$codeLists = $smsHandle->sms()->getStatus($recordIds);
|
||||
foreach ($codeLists as $item) {
|
||||
if (isset($item['id']) && isset($item['resultcode'])) {
|
||||
if ($item['resultcode'] == '' || $item['resultcode'] == null) $item['resultcode'] = 134;
|
||||
$this->dao->update($item['id'], ['resultcode' => $item['resultcode']], 'record_id');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
62
app/services/message/sms/SmsSendServices.php
Normal file
62
app/services/message/sms/SmsSendServices.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\message\sms;
|
||||
|
||||
use app\services\BaseServices;
|
||||
use app\services\message\SystemNotificationServices;
|
||||
use app\services\serve\ServeServices;
|
||||
use crmeb\services\CacheService;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 短信发送
|
||||
* Class SmsSendServices
|
||||
* @package app\services\message\sms
|
||||
*/
|
||||
class SmsSendServices extends BaseServices
|
||||
{
|
||||
private $smsType = ['yihaotong', 'aliyun', 'tencent'];
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param bool $switch
|
||||
* @param $phone
|
||||
* @param array $data
|
||||
* @param string $template
|
||||
* @return bool
|
||||
*/
|
||||
public function send(bool $switch, $phone, array $data, string $template)
|
||||
{
|
||||
if ($switch && $phone) {
|
||||
/** @var ServeServices $services */
|
||||
$services = app()->make(ServeServices::class);
|
||||
|
||||
$type = $this->smsType[sys_config('sms_type', 0)];
|
||||
//获取短信ID
|
||||
$templateId = CacheService::handler('TEMPLATE')->remember('NOTICE_SMS_' . $type . '_' . $template, function () use ($services, $template) {
|
||||
/** @var SystemNotificationServices $notifyServices */
|
||||
$notifyServices = app()->make(SystemNotificationServices::class);
|
||||
return $notifyServices->value(['mark' => $template], 'sms_id') ?? 0;
|
||||
});
|
||||
//获取发送短信驱动类型
|
||||
$smsMake = $services->sms($type);
|
||||
$res = $smsMake->send($phone, $templateId, $data);
|
||||
if ($res === false) {
|
||||
throw new ValidateException($services->getError());
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
57
app/services/message/sms/SmsTemplateApplyServices.php
Normal file
57
app/services/message/sms/SmsTemplateApplyServices.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\message\sms;
|
||||
|
||||
|
||||
use app\services\BaseServices;
|
||||
use crmeb\services\FormBuilder;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
* Class SmsTemplateApplyServices
|
||||
* @package app\services\message\sms
|
||||
*/
|
||||
class SmsTemplateApplyServices extends BaseServices
|
||||
{
|
||||
/**
|
||||
* @var FormBuilder
|
||||
*/
|
||||
#[Inject]
|
||||
protected FormBuilder $builder;
|
||||
|
||||
/**
|
||||
* 创建短信模板表单
|
||||
* @return array
|
||||
* @throws \FormBuilder\Exception\FormBuilderException
|
||||
*/
|
||||
public function createSmsTemplateForm()
|
||||
{
|
||||
$field = [
|
||||
$this->builder->input('title', '模板名称')->placeholder('模板名称,如:订单支付成功'),
|
||||
$this->builder->input('content', '模板内容')->type('textarea')->placeholder('模板内容,如:您购买的商品已支付成功,支付金额{$pay_price}元,订单号{$order_id},感谢您的光临!(注:模板内容不用添加短信签名,可在一号通主页单独修改签名)')->rows(3),
|
||||
$this->builder->radio('type', '模板类型', 1)->options([['label' => '验证码', 'value' => 1], ['label' => '通知', 'value' => 2], ['label' => '推广', 'value' => 3]])
|
||||
];
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取短信申请模板
|
||||
* @return array
|
||||
* @throws \FormBuilder\Exception\FormBuilderException
|
||||
*/
|
||||
public function getSmsTemplateForm()
|
||||
{
|
||||
return create_form('申请短信模板', $this->createSmsTemplateForm(), $this->url('/notify/sms/temp'), 'POST');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user