30 changed files with 2232 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
// 默认输出类型 |
|||
'default_return_type' => 'html', |
|||
|
|||
'template' => [ |
|||
// layout布局 |
|||
'layout_on' => true, |
|||
'layout_name' => 'layouts/layout', |
|||
// 模板引擎类型 支持 php think 支持扩展 |
|||
'type' => 'think', |
|||
// 模板路径 |
|||
'view_path' => '', |
|||
// 模板后缀 |
|||
'view_suffix' => 'php', |
|||
// 模板文件名分隔符 |
|||
'view_depr' => DS, |
|||
// 模板引擎普通标签开始标记 |
|||
'tpl_begin' => '{{', |
|||
// 模板引擎普通标签结束标记 |
|||
'tpl_end' => '}}', |
|||
// 标签库标签开始标记 |
|||
'taglib_begin' => '{{', |
|||
// 标签库标签结束标记 |
|||
'taglib_end' => '}}', |
|||
], |
|||
]; |
|||
@ -0,0 +1,187 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller; |
|||
|
|||
use think\Config; |
|||
use think\Request; |
|||
use think\Session; |
|||
|
|||
// use app\store\model\Setting; |
|||
|
|||
/** |
|||
* 超管后台控制器基类 |
|||
* Class Controller |
|||
* @package app\admin\controller |
|||
*/ |
|||
class Controller extends \think\Controller |
|||
{ |
|||
/* @var array $admin 商家登录信息 */ |
|||
protected $admin; |
|||
|
|||
/* @var string $route 当前控制器名称 */ |
|||
protected $controller = ''; |
|||
|
|||
/* @var string $route 当前方法名称 */ |
|||
protected $action = ''; |
|||
|
|||
/* @var string $route 当前路由uri */ |
|||
protected $routeUri = ''; |
|||
|
|||
/* @var string $route 当前路由:分组名称 */ |
|||
protected $group = ''; |
|||
|
|||
/* @var array $allowAllAction 登录验证白名单 */ |
|||
protected $allowAllAction = [ |
|||
// 登录页面 |
|||
'passport/login', |
|||
]; |
|||
|
|||
/* @var array $notLayoutAction 无需全局layout */ |
|||
protected $notLayoutAction = [ |
|||
// 登录页面 |
|||
'passport/login', |
|||
]; |
|||
|
|||
/** |
|||
* 后台初始化 |
|||
* @throws \Exception |
|||
*/ |
|||
public function _initialize() |
|||
{ |
|||
// 商家登录信息 |
|||
$this->admin = Session::get('yoshop_admin'); |
|||
// 当前路由信息 |
|||
$this->getRouteinfo(); |
|||
// 验证登录 |
|||
$this->checkLogin(); |
|||
// 全局layout |
|||
$this->layout(); |
|||
} |
|||
|
|||
/** |
|||
* 全局layout模板输出 |
|||
* @throws \Exception |
|||
*/ |
|||
private function layout() |
|||
{ |
|||
// 验证当前请求是否在白名单 |
|||
if (!in_array($this->routeUri, $this->notLayoutAction)) { |
|||
// 输出到view |
|||
$this->assign([ |
|||
'base_url' => base_url(), // 当前域名 |
|||
'admin_url' => url('/admin'), // 后台模块url |
|||
'group' => $this->group, |
|||
'menus' => $this->menus(), // 后台菜单 |
|||
'admin' => $this->admin, // 商家登录信息 |
|||
'version' => get_version(), // 当前系统版本号 |
|||
'request' => Request::instance() // Request对象 |
|||
]); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 解析当前路由参数 (分组名称、控制器名称、方法名) |
|||
*/ |
|||
protected function getRouteinfo() |
|||
{ |
|||
// 控制器名称 |
|||
$this->controller = toUnderScore($this->request->controller()); |
|||
// 方法名称 |
|||
$this->action = $this->request->action(); |
|||
// 控制器分组 (用于定义所属模块) |
|||
$groupstr = strstr($this->controller, '.', true); |
|||
$this->group = $groupstr !== false ? $groupstr : $this->controller; |
|||
// 当前uri |
|||
$this->routeUri = $this->controller . '/' . $this->action; |
|||
} |
|||
|
|||
/** |
|||
* 后台菜单配置 |
|||
* @return array |
|||
*/ |
|||
private function menus() |
|||
{ |
|||
foreach ($data = Config::get('menus') as $group => $first) { |
|||
$data[$group]['active'] = $group === $this->group; |
|||
// 遍历:二级菜单 |
|||
if (isset($first['submenu'])) { |
|||
foreach ($first['submenu'] as $secondKey => $second) { |
|||
// 二级菜单所有uri |
|||
$secondUris = isset($second['uris']) ? $second['uris'] : [$second['index']]; |
|||
// 二级菜单:active |
|||
!isset($data[$group]['submenu'][$secondKey]['active']) |
|||
&& $data[$group]['submenu'][$secondKey]['active'] = in_array($this->routeUri, $secondUris); |
|||
} |
|||
} |
|||
} |
|||
return $data; |
|||
} |
|||
|
|||
/** |
|||
* 验证登录状态 |
|||
* @return bool |
|||
*/ |
|||
private function checkLogin() |
|||
{ |
|||
// 验证当前请求是否在白名单 |
|||
if (in_array($this->routeUri, $this->allowAllAction)) { |
|||
return true; |
|||
} |
|||
// 验证登录状态 |
|||
if (empty($this->admin) |
|||
|| (int)$this->admin['is_login'] !== 1 |
|||
) { |
|||
$this->redirect('passport/login'); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 返回封装后的 API 数据到客户端 |
|||
* @param int $code |
|||
* @param string $msg |
|||
* @param string $url |
|||
* @param array $data |
|||
* @return array |
|||
*/ |
|||
protected function renderJson($code = 1, $msg = '', $url = '', $data = []) |
|||
{ |
|||
return compact('code', 'msg', 'url', 'data'); |
|||
} |
|||
|
|||
/** |
|||
* 返回操作成功json |
|||
* @param string $msg |
|||
* @param string $url |
|||
* @param array $data |
|||
* @return array |
|||
*/ |
|||
protected function renderSuccess($msg = 'success', $url = '', $data = []) |
|||
{ |
|||
return $this->renderJson(1, $msg, $url, $data); |
|||
} |
|||
|
|||
/** |
|||
* 返回操作失败json |
|||
* @param string $msg |
|||
* @param string $url |
|||
* @param array $data |
|||
* @return array |
|||
*/ |
|||
protected function renderError($msg = 'error', $url = '', $data = []) |
|||
{ |
|||
return $this->renderJson(0, $msg, $url, $data); |
|||
} |
|||
|
|||
/** |
|||
* 获取post数据 (数组) |
|||
* @param $key |
|||
* @return mixed |
|||
*/ |
|||
protected function postData($key) |
|||
{ |
|||
return $this->request->post($key . '/a'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller; |
|||
|
|||
|
|||
/** |
|||
* 后台首页 |
|||
* Class Index |
|||
* @package app\admin\controller |
|||
*/ |
|||
class Index extends Controller |
|||
{ |
|||
/** |
|||
* 后台首页 |
|||
* @return mixed |
|||
*/ |
|||
public function index() |
|||
{ |
|||
return $this->fetch('index'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller; |
|||
|
|||
use app\admin\model\admin\User as UserModel; |
|||
use think\Session; |
|||
|
|||
/** |
|||
* 超管后台认证 |
|||
* Class Passport |
|||
* @package app\store\controller |
|||
*/ |
|||
class Passport extends Controller |
|||
{ |
|||
/** |
|||
* 超管后台登录 |
|||
* @return array|mixed |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function login() |
|||
{ |
|||
if ($this->request->isAjax()) { |
|||
$model = new UserModel; |
|||
if ($model->login($this->postData('User'))) { |
|||
return $this->renderSuccess('登录成功', url('index/index')); |
|||
} |
|||
return $this->renderError($model->getError() ?: '登录失败'); |
|||
} |
|||
$this->view->engine->layout(false); |
|||
return $this->fetch('login'); |
|||
} |
|||
|
|||
/** |
|||
* 退出登录 |
|||
*/ |
|||
public function logout() |
|||
{ |
|||
Session::clear('yoshop_admin'); |
|||
$this->redirect('passport/login'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller; |
|||
|
|||
use app\admin\model\Wxapp as WxappModel; |
|||
use app\admin\model\store\User as StoreUser; |
|||
|
|||
/** |
|||
* 小程序商城管理 |
|||
* Class Store |
|||
* @package app\admin\controller |
|||
*/ |
|||
class Store extends Controller |
|||
{ |
|||
/** |
|||
* 小程序列表 |
|||
* @return mixed |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function index() |
|||
{ |
|||
$model = new WxappModel; |
|||
return $this->fetch('index', [ |
|||
'list' => $list = $model->getList(), |
|||
'names' => $model->getStoreName($list) |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 进入商城 |
|||
* @param $wxapp_id |
|||
* @throws \think\Exception |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function enter($wxapp_id) |
|||
{ |
|||
$model = new StoreUser; |
|||
$model->login($wxapp_id); |
|||
$this->redirect('store/index/index'); |
|||
} |
|||
|
|||
/** |
|||
* 回收站列表 |
|||
* @return mixed |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function recycle() |
|||
{ |
|||
$model = new WxappModel; |
|||
return $this->fetch('recycle', [ |
|||
'list' => $list = $model->getList(true), |
|||
'names' => $model->getStoreName($list) |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 添加小程序 |
|||
* @return array|mixed |
|||
*/ |
|||
public function add() |
|||
{ |
|||
$model = new WxappModel; |
|||
if (!$this->request->isAjax()) { |
|||
return $this->fetch('add'); |
|||
} |
|||
// 新增记录 |
|||
if ($model->add($this->postData('store'))) { |
|||
return $this->renderSuccess('添加成功', url('store/index')); |
|||
} |
|||
return $this->renderError($model->getError() ?: '添加失败'); |
|||
} |
|||
|
|||
/** |
|||
* 回收小程序 |
|||
* @param $wxapp_id |
|||
* @return array |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function recovery($wxapp_id) |
|||
{ |
|||
// 小程序详情 |
|||
$model = WxappModel::detail($wxapp_id); |
|||
if (!$model->recycle()) { |
|||
return $this->renderError('操作失败'); |
|||
} |
|||
return $this->renderSuccess('操作成功'); |
|||
} |
|||
|
|||
/** |
|||
* 移出回收站 |
|||
* @param $wxapp_id |
|||
* @return array |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function move($wxapp_id) |
|||
{ |
|||
// 小程序详情 |
|||
$model = WxappModel::detail($wxapp_id); |
|||
if (!$model->recycle(false)) { |
|||
return $this->renderError('操作失败'); |
|||
} |
|||
return $this->renderSuccess('操作成功'); |
|||
} |
|||
|
|||
/** |
|||
* 删除小程序 |
|||
* @param $wxapp_id |
|||
* @return array |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function delete($wxapp_id) |
|||
{ |
|||
// 小程序详情 |
|||
$model = WxappModel::detail($wxapp_id); |
|||
if (!$model->setDelete()) { |
|||
return $this->renderError('操作失败'); |
|||
} |
|||
return $this->renderSuccess('操作成功'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller\admin; |
|||
|
|||
use app\admin\controller\Controller; |
|||
use app\admin\model\admin\User as AdminUserModel; |
|||
|
|||
/** |
|||
* 超管后台管理员控制器 |
|||
* Class User |
|||
* @package app\store\controller |
|||
*/ |
|||
class User extends Controller |
|||
{ |
|||
/** |
|||
* 更新当前管理员信息 |
|||
* @return array|mixed |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function renew() |
|||
{ |
|||
$model = AdminUserModel::detail($this->admin['user']['admin_user_id']); |
|||
if ($this->request->isAjax()) { |
|||
if ($model->renew($this->postData('user'))) { |
|||
return $this->renderSuccess('更新成功'); |
|||
} |
|||
return $this->renderError($model->getError() ?: '更新失败'); |
|||
} |
|||
return $this->fetch('renew', compact('model')); |
|||
} |
|||
} |
|||
@ -0,0 +1,84 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller\setting; |
|||
|
|||
use app\admin\controller\Controller; |
|||
use think\Cache as CacheDriver; |
|||
|
|||
/** |
|||
* 清理缓存 |
|||
* Class Index |
|||
* @package app\admin\controller |
|||
*/ |
|||
class Cache extends Controller |
|||
{ |
|||
/** |
|||
* 清理缓存 |
|||
* @param bool $isForce |
|||
* @return mixed |
|||
*/ |
|||
public function clear($isForce = false) |
|||
{ |
|||
if ($this->request->isAjax()) { |
|||
$this->rmCache($this->postData('cache')); |
|||
return $this->renderSuccess('操作成功'); |
|||
} |
|||
return $this->fetch('clear', [ |
|||
'isForce' => !!$isForce ?: config('app_debug'), |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 删除缓存 |
|||
* @param $data |
|||
*/ |
|||
private function rmCache($data) |
|||
{ |
|||
// 数据缓存 |
|||
if (in_array('data', $data['item'])) { |
|||
// 强制模式 |
|||
$isForce = isset($data['isForce']) ? !!$data['isForce'] : false; |
|||
// 清除缓存 |
|||
CacheDriver::clear($isForce ? null : 'cache'); |
|||
} |
|||
// 临时文件 |
|||
if (in_array('temp', $data['item'])) { |
|||
$paths = [ |
|||
'temp' => WEB_PATH . 'temp/', |
|||
'runtime' => RUNTIME_PATH . 'image/' |
|||
]; |
|||
foreach ($paths as $path) { |
|||
$this->deleteFolder($path); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 递归删除指定目录下所有文件 |
|||
* @param $path |
|||
* @return bool |
|||
*/ |
|||
private function deleteFolder($path) |
|||
{ |
|||
if (!is_dir($path)) |
|||
return false; |
|||
// 扫描一个文件夹内的所有文件夹和文件 |
|||
foreach (scandir($path) as $val) { |
|||
// 排除目录中的.和.. |
|||
if (!in_array($val, ['.', '..', '.gitignore'])) { |
|||
// 如果是目录则递归子目录,继续操作 |
|||
if (is_dir($path . $val)) { |
|||
// 子目录中操作删除文件夹和文件 |
|||
$this->deleteFolder($path . $val . '/'); |
|||
// 目录清空后删除空文件夹 |
|||
rmdir($path . $val . '/'); |
|||
} else { |
|||
// 如果是文件直接删除 |
|||
unlink($path . $val); |
|||
} |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,184 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller\setting; |
|||
|
|||
use app\admin\controller\Controller; |
|||
|
|||
/** |
|||
* 环境检测 |
|||
* Class Science |
|||
* @package app\admin\controller\setting |
|||
*/ |
|||
class Science extends Controller |
|||
{ |
|||
/** |
|||
* 状态class |
|||
* @var array |
|||
*/ |
|||
private $statusClass = [ |
|||
'normal' => '', |
|||
'warning' => 'am-active', |
|||
'danger' => 'am-danger' |
|||
]; |
|||
|
|||
/** |
|||
* 环境检测 |
|||
*/ |
|||
public function index() |
|||
{ |
|||
return $this->fetch('index', [ |
|||
'statusClass' => $this->statusClass, |
|||
'phpinfo' => $this->phpinfo(), // PHP环境要求 |
|||
'server' => $this->server(), // 服务器信息 |
|||
'writeable' => $this->writeable(), // 目录权限监测 |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 服务器信息 |
|||
* @return array |
|||
*/ |
|||
private function server() |
|||
{ |
|||
return [ |
|||
'system' => [ |
|||
'name' => '服务器操作系统', |
|||
'value' => PHP_OS, |
|||
'status' => PHP_SHLIB_SUFFIX === 'dll' ? 'warning' : 'normal', |
|||
'remark' => '建议使用 Linux 系统以提升程序性能' |
|||
], |
|||
'webserver' => [ |
|||
'name' => 'Web服务器环境', |
|||
'value' => $this->request->server('SERVER_SOFTWARE'), |
|||
'status' => PHP_SAPI === 'isapi' ? 'warning' : 'normal', |
|||
'remark' => '建议使用 Apache 或 Nginx 以提升程序性能' |
|||
], |
|||
'php' => [ |
|||
'name' => 'PHP版本', |
|||
'value' => PHP_VERSION, |
|||
'status' => version_compare(PHP_VERSION, '5.4.0') === -1 ? 'danger' : 'normal', |
|||
'remark' => 'PHP版本必须为 5.4.0 以上' |
|||
], |
|||
'upload_max' => [ |
|||
'name' => '文件上传限制', |
|||
'value' => @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknow', |
|||
'status' => 'normal', |
|||
'remark' => '' |
|||
], |
|||
'web_path' => [ |
|||
'name' => '程序运行目录', |
|||
'value' => WEB_PATH, |
|||
'status' => 'normal', |
|||
'remark' => '' |
|||
], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* PHP环境要求 |
|||
* @return array |
|||
*/ |
|||
private function phpinfo() |
|||
{ |
|||
return [ |
|||
'php_version' => [ |
|||
'name' => 'PHP版本', |
|||
'value' => '5.4.0及以上', |
|||
'status' => version_compare(PHP_VERSION, '5.4.0') === -1 ? 'danger' : 'normal', |
|||
'remark' => 'PHP版本必须为 5.4.0及以上' |
|||
], |
|||
'curl' => [ |
|||
'name' => 'CURL', |
|||
'value' => '支持', |
|||
'status' => extension_loaded('curl') && function_exists('curl_init') ? 'normal' : 'danger', |
|||
'remark' => '您的PHP环境不支持CURL, 系统无法正常运行' |
|||
], |
|||
'openssl' => [ |
|||
'name' => 'OpenSSL', |
|||
'value' => '支持', |
|||
'status' => extension_loaded('openssl') ? 'normal' : 'danger', |
|||
'remark' => '没有启用OpenSSL, 将无法访问微信平台的接口' |
|||
], |
|||
'pdo' => [ |
|||
'name' => 'PDO', |
|||
'value' => '支持', |
|||
'status' => extension_loaded('PDO') && extension_loaded('pdo_mysql') ? 'normal' : 'danger', |
|||
'remark' => '您的PHP环境不支持PDO, 系统无法正常运行' |
|||
], |
|||
'gd' => [ |
|||
'name' => 'GD', |
|||
'value' => '支持', |
|||
'status' => extension_loaded('gd') ? 'normal' : 'danger', |
|||
'remark' => '您的PHP环境不支持GD, 系统无法正常生成图片' |
|||
], |
|||
'bcmath' => [ |
|||
'name' => 'BCMath', |
|||
'value' => '支持', |
|||
'status' => extension_loaded('bcmath') ? 'normal' : 'danger', |
|||
'remark' => '您的PHP环境不支持BCMath, 系统无法正常运行' |
|||
], |
|||
]; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 目录权限监测 |
|||
*/ |
|||
private function writeable() |
|||
{ |
|||
$paths = [ |
|||
'uploads' => realpath(WEB_PATH) . '/uploads/', |
|||
'wxpay_log' => realpath(APP_PATH) . '/common/library/wechat/logs/', |
|||
'wxpay_cert' => realpath(APP_PATH) . '/common/library/wechat/cert/', |
|||
'behavior_log' => realpath(APP_PATH) . '/task/behavior/logs/', |
|||
]; |
|||
return [ |
|||
'uploads' => [ |
|||
'name' => '文件上传目录', |
|||
'value' => str_replace('\\', '/', $paths['uploads']), |
|||
'status' => $this->checkWriteable($paths['uploads']) ? 'normal' : 'danger', |
|||
'remark' => '目录不可写,系统将无法正常上传文件' |
|||
], |
|||
'wxpay_log' => [ |
|||
'name' => '微信支付日志目录', |
|||
'value' => str_replace('\\', '/', $paths['wxpay_log']), |
|||
'status' => $this->checkWriteable($paths['wxpay_log']) ? 'normal' : 'danger', |
|||
'remark' => '目录不可写,系统将无法正常上传文件' |
|||
], |
|||
'wxpay_cert' => [ |
|||
'name' => '微信支付证书目录', |
|||
'value' => str_replace('\\', '/', $paths['wxpay_cert']), |
|||
'status' => $this->checkWriteable($paths['wxpay_cert']) ? 'normal' : 'danger', |
|||
'remark' => '目录不可写,系统将无法正常上传文件' |
|||
], |
|||
'behavior_log' => [ |
|||
'name' => '自动任务日志目录', |
|||
'value' => str_replace('\\', '/', $paths['behavior_log']), |
|||
'status' => $this->checkWriteable($paths['behavior_log']) ? 'normal' : 'danger', |
|||
'remark' => '目录不可写,系统将无法正常上传文件' |
|||
], |
|||
]; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 检查目录是否可写 |
|||
* @param $path |
|||
* @return bool |
|||
*/ |
|||
private function checkWriteable($path) |
|||
{ |
|||
try { |
|||
!is_dir($path) && mkdir($path, 0755); |
|||
if (!is_dir($path)) |
|||
return false; |
|||
$fileName = $path . '/_test_write.txt'; |
|||
if ($fp = fopen($fileName, 'w')) { |
|||
return fclose($fp) && unlink($fileName); |
|||
} |
|||
} catch (\Exception $e) { |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\controller\store; |
|||
|
|||
use app\admin\controller\Controller; |
|||
use app\admin\model\store\Access as AccesscModel; |
|||
|
|||
/** |
|||
* 商家用户权限控制器 |
|||
* Class StoreUser |
|||
* @package app\store\controller |
|||
*/ |
|||
class Access extends Controller |
|||
{ |
|||
/** |
|||
* 权限列表 |
|||
* @return mixed |
|||
* @throws \think\Exception |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function index() |
|||
{ |
|||
$model = new AccesscModel; |
|||
$list = $model->getList(); |
|||
return $this->fetch('index', compact('list')); |
|||
} |
|||
|
|||
/** |
|||
* 添加权限 |
|||
* @return array|mixed |
|||
* @throws \think\Exception |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function add() |
|||
{ |
|||
$model = new AccesscModel; |
|||
if (!$this->request->isAjax()) { |
|||
// 权限列表 |
|||
$accessList = $model->getList(); |
|||
return $this->fetch('add', compact('accessList')); |
|||
} |
|||
// 新增记录 |
|||
if ($model->add($this->postData('access'))) { |
|||
return $this->renderSuccess('添加成功', url('store.access/index')); |
|||
} |
|||
return $this->renderError($model->getError() ?: '添加失败'); |
|||
} |
|||
|
|||
/** |
|||
* 更新权限 |
|||
* @param $access_id |
|||
* @return array|mixed |
|||
* @throws \think\Exception |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function edit($access_id) |
|||
{ |
|||
// 权限详情 |
|||
$model = AccesscModel::detail($access_id); |
|||
if (!$this->request->isAjax()) { |
|||
// 权限列表 |
|||
$accessList = $model->getList(); |
|||
return $this->fetch('edit', compact('model', 'accessList')); |
|||
} |
|||
// 更新记录 |
|||
if ($model->edit($this->postData('access'))) { |
|||
return $this->renderSuccess('更新成功', url('store.access/index')); |
|||
} |
|||
return $this->renderError($model->getError() ?: '更新失败'); |
|||
} |
|||
|
|||
/** |
|||
* 删除权限 |
|||
* @param $access_id |
|||
* @return array |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function delete($access_id) |
|||
{ |
|||
// 权限详情 |
|||
$model = AccesscModel::detail($access_id); |
|||
if (!$model->remove()) { |
|||
return $this->renderError($model->getError() ?: '删除失败'); |
|||
} |
|||
return $this->renderSuccess('删除成功'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?php |
|||
/** |
|||
* 后台菜单配置 |
|||
* 'home' => [ |
|||
* 'name' => '首页', // 菜单名称 |
|||
* 'icon' => 'icon-home', // 图标 (class) |
|||
* 'index' => 'index/index', // 链接 |
|||
* ], |
|||
*/ |
|||
return [ |
|||
'store' => [ |
|||
'name' => '小程序商城', |
|||
'icon' => 'icon-shangcheng', |
|||
'submenu' => [ |
|||
[ |
|||
'name' => '商城列表', |
|||
'index' => 'store/index', |
|||
'uris' => [ |
|||
'store/index', |
|||
'store/add', |
|||
] |
|||
], |
|||
[ |
|||
'name' => '回收站', |
|||
'index' => 'store/recycle' |
|||
], |
|||
[ |
|||
'name' => '权限管理', |
|||
'index' => 'store.access/index' |
|||
] |
|||
], |
|||
], |
|||
'setting' => [ |
|||
'name' => '系统设置', |
|||
'icon' => 'icon-shezhi', |
|||
'submenu' => [ |
|||
[ |
|||
'name' => '清理缓存', |
|||
'index' => 'setting.cache/clear' |
|||
], |
|||
[ |
|||
'name' => '环境检测', |
|||
'index' => 'setting.science/index' |
|||
], |
|||
], |
|||
], |
|||
]; |
|||
@ -0,0 +1,31 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model; |
|||
|
|||
use app\common\model\Setting as SettingModel; |
|||
|
|||
/** |
|||
* 商城设置模型 |
|||
* Class Setting |
|||
* @package app\admin\model |
|||
*/ |
|||
class Setting extends SettingModel |
|||
{ |
|||
/** |
|||
* 新增默认配置 |
|||
* @param $wxapp_id |
|||
* @param $store_name |
|||
* @return array|false |
|||
* @throws \Exception |
|||
*/ |
|||
public function insertDefault($wxapp_id, $store_name) |
|||
{ |
|||
// 添加商城默认设置记录 |
|||
$data = []; |
|||
foreach ($this->defaultData($store_name) as $key => $item) { |
|||
$data[] = array_merge($item, ['wxapp_id' => $wxapp_id]); |
|||
} |
|||
return $this->saveAll($data); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model; |
|||
|
|||
use app\common\model\Wxapp as WxappModel; |
|||
use app\admin\model\store\User as StoreUser; |
|||
|
|||
/** |
|||
* 微信小程序模型 |
|||
* Class Wxapp |
|||
* @package app\admin\model |
|||
*/ |
|||
class Wxapp extends WxappModel |
|||
{ |
|||
/** |
|||
* 获取小程序列表 |
|||
* @param boolean $is_recycle |
|||
* @return \think\Paginator |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function getList($is_recycle = false) |
|||
{ |
|||
return $this->where('is_recycle', '=', (int)$is_recycle) |
|||
->where('is_delete', '=', 0) |
|||
->order(['create_time' => 'desc']) |
|||
->paginate(15, false, [ |
|||
'query' => request()->request() |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 从缓存中获取商城名称 |
|||
* @param $data |
|||
* @return array |
|||
*/ |
|||
public function getStoreName($data) |
|||
{ |
|||
$names = []; |
|||
foreach ($data as $wxapp) { |
|||
$names[$wxapp['wxapp_id']] = Setting::getItem('store', $wxapp['wxapp_id'])['name']; |
|||
} |
|||
return $names; |
|||
} |
|||
|
|||
/** |
|||
* 新增记录 |
|||
* @param $data |
|||
* @return bool|mixed |
|||
*/ |
|||
public function add($data) |
|||
{ |
|||
if ($data['password'] !== $data['password_confirm']) { |
|||
$this->error = '确认密码不正确'; |
|||
return false; |
|||
} |
|||
if (StoreUser::checkExist($data['user_name'])) { |
|||
$this->error = '商家用户名已存在'; |
|||
return false; |
|||
} |
|||
return $this->transaction(function () use ($data) { |
|||
// 添加小程序记录 |
|||
$this->allowField(true)->save($data); |
|||
// 商城默认设置 |
|||
(new Setting)->insertDefault($this['wxapp_id'], $data['store_name']); |
|||
// 新增商家用户信息 |
|||
(new StoreUser)->add($this['wxapp_id'], $data); |
|||
// 新增小程序默认帮助 |
|||
(new WxappHelp)->insertDefault($this['wxapp_id']); |
|||
// 新增小程序diy配置 |
|||
(new WxappPage)->insertDefault($this['wxapp_id']); |
|||
// 新增小程序分类页模板 |
|||
(new WxappCategory)->insertDefault($this['wxapp_id']); |
|||
return true; |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 移入移出回收站 |
|||
* @param bool $is_recycle |
|||
* @return false|int |
|||
*/ |
|||
public function recycle($is_recycle = true) |
|||
{ |
|||
return $this->save(['is_recycle' => (int)$is_recycle]); |
|||
} |
|||
|
|||
/** |
|||
* 软删除 |
|||
* @return false|int |
|||
*/ |
|||
public function setDelete() |
|||
{ |
|||
return $this->transaction(function () { |
|||
// 删除商家用户信息 |
|||
(new StoreUser)->setDelete($this['wxapp_id']); |
|||
// 设置当前商城为已删除 |
|||
return $this->save(['is_delete' => 1]); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model; |
|||
|
|||
use app\common\model\WxappCategory as WxappCategoryModel; |
|||
|
|||
/** |
|||
* 微信小程序分类页模板 |
|||
* Class WxappCategory |
|||
* @package app\store\model |
|||
*/ |
|||
class WxappCategory extends WxappCategoryModel |
|||
{ |
|||
/** |
|||
* 新增分类页模板 |
|||
* @param $wxapp_id |
|||
* @return false|int |
|||
*/ |
|||
public function insertDefault($wxapp_id) |
|||
{ |
|||
return $this->save([ |
|||
'wxapp_id' => $wxapp_id, |
|||
'category_style' => '11', |
|||
'share_title' => '', |
|||
]); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model; |
|||
|
|||
use app\common\model\WxappHelp as WxappHelpModel; |
|||
|
|||
/** |
|||
* 小程序帮助中心 |
|||
* Class WxappHelp |
|||
* @package app\admin\model |
|||
*/ |
|||
class WxappHelp extends WxappHelpModel |
|||
{ |
|||
/** |
|||
* 新增默认帮助 |
|||
* @param $wxapp_id |
|||
* @return false|int |
|||
*/ |
|||
public function insertDefault($wxapp_id) |
|||
{ |
|||
return $this->save([ |
|||
'title' => '关于小程序', |
|||
'content' => '小程序本身无需下载,无需注册,不占用手机内存,可以跨平台使用,响应迅速,体验接近原生APP。', |
|||
'sort' => 100, |
|||
'wxapp_id' => $wxapp_id |
|||
]); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model; |
|||
|
|||
use app\common\model\WxappPage as WxappPageModel; |
|||
|
|||
/** |
|||
* 微信小程序diy页面模型 |
|||
* Class WxappPage |
|||
* @package app\admin\model |
|||
*/ |
|||
class WxappPage extends WxappPageModel |
|||
{ |
|||
/** |
|||
* 新增小程序首页diy默认设置 |
|||
* @param $wxapp_id |
|||
* @return false|int |
|||
*/ |
|||
public function insertDefault($wxapp_id) |
|||
{ |
|||
return $this->save([ |
|||
'page_type' => 10, |
|||
'page_name' => '小程序首页', |
|||
'page_data' => [ |
|||
'page' => [ |
|||
'type' => 'page', |
|||
'name' => '页面设置', |
|||
'params' => [ |
|||
'name' => '页面标题', |
|||
'title' => '页面标题', |
|||
'share_title' => '分享标题' |
|||
], |
|||
'style' => [ |
|||
'titleTextColor' => 'black', |
|||
'titleBackgroundColor' => '#ffffff', |
|||
] |
|||
], |
|||
'items' => [ |
|||
[ |
|||
'type' => 'search', |
|||
'name' => '搜索框', |
|||
'params' => ['placeholder' => '搜索商品'], |
|||
'style' => [ |
|||
'textAlign' => 'center', |
|||
'searchStyle' => 'radius', |
|||
], |
|||
], |
|||
[ |
|||
'type' => 'banner', |
|||
'name' => '图片轮播', |
|||
'style' => [ |
|||
'btnColor' => '#ffffff', |
|||
'btnShape' => 'round', |
|||
], |
|||
'params' => [ |
|||
'interval' => '2800' |
|||
], |
|||
'data' => [ |
|||
[ |
|||
'imgUrl' => self::$base_url . 'assets/store/img/diy/banner/01.png', |
|||
'linkUrl' => '', |
|||
], |
|||
[ |
|||
'imgUrl' => self::$base_url . 'assets/store/img/diy/banner/01.png', |
|||
'linkUrl' => '', |
|||
], |
|||
], |
|||
] |
|||
], |
|||
], |
|||
'wxapp_id' => $wxapp_id |
|||
]); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model\admin; |
|||
|
|||
use think\Session; |
|||
use app\common\model\admin\User as UserModel; |
|||
|
|||
/** |
|||
* 超管后台用户模型 |
|||
* Class User |
|||
* @package app\admin\model\admin |
|||
*/ |
|||
class User extends UserModel |
|||
{ |
|||
/** |
|||
* 超管后台用户登录 |
|||
* @param $data |
|||
* @return bool |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function login($data) |
|||
{ |
|||
// 验证用户名密码是否正确 |
|||
if (!$user = self::useGlobalScope(false)->where([ |
|||
'user_name' => $data['user_name'], |
|||
'password' => yoshop_hash($data['password']) |
|||
])->find()) { |
|||
$this->error = '登录失败, 用户名或密码错误'; |
|||
return false; |
|||
} |
|||
// 保存登录状态 |
|||
Session::set('yoshop_admin', [ |
|||
'user' => [ |
|||
'admin_user_id' => $user['admin_user_id'], |
|||
'user_name' => $user['user_name'], |
|||
], |
|||
'is_login' => true, |
|||
]); |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 超管用户信息 |
|||
* @param $admin_user_id |
|||
* @return null|static |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public static function detail($admin_user_id) |
|||
{ |
|||
return self::get($admin_user_id); |
|||
} |
|||
|
|||
/** |
|||
* 更新当前管理员信息 |
|||
* @param $data |
|||
* @return bool |
|||
*/ |
|||
public function renew($data) |
|||
{ |
|||
if ($data['password'] !== $data['password_confirm']) { |
|||
$this->error = '确认密码不正确'; |
|||
return false; |
|||
} |
|||
// 更新管理员信息 |
|||
if ($this->save([ |
|||
'user_name' => $data['user_name'], |
|||
'password' => yoshop_hash($data['password']), |
|||
]) === false) { |
|||
return false; |
|||
} |
|||
// 更新session |
|||
Session::set('yoshop_admin.user', [ |
|||
'admin_user_id' => $this['admin_user_id'], |
|||
'user_name' => $data['user_name'], |
|||
]); |
|||
return true; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model\store; |
|||
|
|||
use app\common\model\store\Access as AccessModel; |
|||
|
|||
/** |
|||
* 商家用户权限模型 |
|||
* Class Access |
|||
* @package app\admin\model\store |
|||
*/ |
|||
class Access extends AccessModel |
|||
{ |
|||
/** |
|||
* 获取权限列表 |
|||
* @throws \think\Exception |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function getList() |
|||
{ |
|||
$all = static::getAll(); |
|||
return $this->formatTreeData($all); |
|||
} |
|||
|
|||
/** |
|||
* 新增记录 |
|||
* @param $data |
|||
* @return false|int |
|||
*/ |
|||
public function add($data) |
|||
{ |
|||
$data['wxapp_id'] = self::$wxapp_id; |
|||
return $this->allowField(true)->save($data); |
|||
} |
|||
|
|||
/** |
|||
* 更新记录 |
|||
* @param $data |
|||
* @return bool |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function edit($data) |
|||
{ |
|||
// 判断上级角色是否为当前子级 |
|||
if ($data['parent_id'] > 0) { |
|||
// 获取所有上级id集 |
|||
$parentIds = $this->getTopAccessIds($data['parent_id']); |
|||
if (in_array($this['access_id'], $parentIds)) { |
|||
$this->error = '上级权限不允许设置为当前子权限'; |
|||
return false; |
|||
} |
|||
} |
|||
return $this->allowField(true)->save($data) !== false; |
|||
} |
|||
|
|||
/** |
|||
* 删除权限 |
|||
* @return bool|int |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function remove() |
|||
{ |
|||
// 判断是否存在下级权限 |
|||
if (self::detail(['parent_id' => $this['access_id']])) { |
|||
$this->error = '当前权限下存在子权限,请先删除'; |
|||
return false; |
|||
} |
|||
return $this->delete(); |
|||
} |
|||
|
|||
/** |
|||
* 获取所有上级id集 |
|||
* @param $access_id |
|||
* @param null $all |
|||
* @return array |
|||
* @throws \think\db\exception\DataNotFoundException |
|||
* @throws \think\db\exception\ModelNotFoundException |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
private function getTopAccessIds($access_id, &$all = null) |
|||
{ |
|||
static $ids = []; |
|||
is_null($all) && $all = $this->getAll(); |
|||
foreach ($all as $item) { |
|||
if ($item['access_id'] == $access_id && $item['parent_id'] > 0) { |
|||
$ids[] = $item['parent_id']; |
|||
$this->getTopAccessIds($item['parent_id'], $all); |
|||
} |
|||
} |
|||
return $ids; |
|||
} |
|||
|
|||
/** |
|||
* 获取权限列表 |
|||
* @param $all |
|||
* @param int $parent_id |
|||
* @param int $deep |
|||
* @return array |
|||
*/ |
|||
private function formatTreeData(&$all, $parent_id = 0, $deep = 1) |
|||
{ |
|||
static $tempTreeArr = []; |
|||
foreach ($all as $key => $val) { |
|||
if ($val['parent_id'] == $parent_id) { |
|||
// 记录深度 |
|||
$val['deep'] = $deep; |
|||
// 根据角色深度处理名称前缀 |
|||
$val['name_h1'] = $this->htmlPrefix($deep) . $val['name']; |
|||
$tempTreeArr[] = $val; |
|||
$this->formatTreeData($all, $val['access_id'], $deep + 1); |
|||
} |
|||
} |
|||
return $tempTreeArr; |
|||
} |
|||
|
|||
private function htmlPrefix($deep) |
|||
{ |
|||
// 根据角色深度处理名称前缀 |
|||
$prefix = ''; |
|||
if ($deep > 1) { |
|||
for ($i = 1; $i <= $deep - 1; $i++) { |
|||
$prefix .= ' ├ '; |
|||
} |
|||
$prefix .= ' '; |
|||
} |
|||
return $prefix; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
<?php |
|||
|
|||
namespace app\admin\model\store; |
|||
|
|||
use app\common\exception\BaseException; |
|||
use app\common\model\store\User as StoreUserModel; |
|||
|
|||
/** |
|||
* 商家用户模型 |
|||
* Class StoreUser |
|||
* @package app\admin\model |
|||
*/ |
|||
class User extends StoreUserModel |
|||
{ |
|||
/** |
|||
* 新增商家用户记录 |
|||
* @param int $wxappId |
|||
* @param array $data |
|||
* @return bool|false|int |
|||
*/ |
|||
public function add($wxappId, $data) |
|||
{ |
|||
return $this->save([ |
|||
'user_name' => $data['user_name'], |
|||
'password' => yoshop_hash($data['password']), |
|||
'is_super' => 1, |
|||
'wxapp_id' => $wxappId, |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* 商家用户登录 |
|||
* @param int $wxappId |
|||
* @throws \think\Exception |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
public function login($wxappId) |
|||
{ |
|||
// 获取获取商城超级管理员用户信息 |
|||
$user = $this->getSuperStoreUser($wxappId); |
|||
if (empty($user)) { |
|||
throw new BaseException(['msg' => '超级管理员用户信息不存在']); |
|||
} |
|||
$this->loginState($user); |
|||
} |
|||
|
|||
/** |
|||
* 获取获取商城超级管理员用户信息 |
|||
* @param $wxappId |
|||
* @return User|null |
|||
* @throws \think\exception\DbException |
|||
*/ |
|||
private function getSuperStoreUser($wxappId) |
|||
{ |
|||
return static::detail(['wxapp_id' => $wxappId, 'is_super' => 1], ['wxapp']); |
|||
} |
|||
|
|||
/** |
|||
* 删除小程序下的商家用户 |
|||
* @param $wxappId |
|||
* @return false|int |
|||
*/ |
|||
public function setDelete($wxappId) |
|||
{ |
|||
return $this->save(['is_delete' => 1], ['wxapp_id' => $wxappId]); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
<div class="row-content am-cf"> |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">管理员设置</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-form-label form-require"> 用户名 </label> |
|||
<div class="am-u-sm-9"> |
|||
<input type="text" class="tpl-form-input" name="user[user_name]" |
|||
value="<?= $model['user_name'] ?>" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-form-label form-require"> 登录密码 </label> |
|||
<div class="am-u-sm-9"> |
|||
<input type="password" class="tpl-form-input" name="user[password]" |
|||
value="" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-form-label form-require"> 确认密码 </label> |
|||
<div class="am-u-sm-9"> |
|||
<input type="password" class="tpl-form-input" name="user[password_confirm]" |
|||
value="" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg"> |
|||
<button type="submit" class="j-submit am-btn am-btn-secondary">提交 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
/** |
|||
* 表单验证提交 |
|||
* @type {*} |
|||
*/ |
|||
$('#my-form').superForm(); |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,13 @@ |
|||
|
|||
<div class="widget am-cf"> |
|||
<div class="widget-body"> |
|||
<div class="tpl-page-state am-margin-top-xl"> |
|||
<div class="tpl-page-state-title am-text-center">小程序运营管理系统</div> |
|||
<div class="tpl-error-title-info">Welcome To YoShop System</div> |
|||
<div class="tpl-page-state-content tpl-error-content"> |
|||
<p>平台运营管理后台</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
@ -0,0 +1,104 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
|
|||
<head> |
|||
<meta charset="utf-8"/> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
|||
<title>运营管理系统</title> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"/> |
|||
<meta name="renderer" content="webkit"/> |
|||
<meta http-equiv="Cache-Control" content="no-siteapp"/> |
|||
<link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/> |
|||
<meta name="apple-mobile-web-app-title" content="运营管理系统"/> |
|||
<link rel="stylesheet" href="assets/common/css/amazeui.min.css"/> |
|||
<link rel="stylesheet" href="assets/admin/css/app.css"/> |
|||
<link rel="stylesheet" href="//at.alicdn.com/t/font_783249_c9du3u6ahxp.css"> |
|||
<script src="assets/common/js/jquery.min.js"></script> |
|||
<script> |
|||
BASE_URL = '<?= isset($base_url) ? $base_url : '' ?>'; |
|||
ADMIN_URL = '<?= isset($admin_url) ? $admin_url : '' ?>'; |
|||
</script> |
|||
</head> |
|||
|
|||
<body data-type=""> |
|||
<div class="am-g tpl-g"> |
|||
<!-- 头部 --> |
|||
<header class="tpl-header"> |
|||
<!-- 右侧内容 --> |
|||
<div class="tpl-header-fluid"> |
|||
<!-- 其它功能--> |
|||
<div class="am-fr tpl-header-navbar"> |
|||
<ul> |
|||
<!-- 欢迎语 --> |
|||
<li class="am-text-sm tpl-header-navbar-welcome"> |
|||
<a href="<?= url('admin.user/renew') ?>">欢迎你,<span><?= $admin['user']['user_name'] ?></span> |
|||
</a> |
|||
</li> |
|||
<!-- 退出 --> |
|||
<li class="am-text-sm"> |
|||
<a href="<?= url('passport/logout') ?>"> |
|||
<i class="iconfont icon-tuichu"></i> 退出 |
|||
</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</header> |
|||
|
|||
<!-- 内容区域 start --> |
|||
<div class="tpl-content-wrapper dis-flex"> |
|||
<!-- 左侧菜单 --> |
|||
<?php $menus = $menus ?: []; ?> |
|||
<?php $group = $group ?: 0; ?> |
|||
<div class="left-sidebar"> |
|||
<ul class="sidebar-nav"> |
|||
<?php foreach ($menus as $key => $item): ?> |
|||
<li class="sidebar-nav-link"> |
|||
<a href="<?= isset($item['index']) ? url($item['index']) : 'javascript:void(0);' ?>" |
|||
class="sidebar-nav-link-disabled"> |
|||
<?php if (isset($item['is_svg']) && $item['is_svg'] == true): ?> |
|||
<svg class="icon sidebar-nav-link-logo" aria-hidden="true"> |
|||
<use xlink:href="#<?= $item['icon'] ?>"></use> |
|||
</svg> |
|||
<?php else: ?> |
|||
<i class="iconfont sidebar-nav-link-logo <?= $item['icon'] ?>" |
|||
style="<?= isset($item['color']) ? "color:{$item['color']};" : '' ?>"></i> |
|||
<?php endif; ?> |
|||
<?= $item['name'] ?> |
|||
</a> |
|||
<!-- 子级菜单--> |
|||
<?php if (isset($item['submenu']) && !empty($item['submenu'])) : ?> |
|||
<ul class="sidebar-third-nav-sub"> |
|||
<?php foreach ($item['submenu'] as $second) : ?> |
|||
<li class="sidebar-nav-link <?= $second['active'] ? 'active' : '' ?>"> |
|||
<a class="" href="<?= url($second['index']) ?>"> |
|||
<?= $second['name'] ?></a> |
|||
</li> |
|||
<?php endforeach; ?> |
|||
</ul> |
|||
<?php endif; ?> |
|||
</li> |
|||
<?php endforeach; ?> |
|||
</ul> |
|||
</div> |
|||
<!-- 内容区域 --> |
|||
<div class="row-content am-cf"> |
|||
{__CONTENT__} |
|||
</div> |
|||
|
|||
</div> |
|||
<!-- 内容区域 end --> |
|||
|
|||
<div class="help-block am-text-center am-padding-sm"> |
|||
<small>当前系统版本号:v<?= $version ?></small> |
|||
</div> |
|||
</div> |
|||
<script src="assets/common/plugins/layer/layer.js"></script> |
|||
<script src="assets/common/js/jquery.form.min.js"></script> |
|||
<script src="assets/common/js/amazeui.min.js"></script> |
|||
<script src="assets/common/js/webuploader.html5only.js"></script> |
|||
<script src="assets/common/js/art-template.js"></script> |
|||
<script src="assets/admin/js/app.js"></script> |
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,63 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta content="IE=edge" http-equiv="X-UA-Compatible"> |
|||
<title>商城系统登录</title> |
|||
<link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/> |
|||
<link rel="stylesheet" href="assets/admin/css/login/style.css"/> |
|||
</head> |
|||
<body class="page-login-v3"> |
|||
<div class="container"> |
|||
<div id="wrapper" class="login-body"> |
|||
<div class="login-content"> |
|||
<div class="brand"> |
|||
<h2 class="brand-text">小程序运营管理系统</h2> |
|||
</div> |
|||
<form id="login-form" class="login-form"> |
|||
<div class="form-group"> |
|||
<input class="" name="User[user_name]" placeholder="请输入用户名" type="text" required> |
|||
</div> |
|||
<div class="form-group"> |
|||
<input class="" name="User[password]" placeholder="请输入密码" type="password" required> |
|||
</div> |
|||
<div class="form-group"> |
|||
<button id="btn-submit" type="submit"> |
|||
登录 |
|||
</button> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script src="assets/common/js/jquery.min.js"></script> |
|||
<script src="assets/common/plugins/layer/layer.js"></script> |
|||
<script src="assets/common/js/jquery.form.min.js"></script> |
|||
<script> |
|||
$(function () { |
|||
// 表单提交 |
|||
var $form = $('#login-form'); |
|||
$form.submit(function () { |
|||
var $btn_submit = $('#btn-submit'); |
|||
$btn_submit.attr("disabled", true); |
|||
$form.ajaxSubmit({ |
|||
type: "post", |
|||
dataType: "json", |
|||
// url: '', |
|||
success: function (result) { |
|||
$btn_submit.attr('disabled', false); |
|||
if (result.code === 1) { |
|||
layer.msg(result.msg, {time: 1500, anim: 1}, function () { |
|||
window.location = result.url; |
|||
}); |
|||
return true; |
|||
} |
|||
layer.msg(result.msg, {time: 1500, anim: 6}); |
|||
} |
|||
}); |
|||
return false; |
|||
}); |
|||
}); |
|||
</script> |
|||
</html> |
|||
@ -0,0 +1,78 @@ |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">清理缓存</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-form-label form-require"> |
|||
缓存项 |
|||
</label> |
|||
<div class="am-u-sm-9"> |
|||
<label class="am-checkbox-inline"> |
|||
<input type="checkbox" name="cache[item][]" value="data" |
|||
data-am-ucheck checked required> |
|||
数据缓存 |
|||
</label> |
|||
<label class="am-checkbox-inline"> |
|||
<input type="checkbox" name="cache[item][]" value="temp" |
|||
data-am-ucheck checked required> |
|||
临时图片 |
|||
</label> |
|||
</div> |
|||
</div> |
|||
<?php if (isset($isForce) && $isForce === true): ?> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-form-label form-require"> 强制模式 </label> |
|||
<div class="am-u-sm-9"> |
|||
<label class="am-radio-inline"> |
|||
<input type="radio" name="cache[isForce]" value="0" checked |
|||
data-am-ucheck> |
|||
否 |
|||
</label> |
|||
<label class="am-radio-inline"> |
|||
<input type="radio" name="cache[isForce]" value="1" data-am-ucheck> |
|||
是 |
|||
</label> |
|||
<div class="help-block"> |
|||
<small class="x-color-red">此操作将会强制清空所有缓存文件,包含用户授权登录状态、用户购物车数据,仅允许在开发环境中使用 |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<?php else: ?> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3"> |
|||
<small> |
|||
<a href="<?= url('', ['isForce' => true]) ?>"> |
|||
进入强制模式</a> |
|||
</small> |
|||
</div> |
|||
</div> |
|||
<?php endif; ?> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg"> |
|||
<button type="submit" class="j-submit am-btn am-btn-secondary">提交 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
/** |
|||
* 表单验证提交 |
|||
* @type {*} |
|||
*/ |
|||
$('#my-form').superForm(); |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,100 @@ |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form class="am-form tpl-form-line-form"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">服务器信息</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-scrollable-horizontal"> |
|||
<table class="am-table am-table-centered"> |
|||
<tbody> |
|||
<tr> |
|||
<th width="30%">参数</th> |
|||
<th>值</th> |
|||
<th></th> |
|||
</tr> |
|||
<?php if (isset($server)): foreach ($server as $item): ?> |
|||
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>"> |
|||
<td><?= $item['name'] ?></td> |
|||
<td><?= $item['value'] ?> </td> |
|||
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td> |
|||
</tr> |
|||
<?php endforeach; endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">PHP环境要求</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-scrollable-horizontal"> |
|||
<table class="am-table am-table-centered"> |
|||
<tbody> |
|||
<tr> |
|||
<th width="30%">选项</th> |
|||
<th>要求</th> |
|||
<th>状态</th> |
|||
<th></th> |
|||
</tr> |
|||
<?php if (isset($phpinfo)): foreach ($phpinfo as $item): ?> |
|||
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>"> |
|||
<td><?= $item['name'] ?></td> |
|||
<td><?= $item['value'] ?> </td> |
|||
<td> |
|||
<?php if ($item['status'] !== 'danger'): ?> |
|||
<i class="am-icon-check x-color-green"></i> |
|||
<?php else: ?> |
|||
<i class="am-icon-times x-color-red"></i> |
|||
<?php endif; ?> |
|||
</td> |
|||
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td> |
|||
</tr> |
|||
<?php endforeach; endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">目录权限监测</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-scrollable-horizontal"> |
|||
<table class="am-table am-table-centered"> |
|||
<tbody> |
|||
<tr> |
|||
<th width="30%">名称</th> |
|||
<th class="am-text-left">路径</th> |
|||
<th>状态</th> |
|||
<th></th> |
|||
</tr> |
|||
<?php if (isset($writeable)): foreach ($writeable as $item): ?> |
|||
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>"> |
|||
<td><?= $item['name'] ?></td> |
|||
<td class="am-text-left"><?= $item['value'] ?> </td> |
|||
<td> |
|||
<?php if ($item['status'] !== 'danger'): ?> |
|||
<i class="am-icon-check x-color-green"></i> |
|||
<?php else: ?> |
|||
<i class="am-icon-times x-color-red"></i> |
|||
<?php endif; ?> |
|||
</td> |
|||
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td> |
|||
</tr> |
|||
<?php endforeach; endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
|
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,67 @@ |
|||
<div class="row-content am-cf"> |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form id="my-form" class="am-form tpl-form-line-form" method="post"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">添加权限</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限名称 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="access[name]" |
|||
value="" placeholder="请输入权限名称" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">上级权限 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<select name="access[parent_id]" data-am-selected="{searchBox: 1, btnSize: 'sm', maxHeight: 420}"> |
|||
<option value="0"> 顶级权限 </option> |
|||
<?php if (isset($accessList)): foreach ($accessList as $access): ?> |
|||
<option value="<?= $access['access_id'] ?>"> <?= $access['name_h1'] ?></option> |
|||
<?php endforeach; endif; ?> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限url </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="access[url]" |
|||
value="" placeholder="请输入权限url" required> |
|||
<small>例如:index/index</small> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label">排序 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="number" min="0" class="tpl-form-input" name="access[sort]" |
|||
value="100"> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg"> |
|||
<button type="submit" class="j-submit am-btn am-btn-secondary">提交 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
/** |
|||
* 表单验证提交 |
|||
* @type {*} |
|||
*/ |
|||
$('#my-form').superForm(); |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,69 @@ |
|||
<div class="row-content am-cf"> |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form id="my-form" class="am-form tpl-form-line-form" method="post"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">编辑权限</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限名称 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="access[name]" |
|||
value="<?= $model['name'] ?>" placeholder="请输入权限名称" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">上级权限 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<select name="access[parent_id]" data-am-selected="{searchBox: 1, btnSize: 'sm', maxHeight: 420}"> |
|||
<option value="0"> 顶级权限</option> |
|||
<?php if (isset($accessList)): foreach ($accessList as $access): ?> |
|||
<option value="<?= $access['access_id'] ?>" |
|||
<?= $model['parent_id'] == $access['access_id'] ? 'selected' : '' ?> |
|||
<?= $model['access_id'] == $access['access_id'] ? 'disabled' : '' ?>> |
|||
<?= $access['name_h1'] ?></option> |
|||
<?php endforeach; endif; ?> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限url </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="access[url]" |
|||
value="<?= $model['url'] ?>" placeholder="请输入权限url" required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label">排序 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="number" min="0" class="tpl-form-input" name="access[sort]" |
|||
value="<?= $model['sort'] ?>"> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg"> |
|||
<button type="submit" class="j-submit am-btn am-btn-secondary">提交 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
/** |
|||
* 表单验证提交 |
|||
* @type {*} |
|||
*/ |
|||
$('#my-form').superForm(); |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,82 @@ |
|||
<div class="row-content am-cf"> |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title a m-cf">权限列表</div> |
|||
</div> |
|||
<div class="widget-body am-fr"> |
|||
<div class="tips am-margin-bottom-sm am-u-sm-12"> |
|||
<div class="pre"> |
|||
<p> 注:此处数据为小程序商城后台的页面url,用于给管理员角色设置操作权限</p> |
|||
<p> 注:如非二开需求,本页面数据无需更改</p> |
|||
</div> |
|||
</div> |
|||
<!-- 工具栏 --> |
|||
<div class="page_toolbar am-margin-bottom-xs am-cf"> |
|||
<div class="am-form-group"> |
|||
<div class="am-btn-group am-btn-group-xs"> |
|||
<a class="am-btn am-btn-default am-btn-success" |
|||
href="<?= url('store.access/add') ?>"> |
|||
<span class="am-icon-plus"></span> 新增 |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="am-scrollable-horizontal am-u-sm-12"> |
|||
<table width="100%" class="am-table am-table-compact am-table-striped |
|||
tpl-table-black am-text-nowrap"> |
|||
<thead> |
|||
<tr> |
|||
<th>权限ID</th> |
|||
<th>权限名称</th> |
|||
<th>权限url</th> |
|||
<th>排序</th> |
|||
<th>添加时间</th> |
|||
<th>操作</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php if (!empty($list)): foreach ($list as $item): ?> |
|||
<tr> |
|||
<td class="am-text-middle"><?= $item['access_id'] ?></td> |
|||
<td class="am-text-middle"><?= $item['name_h1'] ?></td> |
|||
<td class="am-text-middle"><?= $item['url'] ?></td> |
|||
<td class="am-text-middle"><?= $item['sort'] ?></td> |
|||
<td class="am-text-middle"><?= $item['create_time'] ?></td> |
|||
<td class="am-text-middle"> |
|||
<div class="tpl-table-black-operation"> |
|||
<a href="<?= url('store.access/edit', ['access_id' => $item['access_id']]) ?>"> |
|||
<i class="am-icon-pencil"></i> 编辑 |
|||
</a> |
|||
<a href="javascript:void(0);" |
|||
class="item-delete tpl-table-black-operation-del" |
|||
data-id="<?= $item['access_id'] ?>"> |
|||
<i class="am-icon-trash"></i> 删除 |
|||
</a> |
|||
</div> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; else: ?> |
|||
<tr> |
|||
<td colspan="6" class="am-text-center">暂无记录</td> |
|||
</tr> |
|||
<?php endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
// 删除元素 |
|||
var url = "<?= url('store.access/delete') ?>"; |
|||
$('.item-delete').delete('access_id', url, '删除后不可恢复,确定要删除吗?'); |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
@ -0,0 +1,70 @@ |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<form id="my-form" class="am-form tpl-form-line-form" method="post"> |
|||
<div class="widget-body"> |
|||
<fieldset> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-fl">新增小程序商城</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商城名称 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="store[store_name]" value="" |
|||
required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">排序 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="number" min="0" class="tpl-form-input" name="store[sort]" value="100" |
|||
required> |
|||
<small>数字越小越靠前</small> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group am-padding-top-sm"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家账户名 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="text" class="tpl-form-input" name="store[user_name]" value="" |
|||
required> |
|||
<small>商家后台用户名</small> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家账户密码 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="password" class="tpl-form-input" name="store[password]" value="" |
|||
required> |
|||
<small>商家后台用户密码</small> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 确认密码 </label> |
|||
<div class="am-u-sm-9 am-u-end"> |
|||
<input type="password" class="tpl-form-input" name="store[password_confirm]" value="" |
|||
required> |
|||
</div> |
|||
</div> |
|||
<div class="am-form-group"> |
|||
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg"> |
|||
<button type="submit" class="j-submit am-btn am-btn-secondary">提交 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
/** |
|||
* 表单验证提交 |
|||
* @type {*} |
|||
*/ |
|||
$('#my-form').superForm(); |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,74 @@ |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-cf">商城列表</div> |
|||
</div> |
|||
<div class="widget-body am-fr"> |
|||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6"> |
|||
<div class="am-form-group"> |
|||
<div class="am-btn-toolbar"> |
|||
<div class="am-btn-group am-btn-group-xs"> |
|||
<a class="am-btn am-btn-default am-btn-success am-radius" |
|||
href="<?= url('store/add') ?>"> |
|||
<span class="am-icon-plus"></span> 新增 |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="am-u-sm-12"> |
|||
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "> |
|||
<thead> |
|||
<tr> |
|||
<th>商城ID</th> |
|||
<th>商城名称</th> |
|||
<th>添加时间</th> |
|||
<th>操作</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php if (!$list->isEmpty()): foreach ($list as $item): ?> |
|||
<tr> |
|||
<td class="am-text-middle"> |
|||
<p class="item-title"><?= $item['wxapp_id'] ?></p> |
|||
</td> |
|||
<td class="am-text-middle"> |
|||
<p class="item-title"><?= $names[$item['wxapp_id']] ?></p> |
|||
</td> |
|||
<td class="am-text-middle"><?= $item['create_time'] ?></td> |
|||
<td class="am-text-middle"> |
|||
<div class="tpl-table-black-operation"> |
|||
<a href="<?= url('store/enter', ['wxapp_id' => $item['wxapp_id']]) ?>" |
|||
class="j-move" data-id="<?= $item['wxapp_id'] ?>" target="_blank"> |
|||
<i class="am-icon-arrow-right"></i> 进入商城 |
|||
</a> |
|||
<a href="javascript:void(0);" class="j-delete tpl-table-black-operation-del" |
|||
data-id="<?= $item['wxapp_id'] ?>"> |
|||
<i class="am-icon-trash"></i> 删除 |
|||
</a> |
|||
</div> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; else: ?> |
|||
<tr> |
|||
<td colspan="4" class="am-text-center">暂无记录</td> |
|||
</tr> |
|||
<?php endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
// 删除元素 |
|||
var url = "<?= url('store/recovery') ?>"; |
|||
$('.j-delete').delete('wxapp_id', url, '确定要删除吗?可在回收站中恢复'); |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
@ -0,0 +1,69 @@ |
|||
<div class="row"> |
|||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"> |
|||
<div class="widget am-cf"> |
|||
<div class="widget-head am-cf"> |
|||
<div class="widget-title am-cf">回收站列表</div> |
|||
</div> |
|||
<div class="widget-body am-fr"> |
|||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6"> |
|||
<div class="am-form-group"> |
|||
<div class="am-btn-toolbar"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="am-u-sm-12"> |
|||
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "> |
|||
<thead> |
|||
<tr> |
|||
<th>商城ID</th> |
|||
<th>商城名称</th> |
|||
<th>添加时间</th> |
|||
<th>操作</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php if (!$list->isEmpty()): foreach ($list as $item): ?> |
|||
<tr> |
|||
<td class="am-text-middle"> |
|||
<p class="item-title"><?= $item['wxapp_id'] ?></p> |
|||
</td> |
|||
<td class="am-text-middle"> |
|||
<p class="item-title"><?= $names[$item['wxapp_id']] ?></p> |
|||
</td> |
|||
<td class="am-text-middle"><?= $item['create_time'] ?></td> |
|||
<td class="am-text-middle"> |
|||
<div class="tpl-table-black-operation"> |
|||
<a href="javascript:void(0);" class="j-move" |
|||
data-id="<?= $item['wxapp_id'] ?>"> |
|||
<i class="am-icon-undo"></i> 还原 |
|||
</a> |
|||
<a href="javascript:void(0);" class="j-delete tpl-table-black-operation-del" |
|||
data-id="<?= $item['wxapp_id'] ?>"> |
|||
<i class="am-icon-trash"></i> 删除 |
|||
</a> |
|||
</div> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; else: ?> |
|||
<tr> |
|||
<td colspan="4" class="am-text-center">暂无记录</td> |
|||
</tr> |
|||
<?php endif; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
$(function () { |
|||
|
|||
// 移出回收站 |
|||
$('.j-move').delete('wxapp_id', "<?= url('store/move') ?>", '确定要还原吗?'); |
|||
|
|||
// 删除小程序 |
|||
$('.j-delete').delete('wxapp_id', "<?= url('store/delete') ?>", '确定要删除吗?删除后无法恢复'); |
|||
}); |
|||
</script> |
|||
|
|||
Loading…
Reference in new issue