chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\smsbao;
use ywxapp\AddonBase;
use ywxapp\library\Menu;
/**
* Addon 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Addon extends addon
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete('smsbao');
return true;
}
/**
* 插件启用方法
*/
public function enable()
{
Menu::enable('smsbao');
}
/**
* 插件禁用方法
*/
public function disable()
{
Menu::disable('smsbao');
}
/**
* 前端菜单方法
*/
public function frontMenu(){}
/**
* 会员菜单方法
*/
public function memberMenu(){}
/**
* 后台菜单方法
*/
public function backMenu(){}
}
+9
View File
@@ -0,0 +1,9 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
// 这是系统自动生成的common定义文件
+40
View File
@@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
// 短信宝插件配置项(后台配置页数据源;实际值存于统一配置表 wxapp_addon_config
// 默认值仅为迁移占位,请在生产环境替换为自有账号与签名。
return [
[
'name' => 'u',
'title' => '短信宝账号',
'type' => 'string',
'value' => 'cqmqzp',
'tip' => '短信宝平台账号,请替换为自己的账号',
],
[
'name' => 'p',
'title' => '短信宝密码',
'type' => 'string',
'value' => 'a645b6f80c0a40b69156ca0fd9d47d7c',
'tip' => '短信宝密码(明文,提交前会随平台规则处理),请替换',
],
[
'name' => 'sign',
'title' => '短信签名',
'type' => 'string',
'value' => '妙趣横生',
'tip' => '短信内容前缀【签名】',
],
[
'name' => 'template',
'title' => '短信模板',
'type' => 'textarea',
'value' => '您的短信验证码为:{code}, 五分钟有效,请勿告诉他人',
'tip' => '支持占位符 {code} 与 {mobile}',
],
];
+117
View File
@@ -0,0 +1,117 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\smsbao\controller;
use think\Request;
use ywxapp\addon\Controller;
/**
* Index 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Index extends Controller
{
/**
* Summary of needLogin
* @var array
*/
protected $noNeedLogin = ['*'];
/**
* Summary of needRight
* @var array
*/
protected $noNeedVerify = ['*'];
/**
* 控制器初始化 _initialize
* @return void
*/
protected function initialize()
{}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
//
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id = null)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
return [
'name' => 'smsbao',
'title' => '短信宝',
'intro' => '',
'author' => '',
'website' => '',
'version' => '1.0.1',
'state' => 0,
'url' => '/smsbao',
'license' => '',
'licenseto' => 0,
'config' => [
],
'events' => [
'subscribe' =>
[
0 => 'addon\\smsbao\\subscribe\\Smsbao',
],
],
'middleware' => [
],
'services' => [
],
'update_time' => 1786365220,
];
+81
View File
@@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\smsbao\subscribe;
use ywxapp\service\AddonService;
use ywxapp\utils\HttpClient;
/**
* Smsbao 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Smsbao
{
protected $eventPrefix = 'Sms';
public function onSend($sms)
{
$statusStr = [
"0" => "短信发送成功",
"-1" => "参数不全",
"-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
"30" => "密码错误",
"40" => "账号不存在",
"41" => "余额不足",
"42" => "帐户已过期",
"43" => "IP地址限制",
"50" => "内容含有敏感词",
];
// 统一从数据库配置表读取(后台「插件配置」页可改),不再硬编码
$cfg = AddonService::config('smsbao');
$sign = $cfg['sign'] ?? '妙趣横生';
$content = '【' . $sign . '】' . str_replace(
['{code}', '{mobile}'],
[$sms['code'] ?? '', $sms['mobile'] ?? ''],
$cfg['template'] ?? '您的短信验证码为:{code}, 五分钟有效,请勿告诉他人'
);
$params = [
'u' => $cfg['u'] ?? '',
'p' => $cfg['p'] ?? '',
'm' => $sms['mobile'],
'c' => $content,
];
$client = new HttpClient();
$response = $client->get('https://api.smsbao.com/sms', $params);
if ($response !== false) {
return [true, $statusStr['0']];
} else {
return [false, "请求失败: " . $client->getError()];
}
}
public function onGet($sms)
{
return true;
}
public function onNotice($sms)
{
return true;
}
public function onCheck($sms)
{
return true;
}
}