更新目录结构
77
README.md
@@ -1,79 +1,18 @@
|
|||||||

|
# sentos
|
||||||
|
|
||||||
ThinkPHP 8.0
|
|
||||||
===============
|
|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
* 基于PHP`8.0+`重构
|
- 后端基于thinkphp8 开发
|
||||||
* 升级`PSR`依赖
|
- 前端基于vue + aiox + vuex + electron + element plus开发
|
||||||
* 依赖`think-orm`3.0版本
|
|
||||||
* `6.0`/`6.1`无缝升级
|
|
||||||
|
|
||||||
|
|
||||||
> ThinkPHP8.0的运行环境要求PHP8.0.0+
|
|
||||||
|
|
||||||
现在开始,你可以使用官方提供的[ThinkChat](https://chat.topthink.com/),让你在学习ThinkPHP的旅途中享受私人AI助理服务!
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## 文档
|
|
||||||
|
|
||||||
[完全开发手册](https://doc.thinkphp.cn)
|
|
||||||
|
|
||||||
## 服务
|
|
||||||
|
|
||||||
ThinkPHP生态服务由[顶想云](https://www.topthink.com)(TOPThink Cloud)提供,为生态提供专业的开发者服务和价值之选。
|
|
||||||
|
|
||||||
## 赞助
|
|
||||||
全新的[赞助计划](https://www.thinkphp.cn/sponsor)可以让你通过我们的网站、手册、欢迎页及GIT仓库获得巨大曝光,同时提升企业的品牌声誉,也更好保障ThinkPHP的可持续发展。
|
|
||||||
|
|
||||||
[](http://github.crmeb.net/u/TPSY)
|
|
||||||
|
|
||||||
[](https://www.thinkphp.cn/sponsor)
|
|
||||||
|
|
||||||
[](https://www.thinkphp.cn/sponsor)
|
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
~~~
|
- 后端安装
|
||||||
composer create-project topthink/think tp
|
|
||||||
~~~
|
|
||||||
|
|
||||||
启动服务
|
系统根目录下执行命令,安装后端扩展
|
||||||
|
|
||||||
~~~
|
> composer install
|
||||||
cd tp
|
|
||||||
php think run
|
|
||||||
~~~
|
|
||||||
|
|
||||||
然后就可以在浏览器中访问
|
配置好数据库链接,并导入数据库文件
|
||||||
|
|
||||||
~~~
|
- 前端安装
|
||||||
http://localhost:8000
|
|
||||||
~~~
|
|
||||||
|
|
||||||
如果需要更新框架使用
|
|
||||||
~~~
|
|
||||||
composer update topthink/framework
|
|
||||||
~~~
|
|
||||||
|
|
||||||
## 命名规范
|
|
||||||
|
|
||||||
`ThinkPHP`遵循PSR-2命名规范和PSR-4自动加载规范。
|
|
||||||
|
|
||||||
## 参与开发
|
|
||||||
|
|
||||||
直接提交PR或者Issue即可
|
|
||||||
|
|
||||||
## 版权信息
|
|
||||||
|
|
||||||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
|
|
||||||
|
|
||||||
本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
|
||||||
|
|
||||||
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn) All rights reserved。
|
|
||||||
|
|
||||||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
|
|
||||||
|
|
||||||
更多细节参阅 [LICENSE.txt](LICENSE.txt)
|
|
||||||
|
|||||||
@@ -9,8 +9,23 @@
|
|||||||
namespace app\controller;
|
namespace app\controller;
|
||||||
|
|
||||||
use app\BaseController;
|
use app\BaseController;
|
||||||
|
use think\facade\Cache;
|
||||||
|
use app\services\system\DictionaryService;
|
||||||
|
|
||||||
class Base extends BaseController{
|
class Base extends BaseController{
|
||||||
|
|
||||||
public $data = ['code' => 1, 'data' => '', 'message' => ''];
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,10 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller;
|
namespace app\controller;
|
||||||
|
|
||||||
|
use think\facade\Console;
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
|
use Dcat\EasyExcel\Excel;
|
||||||
|
use app\services\FieldService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 首页
|
* @title 首页
|
||||||
@@ -24,11 +27,37 @@ class Index extends Base{
|
|||||||
if(request()->isAjax()){
|
if(request()->isAjax()){
|
||||||
return ['code' => 1, 'data' => 'SentOS'];
|
return ['code' => 1, 'data' => 'SentOS'];
|
||||||
}else{
|
}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(){
|
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(){
|
public function miss(){
|
||||||
|
|||||||
@@ -1,124 +1,124 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\auth;
|
namespace app\controller\admin\auth;
|
||||||
|
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use app\model\auth\Departments;
|
use app\model\auth\Departments;
|
||||||
use app\services\auth\DepartmentService;
|
use app\services\auth\DepartmentService;
|
||||||
use Xin\Support\Arr;
|
use Xin\Support\Arr;
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
|
|
||||||
class Department extends Base {
|
class Department extends Base {
|
||||||
/**
|
/**
|
||||||
* @title 部门列表
|
* @title 部门列表
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param Departments $department
|
* @param Departments $department
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$list = app()->make(DepartmentService::class)->getDepartmentList($this->request)->toArray();
|
$list = app()->make(DepartmentService::class)->getDepartmentList($this->request)->toArray();
|
||||||
if(count($list) > 0){
|
if(count($list) > 0){
|
||||||
$root = '';
|
$root = '';
|
||||||
foreach ($list as $value) {
|
foreach ($list as $value) {
|
||||||
if($root == ''){
|
if($root == ''){
|
||||||
$root = $value['parent_id'];
|
$root = $value['parent_id'];
|
||||||
}else{
|
}else{
|
||||||
if($root > $value['parent_id']){
|
if($root > $value['parent_id']){
|
||||||
$root = $value['parent_id'];
|
$root = $value['parent_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
|
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
|
||||||
if(empty($tree)){
|
if(empty($tree)){
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
}else{
|
}else{
|
||||||
$this->data['data'] = $tree;
|
$this->data['data'] = $tree;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->data['data'] = [];
|
$this->data['data'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 添加部门
|
* @title 添加部门
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function add() {
|
public function add() {
|
||||||
$data = request()->post();
|
$data = request()->post();
|
||||||
$data['creator_id'] = request()->user['uid'];
|
$data['creator_id'] = request()->user['uid'];
|
||||||
try {
|
try {
|
||||||
$result = Departments::create($data);
|
$result = Departments::create($data);
|
||||||
$this->data['message'] = '添加成功!';
|
$this->data['message'] = '添加成功!';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 更新部门
|
* @title 更新部门
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function edit() {
|
public function edit() {
|
||||||
$data = request()->post();
|
$data = request()->post();
|
||||||
$data['creator_id'] = request()->user['uid'];
|
$data['creator_id'] = request()->user['uid'];
|
||||||
try {
|
try {
|
||||||
$result = Departments::update($data);
|
$result = Departments::update($data);
|
||||||
$this->data['message'] = '更新成功!';
|
$this->data['message'] = '更新成功!';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 删除部门
|
* @title 删除部门
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete() {
|
||||||
$data = request()->post('id');
|
$data = request()->post('id');
|
||||||
$map = [];
|
$map = [];
|
||||||
if(is_array($data)){
|
if(is_array($data)){
|
||||||
$map[] = ['id', 'IN', $data];
|
$map[] = ['id', 'IN', $data];
|
||||||
}else if(is_numeric($data)){
|
}else if(is_numeric($data)){
|
||||||
$map[] = ['id', '=', $data];
|
$map[] = ['id', '=', $data];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$result = Departments::destroy(function($query) use ($map){
|
$result = Departments::destroy(function($query) use ($map){
|
||||||
$query->where($map);
|
$query->where($map);
|
||||||
});
|
});
|
||||||
$this->data['message'] = '删除成功!';
|
$this->data['message'] = '删除成功!';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 获取班级
|
* @title 获取班级
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function studentclass(){
|
public function studentclass(){
|
||||||
$this->data['data'] = app()->make(DepartmentService::class)->getStudentClassList();
|
$this->data['data'] = app()->make(DepartmentService::class)->getStudentClassList();
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\auth;
|
namespace app\controller\admin\auth;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\auth\AuthService;
|
use app\services\auth\AuthService;
|
||||||
@@ -1,91 +1,109 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\auth;
|
namespace app\controller\admin\auth;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\auth\RoleService;
|
use app\services\auth\RoleService;
|
||||||
|
|
||||||
class Role extends Base{
|
class Role extends Base{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 角色列表
|
* @title 角色列表
|
||||||
*
|
*
|
||||||
* @time 2019年12月09日
|
* @time 2019年12月09日
|
||||||
* @return string|Json
|
* @return string|Json
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$tree = app()->make(RoleService::class)->getRolesList($this->request, true);
|
$tree = app()->make(RoleService::class)->getRolesList($this->request, true);
|
||||||
|
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $tree;
|
$this->data['data'] = $tree;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 角色修改
|
* @title 角色添加
|
||||||
* @time 2019年12月11日
|
* @time 2019年12月11日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function edit(RoleService $service) {
|
public function add(RoleService $service) {
|
||||||
try {
|
try {
|
||||||
$service->updateRole($this->request);
|
$service->createRole($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 角色授权
|
* @title 角色修改
|
||||||
* @time 2019年12月11日
|
* @time 2019年12月11日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function auth() {
|
public function edit(RoleService $service) {
|
||||||
$role_id = $this->request->param('role_id', '');
|
try {
|
||||||
$auth = $this->request->param('auth', '');
|
$service->updateRole($this->request);
|
||||||
$service = app()->make(RoleService::class);
|
$this->data['code'] = 1;
|
||||||
try {
|
} catch (\Exception $e) {
|
||||||
$service->updateRolePermission($role_id, $auth);
|
$this->data['code'] = 0;
|
||||||
$service->updateRoleAuth($this->request);
|
$this->data['message'] = $e->getMessage();
|
||||||
$this->data['code'] = 1;
|
}
|
||||||
} catch (\Exception $e) {
|
return $this->data;
|
||||||
$this->data['code'] = 0;
|
}
|
||||||
$this->data['message'] = $e->getMessage();
|
|
||||||
}
|
/**
|
||||||
return $this->data;
|
* @title 角色授权
|
||||||
}
|
* @time 2019年12月11日
|
||||||
|
* @param $id
|
||||||
/**
|
* @param Request $request
|
||||||
* @title 删除角色
|
* @return Array
|
||||||
*
|
*/
|
||||||
* @time 2019年12月11日
|
public function auth() {
|
||||||
* @param $id
|
$role_id = $this->request->param('role_id', '');
|
||||||
* @throws FailedException
|
$auth = $this->request->param('auth', '');
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
$service = app()->make(RoleService::class);
|
||||||
* @throws \think\db\exception\DbException
|
try {
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
$service->updateRolePermission($role_id, $auth);
|
||||||
* @return Json
|
$service->updateRoleAuth($this->request);
|
||||||
*/
|
$this->data['code'] = 1;
|
||||||
public function delete(){
|
} catch (\Exception $e) {
|
||||||
try {
|
$this->data['code'] = 0;
|
||||||
$service = app()->make(RoleService::class)->deleteRole($this->request);
|
$this->data['message'] = $e->getMessage();
|
||||||
$this->data['code'] = 1;
|
}
|
||||||
} catch (\Exception $e) {
|
return $this->data;
|
||||||
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,120 +1,120 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\auth;
|
namespace app\controller\admin\auth;
|
||||||
|
|
||||||
use app\services\auth\UsersService;
|
use app\services\auth\UsersService;
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
|
|
||||||
class User extends Base{
|
class User extends Base{
|
||||||
/**
|
/**
|
||||||
* @title 用户列表
|
* @title 用户列表
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function index(UsersService $user){
|
public function index(UsersService $user){
|
||||||
$list = $user->getUserList($this->request);
|
$list = $user->getUserList($this->request);
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 添加用户
|
* @title 添加用户
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function add(){
|
public function add(){
|
||||||
try {
|
try {
|
||||||
$res = app()->make(UsersService::class)->createUsers($this->request);
|
$res = app()->make(UsersService::class)->createUsers($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $res;
|
$this->data['data'] = $res;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 修改用户信息
|
* @title 修改用户信息
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function edit(){
|
public function edit(){
|
||||||
try {
|
try {
|
||||||
$res = app()->make(UsersService::class)->updateUsers($this->request);
|
$res = app()->make(UsersService::class)->updateUsers($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $res;
|
$this->data['data'] = $res;
|
||||||
$this->data['message'] = "更新成功!";
|
$this->data['message'] = "更新成功!";
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 修改密码
|
* @title 修改密码
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function passwd(){
|
public function passwd(){
|
||||||
try {
|
try {
|
||||||
$res = app()->make(UsersService::class)->updateUserPassword($this->request);
|
$res = app()->make(UsersService::class)->updateUserPassword($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $res;
|
$this->data['data'] = $res;
|
||||||
$this->data['message'] = "修改成功";
|
$this->data['message'] = "修改成功";
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 批量导入用户
|
* @title 批量导入用户
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function insert(){
|
public function insert(){
|
||||||
try {
|
try {
|
||||||
$users = app()->make(UsersService::class)->insertAll($this->request);
|
$users = app()->make(UsersService::class)->insertAll($this->request);
|
||||||
$this->data['data'] = $users;
|
$this->data['data'] = $users;
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 用户信息
|
* @title 用户信息
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function info(){
|
public function info(){
|
||||||
$this->data['data'] = app()->make(UsersService::class)->userInfo($this->request->user['uid']);
|
$this->data['data'] = app()->make(UsersService::class)->userInfo($this->request->user['uid']);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 用户授权
|
* @title 用户授权
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function auth(){
|
public function auth(){
|
||||||
try {
|
try {
|
||||||
$uid = $this->request->param('uid');
|
$uid = $this->request->param('uid');
|
||||||
$role = $this->request->param('role');
|
$role = $this->request->param('role');
|
||||||
app()->make(UsersService::class)->updateRoles($uid, $role);
|
app()->make(UsersService::class)->updateRoles($uid, $role);
|
||||||
$this->data['message'] = '更新成功!';
|
$this->data['message'] = '更新成功!';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
81
app/controller/admin/operate/Ads.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
202
app/controller/admin/operate/Client.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,127 +1,133 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\system;
|
namespace app\controller\admin\system;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\system\DictionaryService;
|
use app\services\system\DictionaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 字典功能
|
* @title 字典功能
|
||||||
*/
|
*/
|
||||||
class Dict extends Base{
|
class Dict extends Base{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 字典分类数据
|
* @title 字典分类数据
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function category(DictionaryService $dic){
|
public function category(DictionaryService $dic){
|
||||||
$list = $dic->getTree($this->request);
|
$list = $dic->getTree($this->request);
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 添加字典分类
|
* @title 添加字典分类
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addcate(DictionaryService $dic){
|
public function addcate(DictionaryService $dic){
|
||||||
try {
|
try {
|
||||||
$data = $dic->addcate($this->request);
|
$data = $dic->addcate($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 修改字典分类
|
* @title 修改字典分类
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function editcate(DictionaryService $dic){
|
public function editcate(DictionaryService $dic){
|
||||||
try {
|
try {
|
||||||
$data = $dic->editcate($this->request);
|
$data = $dic->editcate($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
public function delcate(DictionaryService $dic){
|
public function delcate(DictionaryService $dic){
|
||||||
$dic->deleteCategory($this->request);
|
$dic->deleteCategory($this->request);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 字典列表
|
* @title 字典列表
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function lists(DictionaryService $dic){
|
public function lists(DictionaryService $dic){
|
||||||
$list = $dic->getDictionary($this->request);
|
$list = $dic->getDictionary($this->request);
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 添加字典
|
* @title 添加字典
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add(DictionaryService $dic){
|
public function add(DictionaryService $dic){
|
||||||
try {
|
try {
|
||||||
$data = $dic->createDic($this->request);
|
$data = $dic->createDic($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 修改字典
|
* @title 修改字典
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function edit(DictionaryService $dic){
|
public function edit(DictionaryService $dic){
|
||||||
try {
|
try {
|
||||||
$data = $dic->updateDic($this->request);
|
$data = $dic->updateDic($this->request);
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 删除字典
|
* @title 删除字典
|
||||||
*
|
*
|
||||||
* @param DictionaryService $dic
|
* @param DictionaryService $dic
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete(DictionaryService $dic){
|
public function delete(DictionaryService $dic){
|
||||||
$dic->deleteDic($this->request);
|
$dic->deleteDic($this->request);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 字典明细
|
* @title 字典明细
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function detail(DictionaryService $dic){
|
public function detail(DictionaryService $dic){
|
||||||
$list = $dic->getDictionaryDetail($this->request);
|
$list = $dic->getDictionaryDetail($this->request);
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function all(DictionaryService $dic){
|
||||||
|
$list = $dic->getDictionaryAll($this->request);
|
||||||
|
$this->data['data'] = $list;
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\system;
|
namespace app\controller\admin\system;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\validate\File as Files;
|
use app\validate\File as Files;
|
||||||
@@ -1,45 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\system;
|
namespace app\controller\admin\system;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\system\ConfigService;
|
use app\services\system\ConfigService;
|
||||||
|
|
||||||
class Index extends Base{
|
class Index extends Base{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 系统版本
|
* @title 系统版本
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function version(){
|
public function version(){
|
||||||
$system_info_mysql = \think\facade\Db::query("select version() as v;");
|
$system_info_mysql = \think\facade\Db::query("select version() as v;");
|
||||||
$this->data['data'] = [
|
$this->data['data'] = [
|
||||||
['label' => '核心版本', 'values' => \think\facade\Env::get('version')],
|
['label' => '核心版本', 'values' => \think\facade\Env::get('version')],
|
||||||
['label' => '服务器操作系统', 'values' => PHP_OS],
|
['label' => '服务器操作系统', 'values' => PHP_OS],
|
||||||
['label' => '运行环境', 'values' => $_SERVER['SERVER_SOFTWARE']],
|
['label' => '运行环境', 'values' => $_SERVER['SERVER_SOFTWARE']],
|
||||||
['label' => 'MYSQL版本', 'values' => $system_info_mysql[0]['v']],
|
['label' => 'MYSQL版本', 'values' => $system_info_mysql[0]['v']],
|
||||||
['label' => '上传限制', 'values' => '10']
|
['label' => '上传限制', 'values' => '10']
|
||||||
];
|
];
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置列表
|
* 获取配置列表
|
||||||
*
|
*
|
||||||
* @param ConfigService $service
|
* @param ConfigService $service
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setting(ConfigService $service){
|
public function setting(ConfigService $service){
|
||||||
$list = $service->getConfigField();
|
$list = $service->getConfigField();
|
||||||
|
|
||||||
$this->data['data'] = $list;
|
$this->data['data'] = $list;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\system;
|
namespace app\controller\admin\system;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\auth\UsersLogService;
|
use app\services\auth\UsersLogService;
|
||||||
@@ -1,134 +1,134 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\system;
|
namespace app\controller\admin\system;
|
||||||
|
|
||||||
use app\controller\Base;
|
use app\controller\Base;
|
||||||
use app\services\auth\MenuService;
|
use app\services\auth\MenuService;
|
||||||
use app\services\auth\AuthService;
|
use app\services\auth\AuthService;
|
||||||
|
|
||||||
class Menu extends Base{
|
class Menu extends Base{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 权限列表
|
* @title 权限列表
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param Departments $department
|
* @param Departments $department
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$data = app()->make(MenuService::class)->getSystemMenu(false);
|
$data = app()->make(MenuService::class)->getSystemMenu(false);
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 权限保存
|
* @title 权限保存
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function add() {
|
public function add() {
|
||||||
$data = request()->post();
|
$data = request()->post();
|
||||||
$data['creator_id'] = request()->user['uid'];
|
$data['creator_id'] = request()->user['uid'];
|
||||||
try {
|
try {
|
||||||
$result = app()->make(MenuService::class)->createData($data);
|
$result = app()->make(MenuService::class)->createData($data);
|
||||||
$this->data['data'] = $result;
|
$this->data['data'] = $result;
|
||||||
$this->data['message'] = '添加成功!';
|
$this->data['message'] = '添加成功!';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 权限更新
|
* @title 权限更新
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function edit() {
|
public function edit() {
|
||||||
$data = request()->post();
|
$data = request()->post();
|
||||||
try {
|
try {
|
||||||
$result = app()->make(MenuService::class)->saveData($data);
|
$result = app()->make(MenuService::class)->saveData($data);
|
||||||
if($result){
|
if($result){
|
||||||
$this->data['data'] = app()->make(AuthService::class)->getAuthMenu();
|
$this->data['data'] = app()->make(AuthService::class)->getAuthMenu();
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 权限删除
|
* @title 权限删除
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete() {
|
||||||
$ids = request()->post('ids');
|
$ids = request()->post('ids');
|
||||||
try {
|
try {
|
||||||
$result = app()->make(MenuService::class)->deleteMenu($ids);
|
$result = app()->make(MenuService::class)->deleteMenu($ids);
|
||||||
$this->data['data'] = app()->make(MenuService::class)->getSystemMenu();
|
$this->data['data'] = app()->make(MenuService::class)->getSystemMenu();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->data['code'] = 0;
|
$this->data['code'] = 0;
|
||||||
$this->data['message'] = $e->getMessage();
|
$this->data['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 菜单路由
|
* @title 菜单路由
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function routes(Permissions $permission) {
|
public function routes(Permissions $permission) {
|
||||||
$map = [];
|
$map = [];
|
||||||
$map[] = ['type', '=', 1];
|
$map[] = ['type', '=', 1];
|
||||||
$map[] = ['hidden', '=', 1];
|
$map[] = ['hidden', '=', 1];
|
||||||
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
|
$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');
|
$tree = (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
|
||||||
$this->data['data'] = [['router' => 'root', 'children' => $tree]];
|
$this->data['data'] = [['router' => 'root', 'children' => $tree]];
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 权限数据
|
* @title 权限数据
|
||||||
*
|
*
|
||||||
* @time 2020年01月09日
|
* @time 2020年01月09日
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function permission(Permissions $permission) {
|
public function permission(Permissions $permission) {
|
||||||
$map = [];
|
$map = [];
|
||||||
$map[] = ['hidden', '=', 1];
|
$map[] = ['hidden', '=', 1];
|
||||||
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
|
$list = $permission->where($map)->field('router,name,icon,id,parent_id')->order('sort asc')->select()->toArray();
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach($list as $item){
|
foreach($list as $item){
|
||||||
if($item['type'] == 1){
|
if($item['type'] == 1){
|
||||||
$data[$item['id']] = $item;
|
$data[$item['id']] = $item;
|
||||||
}else{
|
}else{
|
||||||
$data[$item['parent_id']]['module'] = $item;
|
$data[$item['parent_id']]['module'] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->data['data'] = $data;
|
$this->data['data'] = $data;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @title 我的菜单
|
* @title 我的菜单
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function my(AuthService $service){
|
public function my(AuthService $service){
|
||||||
$this->data['code'] = 1;
|
$this->data['code'] = 1;
|
||||||
$this->data['data'] = ['menu' => $service->getAuthMenu($this->request), 'permissions' => $service->getAuthPermissions($this->request)];
|
$this->data['data'] = ['menu' => $service->getAuthMenu($this->request), 'permissions' => $service->getAuthPermissions($this->request)];
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
26
app/controller/api/auth/Index.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/controller/api/operate/Ads.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/controller/api/operate/Client.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,7 @@ class AllowCrossDomain{
|
|||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(Config $config){
|
public function __construct(Config $config){
|
||||||
$this->header = array_merge($this->header, $config->get('cross', ''));
|
$this->header = array_merge($this->header, $config->get('cross', []));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
47
app/middleware/ApiCheck.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?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>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\middleware;
|
||||||
|
|
||||||
|
use think\App;
|
||||||
|
use think\Response;
|
||||||
|
use leruge\exception\JWTTokenNotFoundException;
|
||||||
|
|
||||||
|
class ApiCheck{
|
||||||
|
protected $app;
|
||||||
|
|
||||||
|
public function __construct(App $app){
|
||||||
|
$this->app = $app;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 处理请求
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @param [type] $store
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($request, \Closure $next, $store = null){
|
||||||
|
try {
|
||||||
|
$verify = \leruge\facade\JWT::validate();;
|
||||||
|
if (true === $verify) {
|
||||||
|
$student = \leruge\facade\JWT::auth();
|
||||||
|
if ($student->id) {
|
||||||
|
// 路由注入
|
||||||
|
$request->student = $student;
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
} catch (JWTTokenNotFoundException $e) {
|
||||||
|
return Response::create(['message' => '未登录或登录过期!', 'code' => 2000], 'json', 401);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ class Validate {
|
|||||||
if (!$v->check($params)) {
|
if (!$v->check($params)) {
|
||||||
//校验不通过则直接返回错误信息
|
//校验不通过则直接返回错误信息
|
||||||
$data = array(
|
$data = array(
|
||||||
'msg' => $v->getError(),
|
'message' => $v->getError(),
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
'data' => '',
|
'data' => '',
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace app\model;
|
|||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
use think\facade\Env;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
class BaseModel extends Model{
|
class BaseModel extends Model{
|
||||||
@@ -18,22 +19,32 @@ class BaseModel extends Model{
|
|||||||
$auth = request()->auth();
|
$auth = request()->auth();
|
||||||
$uid = request()->user['uid'];
|
$uid = request()->user['uid'];
|
||||||
$map = [];
|
$map = [];
|
||||||
if(!in_array($uid, Config::get('auth.admin_root'))){
|
if($uid != Env::get('admin')){
|
||||||
$subMap = [];
|
$subMap = [];
|
||||||
if($auth['data_range'] == 2){
|
if($auth['data_range'] == 2){
|
||||||
$subMap[] = ['department_id', 'IN', getDepartmentChild($auth['department_id'])];
|
$subMap[] = ['department_id', 'IN', getDepartmentChild($auth['department_id'])];
|
||||||
}elseif($auth['data_range'] == 3){
|
}elseif($auth['data_range'] == 3){
|
||||||
$subMap[] = ['department_id', 'IN', $auth['department_id']];
|
$subMap[] = ['department_id', 'IN', $auth['department_id']];
|
||||||
}elseif($auth['data_range'] == 4){
|
}elseif($auth['data_range'] == 4){
|
||||||
$map[] = ['uid', '=', $uid];
|
$map[] = ['user_id', '=', $uid];
|
||||||
|
}else{
|
||||||
|
$m = [['user_id', '=', $uid], ['user_id', '=', 0]];
|
||||||
|
$query->where(function($q) use($m){
|
||||||
|
$q->whereOr($m);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if(!empty($subMap)){
|
if(!empty($subMap)){
|
||||||
$subsql = Db::name('users')->where($subMap)->field('uid')->buildSql();
|
$subsql = Db::name('users')->where($subMap)->field('uid')->buildSql();
|
||||||
$subsql = str_replace(" AS thinkphp) AS T1 )", "", $subsql);
|
$subsql = str_replace(" AS thinkphp) AS T1 )", "", $subsql);
|
||||||
$subsql = str_replace("SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (", "", $subsql);
|
$subsql = str_replace("SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (", "", $subsql);
|
||||||
$map[] = ['uid', 'IN', Db::raw($subsql)];
|
$map[] = ['user_id', 'IN', Db::raw($subsql)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query->where($where)->where($map);
|
if(!empty($map)){
|
||||||
|
$query->where($map);
|
||||||
|
}
|
||||||
|
if(!empty($where)){
|
||||||
|
$query->where($where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,67 +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\model\customer;
|
|
||||||
|
|
||||||
use app\model\BaseModel;
|
|
||||||
use think\model\concern\SoftDelete;
|
|
||||||
use think\facade\Cache;
|
|
||||||
|
|
||||||
class Company extends BaseModel{
|
|
||||||
|
|
||||||
use SoftDelete;
|
|
||||||
protected $deleteTime = 'delete_time';
|
|
||||||
protected $defaultSoftDelete = 0;
|
|
||||||
|
|
||||||
|
|
||||||
public $insertFieldAlis = [
|
|
||||||
'企业编号' => ['name' => 'org_code', 'table' => 'company'],
|
|
||||||
'公司名称' => ['name' => 'name', 'table' => 'company'],
|
|
||||||
'网址' => ['name' => 'web_site', 'table' => 'company'],
|
|
||||||
'一级行业' => ['name' => 'industry', 'table' => 'company'],
|
|
||||||
'二级行业' => ['name' => 'industry_sub', 'table' => 'company'],
|
|
||||||
'三级行业' => ['name' => 'industry_three', 'table' => 'company'],
|
|
||||||
'省份' => ['name' => 'province', 'table' => 'company'],
|
|
||||||
'城市' => ['name' => 'city', 'table' => 'company'],
|
|
||||||
'区县' => ['name' => 'area', 'table' => 'company'],
|
|
||||||
'年营业额' => ['name' => 'turnover_text', 'table' => 'company',],
|
|
||||||
'员工人数' => ['name' => 'staff_num_text', 'table' => 'company'],
|
|
||||||
'注册资金' => ['name' => 'reg_capital', 'table' => 'company'],
|
|
||||||
'资金类型' => ['name' => 'reg_capital_type', 'table' => 'company'],
|
|
||||||
'PC数量' => ['name' => 'pc_num_text', 'table' => 'company'],
|
|
||||||
'营收规模' => ['name' => 'turnover', 'table' => 'company'],
|
|
||||||
'社保人数' => ['name' => 'social_insurance', 'table' => 'company'],
|
|
||||||
'企业性质' => ['name' => 'company_type', 'table' => 'company'],
|
|
||||||
'是否上市' => ['name' => 'is_ipo_text', 'table' => 'company'],
|
|
||||||
'融资信息' => ['name' => 'finance_info', 'table' => 'company'],
|
|
||||||
'企业标签' => ['name' => 'tags', 'table' => 'company'],
|
|
||||||
'企业状态' => ['name' => 'status', 'table' => 'company'],
|
|
||||||
'成立时间' => ['name' => 'reg_date', 'table' => 'company'],
|
|
||||||
'注册地址' => ['name' => 'reg_address', 'table' => 'company'],
|
|
||||||
'联系人' => ['name' => 'name', 'table' => 'contact'],
|
|
||||||
'岗位' => ['name' => 'job','table' => 'contact'],
|
|
||||||
'固定电话' => ['name' => 'phone', 'table' => 'contact'],
|
|
||||||
'手机号码' => ['name' => 'mobile', 'table' => 'contact'],
|
|
||||||
'邮箱' => ['name' => 'email', 'table' => 'contact'],
|
|
||||||
'是否法人' => ['name' => 'is_faren', 'table' => 'contact']
|
|
||||||
];
|
|
||||||
|
|
||||||
public function getAreaTAttr($value, $data){
|
|
||||||
$text = [$data['province'], $data['city'], $data['area']];
|
|
||||||
return implode(",", array_filter($text));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIndustryTAttr($value, $data){
|
|
||||||
$text = [$data['industry'], $data['industry_sub'], $data['industry_three']];
|
|
||||||
return implode(",", array_filter($text));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function contact(){
|
|
||||||
return $this->hasMany(Contact::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
37
app/model/operate/Ads.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?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\model\operate;
|
||||||
|
|
||||||
|
use app\model\BaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
use think\facade\Cache;
|
||||||
|
|
||||||
|
class Ads extends BaseModel{
|
||||||
|
|
||||||
|
protected function getStatusTextAttr($value, $data){
|
||||||
|
$status = ['禁用', '启用'];
|
||||||
|
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhotoAttr($value, $data){
|
||||||
|
if($data['photo_list']){
|
||||||
|
if($data['type'] == 1){
|
||||||
|
return explode(",", $data['photo_list']);
|
||||||
|
}else{
|
||||||
|
return $data['photo_list'];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($data['type'] == 1){
|
||||||
|
return [];
|
||||||
|
}else{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app/model/operate/Client.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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\model\operate;
|
||||||
|
|
||||||
|
use app\model\BaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
use think\facade\Cache;
|
||||||
|
|
||||||
|
class Client extends BaseModel{
|
||||||
|
|
||||||
|
protected function getStatusTextAttr($value, $data){
|
||||||
|
$status = ['禁用', '启用'];
|
||||||
|
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setting(){
|
||||||
|
return $this->hasMany(ClientConfig::class, 'client_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
use think\facade\Route;
|
namespace app\model\operate;
|
||||||
|
|
||||||
Route::group('auth', function(){
|
use app\model\BaseModel;
|
||||||
Route::post('login', 'auth.Index/login');
|
use think\model\concern\SoftDelete;
|
||||||
Route::get('member', 'auth.Index/member');
|
use think\facade\Cache;
|
||||||
});
|
|
||||||
|
class ClientConfig extends BaseModel{
|
||||||
|
|
||||||
|
protected function getStatusTextAttr($value, $data){
|
||||||
|
$status = ['禁用', '启用'];
|
||||||
|
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,16 +6,16 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model\customer;
|
namespace app\model\operate;
|
||||||
|
|
||||||
use app\model\BaseModel;
|
use app\model\BaseModel;
|
||||||
use think\model\concern\SoftDelete;
|
use think\model\concern\SoftDelete;
|
||||||
|
use think\facade\Cache;
|
||||||
|
|
||||||
class Contact extends BaseModel{
|
class ClientMenu extends BaseModel{
|
||||||
|
|
||||||
use SoftDelete;
|
|
||||||
protected $deleteTime = 'delete_time';
|
|
||||||
protected $defaultSoftDelete = 0;
|
|
||||||
protected $name = "company_contact";
|
|
||||||
|
|
||||||
|
protected function getStatusTextAttr($value, $data){
|
||||||
|
$status = ['禁用', '启用'];
|
||||||
|
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,5 +16,4 @@ class Dictionary extends BaseModel{
|
|||||||
use SoftDelete;
|
use SoftDelete;
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
protected $defaultSoftDelete = 0;
|
protected $defaultSoftDelete = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
41
app/services/FieldService.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?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\services;
|
||||||
|
|
||||||
|
class FieldService{
|
||||||
|
|
||||||
|
public function getFields($model = 'student'){
|
||||||
|
if(method_exists(new self(), $model)){
|
||||||
|
return $this->$model();
|
||||||
|
}else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 学员导入字段
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function student(){
|
||||||
|
return ['学生姓名' => 'name', '性别' => 'sex', '电话' => 'mobile', '身份证号码' => 'id_card'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 题库导入字段
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exam(){
|
||||||
|
return [
|
||||||
|
'题目类型' => 'type_text', '题干' => 'title', '答案' => 'answer', '解析' => 'analysis',
|
||||||
|
'选项A' => 'A', '选项B' => 'B', '选项C' => 'C', '选项D' => 'D', '选项E' => 'E'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,11 +49,11 @@ class RoleService{
|
|||||||
}
|
}
|
||||||
$role = Roles::find($id);
|
$role = Roles::find($id);
|
||||||
// 删除权限
|
// 删除权限
|
||||||
PermissionAccess::where('role_id', '=', $role_id)->delete();
|
PermissionAccess::where('role_id', '=', $id)->delete();
|
||||||
// 删除部门关联
|
// 删除部门关联
|
||||||
// $role->detachDepartments();
|
// $role->detachDepartments();
|
||||||
// 删除用户关联
|
// 删除用户关联
|
||||||
RolesAccess::where('role_id', '=', $role_id)->delete();
|
RolesAccess::where('role_id', '=', $id)->delete();
|
||||||
// 删除
|
// 删除
|
||||||
$role->delete();
|
$role->delete();
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,7 @@ class RoleService{
|
|||||||
(new PermissionAccess())->saveAll($save);
|
(new PermissionAccess())->saveAll($save);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateRoleAuth($request){
|
public function updateRoleAuth($request){
|
||||||
$role_id = $request->param('role_id', '');
|
$role_id = $request->param('role_id', '');
|
||||||
$data_range = $request->param('data_range', '');
|
$data_range = $request->param('data_range', '');
|
||||||
@@ -87,6 +88,11 @@ class RoleService{
|
|||||||
return $role->save($save);
|
return $role->save($save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createRole($request){
|
||||||
|
$data = $request->param();
|
||||||
|
return Roles::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
public function updateRole($request){
|
public function updateRole($request){
|
||||||
$data = $request->param();
|
$data = $request->param();
|
||||||
return Roles::update($data);
|
return Roles::update($data);
|
||||||
|
|||||||
@@ -1,119 +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\services\company;
|
|
||||||
|
|
||||||
use app\model\customer\Company;
|
|
||||||
use app\model\customer\Contact;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented class
|
|
||||||
*/
|
|
||||||
class CompanyService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title 获取企业列表
|
|
||||||
*
|
|
||||||
* @param [type] $request
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getCompanyList($request) {
|
|
||||||
$param = $request->param();
|
|
||||||
$map = [];
|
|
||||||
if (isset($param['name']) && $param['name']) {
|
|
||||||
$map[] = ['name', 'LIKE', '%' . $param['name'] . '%'];
|
|
||||||
}
|
|
||||||
if (isset($param['org_code']) && $param['org_code']) {
|
|
||||||
$map[] = ['org_code', '=', $param['org_code']];
|
|
||||||
}
|
|
||||||
$list = Company::with(['contact'])->where($map)->order('id desc')->paginate($request->pageConfig);
|
|
||||||
return $list->append(['area_t', 'industry_t']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title 获取企业详情
|
|
||||||
*
|
|
||||||
* @param [type] $request
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getCompanyDetail($request) {
|
|
||||||
$param = $request->param();
|
|
||||||
if (!isset($param['id'])) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
$map = [];
|
|
||||||
$map[] = ['id', '=', $param['id']];
|
|
||||||
$data = Company::with(['contact'])->where($map)->find();
|
|
||||||
return $data->append(['area_t', 'industry_t']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title 导入数据
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function insertCompanyData($request) {
|
|
||||||
$data = $request->post('data');
|
|
||||||
$company = new Company();
|
|
||||||
$contactM = new Contact();
|
|
||||||
|
|
||||||
$resultData = [];
|
|
||||||
foreach ($data as $k => $item) {
|
|
||||||
$info = [];
|
|
||||||
if (!is_array($item)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach ($item as $key => $value) {
|
|
||||||
if (isset($company->insertFieldAlis[$key])) {
|
|
||||||
$info[$company->insertFieldAlis[$key]['table']][$company->insertFieldAlis[$key]['name']] = trim($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$info['company']['uid'] = $info['contact']['uid'] = request()->user['uid'];
|
|
||||||
|
|
||||||
if (isset($info['company']) && isset($info['company']['name'])) {
|
|
||||||
$customer = $company->where('name', '=', trim($info['company']['name']))->find();
|
|
||||||
$company_id = isset($customer['id']) ? $customer['id'] : 0;
|
|
||||||
if (!$company_id) {
|
|
||||||
$info['company']['turnover'] = '';
|
|
||||||
$info['company']['staff_num'] = '';
|
|
||||||
$info['company']['come_from'] = '';
|
|
||||||
$info['company']['company_type'] = '';
|
|
||||||
$info['company']['pc_count'] = '';
|
|
||||||
$customer = Company::create($info['company']);
|
|
||||||
$company_id = $customer->id;
|
|
||||||
} else {
|
|
||||||
$save_coustomer = $info['company'];
|
|
||||||
if (!empty($save_coustomer)) {
|
|
||||||
$save_coustomer['id'] = $company_id;
|
|
||||||
$result = $customer->save($save_coustomer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($info['contact']['name'])) {
|
|
||||||
$map = [];
|
|
||||||
$map[] = ['name', '=', $info['contact']['name']];
|
|
||||||
$map[] = ['mobile', '=', isset($info['contact']['mobile']) ? $info['contact']['mobile'] : ''];
|
|
||||||
$map[] = ['company_id', '=', $company_id];
|
|
||||||
$contact = $contactM->where($map)->find(); //每次查询重新实例化
|
|
||||||
$contact_id = isset($contact['id']) ? $contact['id'] : 0;
|
|
||||||
if (!$contact_id) {
|
|
||||||
$info['contact']['company_id'] = $company_id;
|
|
||||||
$res = Contact::create($info['contact']);
|
|
||||||
$contact_id = $res->id;
|
|
||||||
} else {
|
|
||||||
$info['contact']['id'] = $contact_id;
|
|
||||||
$contact->save($info['contact']);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$contact_id = 0;
|
|
||||||
}
|
|
||||||
$resultData[] = ['company_id' => $company_id, 'contact_id' => (int) $contact_id, 'company' => $info['company'], 'contact' => $info['contact']];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return empty($resultData) ? false : $resultData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
81
app/services/operate/AdsService.php
Normal 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\services\operate;
|
||||||
|
|
||||||
|
use app\model\operate\Ads;
|
||||||
|
|
||||||
|
class AdsService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDataList($request){
|
||||||
|
$param = $request->param();
|
||||||
|
$order = "id desc";
|
||||||
|
$map = [];
|
||||||
|
if(isset($param['title']) && $param['title'] != ''){
|
||||||
|
$map[] = ['title', 'LIKE', '%' . $param['title'] . '%'];
|
||||||
|
}
|
||||||
|
if(isset($param['name']) && $param['name'] != ''){
|
||||||
|
$map[] = ['name', '=', $param['name']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = Ads::where($map)->order($order)->append(['status_text', 'photo'])->paginate($request->pageConfig);
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 添加广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function create($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$data['user_id'] = $request->user['uid'];
|
||||||
|
return Ads::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 编辑广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$ads = Ads::find($data['id']);
|
||||||
|
return $ads->save($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 删除广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete($request){
|
||||||
|
$id = $request->post('id', 0);
|
||||||
|
if(!$id){
|
||||||
|
throw new \think\Exception("非法操作!", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ads::where('id', $id)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAdsDetail($request){
|
||||||
|
$name = $request->param('name', '');
|
||||||
|
return Ads::where('name', $name)->append(['photo'])->find();
|
||||||
|
}
|
||||||
|
}
|
||||||
75
app/services/operate/ClientConfigService.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?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\services\operate;
|
||||||
|
|
||||||
|
use app\model\operate\ClientConfig;
|
||||||
|
|
||||||
|
class ClientConfigService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDataList($request){
|
||||||
|
$param = $request->param();
|
||||||
|
$order = "id desc";
|
||||||
|
$map = [];
|
||||||
|
if(isset($param['title']) && $param['title'] != ''){
|
||||||
|
$map[] = ['title', 'LIKE', '%' . $param['title'] . '%'];
|
||||||
|
}
|
||||||
|
if(isset($param['name']) && $param['name'] != ''){
|
||||||
|
$map[] = ['name', '=', $param['name']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = ClientConfig::where($map)->order($order)->append(['status_text'])->paginate($request->pageConfig);
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 添加广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function create($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
return ClientConfig::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 编辑配置
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$config = ClientConfig::find($data['id']);
|
||||||
|
$config->save($data);
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 删除配置
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$config = ClientConfig::find($data['id']);
|
||||||
|
|
||||||
|
return $config->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
75
app/services/operate/ClientMenuService.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?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\services\operate;
|
||||||
|
|
||||||
|
use app\model\operate\ClientMenu;
|
||||||
|
|
||||||
|
class ClientMenuService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDataList($request){
|
||||||
|
$param = $request->param();
|
||||||
|
$order = "id desc";
|
||||||
|
$map = [];
|
||||||
|
if(isset($param['title']) && $param['title'] != ''){
|
||||||
|
$map[] = ['title', 'LIKE', '%' . $param['title'] . '%'];
|
||||||
|
}
|
||||||
|
if(isset($param['name']) && $param['name'] != ''){
|
||||||
|
$map[] = ['name', '=', $param['name']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = ClientMenu::where($map)->order($order)->append(['status_text'])->paginate($request->pageConfig);
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 添加广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function create($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$data['user_id'] = $request->user['uid'];
|
||||||
|
return ClientMenu::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 编辑广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$menu = ClientMenu::find($data['id']);
|
||||||
|
return $client->save($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 删除配置
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$menu = ClientMenu::find($data['id']);
|
||||||
|
|
||||||
|
return $menu->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
91
app/services/operate/ClientService.php
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?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\services\operate;
|
||||||
|
|
||||||
|
use app\model\operate\Client;
|
||||||
|
|
||||||
|
class ClientService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDataList($request){
|
||||||
|
$param = $request->param();
|
||||||
|
$order = "id desc";
|
||||||
|
$map = [];
|
||||||
|
if(isset($param['title']) && $param['title'] != ''){
|
||||||
|
$map[] = ['title', 'LIKE', '%' . $param['title'] . '%'];
|
||||||
|
}
|
||||||
|
if(isset($param['name']) && $param['name'] != ''){
|
||||||
|
$map[] = ['name', '=', $param['name']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = Client::with(['setting'])->where($map)->order($order)->append(['status_text'])->paginate($request->pageConfig);
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 添加广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function create($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$data['user_id'] = $request->user['uid'];
|
||||||
|
return Client::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 编辑广告
|
||||||
|
*
|
||||||
|
* @param [type] $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update($request){
|
||||||
|
$data = $request->param();
|
||||||
|
|
||||||
|
$client = Client::find($data['id']);
|
||||||
|
return $client->save($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientMenu($request){
|
||||||
|
$param = $request->param();
|
||||||
|
|
||||||
|
$list = [];
|
||||||
|
if(isset($param['type'])){
|
||||||
|
if($param['type'] == 'home'){
|
||||||
|
$list = [
|
||||||
|
['title' => '常考题', 'image' => request()->static() . 'images/icon/5.jpg', 'url' => '/pages/exam/index/index'],
|
||||||
|
['title' => '模拟考', 'image' => request()->static() . 'images/icon/6.jpg', 'url' => '/pages/exam/index/index'],
|
||||||
|
['title' => '题库练习', 'image' => request()->static() . 'images/icon/7.jpg', 'url' => '/pages/exam/index/index'],
|
||||||
|
['title' => '易错题', 'image' => request()->static() . 'images/icon/8.jpg', 'url' => '/pages/exam/index/index'],
|
||||||
|
['title' => '我的错题', 'image' => request()->static() . 'images/icon/10.png', 'url' => '/pages/exam/my/index', 'desc' => '巩固错题,轻轻松松过考'],
|
||||||
|
['title' => '我的收藏', 'image' => request()->static() . 'images/icon/9.png', 'url' => '/pages/exam/my/index', 'desc' => '您收藏的题目,都在这里'],
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
$list = [
|
||||||
|
['title' => '我的资料', 'icon' => 'profile', 'iconColor' => 'green', 'url' => '/pages/ucenter/profile/index'],
|
||||||
|
['title' => '我的报名', 'icon' => 'edit', 'iconColor' => 'green', 'url' => '/pages/ucenter/enter/index'],
|
||||||
|
['title' => '我的记录', 'icon' => 'list', 'iconColor' => 'green', 'url' => '/pages/ucenter/exam/index'],
|
||||||
|
['title' => '我的订单', 'icon' => 'shop', 'iconColor' => 'green', 'url' => '/pages/ucenter/order/index'],
|
||||||
|
['title' => '邀请推广', 'icon' => 'qrcode', 'iconColor' => 'green', 'url' => '/pages/ucenter/invite/index'],
|
||||||
|
['title' => '关于我们', 'icon' => 'info', 'iconColor' => 'green', 'url' => '/pages/ucenter/about/index'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,20 @@ class DictionaryService{
|
|||||||
$list = Dictionary::where($map)->order('id desc')->paginate($request->pageConfig);
|
$list = Dictionary::where($map)->order('id desc')->paginate($request->pageConfig);
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 所有字典数据
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDictionaryAll(){
|
||||||
|
$list = Dictionary::where([])->select();
|
||||||
|
$data = [];
|
||||||
|
foreach($list as $value){
|
||||||
|
$data[$value['dic_type']][] = $value->toArray();
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @title 获取字典明细
|
* @title 获取字典明细
|
||||||
*
|
*
|
||||||
|
|||||||
60
app/services/wechat/OauthService.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?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\services\wechat;
|
||||||
|
|
||||||
|
use EasyWeChat\Factory;
|
||||||
|
use think\facade\Config;
|
||||||
|
use app\model\student\Student;
|
||||||
|
use app\model\student\Wechat;
|
||||||
|
|
||||||
|
class OauthService{
|
||||||
|
|
||||||
|
public function oauth($request){
|
||||||
|
$code = $request->post('code');
|
||||||
|
$config = Config::get('wechat.miniapp');
|
||||||
|
|
||||||
|
$app = Factory::miniProgram($config);
|
||||||
|
try {
|
||||||
|
//获取openid
|
||||||
|
$session_code = $app->auth->session($code);
|
||||||
|
|
||||||
|
$wechat = Wechat::where('openid', '=', $session_code['openid'])->findOrEmpty();
|
||||||
|
if($wechat->isEmpty()){
|
||||||
|
$userInfo = $app->encryptor->decryptData($session_code['session_key'], $request->post('iv'), $request->post('encrypted'));
|
||||||
|
$data = [
|
||||||
|
'headimgurl' => $userInfo['avatarUrl'],
|
||||||
|
'nickname' => $userInfo['nickName'],
|
||||||
|
'openid'=> $userInfo['openId'],
|
||||||
|
'sex' => $userInfo['gender'],
|
||||||
|
'city' => $userInfo['city'],
|
||||||
|
'country' => $userInfo['country'],
|
||||||
|
'province' => $userInfo['province'],
|
||||||
|
'language' => $userInfo['language']
|
||||||
|
];
|
||||||
|
$wechat = Wechat::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($wechat['uid'] > 0){
|
||||||
|
$wechat['users'] = Student::with(['enter'])->visible(['name', 'mobile', 'sex', 'address', 'id', 'id_card', 'invite_id', 'exam_num', 'incorrect_num', 'point'])->find($wechat['uid'])->append(['token']);
|
||||||
|
}
|
||||||
|
return $wechat;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \think\Exception($e->getMessage(), 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQrCode($request){
|
||||||
|
$config = Config::get('wechat.miniapp');
|
||||||
|
|
||||||
|
$app = Factory::miniProgram($config);
|
||||||
|
|
||||||
|
$res = $app->url_link->generate([]);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,13 +13,14 @@ use think\Validate;
|
|||||||
class File extends Validate{
|
class File extends Validate{
|
||||||
|
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'avatar' => 'fileSize:102400|fileExt:jpg,png',
|
'avatar' => 'fileSize:1048576|fileExt:jpg,png',
|
||||||
'image' => 'fileSize:204800|fileExt:jpg,jpeg,png,webp',
|
'image' => 'fileSize:1048576 * 2|fileExt:jpg,jpeg,png,webp',
|
||||||
'file' => 'fileSize:1024 * 1000|fileExt:doc,xls,zip,rar'
|
'file' => 'fileSize:1048576 * 5|fileExt:doc,xls,zip,rar'
|
||||||
];
|
];
|
||||||
protected $message = [
|
protected $message = [
|
||||||
'avatar.fileSize' => '图片不大于1M',
|
'avatar.fileSize' => '图片不大于1M',
|
||||||
'avatar.fileExt' => '头像后缀不正确',
|
'avatar.fileExt' => '头像后缀不正确',
|
||||||
'avatar.image' => '头像尺寸不正确',
|
'avatar.image' => '头像尺寸不正确',
|
||||||
|
'image.fileSize' => '图片大小超过允许上传大小'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\validate\auth;
|
namespace app\validate\admin\auth;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
class Index extends Validate{
|
class Index extends Validate{
|
||||||
|
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'username' => 'require:id',
|
'username' => 'require',
|
||||||
'password' => 'require'
|
'password' => 'require'
|
||||||
];
|
];
|
||||||
protected $message = [
|
protected $message = [
|
||||||
'password.require' => '登录密码必须',
|
'password.require' => '登录密码必须',
|
||||||
'username.require' => '登录用户名必须'
|
'username.require' => '登录用户名必须'
|
||||||
];
|
];
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'login' => ['username', 'password'],
|
'login' => ['username', 'password'],
|
||||||
'resetpasswd' => ['username', 'password']
|
'resetpasswd' => ['username', 'password']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\validate\auth;
|
namespace app\validate\admin\auth;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
30
app/validate/api/student/Enter.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?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\validate\api\student;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class Enter extends Validate{
|
||||||
|
|
||||||
|
protected $rule = [
|
||||||
|
'category_id' => 'require',
|
||||||
|
'id_card' => 'require|idCard',
|
||||||
|
'mobile' => 'require|mobile'
|
||||||
|
];
|
||||||
|
protected $message = [
|
||||||
|
'category_id.require' => '科目必选',
|
||||||
|
'id_card.require' => '身份证号码必填',
|
||||||
|
'id_card.idCard' => '身份证号码格式错误',
|
||||||
|
'mobile.require' => '手机号码必填',
|
||||||
|
'mobile.mobile' => '手机号码格式错误'
|
||||||
|
];
|
||||||
|
protected $scene = [
|
||||||
|
'add' => ['category_id', 'id_card']
|
||||||
|
];
|
||||||
|
}
|
||||||
36
app/validate/api/student/Login.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?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\validate\api\student;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class Login extends Validate{
|
||||||
|
|
||||||
|
protected $rule = [
|
||||||
|
'name' => 'require|chsAlpha',
|
||||||
|
'mobile' => 'require|mobile|unique:student',
|
||||||
|
'password' => 'require',
|
||||||
|
'repassword'=>'require|confirm:password'
|
||||||
|
];
|
||||||
|
protected $message = [
|
||||||
|
'password.require' => '登录密码必须',
|
||||||
|
'mobile.require' => '手机号码必须',
|
||||||
|
'mobile.mobile' => '手机号码不正确',
|
||||||
|
'mobile.unique' => '当前手机号码已注册',
|
||||||
|
'name.require' => '姓名必须',
|
||||||
|
'name.chsAlpha' => '姓名格式不正确',
|
||||||
|
'repassword.require' => '确认密码必须',
|
||||||
|
'repassword.confirm' => '两次密码输入不同'
|
||||||
|
];
|
||||||
|
protected $scene = [
|
||||||
|
'login' => ['name', 'mobile', 'password'],
|
||||||
|
'register' => ['name', 'mobile', 'password', 'repassword'],
|
||||||
|
'resetpasswd' => ['name', 'password']
|
||||||
|
];
|
||||||
|
}
|
||||||
31
route/admin.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
use think\facade\Route;
|
||||||
|
|
||||||
|
Route::rule('/', 'Index/index');
|
||||||
|
Route::rule('test', 'Index/test');
|
||||||
|
|
||||||
|
Route::group('/admin', function(){
|
||||||
|
Route::rule('auth/user/:action', 'admin.auth.User/:action');
|
||||||
|
Route::rule('auth/department/:action', 'admin.auth.Department/:action');
|
||||||
|
Route::rule('auth/role/:action', 'admin.auth.Role/:action');
|
||||||
|
Route::rule('system/:controller/:action', 'admin.system.:controller/:action');
|
||||||
|
Route::rule('student/:controller/:action', 'admin.student.:controller/:action');
|
||||||
|
Route::rule('exam/:controller/:action', 'admin.exam.:controller/:action');
|
||||||
|
Route::rule('point/:controller/:action', 'admin.point.:controller/:action');
|
||||||
|
Route::rule('operate/:controller/:action', 'admin.operate.:controller/:action');
|
||||||
|
})->middleware(['Api', 'Auth']);
|
||||||
|
|
||||||
|
Route::group('admin/auth', function(){
|
||||||
|
Route::post('login', 'admin.auth.Index/login');
|
||||||
|
})->middleware(['Api']);
|
||||||
|
|
||||||
|
Route::miss('index/miss');
|
||||||
17
route/api.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
use think\facade\Route;
|
||||||
|
|
||||||
|
Route::group('/api', function(){
|
||||||
|
Route::rule('operate/:controller/:action', 'api.operate.:controller/:action')->middleware(['ApiAuth']);
|
||||||
|
})->middleware(['Api']);
|
||||||
|
|
||||||
|
Route::miss('index/miss');
|
||||||
@@ -10,15 +10,4 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
Route::rule('/', 'Index/index');
|
Route::rule('template', 'index/template');
|
||||||
Route::rule('test', 'Index/test');
|
|
||||||
|
|
||||||
Route::group('/', function(){
|
|
||||||
Route::rule('system/:controller/:action', 'system.:controller/:action');
|
|
||||||
Route::rule('auth/user/:action', 'auth.User/:action');
|
|
||||||
Route::rule('auth/department/:action', 'auth.Department/:action');
|
|
||||||
Route::rule('auth/role/:action', 'auth.Role/:action');
|
|
||||||
Route::rule('customer/company/:action', 'customer.Company/:action');
|
|
||||||
})->middleware([\app\middleware\Check::class], 'api');
|
|
||||||
|
|
||||||
Route::miss('index/miss');
|
|
||||||
32
ui/.gitignore
vendored
@@ -1,24 +1,10 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
out/
|
||||||
|
logs/
|
||||||
# local env files
|
run/
|
||||||
.env.local
|
.idea/
|
||||||
.env.*.local
|
package-lock.json
|
||||||
|
data/
|
||||||
# Log files
|
.vscode/launch.json
|
||||||
npm-debug.log*
|
public/electron/
|
||||||
yarn-debug.log*
|
pnpm-lock.yaml
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
|
|
||||||
/package-lock.json
|
|
||||||
24
ui/frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
/package-lock.json
|
||||||
74
ui/frontend/package.json
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"name": "scui",
|
||||||
|
"version": "1.6.6",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build --report",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@element-plus/icons-vue": "2.0.6",
|
||||||
|
"@tinymce/tinymce-vue": "5.0.0",
|
||||||
|
"axios": "0.27.2",
|
||||||
|
"codemirror": "5.65.5",
|
||||||
|
"core-js": "3.24.1",
|
||||||
|
"cropperjs": "1.5.12",
|
||||||
|
"crypto-js": "4.1.1",
|
||||||
|
"echarts": "5.3.3",
|
||||||
|
"element-plus": "2.2.12",
|
||||||
|
"nprogress": "0.2.0",
|
||||||
|
"qrcodejs2": "0.0.2",
|
||||||
|
"sortablejs": "1.15.0",
|
||||||
|
"tinymce": "6.1.2",
|
||||||
|
"vue": "3.2.37",
|
||||||
|
"vue-i18n": "9.2.2",
|
||||||
|
"vue-router": "4.1.3",
|
||||||
|
"vuedraggable": "4.0.3",
|
||||||
|
"vuex": "4.0.2",
|
||||||
|
"xgplayer": "2.31.7",
|
||||||
|
"xgplayer-hls": "2.5.2",
|
||||||
|
"xlsx": "^0.18.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "7.18.9",
|
||||||
|
"@babel/eslint-parser": "7.18.9",
|
||||||
|
"@vue/cli-plugin-babel": "5.0.8",
|
||||||
|
"@vue/cli-plugin-eslint": "5.0.8",
|
||||||
|
"@vue/cli-service": "5.0.8",
|
||||||
|
"eslint": "8.21.0",
|
||||||
|
"eslint-plugin-vue": "9.3.0",
|
||||||
|
"sass": "1.37.5",
|
||||||
|
"sass-loader": "10.1.1"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"APP_CONFIG": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:vue/vue3-essential",
|
||||||
|
"eslint:recommended"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "@babel/eslint-parser",
|
||||||
|
"requireConfigFile": false
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": 0,
|
||||||
|
"no-tabs": 0,
|
||||||
|
"no-mixed-spaces-and-tabs": 0,
|
||||||
|
"vue/no-unused-components": 0,
|
||||||
|
"vue/multi-word-component-names": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not dead",
|
||||||
|
"not ie 11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 509 KiB After Width: | Height: | Size: 509 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |