modified 新增刷新AppSecret的功能

This commit is contained in:
zhaoxiang 2018-06-10 15:16:57 +08:00
parent d0f5772cb9
commit 869b65d605
3 changed files with 36 additions and 7 deletions

View File

@ -80,6 +80,24 @@ class App extends Base {
return $this->buildSuccess($res);
}
/**
* 刷新APPSecret
* @author zhaoxiang <zhaoxiang051405@gmail.com>
* @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

View File

@ -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]
);
);

View File

@ -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;