更新目录结构

This commit is contained in:
2023-10-21 21:18:46 +08:00
parent 664295167d
commit 1153b13299
298 changed files with 3032 additions and 2173 deletions

View File

@@ -9,8 +9,23 @@
namespace app\controller;
use app\BaseController;
use think\facade\Cache;
use app\services\system\DictionaryService;
class Base extends BaseController{
public $data = ['code' => 1, 'data' => '', 'message' => ''];
public function initialize(){
$this->cacheData($this->request); //缓存基础数据
}
protected function cacheData($request) {
$diction = Cache::get('diction');
if(!$diction){
$service = app()->make(DictionaryService::class);
$data = $service->getDictionaryAll();
Cache::set('diction', $data);
}
}
}

View File

@@ -8,7 +8,10 @@
// +----------------------------------------------------------------------
namespace app\controller;
use think\facade\Console;
use app\controller\Base;
use Dcat\EasyExcel\Excel;
use app\services\FieldService;
/**
* @title 首页
@@ -24,11 +27,37 @@ class Index extends Base{
if(request()->isAjax()){
return ['code' => 1, 'data' => 'SentOS'];
}else{
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible"content="IE=edge"><meta name="viewport"content="width=device-width, initial-scale=1"><title>SentOS</title><style>html,body{background-color:#fff;color:#3c4042;font-family:'Raleway',sans-serif;font-weight:100;height:80vh;margin:0}.top{text-align:right;line-height:35px;padding:0 20px}.top a{color:#333333;padding:0 10px}.full-height{height:90vh}.flex-center{align-items:center;display:flex;justify-content:center}.position-ref{position:relative}.top-right{position:absolute;right:10px;top:18px}.content{text-align:center}.title{font-size:84px}.links>a{color:#3c4042;padding:0 25px;font-size:12px;font-weight:600;letter-spacing:.1rem;text-decoration:none;text-transform:uppercase}.m-b-md{margin-bottom:30px}</style></head><body><div class="flex-center position-ref full-height"><div class="content"><div class="title m-b-md">SentOS</div><div class="links"></div></div></div><div style="text-align: center; font-size: 12px;"><p><a href="https://beian.miit.gov.cn/"target="_blank"style="color: #333333; text-decoration: none;">赣ICP备13006622号-1</a></p><p>技术支持:<a href="https://www.tensent.cn"target="_blank"style="color: #333333; text-decoration: none;">腾速科技</a></p></div></body></html>`;
return view(`<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible"content="IE=edge"><meta name="viewport"content="width=device-width, initial-scale=1"><title>SentOS</title><style>html,body{background-color:#fff;color:#3c4042;font-family:'Raleway',sans-serif;font-weight:100;height:80vh;margin:0}.top{text-align:right;line-height:35px;padding:0 20px}.top a{color:#333333;padding:0 10px}.full-height{height:90vh}.flex-center{align-items:center;display:flex;justify-content:center}.position-ref{position:relative}.top-right{position:absolute;right:10px;top:18px}.content{text-align:center}.title{font-size:84px}.links>a{color:#3c4042;padding:0 25px;font-size:12px;font-weight:600;letter-spacing:.1rem;text-decoration:none;text-transform:uppercase}.m-b-md{margin-bottom:30px}</style></head><body><div class="flex-center position-ref full-height"><div class="content"><div class="title m-b-md">SentOS</div><div class="links"></div></div></div><div style="text-align: center; font-size: 12px;"><p><a href="https://beian.miit.gov.cn/"target="_blank"style="color: #333333; text-decoration: none;">赣ICP备13006622号-1</a></p><p>技术支持:<a href="https://www.tensent.cn"target="_blank"style="color: #333333; text-decoration: none;">腾速科技</a></p></div></body></html>`);
}
}
public function test(){
// $output = Console::call('worker:gateway');
$service = app()->make(\app\services\wechat\OauthService::class);
print_r($service->getQrCode($this->request)) ;
// return $output->fetch();
// $array = [
// ['id' => 1, 'name' => 'Brakus', 'email' => 'treutel@eg.com', 'created_at' => '...'],
// ];
// Excel::export($array)->download('users.xlsx');
// $area = \think\facade\Db::name('areas')->select();
// $save = [];
// foreach($area as $val){
// $save[] = ['title' => $val['area'], 'code' => $val['area_id'], 'parent_id' => $val['city_id'], 'first' => '', 'create_time' => time(), 'update_time' => time()];
// }
// \think\facade\Db::name('area')->insertAll($save);
}
/**
* @title 导出模版
*
* @return void
*/
public function template(FieldService $service){
$model = $this->request->param('model');
$array = [];
$headings = array_flip($service->getFields($model));
return Excel::export($array)->headings($headings)->download($model . time() . '.xlsx');
}
public function miss(){

View File

@@ -1,124 +1,124 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\auth;
use think\facade\Request;
use app\model\auth\Departments;
use app\services\auth\DepartmentService;
use Xin\Support\Arr;
use app\controller\Base;
class Department extends Base {
/**
* @title 部门列表
*
* @time 2020年01月09日
* @param Departments $department
* @return Array
*/
public function index() {
$list = app()->make(DepartmentService::class)->getDepartmentList($this->request)->toArray();
if(count($list) > 0){
$root = '';
foreach ($list as $value) {
if($root == ''){
$root = $value['parent_id'];
}else{
if($root > $value['parent_id']){
$root = $value['parent_id'];
}
}
}
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
if(empty($tree)){
$this->data['data'] = $list;
}else{
$this->data['data'] = $tree;
}
}else{
$this->data['data'] = [];
}
return $this->data;
}
/**
* @title 添加部门
*
* @time 2020年01月09日
* @return Array
*/
public function add() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = Departments::create($data);
$this->data['message'] = '添加成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 更新部门
*
* @time 2020年01月09日
* @param $id
* @param Request $request
* @return Array
*/
public function edit() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = Departments::update($data);
$this->data['message'] = '更新成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除部门
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function delete() {
$data = request()->post('id');
$map = [];
if(is_array($data)){
$map[] = ['id', 'IN', $data];
}else if(is_numeric($data)){
$map[] = ['id', '=', $data];
}
try {
$result = Departments::destroy(function($query) use ($map){
$query->where($map);
});
$this->data['message'] = '删除成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 获取班级
*
* @return void
*/
public function studentclass(){
$this->data['data'] = app()->make(DepartmentService::class)->getStudentClassList();
$this->data['code'] = 1;
return $this->data;
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\auth;
use think\facade\Request;
use app\model\auth\Departments;
use app\services\auth\DepartmentService;
use Xin\Support\Arr;
use app\controller\Base;
class Department extends Base {
/**
* @title 部门列表
*
* @time 2020年01月09日
* @param Departments $department
* @return Array
*/
public function index() {
$list = app()->make(DepartmentService::class)->getDepartmentList($this->request)->toArray();
if(count($list) > 0){
$root = '';
foreach ($list as $value) {
if($root == ''){
$root = $value['parent_id'];
}else{
if($root > $value['parent_id']){
$root = $value['parent_id'];
}
}
}
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
if(empty($tree)){
$this->data['data'] = $list;
}else{
$this->data['data'] = $tree;
}
}else{
$this->data['data'] = [];
}
return $this->data;
}
/**
* @title 添加部门
*
* @time 2020年01月09日
* @return Array
*/
public function add() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = Departments::create($data);
$this->data['message'] = '添加成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 更新部门
*
* @time 2020年01月09日
* @param $id
* @param Request $request
* @return Array
*/
public function edit() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = Departments::update($data);
$this->data['message'] = '更新成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除部门
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function delete() {
$data = request()->post('id');
$map = [];
if(is_array($data)){
$map[] = ['id', 'IN', $data];
}else if(is_numeric($data)){
$map[] = ['id', '=', $data];
}
try {
$result = Departments::destroy(function($query) use ($map){
$query->where($map);
});
$this->data['message'] = '删除成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 获取班级
*
* @return void
*/
public function studentclass(){
$this->data['data'] = app()->make(DepartmentService::class)->getStudentClassList();
$this->data['code'] = 1;
return $this->data;
}
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\auth;
namespace app\controller\admin\auth;
use app\controller\Base;
use app\services\auth\AuthService;

View File

@@ -1,91 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\auth;
use app\controller\Base;
use app\services\auth\RoleService;
class Role extends Base{
/**
* @title 角色列表
*
* @time 2019年12月09日
* @return string|Json
*/
public function index() {
$tree = app()->make(RoleService::class)->getRolesList($this->request, true);
$this->data['code'] = 1;
$this->data['data'] = $tree;
return $this->data;
}
/**
* @title 角色修改
* @time 2019年12月11日
* @param $id
* @param Request $request
* @return Array
*/
public function edit(RoleService $service) {
try {
$service->updateRole($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 角色授权
* @time 2019年12月11日
* @param $id
* @param Request $request
* @return Array
*/
public function auth() {
$role_id = $this->request->param('role_id', '');
$auth = $this->request->param('auth', '');
$service = app()->make(RoleService::class);
try {
$service->updateRolePermission($role_id, $auth);
$service->updateRoleAuth($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除角色
*
* @time 2019年12月11日
* @param $id
* @throws FailedException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Json
*/
public function delete(){
try {
$service = app()->make(RoleService::class)->deleteRole($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\auth;
use app\controller\Base;
use app\services\auth\RoleService;
class Role extends Base{
/**
* @title 角色列表
*
* @time 2019年12月09日
* @return string|Json
*/
public function index() {
$tree = app()->make(RoleService::class)->getRolesList($this->request, true);
$this->data['code'] = 1;
$this->data['data'] = $tree;
return $this->data;
}
/**
* @title 角色添加
* @time 2019年12月11日
* @param $id
* @param Request $request
* @return Array
*/
public function add(RoleService $service) {
try {
$service->createRole($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 角色修改
* @time 2019年12月11日
* @param $id
* @param Request $request
* @return Array
*/
public function edit(RoleService $service) {
try {
$service->updateRole($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 角色授权
* @time 2019年12月11日
* @param $id
* @param Request $request
* @return Array
*/
public function auth() {
$role_id = $this->request->param('role_id', '');
$auth = $this->request->param('auth', '');
$service = app()->make(RoleService::class);
try {
$service->updateRolePermission($role_id, $auth);
$service->updateRoleAuth($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除角色
*
* @time 2019年12月11日
* @param $id
* @throws FailedException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Json
*/
public function delete(){
try {
$service = app()->make(RoleService::class)->deleteRole($this->request);
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}

View File

@@ -1,120 +1,120 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\auth;
use app\services\auth\UsersService;
use app\controller\Base;
class User extends Base{
/**
* @title 用户列表
* @param int $uid
* @return array
*/
public function index(UsersService $user){
$list = $user->getUserList($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加用户
* @param int $uid
* @return array
*/
public function add(){
try {
$res = app()->make(UsersService::class)->createUsers($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改用户信息
* @param int $uid
* @return array
*/
public function edit(){
try {
$res = app()->make(UsersService::class)->updateUsers($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
$this->data['message'] = "更新成功!";
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改密码
*
* @return void
*/
public function passwd(){
try {
$res = app()->make(UsersService::class)->updateUserPassword($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
$this->data['message'] = "修改成功";
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 批量导入用户
* @param int $uid
* @return array
*/
public function insert(){
try {
$users = app()->make(UsersService::class)->insertAll($this->request);
$this->data['data'] = $users;
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 用户信息
* @param int $uid
* @return array
*/
public function info(){
$this->data['data'] = app()->make(UsersService::class)->userInfo($this->request->user['uid']);
$this->data['code'] = 1;
return $this->data;
}
/**
* @title 用户授权
* @return array
*/
public function auth(){
try {
$uid = $this->request->param('uid');
$role = $this->request->param('role');
app()->make(UsersService::class)->updateRoles($uid, $role);
$this->data['message'] = '更新成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\auth;
use app\services\auth\UsersService;
use app\controller\Base;
class User extends Base{
/**
* @title 用户列表
* @param int $uid
* @return array
*/
public function index(UsersService $user){
$list = $user->getUserList($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加用户
* @param int $uid
* @return array
*/
public function add(){
try {
$res = app()->make(UsersService::class)->createUsers($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改用户信息
* @param int $uid
* @return array
*/
public function edit(){
try {
$res = app()->make(UsersService::class)->updateUsers($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
$this->data['message'] = "更新成功!";
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改密码
*
* @return void
*/
public function passwd(){
try {
$res = app()->make(UsersService::class)->updateUserPassword($this->request);
$this->data['code'] = 1;
$this->data['data'] = $res;
$this->data['message'] = "修改成功";
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 批量导入用户
* @param int $uid
* @return array
*/
public function insert(){
try {
$users = app()->make(UsersService::class)->insertAll($this->request);
$this->data['data'] = $users;
$this->data['code'] = 1;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 用户信息
* @param int $uid
* @return array
*/
public function info(){
$this->data['data'] = app()->make(UsersService::class)->userInfo($this->request->user['uid']);
$this->data['code'] = 1;
return $this->data;
}
/**
* @title 用户授权
* @return array
*/
public function auth(){
try {
$uid = $this->request->param('uid');
$role = $this->request->param('role');
app()->make(UsersService::class)->updateRoles($uid, $role);
$this->data['message'] = '更新成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}

View File

@@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\operate;
use app\controller\Base;
use app\services\operate\AdsService;
class Ads extends Base{
/**
* @title 广告列表
*
* @param AdsService $service
* @return void
*/
public function index(AdsService $service){
$this->data['data'] = $service->getDataList($this->request);
return $this->data;
}
/**
* @title 添加广告
*
* @param AdsService $service
* @return void
*/
public function add(AdsService $service){
try {
$data = $service->create($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 编辑广告
*
* @param AdsService $service
* @return void
*/
public function edit(AdsService $service){
try {
$data = $service->update($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除广告
*
* @param AdsService $service
* @return void
*/
public function delete(AdsService $service){
try {
$data = $service->delete($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}

View File

@@ -0,0 +1,202 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\operate;
use app\controller\Base;
use app\services\operate\ClientService;
use app\services\operate\ClientMenuService;
use app\services\operate\ClientConfigService;
class Client extends Base{
/**
* @title 客户端列表
*
* @param ClientService $service
* @return void
*/
public function index(ClientService $service){
$this->data['data'] = $service->getDataList($this->request);
return $this->data;
}
/**
* @title 添加客户端
*
* @param ClientService $service
* @return void
*/
public function add(ClientService $service){
try {
$data = $service->create($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 编辑客户端
*
* @param ClientService $service
* @return void
*/
public function edit(ClientService $service){
try {
$data = $service->update($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除客户端
*
* @param ClientService $service
* @return void
*/
public function delete(ClientService $service){
try {
$data = $service->delete($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 客户端菜单列表
*
* @param ClientMenuService $service
* @return void
*/
public function menu(ClientMenuService $service){
$this->data['data'] = $service->getDataList($this->request);
return $this->data;
}
/**
* @title 添加客户端菜单
*
* @param ClientMenuService $service
* @return void
*/
public function addmenu(ClientMenuService $service){
try {
$data = $service->create($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 编辑客户端菜单
*
* @param ClientMenuService $service
* @return void
*/
public function editmenu(ClientMenuService $service){
try {
$data = $service->update($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除客户端菜单
*
* @param ClientMenuService $service
* @return void
*/
public function delmenu(ClientMenuService $service){
try {
$data = $service->delete($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 添加客户端配置
*
* @param ClientConfigService $service
* @return void
*/
public function addconfig(ClientConfigService $service){
try {
$data = $service->create($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 添加客户端配置
*
* @param ClientConfigService $service
* @return void
*/
public function editconfig(ClientConfigService $service){
try {
$data = $service->update($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除客户端配置
*
* @param ClientConfigService $service
* @return void
*/
public function delconfig(ClientConfigService $service){
try {
$data = $service->delete($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}

View File

@@ -1,127 +1,133 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
use app\controller\Base;
use app\services\system\DictionaryService;
/**
* @title 字典功能
*/
class Dict extends Base{
/**
* @title 字典分类数据
*
* @return void
*/
public function category(DictionaryService $dic){
$list = $dic->getTree($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典分类
*
* @return void
*/
public function addcate(DictionaryService $dic){
try {
$data = $dic->addcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典分类
*
* @return void
*/
public function editcate(DictionaryService $dic){
try {
$data = $dic->editcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
public function delcate(DictionaryService $dic){
$dic->deleteCategory($this->request);
return $this->data;
}
/**
* @title 字典列表
*
* @return void
*/
public function lists(DictionaryService $dic){
$list = $dic->getDictionary($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典
*
* @return void
*/
public function add(DictionaryService $dic){
try {
$data = $dic->createDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典
*
* @return void
*/
public function edit(DictionaryService $dic){
try {
$data = $dic->updateDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除字典
*
* @param DictionaryService $dic
* @return void
*/
public function delete(DictionaryService $dic){
$dic->deleteDic($this->request);
return $this->data;
}
/**
* @title 字典明细
*
* @return void
*/
public function detail(DictionaryService $dic){
$list = $dic->getDictionaryDetail($this->request);
$this->data['data'] = $list;
return $this->data;
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\system;
use app\controller\Base;
use app\services\system\DictionaryService;
/**
* @title 字典功能
*/
class Dict extends Base{
/**
* @title 字典分类数据
*
* @return void
*/
public function category(DictionaryService $dic){
$list = $dic->getTree($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典分类
*
* @return void
*/
public function addcate(DictionaryService $dic){
try {
$data = $dic->addcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典分类
*
* @return void
*/
public function editcate(DictionaryService $dic){
try {
$data = $dic->editcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
public function delcate(DictionaryService $dic){
$dic->deleteCategory($this->request);
return $this->data;
}
/**
* @title 字典列表
*
* @return void
*/
public function lists(DictionaryService $dic){
$list = $dic->getDictionary($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典
*
* @return void
*/
public function add(DictionaryService $dic){
try {
$data = $dic->createDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典
*
* @return void
*/
public function edit(DictionaryService $dic){
try {
$data = $dic->updateDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除字典
*
* @param DictionaryService $dic
* @return void
*/
public function delete(DictionaryService $dic){
$dic->deleteDic($this->request);
return $this->data;
}
/**
* @title 字典明细
*
* @return void
*/
public function detail(DictionaryService $dic){
$list = $dic->getDictionaryDetail($this->request);
$this->data['data'] = $list;
return $this->data;
}
public function all(DictionaryService $dic){
$list = $dic->getDictionaryAll($this->request);
$this->data['data'] = $list;
return $this->data;
}
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
namespace app\controller\admin\system;
use app\controller\Base;
use app\validate\File as Files;

View File

@@ -1,45 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
use app\controller\Base;
use app\services\system\ConfigService;
class Index extends Base{
/**
* @title 系统版本
*
* @return void
*/
public function version(){
$system_info_mysql = \think\facade\Db::query("select version() as v;");
$this->data['data'] = [
['label' => '核心版本', 'values' => \think\facade\Env::get('version')],
['label' => '服务器操作系统', 'values' => PHP_OS],
['label' => '运行环境', 'values' => $_SERVER['SERVER_SOFTWARE']],
['label' => 'MYSQL版本', 'values' => $system_info_mysql[0]['v']],
['label' => '上传限制', 'values' => '10']
];
return $this->data;
}
/**
* 获取配置列表
*
* @param ConfigService $service
* @return void
*/
public function setting(ConfigService $service){
$list = $service->getConfigField();
$this->data['data'] = $list;
return $this->data;
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\system;
use app\controller\Base;
use app\services\system\ConfigService;
class Index extends Base{
/**
* @title 系统版本
*
* @return void
*/
public function version(){
$system_info_mysql = \think\facade\Db::query("select version() as v;");
$this->data['data'] = [
['label' => '核心版本', 'values' => \think\facade\Env::get('version')],
['label' => '服务器操作系统', 'values' => PHP_OS],
['label' => '运行环境', 'values' => $_SERVER['SERVER_SOFTWARE']],
['label' => 'MYSQL版本', 'values' => $system_info_mysql[0]['v']],
['label' => '上传限制', 'values' => '10']
];
return $this->data;
}
/**
* 获取配置列表
*
* @param ConfigService $service
* @return void
*/
public function setting(ConfigService $service){
$list = $service->getConfigField();
$this->data['data'] = $list;
return $this->data;
}
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
namespace app\controller\admin\system;
use app\controller\Base;
use app\services\auth\UsersLogService;

View File

@@ -1,134 +1,134 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
use app\controller\Base;
use app\services\auth\MenuService;
use app\services\auth\AuthService;
class Menu extends Base{
/**
* @title 权限列表
*
* @time 2020年01月09日
* @param Departments $department
* @return Array
*/
public function index() {
$data = app()->make(MenuService::class)->getSystemMenu(false);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 权限保存
*
* @time 2020年01月09日
* @return Array
*/
public function add() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = app()->make(MenuService::class)->createData($data);
$this->data['data'] = $result;
$this->data['message'] = '添加成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 权限更新
*
* @time 2020年01月09日
* @param $id
* @param Request $request
* @return Array
*/
public function edit() {
$data = request()->post();
try {
$result = app()->make(MenuService::class)->saveData($data);
if($result){
$this->data['data'] = app()->make(AuthService::class)->getAuthMenu();
}
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 权限删除
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function delete() {
$ids = request()->post('ids');
try {
$result = app()->make(MenuService::class)->deleteMenu($ids);
$this->data['data'] = app()->make(MenuService::class)->getSystemMenu();
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 菜单路由
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function routes(Permissions $permission) {
$map = [];
$map[] = ['type', '=', 1];
$map[] = ['hidden', '=', 1];
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
$tree = (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
$this->data['data'] = [['router' => 'root', 'children' => $tree]];
return $this->data;
}
/**
* @title 权限数据
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function permission(Permissions $permission) {
$map = [];
$map[] = ['hidden', '=', 1];
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
$data = [];
foreach($list as $item){
if($item['type'] == 1){
$data[$item['id']] = $item;
}else{
$data[$item['parent_id']]['module'] = $item;
}
}
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 我的菜单
* @return Array
*/
public function my(AuthService $service){
$this->data['code'] = 1;
$this->data['data'] = ['menu' => $service->getAuthMenu($this->request), 'permissions' => $service->getAuthPermissions($this->request)];
return $this->data;
}
}
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin\system;
use app\controller\Base;
use app\services\auth\MenuService;
use app\services\auth\AuthService;
class Menu extends Base{
/**
* @title 权限列表
*
* @time 2020年01月09日
* @param Departments $department
* @return Array
*/
public function index() {
$data = app()->make(MenuService::class)->getSystemMenu(false);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 权限保存
*
* @time 2020年01月09日
* @return Array
*/
public function add() {
$data = request()->post();
$data['creator_id'] = request()->user['uid'];
try {
$result = app()->make(MenuService::class)->createData($data);
$this->data['data'] = $result;
$this->data['message'] = '添加成功!';
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 权限更新
*
* @time 2020年01月09日
* @param $id
* @param Request $request
* @return Array
*/
public function edit() {
$data = request()->post();
try {
$result = app()->make(MenuService::class)->saveData($data);
if($result){
$this->data['data'] = app()->make(AuthService::class)->getAuthMenu();
}
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 权限删除
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function delete() {
$ids = request()->post('ids');
try {
$result = app()->make(MenuService::class)->deleteMenu($ids);
$this->data['data'] = app()->make(MenuService::class)->getSystemMenu();
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 菜单路由
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function routes(Permissions $permission) {
$map = [];
$map[] = ['type', '=', 1];
$map[] = ['hidden', '=', 1];
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
$tree = (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
$this->data['data'] = [['router' => 'root', 'children' => $tree]];
return $this->data;
}
/**
* @title 权限数据
*
* @time 2020年01月09日
* @param $id
* @return Array
*/
public function permission(Permissions $permission) {
$map = [];
$map[] = ['hidden', '=', 1];
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
$data = [];
foreach($list as $item){
if($item['type'] == 1){
$data[$item['id']] = $item;
}else{
$data[$item['parent_id']]['module'] = $item;
}
}
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 我的菜单
* @return Array
*/
public function my(AuthService $service){
$this->data['code'] = 1;
$this->data['data'] = ['menu' => $service->getAuthMenu($this->request), 'permissions' => $service->getAuthPermissions($this->request)];
return $this->data;
}
}

View File

@@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\api\auth;
use app\controller\Base;
use app\services\wechat\OauthService;
class Index extends Base{
public function wxlogin(OauthService $service){
try {
$this->data['data'] = $service->oauth($this->request);
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
}

View File

@@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\api\operate;
use app\controller\Base;
use app\services\operate\AdsService;
class Ads extends Base{
/**
* @title 客户端菜单
*
* @return void
*/
public function detail(AdsService $service){
$this->data['data'] = $service->getAdsDetail($this->request);
return $this->data;
}
}

View File

@@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\api\operate;
use app\controller\Base;
use app\services\operate\ClientService;
class Client extends Base{
/**
* @title 客户端菜单
*
* @return void
*/
public function menu(ClientService $service){
$this->data['data'] = $service->getClientMenu($this->request);
return $this->data;
}
}

View File

@@ -1,71 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\customer;
use app\controller\Base;
use app\services\company\CompanyService;
/**
* @title 企业信息模型
*/
class Company extends Base{
/**
* @title 企业列表
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function index(CompanyService $service) {
$data = $service->getCompanyList($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 企业详情
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function detail(CompanyService $service) {
$data = $service->getCompanyDetail($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 修改企业
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function edit(CompanyService $service) {
$data = $service->editCompany($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 导入企业信息
*
* @param CompanyService $service
* @return void
*/
public function insert(CompanyService $service){
$this->data['data'] = $service->insertCompanyData($this->request);
return $this->data;
}
}