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
+73
View File
@@ -0,0 +1,73 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use ywxapp\library\Menu;
use ywxapp\AddonBase;
use think\Request;
class {%className%} extends addon
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete('{%addon%}');
return true;
}
/**
* 插件启用方法
*/
public function enable()
{
Menu::enable('{%addon%}');
}
/**
* 插件禁用方法
*/
public function disable()
{
Menu::disable('{%addon%}');
}
/**
* 插件升级方法(覆盖升级时的数据/配置迁移)
* @param string $currentVersion 已安装版本号
*/
public function upgrade($currentVersion = '')
{
return true;
}
/**
* 前端菜单方法
*/
public function frontMenu(){}
/**
* 会员菜单方法
*/
public function memberMenu(){}
/**
* 后台菜单方法
*/
public function backMenu(){}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
class {%className%} extends Command
{
protected function configure()
{
// 指令配置
$this->setName('{%commandName%}')
->setDescription('the {%commandName%} command');
}
protected function execute(Input $input, Output $output)
{
// 指令输出
$output->writeln('{%commandName%}');
}
}
+84
View File
@@ -0,0 +1,84 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use think\Request;
class {%className%} extends \ywxapp\controller\AddonFrontend
{
/**
* 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{%actionSuffix%}()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save{%actionSuffix%}(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read{%actionSuffix%}($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update{%actionSuffix%}(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete{%actionSuffix%}($id)
{
//
}
}
@@ -0,0 +1,28 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%} extends \ywxapp\controller\AddonFrontend
{
/**
* Summary of needLogin
* @var array
*/
protected $noNeedLogin = ['*'];
/**
* Summary of needRight
* @var array
*/
protected $noNeedVerify = ['*'];
/**
* 控制器初始化 _initialize
* @return void
*/
protected function initialize()
{}
//
}
+104
View File
@@ -0,0 +1,104 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use think\Request;
class {%className%} extends \ywxapp\controller\AddonFrontend
{
/**
* 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{%actionSuffix%}()
{
return "这是一个{%app_namespace%} 插件应用";
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create{%actionSuffix%}()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save{%actionSuffix%}(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read{%actionSuffix%}($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit{%actionSuffix%}($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update{%actionSuffix%}(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete{%actionSuffix%}($id)
{
//
}
}
+12
View File
@@ -0,0 +1,12 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%}
{
public function __construct()
{
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
//这是{%app%}应用的配置文件
return [
'name' => '{%app%}',
'title' => '',
'intro' => '',
'author' => '',
'website' => '',
'version' => '1.0.0',
'state' => 1,
'url' => '/{%app%}',
'license' => '',
'licenseto' => 0,
'config' => [],
'events' => [
// 事件绑定,
'bind' => [],
// 事件监听
'listen' => [],
// 事件订阅
'subscribe' => [],
],
'middleware' => [
// 别名 => 中间件类
'alias' => [],
// 中间件优先级,越靠前优先级越高
'priority' => [],
],
'services' => [],
];
+20
View File
@@ -0,0 +1,20 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%}
{
/**
* 事件监听处理
*
* @return mixed
*/
public function handle($param)
{
// 这里可以执行一些插件的初始化操作,比如加载配置、注册服务等
// 例如:加载插件的语言包
// \think\facade\Lang::load(addon_path('demo') . 'lang/zh-cn.php');
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%}
{
/**
* 处理请求
*
* @param \think\Request $request
* @param \Closure $next
* @return Response
*/
public function handle($request, \Closure $next)
{
//
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use ywxapp\model\BaseModel;
/**
* @mixin \think\Model
*/
class {%className%} extends BaseModel
{
protected function getOptions(): array
{
// 所有的参数配置统一返回
return [
'strict' => false,
//'name' => '',
// 'connection' => '',
// 'query' => [],
// 'type' => [],
// 'hidden' => [],
// 'visible' => [],
// 'append' => [],
'autoRelation' => [],
'createTime' => 'create_at',
'updateTime' => 'update_at',
'dateFormat' => 'Y-m-d H:i:s',
];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%} extends \think\Service
{
/**
* 注册服务
*
* @return mixed
*/
public function register()
{
//
}
/**
* 执行服务
*
* @return mixed
*/
public function boot()
{
//
}
}
+8
View File
@@ -0,0 +1,8 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
class {%className%}
{
}
+25
View File
@@ -0,0 +1,25 @@
<?php
declare (strict_types = 1);
namespace {%namespace%};
use think\Validate;
class {%className%} extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [];
}