FastMovieAI AI短剧创作平台 二开基线

- 源码: xhadmincn/FastMovieAI (Apache 2.0)
- 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION
- vendor/示例资源已gitignore
This commit is contained in:
李建琦
2026-08-26 18:37:36 +08:00
commit eae151fd57
888 changed files with 105571 additions and 0 deletions
+235
View File
@@ -0,0 +1,235 @@
[
{
"title": "Dashboard",
"icon": "House",
"path": "Index",
"sort": 0,
"children": [
{
"title": "Console",
"icon": "ElementPlus",
"path": "Index/control",
"component": "databoard"
}
]
},
{
"title": "Functional",
"icon": "Stopwatch",
"path": "Functional",
"children": [
{
"title": "Administrator",
"icon": "User",
"path": "Admin/group",
"component": "table",
"children": [
{
"title": "Staff List",
"path": "Admin/index",
"component": "table",
"children": [
{
"title": "Create Administrator",
"path": "Admin/create",
"show": false,
"component": "form"
},
{
"title": "Edit Administrator",
"show": false,
"path": "Admin/update",
"component": "form"
},
{
"title": "Delete Administrator",
"show": false,
"path": "Admin/delete"
},
{
"title": "Update Status",
"show": false,
"path": "Admin/indexUpdateState"
},
{
"title": "Move Role",
"component": "form",
"show": false,
"path": "Admin/moveRole"
}
]
}
]
},
{
"title": "Role Management",
"icon": "PriceTag",
"path": "AdminRole/group",
"component": "table",
"children": [
{
"title": "Role List",
"path": "AdminRole/index",
"component": "table",
"children": [
{
"title": "Create Role",
"path": "AdminRole/create",
"show": false,
"component": "form"
},
{
"title": "Edit Role",
"show": false,
"path": "AdminRole/update",
"component": "form"
},
{
"title": "Delete Role",
"show": false,
"path": "AdminRole/delete"
},
{
"title": "Update Status",
"show": false,
"path": "AdminRole/indexUpdateState"
}
]
}
]
}
]
},
{
"title": "Systems",
"icon": "Setting",
"path": "System",
"children": [
{
"title": "Basic Settings",
"icon": "Setting",
"path": "System/basic",
"component": "form"
},
{
"title": "Upload Settings",
"icon": "UploadFilled",
"path": "System/upload",
"component": "form"
},
{
"title": "SMS Settings",
"icon": "Message",
"path": "System/sms",
"component": "form"
},
{
"title": "Payment Management",
"icon": "Wallet",
"path": "Payment/group",
"show": false,
"children": [
{
"title": "Payment Settings",
"path": "Payment/index",
"show": false,
"component": "payment-form"
},
{
"title": "Payment Template",
"path": "PaymentTemplate/index",
"component": "table",
"show": false,
"children": [
{
"title": "Create Payment Template",
"path": "PaymentTemplate/create",
"show": false,
"component": "form"
},
{
"title": "Edit Payment Template",
"path": "PaymentTemplate/update",
"show": false,
"component": "form"
},
{
"title": "Delete Payment Template",
"path": "PaymentTemplate/delete",
"show": false,
"component": ""
}
]
}
]
}
]
},
{
"title": "Public Permissions",
"path": "Public",
"show": false,
"children": [
{
"title": "Edit Profile",
"show": false,
"path": "Admin/updateSelf",
"component": "form"
},
{
"title": "Get Profile",
"show": false,
"path": "Admin/getSelfInfo",
"component": ""
},
{
"title": "Logout",
"show": false,
"path": "Public/outLogin",
"component": ""
},
{
"title": "Get Upload Categories",
"path": "Uploads/getUploadClassify",
"show": false,
"component": ""
},
{
"title": "Edit Upload Category",
"path": "Uploads/saveClassify",
"show": false,
"component": ""
},
{
"title": "Delete Upload Category",
"path": "Uploads/deleteClassify",
"show": false,
"component": ""
},
{
"title": "Upload File",
"path": "Uploads/upload",
"show": false,
"component": ""
},
{
"title": "Delete Upload File",
"path": "Uploads/deleteUploads",
"show": false,
"component": ""
},
{
"title": "Edit Upload File",
"path": "Uploads/updateUploads",
"show": false,
"component": ""
},
{
"title": "Get Upload File List",
"path": "Uploads/getList",
"show": false,
"component": ""
}
]
}
]
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace app\admin\api;
use app\expose\api\Install as ApiInstall;
class Install
{
use ApiInstall;
public function __construct()
{
$this->path = __DIR__;
}
}
@@ -0,0 +1,73 @@
<?php
/**
* 自定义Admin入口
* @authors 余心(RenLoong)
* @home https://github.com/RenLoong/loong-admin
*/
use Webman\Route;
$admin_path = getenv('SERVER_ADMIN_PATH');
if ($admin_path && $admin_path != 'admin') {
Route::disableDefaultRoute('', 'admin');
$controllersClass = glob(app_path('admin') . '/controller/*Controller.php');
$len = count($controllersClass);
$routes = [];
for ($i = 0; $i < $len; $i++) {
$value = $controllersClass[$i];
$controllerName = str_replace('Controller', '', basename($value, '.php'));
$classStr = 'app' . str_replace([app_path(), '.php', '/'], ['', '', '\\'], $value);
$reflection = new \ReflectionClass('\\'.$classStr);
// 忽略抽象类、接口
if ($reflection->isAbstract() || $reflection->isInterface()) {
continue;
}
$actions = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
$actionsLen = count($actions);
for ($n = 0; $n < $actionsLen; $n++) {
$name = $actions[$n]->name;
if (!str_starts_with($name, '__')) {
$routes["/{$controllerName}/{$name}"] = [$classStr, $name];
}
}
}
$controllersVersionClass = glob(app_path('admin') . '/controller/**/*Controller.php');
if (!empty($controllersVersionClass)) {
$len = count($controllersVersionClass);
for ($i = 0; $i < $len; $i++) {
$value = $controllersVersionClass[$i];
$version=basename(dirname($value));
$controllerName = str_replace('Controller', '', basename($value, '.php'));
$classStr = 'app' . str_replace([app_path(), '.php', '/'], ['', '', '\\'], $value);
$reflection = new \ReflectionClass('\\' . $classStr);
// 忽略抽象类、接口
if ($reflection->isAbstract() || $reflection->isInterface()) {
continue;
}
$actions = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
$actionsLen = count($actions);
for ($n = 0; $n < $actionsLen; $n++) {
$name = $actions[$n]->name;
if (!str_starts_with($name, '__')) {
$routes["/{$version}/{$controllerName}/{$name}"] = [$classStr, $name];
}
}
}
}
Route::group('/' . $admin_path, function ()use($routes) {
foreach ($routes as $key => $value) {
if(in_array($value[1],['indexUpdateField','indexUpdateState'])){
Route::post($key,$value);
}else if(strpos($value[1],'GetTable')){
Route::get($key,$value);
}else{
Route::any($key,$value);
}
}
});
}
@@ -0,0 +1,601 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\FormBuilder;
use app\expose\build\builder\TableBuilder;
use app\expose\enum\Action;
use app\expose\enum\ResponseEvent;
use app\expose\enum\State;
use app\expose\enum\Week;
use app\model\Admin;
use app\model\AdminRole;
use app\validate\Admin as ValidateAdmin;
use support\Request;
use think\facade\Db;
class AdminController extends Basic
{
public function indexGetTable(Request $request)
{
$builder = new TableBuilder;
$builder->addAction('操作', [
'width' => '200px',
'fixed' => 'right'
]);
$builder->addTableAction('编辑', [
'path' => 'Admin/update',
'props' => [
'type' => 'primary',
'title' => '编辑《{nickname}》管理员'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'primary',
'size' => 'small'
]
]
]);
$builder->addTableAction('删除', [
'model' => Action::COMFIRM['value'],
'path' => 'Admin/delete',
'where' => [
['is_system', '!=', 1]
],
'props' => [
'type' => 'error',
'message' => '确定要删除《{nickname}》管理员吗?',
'confirmButtonClass' => 'el-button--danger'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'danger',
'size' => 'small'
]
]
]);
$builder->addFooter();
$builder->addFooterAction('移动到', [
'model' => Action::DIALOG['value'],
'path' => 'Admin/moveRole',
'props' => [
'title' => '移动到',
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'primary'
]
]
]);
$builder->addHeader();
$builder->addHeaderAction('创建管理员', [
'path' => 'Admin/create',
'props' => [
'type' => 'success',
'title' => '创建管理员'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'success'
]
]
]);
$formBuilder = new FormBuilder;
$formBuilder->add('username', '账号', 'input', '', [
'col' => [
'xs' => 24,
'sm' => 12,
'md' => 8,
'lg' => 6,
'xl' => 4
],
'props' => [
'placeholder' => '账号搜索',
'clearable' => true
]
]);
$formBuilder->add('mobile', '手机号', 'input', '', [
'col' => [
'xs' => 24,
'sm' => 12,
'md' => 8,
'lg' => 6,
'xl' => 4
],
'props' => [
'placeholder' => '手机号搜索',
'clearable' => true
]
]);
$builder->addScreen($formBuilder);
$builder->add('id', 'ID', [
'props' => [
'width' => '80px'
]
]);
$builder->add('userinfo', '管理员', [
'component' => [
'name' => 'table-userinfo',
'props' => [
'nickname' => 'nickname',
'avatar' => 'headimg',
'info' => 'username',
'nicknameTags' => [
[
'field' => 'new_text',
'props' => [
'type' => 'danger',
'size' => 'small'
]
],
[
'field' => 'new_text1',
'props' => [
'type' => 'success',
'size' => 'small'
]
]
],
'tags' => [
[
'field' => 'role_name',
'props' => [
'type' => 'success'
]
]
],
]
],
'props' => [
'minWidth' => '300px'
]
]);
$builder->add('contact', '联系方式', [
'props' => [
'width' => '280px'
],
'component' => [
'name' => 'table-times',
'props' => [
'group' => [
[
'field' => 'mobile',
'label' => '手机号'
],
[
'field' => 'email',
'label' => '邮箱'
],
[
'field' => 'wx_openid',
'label' => 'OpenID'
]
]
]
]
]);
$builder->add('allow_week', '工作日', [
'component' => [
'name' => 'tag',
'options' => Week::getOptions()
],
'props' => [
'width' => '240px'
]
]);
$builder->add('allow_work', '工作时间', [
'component' => [
'name' => 'tag',
'options' => [
[
'index' => 0,
'props' => [
'type' => 'success'
]
],
[
'index' => 1,
'props' => [
'type' => 'danger'
]
]
]
],
'props' => [
'width' => '200px'
]
]);
$builder->add('online_time', '活动', [
'props' => [
'width' => '200px'
],
'component' => [
'name' => 'table-times',
'props' => [
'group' => [
[
'field' => 'online_time',
'label' => '在线'
],
[
'field' => 'login_time',
'label' => '登录'
],
[
'component' => 'tag',
'field' => 'login_ip',
'label' => '登录IP',
'props' => [
'size' => 'small',
]
]
]
]
]
]);
$builder->add('state', '状态', [
'component' => [
'name' => 'switch',
'api' => 'Admin/indexUpdateState',
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
],
'props' => [
'width' => '100px'
]
]);
$builder->add('create_time', '时间', [
'props' => [
'width' => '200px'
],
'component' => [
'name' => 'table-times',
'props' => [
'group' => [
[
'field' => 'create_time',
'label' => '创建'
],
[
'field' => 'update_time',
'label' => '更新'
]
]
]
]
]);
$builder = $builder->builder();
return $this->resData($builder);
}
public function index(Request $request)
{
$limit = $request->get('limit', 10);
$where = [];
$username = $request->get('username');
if ($username) {
$where[] = ['username', 'like', "%{$username}%"];
}
$mobile = $request->get('mobile');
if ($mobile) {
$where[] = ['mobile', 'like', "%{$mobile}%"];
}
$list = Admin::alias('a')->where($where)
->join('admin_role b', 'b.id=a.role_id')
->field('a.*,b.name as role_name,b.is_system')
->order('a.id desc')->paginate($limit)->each(function ($item) {
$item->username = "UserName" . $item->username;
$item->new_text = '新';
$item->new_text1 = 'T';
$allow_work = [];
$allow_work[] = $item->allow_time_start;
$allow_work[] = $item->allow_time_end;
$item->allow_work = $allow_work;
});
return $this->resData($list);
}
public function indexUpdateState(Request $request)
{
$id = $request->post('id');
$field = $request->post('field');
$value = $request->post('value');
$Admin = Admin::where(['id' => $id])->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
$Role = AdminRole::where(['id' => $Admin->role_id])->find();
if ($Role && $Role->is_system && !$value) {
return $this->fail('系统管理员不允许操作');
}
$Admin->{$field} = $value;
if ($Admin->save()) {
return $this->success();
}
return $this->fail('操作失败');
}
public function delete(Request $request)
{
$id = $request->post('id');
$Admin = Admin::where(['id' => $id])->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
$Role = AdminRole::where(['id' => $Admin->role_id])->find();
if ($Role && $Role->is_system) {
return $this->fail('系统管理员不允许操作');
}
if ($Admin->delete()) {
return $this->success();
}
return $this->fail('操作失败');
}
public function create(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
try {
$validate = new ValidateAdmin;
$validate->check($D);
} catch (\Throwable $th) {
return $this->exception($th);
}
$Role = AdminRole::where(['id' => $D['role_id']])->find();
if (!$Role) {
return $this->fail('角色不存在');
}
$Admin = new Admin;
$Admin->role_id = $D['role_id'];
$Admin->username = $D['username'];
$Admin->nickname = $D['nickname'];
$Admin->headimg = $D['headimg'];
$Admin->mobile = $D['mobile'];
$Admin->email = $D['email'];
$Admin->wx_openid = $D['wx_openid'];
if ($D['password']) {
$Admin->password = $D['password'];
}
if ($Role->is_system) {
$Admin->allow_time_start = '00:00:00';
$Admin->allow_time_end = '23:59:59';
$Admin->allow_week = Week::getValues();
} else {
$Admin->allow_time_start = $D['allow_time'][0];
$Admin->allow_time_end = $D['allow_time'][1];
$Admin->allow_week = $D['allow_week'];
}
if ($Admin->save()) {
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
return $this->fail('保存失败');
}
$builder = $this->getFormBuilder();
return $this->resData($builder);
}
public function update(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
try {
$validate = new ValidateAdmin;
$validate->check($D);
} catch (\Throwable $th) {
return $this->exception($th);
}
$Admin = Admin::where(['id' => $D['id']])->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
$Role = AdminRole::where(['id' => $D['role_id']])->find();
if (!$Role) {
return $this->fail('角色不存在');
}
$Admin->role_id = $D['role_id'];
$Admin->username = $D['username'];
$Admin->nickname = $D['nickname'];
$Admin->headimg = $D['headimg'];
$Admin->mobile = $D['mobile'];
$Admin->email = $D['email'];
$Admin->wx_openid = $D['wx_openid'];
if ($D['password']) {
$Admin->password = $D['password'];
}
$Admin->allow_time_start = $D['allow_time'][0];
$Admin->allow_time_end = $D['allow_time'][1];
$Admin->allow_week = $D['allow_week'];
if ($Admin->save()) {
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
return $this->fail('保存失败');
}
$id = $request->get('id');
$Admin = Admin::where(['id' => $id])->withoutField('password')->find();
$Role = AdminRole::where(['id' => $Admin->role_id])->find();
if (!$Role) {
$Admin->role_id = '';
}
$is_system = $Role && $Role->is_system;
$builder = $this->getFormBuilder($is_system);
$Admin->allow_time = [
$Admin->allow_time_start,
$Admin->allow_time_end
];
$builder->setData($Admin->toArray());
return $this->resData($builder);
}
private function getFormBuilder($is_system = false)
{
$builder = new FormBuilder;
$builder->add('role_id', '所属角色', 'cascader', null, [
'required' => true,
'props' => [
'options' => AdminRole::options(),
'filterable' => true,
'props' => [
'checkStrictly' => true,
'emitPath' => false
]
]
]);
$builder->add('username', '账号', 'input', '', [
'required' => true,
'props' => [
'maxlength' => 30,
'show-word-limit' => true
]
]);
$builder->add('password', '密码', 'input', '', [
'props' => [
'placeholder' => '不修改密码请留空',
'maxlength' => 30,
'show-word-limit' => true
]
]);
$builder->add('nickname', '昵称', 'input', '', [
'required' => true,
'maxlength' => 30,
'show-word-limit' => true
]);
$builder->add('headimg', '头像', 'bundle', '', [
'props' => [
'accept' => 'image/*',
'multiple' => 1
]
]);
$builder->add('mobile', '手机号', 'input', '', [
'props' => [
'maxlength' => 11,
'show-word-limit' => true
]
]);
$builder->add('email', '邮箱', 'input', '', [
'props' => [
'maxlength' => 50,
'show-word-limit' => true
]
]);
$SystemRoleId = AdminRole::systemRole('id');
$builder->add('allow_time', '工作时间范围', 'time-picker', $is_system ? ['00:00:00', '23:59:59'] : ['08:00:00', '18:00:00'], [
'where' => [
['role_id', 'not in', $SystemRoleId]
],
'props' => [
'is-range' => true,
'value-format' => 'HH:mm:ss',
'disabled' => $is_system
]
]);
$builder->add('allow_week', '工作日', 'checkbox', [], [
'options' => Week::getOptions(),
'where' => [
['role_id', 'not in', $SystemRoleId]
],
'subProps' => [
'border' => true,
'disabled' => $is_system
]
]);
$builder->add('wx_openid', 'OpenID', 'input', '', []);
return $builder;
}
public function moveRole(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
if (!$D['role_id']) {
return $this->fail('请选择角色');
}
$Role = AdminRole::where(['id' => $D['role_id']])->find();
if (!$Role) {
return $this->fail('角色不存在');
}
$ids = explode(',', $D['id']);
$Admin = Admin::whereIn('id', $ids)->select();
Db::startTrans();
try {
foreach ($Admin as $item) {
$item->role_id = $D['role_id'];
$item->save();
}
Db::commit();
} catch (\Throwable $th) {
Db::rollback();
return $this->exception($th);
}
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
$builder = new FormBuilder(null,null,[
'labelPosition' => 'right',
'label-width' => "400px",
'class' => 'w-80 mx-auto',
'size' => 'large',
]);
$builder->add('role_id', '所属角色', 'cascader', null, [
'required' => true,
'props' => [
'options' => AdminRole::options(),
'filterable' => true,
'props' => [
'checkStrictly' => true,
'emitPath' => false
]
]
]);
return $this->resData($builder);
}
public function updateSelf(Request $request)
{
$id = $request->admin_uid;
if ($request->method() === 'POST') {
$D = $request->post();
$D['id'] = $id;
try {
$validate = new ValidateAdmin;
$validate->scene('self')->check($D);
} catch (\Throwable $th) {
return $this->exception($th);
}
$Admin = Admin::where(['id' => $D['id']])->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
$Admin->username = $D['username'];
$Admin->nickname = $D['nickname'];
$Admin->headimg = $D['headimg'];
$Admin->mobile = $D['mobile'];
$Admin->email = $D['email'];
$Admin->wx_openid = $D['wx_openid'];
if ($D['password']) {
$Admin->password = $D['password'];
}
if ($Admin->save()) {
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
return $this->fail('保存失败');
}
$Admin = Admin::where(['id' => $id])->withoutField('password')->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
$builder = $this->getFormBuilder();
$builder->remove('role_id');
$builder->remove('allow_time');
$builder->remove('allow_week');
$builder->setData($Admin->toArray());
return $this->resData($builder);
}
public function getSelfInfo(Request $request)
{
$id = $request->admin_uid;
$Admin = Admin::where(['id' => $id])->withoutField('password')->find();
if (!$Admin) {
return $this->fail('管理员不存在');
}
return $this->resData(Admin::getTokenInfo($Admin));
}
}
@@ -0,0 +1,294 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\ComponentBuilder;
use app\expose\build\builder\FormBuilder;
use app\expose\build\builder\TableBuilder;
use app\expose\enum\Action;
use app\expose\enum\ResponseEvent;
use app\expose\enum\State;
use app\expose\helper\Menus;
use app\model\Admin;
use app\model\AdminRole;
use support\Request;
class AdminRoleController extends Basic
{
public function indexGetTable(Request $request)
{
$builder = new TableBuilder([
'rowKey' => 'id',
'api' => 'AdminRole/index',
'lazy' => true,
'treeProps' => [
'children' => 'children',
'hasChildren' => 'hasChildren'
]
]);
$builder->addAction('操作', [
'width' => '200px',
'fixed' => 'right'
]);
$builder->addTableAction('编辑', [
'path' => 'AdminRole/update',
'where' => [
['is_system', '!=', 1]
],
'props' => [
'type' => 'primary',
'title' => '编辑《{name}》角色'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'primary',
'size' => 'small'
]
]
]);
$builder->addTableAction('删除', [
'model' => Action::COMFIRM['value'],
'path' => 'AdminRole/delete',
'where' => [
['is_system', '!=', 1]
],
'props' => [
'type' => 'error',
'message' => '确定要删除《{name}》角色吗?',
'confirmButtonClass' => 'el-button--danger'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'danger',
'size' => 'small'
]
]
]);
$builder->addHeader();
$builder->addHeaderAction('创建角色', [
'path' => 'AdminRole/create',
'props' => [
'type' => 'success',
'title' => '创建角色'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'success'
]
]
]);
$builder->add('id', 'ID', [
'props' => [
'width' => '80px'
]
]);
$builder->add('name', '角色名称');
$builder->add('admin_num', '人数', [
'props' => [
'width' => '120px'
]
]);
$builder->add('rule_num', '拥有权限数', [
'props' => [
'width' => '120px'
]
]);
$builder->add('state', '状态', [
'component' => [
'name' => 'switch',
'api' => 'AdminRole/indexUpdateState',
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
],
'props' => [
'width' => '100px'
]
]);
$builder->add('create_time', '时间', [
'props' => [
'width' => '200px'
],
'component' => [
'name' => 'table-times',
'props' => [
'group' => [
[
'field' => 'create_time',
'label' => '创建'
],
[
'field' => 'update_time',
'label' => '更新'
]
]
]
]
]);
$builder = $builder->builder();
return $this->resData($builder);
}
public function index(Request $request)
{
$limit = $request->get('limit', 10);
$where = [];
$id = $request->get('id');
if ($id) {
$where[] = ['pid', '=', $id];
} else {
$where[] = ['pid', 'NULL', ''];
}
$list = AdminRole::where($where)
->order('id asc')->paginate($limit)->each(function ($item) {
$item->admin_num = Admin::where(['role_id' => $item->id])->count();
$item->rule_num = 0;
if ($item->is_system) {
$item->rule_num = '所有';
} elseif ($item->rule) {
$item->rule_num = count($item->rule);
}
$item->hasChildren = AdminRole::where(['pid' => $item->id])->count() > 0;
});
return $this->resData($list);
}
public function indexUpdateState(Request $request)
{
$id = $request->post('id');
$field = $request->post('field');
$value = $request->post('value');
$AdminRole = AdminRole::where(['id' => $id])->find();
if (!$AdminRole) {
return $this->fail('角色不存在');
}
if ($AdminRole->is_system) {
return $this->fail('系统角色不允许操作');
}
$AdminRole->{$field} = $value;
if ($AdminRole->save()) {
return $this->success();
}
return $this->fail('操作失败');
}
public function delete(Request $request)
{
$id = $request->post('id');
$AdminRole = AdminRole::where(['id' => $id])->find();
if (!$AdminRole) {
return $this->fail('角色不存在');
}
if ($AdminRole->is_system) {
return $this->fail('系统角色不允许操作');
}
if (AdminRole::where(['pid' => $id])->count() > 0) {
return $this->fail('请先删除子角色');
}
if (Admin::where(['role_id' => $id])->count() > 0) {
return $this->fail('请先将拥有该角色的用户移除');
}
if ($AdminRole->delete()) {
return $this->success();
}
return $this->fail('操作失败');
}
public function create(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
$AdminRole = new AdminRole;
if (!empty($D['pid'])) {
$AdminRole->pid = $D['pid'];
}
$AdminRole->name = $D['name'];
$AdminRole->rule = $D['rule'];
if ($AdminRole->save()) {
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
return $this->fail('保存失败');
}
$builder = $this->getFormBuilder();
return $this->resData($builder);
}
public function update(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
$AdminRole = AdminRole::where(['id' => $D['id']])->find();
if (!$AdminRole) {
return $this->fail('角色不存在');
}
$AdminRole->name = $D['name'];
$AdminRole->rule = $D['rule'];
if ($AdminRole->save()) {
return $this->event(ResponseEvent::UPDATE_USERINFO, '保存成功');
}
return $this->fail('保存失败');
}
$id = $request->get('id');
$AdminRole = AdminRole::where(['id' => $id])->find();
if (!$AdminRole) {
return $this->fail('角色不存在');
}
$builder = $this->getFormBuilder(true);
if (!$AdminRole->rule) {
$AdminRole->rule = [];
}
$builder->setData($AdminRole->toArray());
return $this->resData($builder);
}
private function getFormBuilder($update = false)
{
$builder = new FormBuilder;
$Component = new ComponentBuilder;
if (!$update) {
$builder->add('pid', '角色等级', 'cascader', null, [
'prompt' => [
$Component->add('text', ['default' => '建议使用公司组织架构为角色等级'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'options' => AdminRole::options(null, ['is_system' => 0]),
'clearable' => true,
'filterable' => true,
'props' => [
'checkStrictly' => true,
'emitPath' => false
]
]
]);
}
$builder->add('name', '角色名称', 'input', '', [
'required' => true,
'prompt' => [
$Component->add('text', ['default' => '建议使用公司组织架构为角色名称'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'maxlength' => 30,
'show-word-limit' => true
]
]);
$Install = new \app\admin\api\Install;
$menus = new Menus($Install);
$builder->add('rule', '规则', 'admin-rule', [], [
'required' => true,
'options' => $menus,
'props' => [
'rightDefaultChecked' => [
'Index',
'Index/index',
'Index/control',
'Admin/updateSelf',
'Admin/getSelfInfo',
'Public',
'Public/outLogin'
]
]
]);
return $builder;
}
}
@@ -0,0 +1,38 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\helper\Captcha;
use support\Request;
use support\Response;
/**
* 图像验证码
* Class CaptchaController
* @package app\api\controller
*/
class CaptchaController extends Basic
{
/**
* 不需要登录的方法
* @var string[]
*/
protected $notNeedLogin = ['captcha', 'captchaCode'];
protected $notNeedAuth = ['captcha', 'captchaCode'];
/**
* 获取图像验证码
* @param Request $request
* @return Response
*/
public function captcha(Request $request)
{
return Captcha::captcha();
}
public function captchaCode()
{
return $this->success(null, Captcha::captchaCode());
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\DataboardBuilder;
use support\Request;
class IndexController extends Basic
{
/**
* 不需要登录的方法
* @var string[]
*/
protected $notNeedLogin = ['index'];
protected $notNeedAuth = ['index'];
public function index(Request $request)
{
$path = $request->path();
# 如果不是以/结尾的,就重定向到以/结尾的URL
if (substr($path, -1) != '/') {
return redirect($path . '/');
}
return view(public_path('index.html'));
}
public function control(Request $request)
{
$builder = new DataboardBuilder([
'gutter' => 6
]);
$pluginConfig = glob(base_path("plugin/*/api/{$request->app}/IndexController.php"));
foreach ($pluginConfig as $path) {
$plugin_name = basename(dirname(dirname(dirname($path))));
$class = 'plugin\\' . $plugin_name . "\\api\\{$request->app}\\IndexController";
if (!class_exists($class)) {
continue;
}
$plugin = new $class;
if (method_exists($plugin, 'control')) {
$plugin->control($builder);
}
}
foreach ($pluginConfig as $path) {
$plugin_name = basename(dirname(dirname(dirname($path))));
$class = 'plugin\\' . $plugin_name . "\\api\\{$request->app}\\IndexController";
if (!class_exists($class)) {
continue;
}
$plugin = new $class;
if (method_exists($plugin, 'echarts')) {
$plugin->echarts($builder);
}
}
return $this->resData($builder);
}
}
@@ -0,0 +1,70 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\model\Admin;
use app\model\AdminRole;
use app\expose\utils\Password;
use app\expose\enum\ResponseCode;
use app\expose\helper\Captcha;
use app\expose\helper\Config;
use Exception;
use support\Request;
class LoginController extends Basic
{
/**
* 不需要登录的方法
* @var string[]
*/
protected $notNeedLogin = ['login'];
protected $notNeedAuth = ['login'];
public function login(Request $request)
{
try {
$D = $request->post();
$captcha_state = Config::get('captcha', 'state');
if ($captcha_state) {
if (!Captcha::check($D['captcha'], $D['token'])) {
throw new Exception("验证码不正确", ResponseCode::CAPTCHA);
}
}
$Admin = Admin::where(['username' => $D['username']])->find();
if (!$Admin) {
throw new Exception('密码错误');
}
if (!Password::verify($D['password'], $Admin->password)) {
throw new Exception('密码错误');
}
if (!$Admin->state) {
throw new Exception('管理员账号异常');
}
$AdminRole = AdminRole::where(['id' => $Admin->role_id])->find();
if (!$AdminRole) {
throw new Exception('管理员角色异常');
}
if (!$AdminRole->state) {
throw new Exception('管理员角色异常');
}
if (!$AdminRole->is_system) {
$now = date('H:i:s');
if (!($now >= $Admin->allow_time_start && $now <= $Admin->allow_time_end)) {
throw new Exception("当前不在工作时间");
}
if (!in_array(date('w'), $Admin->allow_week)) {
throw new Exception("今日因该是休息日哦");
}
}
$Admin->login_time = date('Y-m-d H:i:s');
$Admin->login_ip = $request->getRealIp(true);
if ($Admin->save()) {
return $this->success('登录成功', Admin::getTokenInfo($Admin));
} else {
throw new Exception("登录失败");
}
} catch (\Throwable $th) {
return $this->exception($th);
}
}
}
@@ -0,0 +1,187 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\TableBuilder;
use app\expose\enum\PaymentChannels;
use app\expose\enum\Platform;
use app\expose\enum\State;
use app\model\PaymentConfig;
use app\model\PaymentTemplate;
use support\Request;
class PaymentController extends Basic
{
public function __construct()
{
$this->model = new PaymentConfig;
}
public function index(Request $request)
{
$tabs = [];
$PaymentConfig = PaymentConfig::where(['channels_uid' => null])->select();
$Platform = Platform::getOptions();
foreach ($Platform as $key => $item) {
$channels = [];
switch ($item['value']) {
case Platform::PC['value']:
$channels = [
PaymentChannels::WXPAY,
PaymentChannels::ALIPAY,
PaymentChannels::BALANCE,
PaymentChannels::INTEGRAL
];
break;
case Platform::H5['value']:
$channels = [
PaymentChannels::WXPAY,
PaymentChannels::ALIPAY,
PaymentChannels::BALANCE,
PaymentChannels::INTEGRAL
];
break;
case Platform::WECHAT_MINIAPP['value']:
$channels = [
PaymentChannels::WXPAY,
PaymentChannels::BALANCE,
PaymentChannels::INTEGRAL
];
break;
case Platform::WECHAT_OFFICIAL_ACCOUNT['value']:
$channels = [
PaymentChannels::WXPAY,
PaymentChannels::BALANCE,
PaymentChannels::INTEGRAL
];
break;
case Platform::APP['value']:
$channels = [
PaymentChannels::WXPAY,
PaymentChannels::ALIPAY,
PaymentChannels::BALANCE,
PaymentChannels::INTEGRAL
];
break;
}
$tabs[] = $this->getFormBuilder($PaymentConfig, $item, $channels);
}
return $this->resData($tabs);
}
private function getFormBuilder($PaymentConfig, $Platform, $channels)
{
$builder = new TableBuilder([
'border' => false,
'stripe' => false
]);
$builder->add('channels', '支付方式', [
'component' => [
'name' => 'table-userinfo',
'props' => [
'nickname' => 'channels_text',
'avatar' => [
'field' => 'channels_icon',
'size' => 40
]
]
],
'props' => []
]);
$builder->add('template_id', '支付模板', [
'component' => [
'name' => 'select',
'api' => 'Payment/indexUpdateField',
'options' => PaymentTemplate::options(['channels_uid' => null]),
'props' => [
'clearable' => true
]
],
'props' => [
'width' => '300px'
]
]);
$builder->add('state', '是否启用', [
'component' => [
'name' => 'switch',
'api' => 'Payment/indexUpdateState',
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
],
'props' => [
'width' => '160px'
]
]);
$builder->add('is_default', '是否为默认支付', [
'component' => [
'name' => 'switch',
'api' => 'Payment/indexUpdateState',
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
],
'props' => [
'width' => '160px'
]
]);
$tableData = [];
$exist = [];
foreach ($PaymentConfig as $item) {
if ($item->platform != $Platform['value']) continue;
$temp = $item->toArray();
$PaymentChannels = PaymentChannels::get($item->channels);
if ($PaymentChannels) {
$temp['channels_text'] = $PaymentChannels['label'];
$temp['channels_icon'] = $PaymentChannels['icon'];
}
$exist[] = $item->channels;
$tableData[] = $temp;
}
foreach ($channels as $key => $channel) {
if (!in_array($channel['value'], $exist)) {
$model = new PaymentConfig;
$model->platform = $Platform['value'];
$model->channels = $channel['value'];
$model->state = State::NO['value'];
$model->save();
$tableData[] = [
'id' => $model->id,
'channels' => $channel['value'],
'channels_text' => $channel['label'],
'channels_icon' => $channel['icon'],
'template_id' => null,
'state' => State::NO['value'],
'is_default' => State::NO['value']
];
}
}
$data = [
'title' => $Platform['label'],
'name' => $Platform['value'],
'tips' => '在' . $Platform['label'] . '端付款时使用',
'builder' => $builder,
'data' => $tableData
];
return $data;
}
public function indexUpdateState(Request $request)
{
$id = $request->post('id');
$field = $request->post('field');
$value = $request->post('value');
$PaymentConfig = PaymentConfig::where(['id' => $id])->find();
if (!$PaymentConfig) {
return $this->fail('数据不存在');
}
if ($field == 'is_default' && $value == State::YES['value']) {
$PaymentConfig->where(['platform' => $PaymentConfig->platform])->update(['is_default' => State::NO['value']]);
}
$PaymentConfig->{$field} = $value;
if ($PaymentConfig->save()) {
return $this->success();
}
return $this->fail('操作失败');
}
}
@@ -0,0 +1,639 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\ComponentBuilder;
use app\expose\build\builder\FormBuilder;
use app\expose\build\builder\TableBuilder;
use app\expose\enum\Action;
use app\expose\enum\AlipayRsaModel;
use app\expose\enum\PaymentChannels;
use app\expose\enum\State;
use app\expose\enum\WxpayMchType;
use app\expose\enum\WxpayVersion;
use app\model\PaymentTemplate;
use support\Request;
class PaymentTemplateController extends Basic
{
public function indexGetTable(Request $request)
{
$builder = new TableBuilder;
$builder->addAction('操作', [
'width' => '200px',
'fixed' => 'right'
]);
$builder->addTableAction('编辑', [
'path' => 'PaymentTemplate/update',
'props' => [
'type' => 'primary',
'title' => '编辑《{title}》支付模板'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'primary',
'size' => 'small'
]
]
]);
$builder->addTableAction('删除', [
'model' => Action::COMFIRM['value'],
'path' => 'PaymentTemplate/delete',
'props' => [
'type' => 'error',
'message' => '确定要删除《{title}》支付模板吗?',
'confirmButtonClass' => 'el-button--danger'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'danger',
'size' => 'small'
]
]
]);
$builder->addHeader();
$builder->addHeaderAction('新增模板', [
'path' => 'PaymentTemplate/create',
'props' => [
'type' => 'success',
'title' => '新增支付模板'
],
'component' => [
'name' => 'button',
'props' => [
'type' => 'success',
'icon' => 'Plus'
]
]
]);
$builder->add('id', 'ID', [
'props' => [
'width' => '80px'
]
]);
$builder->add('title', '模板名称');
$builder->add('channels', '支付方式', [
'component' => [
'name' => 'tag',
'options' => PaymentChannels::getOptions()
],
'props' => [
'width' => '160px'
]
]);
$builder->add('state', '状态', [
'component' => [
'name' => 'switch',
'api' => 'PaymentTemplate/indexUpdateState',
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
],
'props' => [
'width' => '100px'
]
]);
$builder->add('create_time', '时间', [
'props' => [
'width' => '200px'
],
'component' => [
'name' => 'table-times',
'props' => [
'group' => [
[
'field' => 'create_time',
'label' => '创建'
],
[
'field' => 'update_time',
'label' => '更新'
]
]
]
]
]);
return $this->resData($builder);
}
public function index(Request $request)
{
$limit = $request->get('limit', 10);
$where = [];
$where[] = ['channels_uid', '=', null];
$list = PaymentTemplate::where($where)->withoutField('value')
->order('id desc')->paginate($limit)->each(function ($item) {
});
return $this->resData($list);
}
public function create(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
$model = new PaymentTemplate;
$model->title = $D['title'];
unset($D['title']);
$model->channels = $D['channels'];
unset($D['channels']);
$model->state = State::YES['value'];
$model->value = $this->getValue($model->channels, $D);
if ($model->save()) {
return $this->success('新增成功');
}
return $this->fail('新增失败');
}
$builder = $this->getFormBuilder();
return $this->resData($builder);
}
public function update(Request $request)
{
if ($request->method() === 'POST') {
$D = $request->post();
$model = PaymentTemplate::where(['id' => $D['id']])->find();
if (!$model) {
return $this->fail('数据不存在');
}
unset($D['id']);
$model->title = $D['title'];
unset($D['title']);
$model->channels = $D['channels'];
unset($D['channels']);
$model->state = State::YES['value'];
$model->value = $this->getValue($model->channels, $D);
if ($model->save()) {
return $this->success('更新成功');
}
return $this->fail('更新失败');
}
$id = $request->get('id');
$model = PaymentTemplate::where(['id' => $id])->find();
if (!$model) {
return $this->fail('数据不存在');
}
$builder = $this->getFormBuilder(true);
$data = [
'id' => $model->id,
'title' => $model->title,
'channels' => $model->channels
];
foreach ($model->value as $key => $value) {
$data[$key] = $value;
}
$builder->setData($data);
return $this->resData($builder);
}
private function getValue($channels, $D)
{
$value = [];
switch ($channels) {
case PaymentChannels::WXPAY['value']:
$value = [
'mch_type' => $D['mch_type'],
'appid' => $D['appid'],
'mch_id' => $D['mch_id'],
'mch_key' => $D['mch_key'],
'ssl_cert' => $D['ssl_cert'],
'ssl_key' => $D['ssl_key'],
'notify_url' => $D['notify_url'],
];
break;
case PaymentChannels::ALIPAY['value']:
$value = [
'appid' => $D['appid'],
'ras_model' => $D['ras_model'],
'app_public_cert' => $D['app_public_cert'],
'alipay_public_cert' => $D['alipay_public_cert'],
'alipay_root_cert' => $D['alipay_root_cert'],
'alipay_public_key' => $D['alipay_public_key'],
'private_key' => $D['private_key'],
'notify_url' => $D['notify_url'],
];
break;
case PaymentChannels::INTEGRAL['value']:
$value = [
'display_name' => $D['display_name'],
'proportion' => $D['proportion'],
'is_integer' => $D['is_integer'],
'integer' => $D['integer']
];
break;
}
return $value;
}
private function getFormBuilder($update = false)
{
$builder = new FormBuilder(null, '', [
'labelWidth' => '300px',
'labelPosition' => 'right'
]);
$Component = new ComponentBuilder;
$builder->add('title', '模板名称', 'input', null, [
'required' => true,
'prompt' => [
$Component->add('text', ['default' => '仅用于后台管理使用,对前台用户不可见;例如:H5-支付宝支付;微信小程序-微信支付'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入模板名称'
]
]);
$builder->add('channels', '支付方式', 'radio', PaymentChannels::WXPAY['value'], [
'required' => true,
'prompt' => [
$Component->add('text', ['default' => '保存以后支付方式将不可修改,请谨慎操作,'], ['type' => 'info', 'size' => 'small'])
->add('link', ['default' => '微信商户平台'], ['type' => 'success', 'href' => 'https://pay.weixin.qq.com', 'target' => '_blank', 'underline' => 'never', 'size' => 'small'])
->add('text', ['default' => ''], ['type' => 'info', 'size' => 'small'])
->add('link', ['default' => '支付宝开放平台'], ['type' => 'primary', 'href' => 'https://alipay.com', 'target' => '_blank', 'underline' => 'never', 'size' => 'small'])
->builder()
],
'options' => PaymentChannels::getOptions(),
'props' => [
'disabled' => $update
],
'subProps' => [
'border' => true
]
]);
# 微信支付开始
/* $builder->add('api_version', '微信支付接口版本', 'radio', WxpayVersion::V3['value'], [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']]
],
'options' => WxpayVersion::getOptions(),
'subProps' => [
'border' => true
]
]); */
$builder->add('mch_type', '微信商户号类型', 'radio', WxpayMchType::NORMAL['value'], [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']]
],
'options' => WxpayMchType::getOptions(),
'subProps' => [
'border' => true
]
]);
$builder->add('appid', '应用ID (AppID)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::NORMAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入应用ID (AppID)'
]
]);
$builder->add('mch_id', '微信商户号 (MchId)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::NORMAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信支付的商户号,纯数字格式;例如:1600000109'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入微信商户号 (MchId)'
]
]);
$builder->add('mch_key', '支付密钥 (APIKEY)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::NORMAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信支付商户平台 - 账户中心 - API安全 - 设置APIv3密钥'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入支付密钥 (APIKEY)'
]
]);
$builder->add('ssl_cert', '证书文件 (CERT)', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::NORMAL['value']]
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
$builder->add('ssl_key', '证书文件 (KEY)', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::NORMAL['value']]
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
# 微信支付结束
# 微信支付服务商模式开始
$builder->add('service_appid', '服务商应用ID (AppID)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'prompt' => [
$Component->add('text', ['default' => '请填写微信支付服务商的AppID'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入服务商应用ID (AppID)'
]
]);
$builder->add('service_mch_id', '服务商户号 (MchId)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信支付服务商的商户号,纯数字格式;例如:1600000109'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入服务商户号 (MchId)'
]
]);
$builder->add('service_mch_key', '服务商密钥 (APIKEY)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信支付商户平台 - 账户中心 - API安全 - 设置API密钥'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入服务商密钥 (APIKEY)'
]
]);
$builder->add('appid', '子商户应用ID (AppID)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入子商户应用ID (AppID)'
]
]);
$builder->add('mch_id', '子商户号 (MchId)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'prompt' => [
$Component->add('text', ['default' => '微信支付的商户号,纯数字格式;例如:1600000109'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入子商户号 (MchId)'
]
]);
$builder->add('service_ssl_cert', '服务商证书文件 (CERT)', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
$builder->add('service_ssl_key', '服务商证书文件 (KEY)', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::WXPAY['value']],
['mch_type', '=', WxpayMchType::SERVICE['value']]
],
'props' => [
'accept' => 'application/octet-stream',
'view' => 'file',
'multiple' => 1
]
]);
# 微信支付服务商模式结束
# 支付宝支付开始
$builder->add('appid', '支付宝应用 (AppID)', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']]
],
'prompt' => [
$Component->add('text', ['default' => '支付宝分配给开发者的应用ID;例如:2021072300007148'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入支付宝应用 (AppID)'
]
]);
$builder->add('ras_model', '加签模式', 'radio', AlipayRsaModel::PUBLIC_CERT['value'], [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']]
],
'prompt' => [
$Component->add('text', ['default' => '如需使用资金支出类的接口,则必须使用公钥证书模式'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'options' => AlipayRsaModel::getOptions(),
'subProps' => [
'border' => true
]
]);
$builder->add('app_public_cert', '应用公钥证书', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']],
['ras_model', '=', AlipayRsaModel::PUBLIC_CERT['value']]
],
'prompt' => [
$Component->add('text', ['default' => '请上传 "appCertPublicKey_xxxxxxxx.crt" 文件'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
$builder->add('alipay_public_cert', '支付宝公钥证书', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']],
['ras_model', '=', AlipayRsaModel::PUBLIC_CERT['value']]
],
'prompt' => [
$Component->add('text', ['default' => '请上传 "alipayCertPublicKey_RSA2.crt" 文件'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
$builder->add('alipay_root_cert', '支付宝根证书', 'bundle', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']],
['ras_model', '=', AlipayRsaModel::PUBLIC_CERT['value']]
],
'prompt' => [
$Component->add('text', ['default' => '请上传 "alipayRootCert.crt" 文件'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'view' => 'file',
'multiple' => 1
]
]);
$builder->add('alipay_public_key', '支付宝公钥 (alipayPublicKey)', 'input', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']],
['ras_model', '=', AlipayRsaModel::PUBLIC_KEY['value']]
],
'prompt' => [
$Component->add('text', ['default' => '可在 "支付宝开放平台" - "应用信息" - "接口加签方式" - "支付宝公钥" 中复制'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'textarea',
'autosize' => [
'minRows' => 4,
'maxRows' => 6
],
'placeholder' => '请输入支付宝公钥 (alipayPublicKey)'
]
]);
$builder->add('private_key', '应用私钥 (privateKey)', 'input', '', [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::ALIPAY['value']]
],
'prompt' => [
$Component->add('text', ['default' => '查看 "应用私钥RSA2048-敏感数据,请妥善保管.txt" 文件,将全部内容复制到此处'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'textarea',
'autosize' => [
'minRows' => 4,
'maxRows' => 6
],
'placeholder' => '请输入应用私钥 (privateKey)'
]
]);
$builder->add('display_name', '显示名称', 'input', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::INTEGRAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '在客户端显示的名称'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '请输入显示名称'
]
]);
$builder->add('proportion', '充值比例', 'input-number', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::INTEGRAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '1元=多少积分'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'controls' => false,
'min' => 1,
'max' => 1000000
]
]);
$builder->add('is_integer', '整数使用', 'switch', State::NO['value'], [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::INTEGRAL['value']]
],
'prompt' => [
$Component->add('text', ['default' => '开启后只能使用整数的倍数积分'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'active-value' => State::YES['value'],
'inactive-value' => State::NO['value']
]
]);
$builder->add('integer', '整数', 'input-number', null, [
'required' => true,
'where' => [
['channels', '=', PaymentChannels::INTEGRAL['value']],
['is_integer', '=', State::YES['value']]
],
'prompt' => [
$Component->add('text', ['default' => '整数的倍数使用'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'controls' => false,
'min' => 1,
'max' => 1000000
]
]);
$builder->add('notify_url', '支付通知', 'input', null, [
'required' => true,
'where' => [
['channels', 'in', [PaymentChannels::WXPAY['value'],PaymentChannels::ALIPAY['value']]]
],
'prompt' => [
$Component->add('text', ['default' => '只需要填写域名,不需要填写路径,如:https://www.baidu.com'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'type' => 'text',
'placeholder' => '支付通知接口域名'
]
]);
return $builder;
}
}
@@ -0,0 +1,20 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\trait\Config;
use support\Request;
class PlatformController extends Basic
{
use Config;
public function wechat_miniproject(Request $request)
{
return $this->builder();
}
public function wechat_official_account(Request $request)
{
return $this->builder();
}
}
@@ -0,0 +1,211 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\config\Action;
use app\expose\build\config\Web;
use app\expose\enum\Action as EnumAction;
use app\expose\enum\Filesystem;
use app\expose\enum\ResponseEvent;
use app\expose\helper\Config;
use app\expose\helper\Menus;
use app\expose\utils\DatabaseSchemaSync;
use loong\oauth\facade\Auth;
use support\Request;
use support\think\Db;
class PublicController extends Basic
{
/**
* 不需要登录的方法
* @var string[]
*/
protected $notNeedLogin = ['config', 'menus', 'unlock'];
protected $notNeedAuth = ['config', 'menus', 'unlock'];
public function config(Request $request)
{
$lang = $request->lang;
$domain = $request->app;
$config = Config::get('basic');
$config = new Web($config);
$captcha_state = Config::get('captcha', 'state');
$config->useLogin([
'title' => trans('Login Title', [], $domain, $lang),
'url' => 'Login/login',
'user_agreement' => '',
'captcha' => $captcha_state
]);
$config->useApis([
'userinfo' => 'Admin/getSelfInfo',
'lock' => 'Public/lock',
'unlock' => 'Public/unlock',
'menus' => 'Public/menus',
'outLogin' => 'Public/outLogin'
]);
$toolbar = new Action();
$toolbar->add(EnumAction::LOCK['value'], [
'icon' => 'Lock',
'tips' => trans('toolbar Lock', [], $domain, $lang),
]);
$toolbar->add(EnumAction::SEARCH['value'], [
'icon' => 'Search',
'tips' => trans('toolbar Search', [], $domain, $lang),
]);
$toolbar->add(EnumAction::NOTIFICATION['value'], [
'icon' => 'Notification',
'tips' => trans('toolbar Notification', [], $domain, $lang),
]);
$toolbar->add(EnumAction::FULL_SCREEN['value'], [
'icon' => 'FullScreen',
'tips' => trans('toolbar FullScreen', [], $domain, $lang),
]);
// 读取update/VERSION文件和跟目录下的VERSION文件对比
$updateVersionContent = file_get_contents(base_path('update/VERSION'));
$updateVersion = explode("\n", $updateVersionContent);
$updateVersion = (int)trim($updateVersion[0]);
$versionContent = file_get_contents(base_path('VERSION'));
$version = explode("\n", $versionContent);
$version = (int)trim($version[0]);
if ($updateVersion < $version) {
$toolbar->add(EnumAction::COMFIRM['value'], [
'path' => 'Public/syncSql',
'icon' => 'Coin',
'tips' => trans('同步SQL', [], $domain, $lang),
'props' => [
'message' => '检测到有SQL未同步,确定要同步SQL吗?',
'confirmButtonClass' => 'el-button--danger'
]
]);
}
$toolbar->add(EnumAction::LINK['value'], [
'icon' => 'House',
'tips' => trans('toolbar House', [], $domain, $lang),
'props' => [
'url' => '/',
'target' => '_blank'
]
]);
$toolbar->add(EnumAction::LINK['value'], [
'icon' => 'ElementPlus',
'tips' => trans('toolbar Control', [], $domain, $lang),
'props' => [
'url' => '/control/',
'target' => '_blank'
]
]);
$config->useToolbar($toolbar->toArray());
$userDropdownMenu = new Action();
$userDropdownMenu->add(EnumAction::DIALOG['value'], [
'path' => 'Admin/updateSelf',
'label' => trans('userDropdownMenu updateSelf', [], $domain, $lang),
'icon' => 'User',
'props' => [
'title' => trans('userDropdownMenu updateSelf', [], $domain, $lang)
]
]);
$config->useUserDropdownMenu($userDropdownMenu->toArray());
$config->storage = Filesystem::getOptions();
$pluginConfig = glob(base_path("plugin/*/api/{$request->app}/PublicController.php"));
foreach ($pluginConfig as $path) {
$plugin_name = basename(dirname(dirname(dirname($path))));
$class = 'plugin\\' . $plugin_name . "\\api\\{$request->app}\\PublicController";
if (!class_exists($class)) {
continue;
}
$plugin = new $class;
if (method_exists($plugin, 'config')) {
$plugin->config($config);
}
}
$updateVersionContent = file_get_contents(base_path('update/VERSION'));
$updateVersionArr = explode("\n", $updateVersionContent);
$config->version_name = $updateVersionArr[1];
$config->version = $updateVersionArr[0];
return $this->resData($config);
}
public function menus(Request $request)
{
$Install = new \app\admin\api\Install;
$menus = new Menus($Install);
return $this->resData($menus);
}
public function outLogin(Request $request)
{
$token = $request->header('Authorization');
if ($token) {
try {
Auth::setPrefix('ADMIN')->delete($token);
} catch (\Throwable $th) {
}
}
return $this->success(trans('Logout Success', [], $request->app, $request->lang));
}
public function lock(Request $request)
{
try {
$password = $request->post('password');
if (!$password) {
return $this->fail(trans('PIN Code Cannot Be Empty', [], $request->app, $request->lang));
}
if (mb_strlen($password) != 6) {
return $this->fail(trans('Please Enter 6 Digits PIN Code', [], $request->app, $request->lang));
}
$token = $request->header('Authorization');
Auth::setPrefix('CONTROL')->lock($token, $password);
return $this->event(ResponseEvent::UPDATE_USERINFO, trans('Lock Success', [], $request->app, $request->lang));
} catch (\Throwable $th) {
return $this->exception($th);
}
}
public function unlock(Request $request)
{
$password = $request->post('password');
try {
$token = $request->header('Authorization');
Auth::setPrefix('CONTROL')->unlock($token, $password);
return $this->success(trans('Unlock Success', [], $request->app, $request->lang));
} catch (\Throwable $th) {
return $this->exception($th);
}
}
public function syncSql(Request $request)
{
$updateVersionContent = file_get_contents(base_path('update/VERSION'));
$updateVersionArr = explode("\n", $updateVersionContent);
$updateVersion = (int)trim($updateVersionArr[0]);
$versionContent = file_get_contents(base_path('VERSION'));
$versionArr = explode("\n", $versionContent);
$version = (int)trim($versionArr[0]);
if ($updateVersion >= $version) {
return $this->fail('已是最新版本');
}
$sqlSum = 0;
$sqlSuccessSum = 0;
$sqlErrorSum = 0;
for ($i = $updateVersion + 1; $i <= $version; $i++) {
$sqlFile = glob(base_path("update/{$i}/*.sql"));
if (empty($sqlFile)) {
continue;
}
foreach ($sqlFile as $file) {
$sqlSum++;
Db::startTrans();
try {
$sql = file_get_contents($file);
$prefix = config('thinkorm.connections.mysql.prefix');
$sql = str_replace('`php_', "`$prefix", $sql);
$sql = str_replace('INTO php_', "INTO $prefix", $sql);
Db::execute($sql);
Db::commit();
$sqlSuccessSum++;
} catch (\Throwable $th) {
Db::rollback();
$sqlErrorSum++;
}
}
}
file_put_contents(base_path('update/VERSION'), $versionContent);
return $this->success('同步SQL成功,共执行' . $sqlSum . '条SQL,成功' . $sqlSuccessSum . '条,失败' . $sqlErrorSum . '条,已更新到:' . $versionArr[1]);
}
}
@@ -0,0 +1,228 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\build\builder\ComponentBuilder;
use app\expose\build\builder\FormBuilder;
use app\expose\enum\Filesystem;
use app\expose\enum\SubmitEvent;
use app\expose\trait\Config;
use support\Request;
class SystemController extends Basic
{
use Config;
public function basic(Request $request)
{
return $this->builder();
}
public function payment(Request $request)
{
return $this->builder();
}
public function sms(Request $request)
{
return $this->tabsBuilder();
}
public function upload(Request $request)
{
$request = request();
if ($request->method() === 'POST') {
$D = $request->post();
$config = [];
$config['default'] = $D['default'];
$config['max_size'] = (int)$D['max_size'];
$config['storage']['public']['url'] = $D['public']['url'];
$config['storage']['local']['url'] = $D['local']['url'];
foreach ($D['ftp'] as $key => $value) {
$config['storage']['ftp'][$key] = $value;
}
foreach ($D['s3'] as $key => $value) {
if (in_array($key, ['key', 'secret'])) {
$config['storage']['s3']['credentials'][$key] = $value;
} else {
$config['storage']['s3'][$key] = $value;
}
}
foreach ($D['minio'] as $key => $value) {
if (in_array($key, ['key', 'secret'])) {
$config['storage']['minio']['credentials'][$key] = $value;
} else {
$config['storage']['minio'][$key] = $value;
}
}
foreach ($D['oss'] as $key => $value) {
$config['storage']['oss'][$key] = $value;
}
foreach ($D['qiniu'] as $key => $value) {
$config['storage']['qiniu'][$key] = $value;
}
foreach ($D['cos'] as $key => $value) {
$config['storage']['cos'][$key] = $value;
}
$content = json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$user = config_path("plugin/shopwwi/filesystem/app.json");
$res = file_put_contents($user, $content);
if ($res) {
return $this->success('保存成功,重启服务生效');
}
return $this->fail('保存失败');
}
$config = config('plugin.shopwwi.filesystem.app');
$builder = new FormBuilder(null, null, [
'translations'=>true,
'submitEvent' => SubmitEvent::SILENT
]);
$defaultOptions = Filesystem::getOptions();
$builder->add('default', '默认存储渠道商', 'select', $config['default'], [
'options' => $defaultOptions
]);
$builder->add('max_size', '单个文件大小(字节)', 'input-number', $config['max_size'], [
'props' => [
'min' => 0,
'controls' => false,
'style' => [
'width' => '200px'
]
]
]);
$Component = new ComponentBuilder;
$subBuilder = new FormBuilder('public', '本地存储(外部)');
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['public']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('local', '本地存储(内部)');
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['local']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('ftp', 'FTP存储');
$subBuilder->add('host', 'HOST', 'input', $config['storage']['ftp']['host']);
$subBuilder->add('username', 'UserName', 'input', $config['storage']['ftp']['username']);
$subBuilder->add('password', 'Password', 'input', $config['storage']['ftp']['password']);
$subBuilder->add('port', 'Port', 'input', $config['storage']['ftp']['port']);
$subBuilder->add('root', '目录', 'input', $config['storage']['ftp']['root']);
$subBuilder->add('passive', '被动模式', 'switch', $config['storage']['ftp']['passive']);
$subBuilder->add('ssl', 'SSL', 'switch', $config['storage']['ftp']['ssl']);
$subBuilder->add('timeout', '超时', 'input-number', $config['storage']['ftp']['timeout']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['ftp']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('s3', 'S3存储');
$subBuilder->add('key', 'KEY', 'input', $config['storage']['s3']['credentials']['key']);
$subBuilder->add('secret', 'Secret', 'input', $config['storage']['s3']['credentials']['secret']);
$subBuilder->add('region', 'Region', 'input', $config['storage']['s3']['region']);
$subBuilder->add('version', 'Version', 'input', $config['storage']['s3']['version']);
$subBuilder->add('bucket_endpoint', 'Bucket Endpoint', 'switch', $config['storage']['s3']['bucket_endpoint']);
$subBuilder->add('use_path_style_endpoint', 'Use path style endpoint', 'switch', $config['storage']['s3']['use_path_style_endpoint']);
$subBuilder->add('endpoint', 'Endpoint', 'input', $config['storage']['s3']['endpoint']);
$subBuilder->add('bucket_name', 'Bucket Name', 'input', $config['storage']['s3']['bucket_name']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['s3']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('minio', 'Minio存储');
$subBuilder->add('key', 'KEY', 'input', $config['storage']['minio']['credentials']['key']);
$subBuilder->add('secret', 'Secret', 'input', $config['storage']['minio']['credentials']['secret']);
$subBuilder->add('region', 'Region', 'input', $config['storage']['minio']['region']);
$subBuilder->add('version', 'Version', 'input', $config['storage']['minio']['version']);
$subBuilder->add('bucket_endpoint', 'Bucket Endpoint', 'switch', $config['storage']['minio']['bucket_endpoint']);
$subBuilder->add('use_path_style_endpoint', 'Use path style endpoint', 'switch', $config['storage']['minio']['use_path_style_endpoint']);
$subBuilder->add('endpoint', 'Endpoint', 'input', $config['storage']['minio']['endpoint']);
$subBuilder->add('bucket_name', 'Bucket Name', 'input', $config['storage']['minio']['bucket_name']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['minio']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('oss', '阿里云存储');
$subBuilder->add('accessId', 'AccessId', 'input', $config['storage']['oss']['accessId']);
$subBuilder->add('accessSecret', 'AccessSecret', 'input', $config['storage']['oss']['accessSecret']);
$subBuilder->add('bucket', 'Bucket', 'input', $config['storage']['oss']['bucket']);
$subBuilder->add('endpoint', 'Bucket域名', 'input', $config['storage']['oss']['endpoint']);
$subBuilder->add('isCName', '私有空间', 'switch', $config['storage']['oss']['isCName']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['oss']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('qiniu', '七牛存储');
$subBuilder->add('accessKey', 'AccessKey', 'input', $config['storage']['qiniu']['accessKey']);
$subBuilder->add('secretKey', 'SecretKey', 'input', $config['storage']['qiniu']['secretKey']);
$subBuilder->add('bucket', 'Bucket', 'input', $config['storage']['qiniu']['bucket']);
$subBuilder->add('domain', 'Domain', 'input', $config['storage']['qiniu']['domain']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['qiniu']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
$subBuilder = new FormBuilder('cos', '腾讯云存储');
$subBuilder->add('app_id', 'Appid', 'input', $config['storage']['cos']['app_id']);
$subBuilder->add('secret_id', 'SecretId', 'input', $config['storage']['cos']['secret_id']);
$subBuilder->add('secret_key', 'SecretKey', 'input', $config['storage']['cos']['secret_key']);
$subBuilder->add('region', 'Region', 'input', $config['storage']['cos']['region']);
$subBuilder->add('bucket', 'Bucket', 'input', $config['storage']['cos']['bucket']);
$subBuilder->add('read_from_cdn', '从CDN读取', 'switch', $config['storage']['cos']['read_from_cdn']);
$subBuilder->add('signed_url', '私有空间', 'switch', $config['storage']['cos']['signed_url']);
$subBuilder->add('url', '静态文件访问域名', 'input', $config['storage']['cos']['url'], [
'prompt' => [
$Component->add('text', ['default' => '对外访问域名,不以斜杠结尾'], ['type' => 'info', 'size' => 'small'])
->builder()
],
'props' => [
'placeholder' => 'http://static.example.com'
]
]);
$builder->addGroupForm($subBuilder);
return $this->resData($builder);
}
}
@@ -0,0 +1,16 @@
<?php
namespace app\admin\controller;
use app\Basic;
use app\expose\trait\Uploads;
class UploadsController extends Basic
{
use Uploads;
public function __construct()
{
$request = request();
$this->admin_uid = $request->admin_uid;
}
}
@@ -0,0 +1,9 @@
<?php
namespace app\admin\middleware;
use app\expose\middleware\AdminAuth;
class Auth extends AdminAuth
{
}