From 869b65d6057cf1fc1c9f22cd2b7ce2b829309565 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Sun, 10 Jun 2018 15:16:57 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E6=96=B0=E5=A2=9E=E5=88=B7=E6=96=B0?= =?UTF-8?q?AppSecret=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/App.php | 18 ++++++++++++++++++ application/adminRoute.php | 8 ++++++-- data/apiadmin_3.0.8.sql | 17 ++++++++++++----- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/application/admin/controller/App.php b/application/admin/controller/App.php index 7669009..7afbefc 100644 --- a/application/admin/controller/App.php +++ b/application/admin/controller/App.php @@ -80,6 +80,24 @@ class App extends Base { return $this->buildSuccess($res); } + /** + * 刷新APPSecret + * @author zhaoxiang + * @return array + */ + public function refreshAppSecret() { + $id = $this->request->get('id', 0); + $data['app_secret'] = Strs::randString(32); + if ($id) { + $res = AdminApp::update($data, ['id' => $id]); + if ($res === false) { + return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败'); + } + } + + return $this->buildSuccess($data); + } + /** * 新增应用 * @return array diff --git a/application/adminRoute.php b/application/adminRoute.php index 38140cd..4f708b3 100644 --- a/application/adminRoute.php +++ b/application/adminRoute.php @@ -51,7 +51,7 @@ Route::group('admin',function(){ 'del' =>[ 'admin/Menu/del', ['method' => 'get'] - ] + ] ]); Route::group('User',[ 'index'=> [ @@ -122,6 +122,10 @@ Route::group('admin',function(){ 'admin/App/index', ['method' => 'get'] ], + 'refreshAppSecret'=> [ + 'admin/App/refreshAppSecret', + ['method' => 'get'] + ], 'changeStatus' =>[ 'admin/App/changeStatus', ['method' => 'get'] @@ -267,4 +271,4 @@ Route::group('admin',function(){ ]); Route::miss('admin/Miss/index'); },['after_behavior' => $afterBehavior] -); \ No newline at end of file +); diff --git a/data/apiadmin_3.0.8.sql b/data/apiadmin_3.0.8.sql index fa9c62d..eb6ee43 100644 --- a/data/apiadmin_3.0.8.sql +++ b/data/apiadmin_3.0.8.sql @@ -6,8 +6,8 @@ # https://github.com/sequelpro/sequelpro # # Host: 127.0.0.1 (MySQL 5.5.5-10.2.12-MariaDB) -# Database: demo -# Generation Time: 2018-04-11 01:21:30 +0000 +# Database: apiadmin_new +# Generation Time: 2018-06-10 07:00:01 +0000 # ************************************************************ @@ -144,9 +144,15 @@ CREATE TABLE `admin_group` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接口组管理'; +LOCK TABLES `admin_group` WRITE; +/*!40000 ALTER TABLE `admin_group` DISABLE KEYS */; + INSERT INTO `admin_group` (`id`, `name`, `description`, `status`, `hash`, `addTime`, `updateTime`, `image`, `hot`) VALUES - (1, '默认分组', '默认分组', 1, 'default', 0, 0, NULL, 0); + (1,'默认分组','默认分组',1,'default',0,0,'',0); + +/*!40000 ALTER TABLE `admin_group` ENABLE KEYS */; +UNLOCK TABLES; # Dump of table admin_list @@ -261,7 +267,8 @@ VALUES (64,'删除单条日志记录',62,'admin/Log/del',0,0,0,'',0), (65,'刷新路由',31,'admin/InterfaceList/refresh',0,0,0,'',0), (67,'文件上传',0,'admin/Index/upload',0,0,0,'',0), - (68,'更新个人信息',9,'admin/User/own',0,0,0,'',0); + (68,'更新个人信息',9,'admin/User/own',0,0,0,'',0), + (69,'刷新AppSecret',24,'admin/App/refreshAppSecret',0,0,0,'',0); /*!40000 ALTER TABLE `admin_menu` ENABLE KEYS */; UNLOCK TABLES; @@ -290,7 +297,7 @@ LOCK TABLES `admin_user` WRITE; INSERT INTO `admin_user` (`id`, `username`, `nickname`, `password`, `regTime`, `regIp`, `updateTime`, `status`, `openId`) VALUES - (1,'root','root','912601e4ad1b308c9ae41877cf6ca754',1519453594,3663623043,1520173599,1,NULL); + (1,'root','root','912601e4ad1b308c9ae41877cf6ca754',1519453594,3663623043,1524152828,1,NULL); /*!40000 ALTER TABLE `admin_user` ENABLE KEYS */; UNLOCK TABLES;