mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
完成初始化数据;
This commit is contained in:
@@ -17,9 +17,6 @@ use app\common\model\TimeModel;
|
||||
|
||||
class MallGoods extends TimeModel
|
||||
{
|
||||
|
||||
protected $table = "";
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function cate()
|
||||
|
||||
@@ -18,4 +18,7 @@ use app\common\model\TimeModel;
|
||||
class SystemAuthNode extends TimeModel
|
||||
{
|
||||
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
protected $deleteTime = false;
|
||||
}
|
||||
@@ -18,5 +18,5 @@ use app\common\model\TimeModel;
|
||||
|
||||
class SystemConfig extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = false;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemLog extends TimeModel
|
||||
{
|
||||
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
parent::__construct($data);
|
||||
$this->name = 'system_log_' . date('Ym');
|
||||
}
|
||||
|
||||
public function setMonth($month)
|
||||
{
|
||||
$this->name = 'system_log_' . $month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\SystemAdmin', 'admin_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -18,6 +18,8 @@ use app\common\model\TimeModel;
|
||||
class SystemNode extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = false;
|
||||
|
||||
public function getNodeTreeList()
|
||||
{
|
||||
$list = $this->select()->toArray();
|
||||
|
||||
@@ -47,6 +47,9 @@ class TimeModel extends Model
|
||||
* 软删除
|
||||
*/
|
||||
use SoftDelete;
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $deleteTime = true;
|
||||
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
}
|
||||
143
app/common/service/InitAdminService.php
Normal file
143
app/common/service/InitAdminService.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use app\admin\model\MallCate;
|
||||
use app\admin\model\MallGoods;
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\admin\model\SystemAuth;
|
||||
use app\admin\model\SystemAuthNode;
|
||||
use app\admin\model\SystemConfig;
|
||||
use app\admin\model\SystemMenu;
|
||||
use app\admin\model\SystemNode;
|
||||
use app\admin\model\SystemQuick;
|
||||
use app\common\constants\AdminConstant;
|
||||
|
||||
class InitAdminService
|
||||
{
|
||||
|
||||
protected $output = null;
|
||||
|
||||
public function __construct($output)
|
||||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->initAdmin();
|
||||
$this->initAuth();
|
||||
$this->initConfig();
|
||||
$this->initMenu();
|
||||
$this->initQuick();
|
||||
$this->initMall();
|
||||
}
|
||||
|
||||
public function initMall()
|
||||
{
|
||||
$output = $this->output;
|
||||
|
||||
$output->writeln('开始初始化商城案例');
|
||||
|
||||
$list_cate = $this->requireData('MallCate');
|
||||
|
||||
$list_goods = $this->requireData('MallGoods');
|
||||
|
||||
foreach ($list_cate as $data_cate) {
|
||||
$model_cate = MallCate::create($data_cate);
|
||||
|
||||
foreach ($list_goods as $data_goods) {
|
||||
$data_goods['cate_id'] = $model_cate->id;
|
||||
MallGoods::create($data_goods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function initQuick()
|
||||
{
|
||||
$output = $this->output;
|
||||
|
||||
$output->writeln('开始初始化快捷入口');
|
||||
|
||||
$list_quick = $this->requireData('SystemQuick');
|
||||
|
||||
$this->installData(SystemQuick::class, $list_quick);
|
||||
}
|
||||
|
||||
public function initMenu()
|
||||
{
|
||||
$output = $this->output;
|
||||
|
||||
$output->writeln('开始初始化系统菜单');
|
||||
|
||||
$list_menu = $this->requireData('SystemMenu');
|
||||
|
||||
$this->installData(SystemMenu::class, $list_menu);
|
||||
}
|
||||
|
||||
public function initConfig()
|
||||
{
|
||||
$output = $this->output;
|
||||
$output->writeln('开始初始化系统设置');
|
||||
|
||||
$list_config = $this->requireData('SystemConfig');
|
||||
|
||||
$this->installData(SystemConfig::class, $list_config);
|
||||
}
|
||||
|
||||
public function initAdmin()
|
||||
{
|
||||
$output = $this->output;
|
||||
|
||||
$output->writeln('创建超级管理员');
|
||||
|
||||
$model_admin = SystemAdmin::find(AdminConstant::SUPER_ADMIN_ID);
|
||||
|
||||
if (empty($model_admin)) {
|
||||
$model_admin = new SystemAdmin();
|
||||
$model_admin->id = AdminConstant::SUPER_ADMIN_ID;
|
||||
$model_admin->head_img = '/static/admin/images/head.jpg';
|
||||
$model_admin->username = 'admin';
|
||||
$model_admin->password = password(123456);
|
||||
$model_admin->status = 1;
|
||||
$model_admin->save();
|
||||
$output->writeln('创建超级管理员成功');
|
||||
} else {
|
||||
$output->writeln('超级管理员已存在,无需初始化');
|
||||
}
|
||||
}
|
||||
|
||||
public function initAuth()
|
||||
{
|
||||
$output = $this->output;
|
||||
|
||||
$output->writeln('开始初始化权限');
|
||||
|
||||
$list_auth = $this->requireData('SystemAuth');
|
||||
|
||||
$this->installData(SystemAuth::class, $list_auth);
|
||||
|
||||
$output->writeln('开始初始化权限节点');
|
||||
|
||||
$list_auth_node = $this->requireData('SystemAuthNode');
|
||||
|
||||
$this->installData(SystemAuthNode::class, $list_auth_node);
|
||||
|
||||
$output->writeln('开始初始化系统节点');
|
||||
$list_node = $this->requireData('SystemNode');
|
||||
|
||||
$this->installData(SystemNode::class, $list_node);
|
||||
}
|
||||
|
||||
protected function installData($model_name, $list)
|
||||
{
|
||||
foreach ($list as $key => $value) {
|
||||
$model_name::create($value);
|
||||
}
|
||||
}
|
||||
|
||||
protected function requireData($table_name)
|
||||
{
|
||||
return include __DIR__ . '/initAdminData/' . $table_name . '.php';
|
||||
}
|
||||
}
|
||||
12
app/common/service/initAdminData/MallCate.php
Normal file
12
app/common/service/initAdminData/MallCate.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$ul_mall_cate = array(
|
||||
array(
|
||||
"title" => "手机",
|
||||
"image" => "http://admin.demo.ulthon.com/upload/20220417/72ef1d769595627af51d76c612a789bf.png",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
"remark" => "",
|
||||
)
|
||||
);
|
||||
|
||||
return $ul_mall_cate;
|
||||
34
app/common/service/initAdminData/MallGoods.php
Normal file
34
app/common/service/initAdminData/MallGoods.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
$ul_mall_goods = array(
|
||||
array(
|
||||
"title" => "落地-风扇",
|
||||
"logo" => "http://admin.demo.ulthon.com/upload/20220417/72ef1d769595627af51d76c612a789bf.png",
|
||||
"images" => "http://admin.host/upload/20200514/95496713918290f6315ea3f87efa6bf2.jpg|http://admin.host/upload/20200514/ae29fa9cba4fc02defb7daed41cb2b13.jpg|http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg|http://admin.host/upload/20200514/3b88be4b1934690e5c1bd6b54b9ab5c8.jpg",
|
||||
"describe" => "<p>76654757</p>\n\n<p><img alt="" src="http://admin.host/upload/20200515/198070421110fa01f2c2ac2f52481647.jpg" style="height:689px; width:790px" /></p>\n\n<p><img alt="" src="http://admin.host/upload/20200515/a07a742c15a78781e79f8a3317006c1d.jpg" style="height:877px; width:790px" /></p>\n",
|
||||
"market_price" => 599.00,
|
||||
"discount_price" => 368.00,
|
||||
"sales" => 0,
|
||||
"virtual_sales" => 594,
|
||||
"stock" => 0,
|
||||
"total_stock" => 0,
|
||||
"sort" => 675,
|
||||
"status" => 1,
|
||||
"remark" => "",
|
||||
),
|
||||
array(
|
||||
"title" => "电脑",
|
||||
"logo" => "http://admin.demo.ulthon.com/upload/20220417/72ef1d769595627af51d76c612a789bf.png",
|
||||
"images" => "http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg",
|
||||
"describe" => "<p>477</p>\n",
|
||||
"market_price" => 0.00,
|
||||
"discount_price" => 0.00,
|
||||
"sales" => 0,
|
||||
"virtual_sales" => 0,
|
||||
"stock" => 115,
|
||||
"total_stock" => 320,
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
"remark" => "",
|
||||
)
|
||||
);
|
||||
return $ul_mall_goods;
|
||||
21
app/common/service/initAdminData/SystemAuth.php
Normal file
21
app/common/service/initAdminData/SystemAuth.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$ul_system_auth = array(
|
||||
array(
|
||||
"id" => 1,
|
||||
"title" => "管理员",
|
||||
"sort" => 1,
|
||||
"status" => 1,
|
||||
"remark" => "测试管理员",
|
||||
),
|
||||
array(
|
||||
"id" => 6,
|
||||
"title" => "游客权限",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
"remark" => "",
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
return $ul_system_auth;
|
||||
84
app/common/service/initAdminData/SystemAuthNode.php
Normal file
84
app/common/service/initAdminData/SystemAuthNode.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
$ul_system_auth_node = array(
|
||||
array(
|
||||
"id" => 1,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 1
|
||||
),
|
||||
array(
|
||||
"id" => 2,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 2
|
||||
),
|
||||
array(
|
||||
"id" => 3,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 9
|
||||
),
|
||||
array(
|
||||
"id" => 4,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 12
|
||||
),
|
||||
array(
|
||||
"id" => 5,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 18
|
||||
),
|
||||
array(
|
||||
"id" => 6,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 19
|
||||
),
|
||||
array(
|
||||
"id" => 7,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 21
|
||||
),
|
||||
array(
|
||||
"id" => 8,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 22
|
||||
),
|
||||
array(
|
||||
"id" => 9,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 29
|
||||
),
|
||||
array(
|
||||
"id" => 10,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 30
|
||||
),
|
||||
array(
|
||||
"id" => 11,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 38
|
||||
),
|
||||
array(
|
||||
"id" => 12,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 39
|
||||
),
|
||||
array(
|
||||
"id" => 13,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 45
|
||||
),
|
||||
array(
|
||||
"id" => 14,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 46
|
||||
),
|
||||
array(
|
||||
"id" => 15,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 52
|
||||
),
|
||||
array(
|
||||
"id" => 16,
|
||||
"auth_id" => 6,
|
||||
"node_id" => 53
|
||||
)
|
||||
);
|
||||
return $ul_system_auth_node;
|
||||
242
app/common/service/initAdminData/SystemConfig.php
Normal file
242
app/common/service/initAdminData/SystemConfig.php
Normal file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
$ul_system_config = array(
|
||||
array(
|
||||
"name" => "alisms_access_key_id",
|
||||
"group" => "sms",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里大于公钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alisms_access_key_secret",
|
||||
"group" => "sms",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里大鱼私钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "upload_type",
|
||||
"group" => "upload",
|
||||
"value" => "local",
|
||||
"remark" => "当前上传方式 (local,alioss,qnoss,txoss)",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "upload_allow_ext",
|
||||
"group" => "upload",
|
||||
"value" => "doc,gif,ico,icon,jpg,mp3,mp4,p12,pem,png,rar,jpeg",
|
||||
"remark" => "允许上传的文件类型",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "upload_allow_size",
|
||||
"group" => "upload",
|
||||
"value" => "1024000",
|
||||
"remark" => "允许上传的大小",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "upload_allow_mime",
|
||||
"group" => "upload",
|
||||
"value" => "image/gif,image/jpeg,video/x-msvideo,text/plain,image/png",
|
||||
"remark" => "允许上传的文件mime",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "upload_allow_type",
|
||||
"group" => "upload",
|
||||
"value" => "local,alioss,qnoss,txcos",
|
||||
"remark" => "可用的上传文件方式",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alioss_access_key_id",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里云oss公钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alioss_access_key_secret",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里云oss私钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alioss_endpoint",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里云oss数据中心",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alioss_bucket",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里云oss空间名称",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "alioss_domain",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "阿里云oss访问域名",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "logo_title",
|
||||
"group" => "site",
|
||||
"value" => "ulthon_admin",
|
||||
"remark" => "LOGO标题",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "logo_image",
|
||||
"group" => "site",
|
||||
"value" => "/favicon.ico",
|
||||
"remark" => "logo图片",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_name",
|
||||
"group" => "site",
|
||||
"value" => "ulthon_admin后台系统",
|
||||
"remark" => "站点名称",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_ico",
|
||||
"group" => "site",
|
||||
"value" => "填你的",
|
||||
"remark" => "浏览器图标",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_copyright",
|
||||
"group" => "site",
|
||||
"value" => "填你的",
|
||||
"remark" => "版权信息",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_beian",
|
||||
"group" => "site",
|
||||
"value" => "填你的",
|
||||
"remark" => "备案信息",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_version",
|
||||
"group" => "site",
|
||||
"value" => "2.0.0",
|
||||
"remark" => "版本信息",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "sms_type",
|
||||
"group" => "sms",
|
||||
"value" => "alisms",
|
||||
"remark" => "短信类型",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "miniapp_appid",
|
||||
"group" => "wechat",
|
||||
"value" => "填你的",
|
||||
"remark" => "小程序公钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "miniapp_appsecret",
|
||||
"group" => "wechat",
|
||||
"value" => "填你的",
|
||||
"remark" => "小程序私钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "web_appid",
|
||||
"group" => "wechat",
|
||||
"value" => "填你的",
|
||||
"remark" => "公众号公钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "web_appsecret",
|
||||
"group" => "wechat",
|
||||
"value" => "填你的",
|
||||
"remark" => "公众号私钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "txcos_secret_id",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "腾讯云cos密钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "txcos_secret_key",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "腾讯云cos私钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "txcos_region",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "存储桶地域",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "tecos_bucket",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "存储桶名称",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "qnoss_access_key",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "访问密钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "qnoss_secret_key",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "安全密钥",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "qnoss_bucket",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "存储空间",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "qnoss_domain",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "访问域名",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "file",
|
||||
"group" => "site",
|
||||
"value" => "",
|
||||
"remark" => "",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "site_domain",
|
||||
"group" => "site",
|
||||
"value" => "http://admin.demo.ulthon.com",
|
||||
"remark" => "",
|
||||
"sort" => 0,
|
||||
)
|
||||
);
|
||||
return $ul_system_config;
|
||||
122
app/common/service/initAdminData/SystemMenu.php
Normal file
122
app/common/service/initAdminData/SystemMenu.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
$ul_system_menu = array(
|
||||
array(
|
||||
"pid" => 99999999,
|
||||
"title" => "后台首页",
|
||||
"icon" => "fa fa-home",
|
||||
"href" => "index/welcome",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 0,
|
||||
"title" => "系统管理",
|
||||
"icon" => "fa fa-cog",
|
||||
"href" => "",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "菜单管理",
|
||||
"icon" => "fa fa-tree",
|
||||
"href" => "system.menu/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "管理员管理",
|
||||
"icon" => "fa fa-user",
|
||||
"href" => "system.admin/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "角色管理",
|
||||
"icon" => "fa fa-bitbucket-square",
|
||||
"href" => "system.auth/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "节点管理",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "system.node/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "配置管理",
|
||||
"icon" => "fa fa-asterisk",
|
||||
"href" => "system.config/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "上传管理",
|
||||
"icon" => "fa fa-arrow-up",
|
||||
"href" => "system.uploadfile/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 0,
|
||||
"title" => "商城管理",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 249,
|
||||
"title" => "商品分类",
|
||||
"icon" => "fa fa-calendar-check-o",
|
||||
"href" => "mall.cate/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 249,
|
||||
"title" => "商品管理",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "mall.goods/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "快捷入口",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "system.quick/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"pid" => 228,
|
||||
"title" => "日志管理",
|
||||
"icon" => "fa fa-connectdevelop",
|
||||
"href" => "system.log/index",
|
||||
"params" => "",
|
||||
"target" => "_self",
|
||||
"status" => 1,
|
||||
)
|
||||
);
|
||||
|
||||
return $ul_system_menu;
|
||||
480
app/common/service/initAdminData/SystemNode.php
Normal file
480
app/common/service/initAdminData/SystemNode.php
Normal file
@@ -0,0 +1,480 @@
|
||||
<?php
|
||||
$ul_system_node = array(
|
||||
array(
|
||||
"id" => 1,
|
||||
"node" => "system.admin",
|
||||
"title" => "管理员管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 2,
|
||||
"node" => "system.admin/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 3,
|
||||
"node" => "system.admin/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 4,
|
||||
"node" => "system.admin/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 5,
|
||||
"node" => "system.admin/password",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 6,
|
||||
"node" => "system.admin/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 7,
|
||||
"node" => "system.admin/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 8,
|
||||
"node" => "system.admin/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 9,
|
||||
"node" => "system.auth",
|
||||
"title" => "角色权限管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 10,
|
||||
"node" => "system.auth/authorize",
|
||||
"title" => "授权",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 11,
|
||||
"node" => "system.auth/saveAuthorize",
|
||||
"title" => "授权保存",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 12,
|
||||
"node" => "system.auth/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 13,
|
||||
"node" => "system.auth/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 14,
|
||||
"node" => "system.auth/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 15,
|
||||
"node" => "system.auth/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 16,
|
||||
"node" => "system.auth/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 17,
|
||||
"node" => "system.auth/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 18,
|
||||
"node" => "system.config",
|
||||
"title" => "系统配置管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 19,
|
||||
"node" => "system.config/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 20,
|
||||
"node" => "system.config/save",
|
||||
"title" => "保存",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 21,
|
||||
"node" => "system.menu",
|
||||
"title" => "菜单管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 22,
|
||||
"node" => "system.menu/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 23,
|
||||
"node" => "system.menu/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 24,
|
||||
"node" => "system.menu/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 25,
|
||||
"node" => "system.menu/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 26,
|
||||
"node" => "system.menu/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 27,
|
||||
"node" => "system.menu/getMenuTips",
|
||||
"title" => "添加菜单提示",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 28,
|
||||
"node" => "system.menu/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 29,
|
||||
"node" => "system.node",
|
||||
"title" => "系统节点管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 30,
|
||||
"node" => "system.node/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 31,
|
||||
"node" => "system.node/refreshNode",
|
||||
"title" => "系统节点更新",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 32,
|
||||
"node" => "system.node/clearNode",
|
||||
"title" => "清除失效节点",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 33,
|
||||
"node" => "system.node/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 34,
|
||||
"node" => "system.node/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 35,
|
||||
"node" => "system.node/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 36,
|
||||
"node" => "system.node/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 37,
|
||||
"node" => "system.node/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 38,
|
||||
"node" => "system.uploadfile",
|
||||
"title" => "上传文件管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 39,
|
||||
"node" => "system.uploadfile/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 40,
|
||||
"node" => "system.uploadfile/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 41,
|
||||
"node" => "system.uploadfile/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 42,
|
||||
"node" => "system.uploadfile/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 43,
|
||||
"node" => "system.uploadfile/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 44,
|
||||
"node" => "system.uploadfile/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 45,
|
||||
"node" => "mall.cate",
|
||||
"title" => "商品分类管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 46,
|
||||
"node" => "mall.cate/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 47,
|
||||
"node" => "mall.cate/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 48,
|
||||
"node" => "mall.cate/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 49,
|
||||
"node" => "mall.cate/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 50,
|
||||
"node" => "mall.cate/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 51,
|
||||
"node" => "mall.cate/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 52,
|
||||
"node" => "mall.goods",
|
||||
"title" => "商城商品管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 53,
|
||||
"node" => "mall.goods/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 54,
|
||||
"node" => "mall.goods/stock",
|
||||
"title" => "入库",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 55,
|
||||
"node" => "mall.goods/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 56,
|
||||
"node" => "mall.goods/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 57,
|
||||
"node" => "mall.goods/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 58,
|
||||
"node" => "mall.goods/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 59,
|
||||
"node" => "mall.goods/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 60,
|
||||
"node" => "system.quick",
|
||||
"title" => "快捷入口管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 61,
|
||||
"node" => "system.quick/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 62,
|
||||
"node" => "system.quick/add",
|
||||
"title" => "添加",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 63,
|
||||
"node" => "system.quick/edit",
|
||||
"title" => "编辑",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 64,
|
||||
"node" => "system.quick/delete",
|
||||
"title" => "删除",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 65,
|
||||
"node" => "system.quick/export",
|
||||
"title" => "导出",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 66,
|
||||
"node" => "system.quick/modify",
|
||||
"title" => "属性修改",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 67,
|
||||
"node" => "system.log",
|
||||
"title" => "操作日志管理",
|
||||
"type" => 1,
|
||||
"is_auth" => 1,
|
||||
),
|
||||
array(
|
||||
"id" => 68,
|
||||
"node" => "system.log/index",
|
||||
"title" => "列表",
|
||||
"type" => 2,
|
||||
"is_auth" => 1,
|
||||
)
|
||||
);
|
||||
return $ul_system_node;
|
||||
61
app/common/service/initAdminData/SystemQuick.php
Normal file
61
app/common/service/initAdminData/SystemQuick.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
$ul_system_quick = array(
|
||||
array(
|
||||
"title" => "管理员管理",
|
||||
"icon" => "fa fa-user",
|
||||
"href" => "system.admin/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "角色管理",
|
||||
"icon" => "fa fa-bitbucket-square",
|
||||
"href" => "system.auth/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "菜单管理",
|
||||
"icon" => "fa fa-tree",
|
||||
"href" => "system.menu/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "节点管理",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "system.node/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "配置管理",
|
||||
"icon" => "fa fa-asterisk",
|
||||
"href" => "system.config/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "上传管理",
|
||||
"icon" => "fa fa-arrow-up",
|
||||
"href" => "system.uploadfile/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "商品分类",
|
||||
"icon" => "fa fa-calendar-check-o",
|
||||
"href" => "mall.cate/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
),
|
||||
array(
|
||||
"title" => "商品管理",
|
||||
"icon" => "fa fa-list",
|
||||
"href" => "mall.goods/index",
|
||||
"sort" => 0,
|
||||
"status" => 1,
|
||||
)
|
||||
);
|
||||
|
||||
return $ul_system_quick;
|
||||
54
database/seeds/InitBaseAdminData.php
Normal file
54
database/seeds/InitBaseAdminData.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
|
||||
use app\admin\model\SystemConfig;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\service\InitAdminService;
|
||||
use think\migration\Seeder;
|
||||
|
||||
class InitBaseAdminData extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
* Write your database seeder using this method.
|
||||
*
|
||||
* More information on writing seeders is available here:
|
||||
* http://docs.phinx.org/en/latest/seeding.html
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
$output = $this->getOutput();
|
||||
|
||||
TriggerService::updateSysconfig();
|
||||
|
||||
$install_lock = sysconfig('base_admin_install', true, 0);
|
||||
|
||||
if ($install_lock == 1) {
|
||||
|
||||
$output->writeln('系统已初始化,跳过当前程序');
|
||||
return false;
|
||||
}
|
||||
|
||||
$model_config = SystemConfig::where('group', 'system')
|
||||
->where('name', 'base_admin_install')
|
||||
->find();
|
||||
|
||||
if (empty($model_config)) {
|
||||
$model_config = new SystemConfig();
|
||||
|
||||
$model_config->group = 'system';
|
||||
$model_config->name = 'base_admin_install';
|
||||
$model_config->remark = '系统初始化锁定,请勿修改,避免插入重复数据';
|
||||
}
|
||||
|
||||
$model_config->value = 1;
|
||||
|
||||
$model_config->save();
|
||||
|
||||
TriggerService::updateSysconfig();
|
||||
|
||||
(new InitAdminService($output))->init();
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ Route::view('/', 'welcome', [
|
||||
[
|
||||
'name' => '演示',
|
||||
'active' => false,
|
||||
'href' => 'http://admin.demo.ulthon.com/',
|
||||
'href' => 'http://admin.demo.ulthon.com/admin/',
|
||||
'target' => '_blank',
|
||||
],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user