mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-25 05:50:19 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85fce8f01e | ||
|
|
7475bc56c9 | ||
|
|
7af2dffb7a | ||
|
|
15f2d149df | ||
|
|
c09924dbdc | ||
|
|
b45afe9669 | ||
|
|
1e85e03713 | ||
|
|
43eef673bc | ||
|
|
41ce276dbd | ||
|
|
d6e078f3d6 | ||
|
|
4c2f43b4cf | ||
|
|
9bbcb62505 | ||
|
|
ef03c95f40 | ||
|
|
eb7a6411d1 | ||
|
|
e02e70ff26 | ||
|
|
b6843e04d5 | ||
|
|
5e4c82b94a | ||
|
|
1f411ec6e0 | ||
|
|
a890bd2d38 | ||
|
|
7a47f59945 | ||
|
|
830c2cf29b | ||
|
|
86593943d3 | ||
|
|
7c188fa7ce | ||
|
|
a9432b5d9c | ||
|
|
0bebb7f65b | ||
|
|
6536caed75 | ||
|
|
bf6f469dad | ||
|
|
68677e1b5b | ||
|
|
8392398b1c | ||
|
|
b4355b4399 | ||
|
|
81e0e4dde7 | ||
|
|
fba9ab0ae6 | ||
|
|
e18518b4d3 | ||
|
|
074a7145d2 | ||
|
|
46372f0e6c | ||
|
|
1acd2e3238 | ||
|
|
a2e7827aa8 | ||
|
|
ac71aafe83 | ||
|
|
0b1cc913d9 | ||
|
|
84b967ae82 | ||
|
|
cf9002a377 | ||
|
|
829fa4dac5 | ||
|
|
5529d5f46d | ||
|
|
08e9c6b38a | ||
|
|
5c94c73004 | ||
|
|
8ebb1fda77 | ||
|
|
96380bd031 | ||
|
|
c342e63e63 | ||
|
|
4fa43c232d | ||
|
|
d07cbc8783 | ||
|
|
f7667ad3e1 | ||
|
|
5fe66b7abc | ||
|
|
856c09c38d | ||
|
|
b947f043ee | ||
|
|
ebd515f057 | ||
|
|
636faaf93b | ||
|
|
ed1c6c7a47 | ||
|
|
e4340641ad | ||
|
|
35738cfda8 | ||
|
|
e749adaa10 | ||
|
|
26a1a89d60 | ||
|
|
2daa65f00d | ||
|
|
d2579d390c | ||
|
|
261e34a5c2 | ||
|
|
b4bad21e35 | ||
|
|
699f53e8b2 | ||
|
|
820c9f733f | ||
|
|
99bd217080 | ||
|
|
c86c05f380 | ||
|
|
544901bf45 | ||
|
|
8db0e2fb06 | ||
|
|
c5ed47192e | ||
|
|
3d56cb7eb2 | ||
|
|
ada8818960 | ||
|
|
2f97f4b979 | ||
|
|
0a4e81138a | ||
|
|
c61350643a | ||
|
|
9f59275652 | ||
|
|
1da644b96a | ||
|
|
1de825ee43 | ||
|
|
2e18f3f5e1 | ||
|
|
653f73b989 | ||
|
|
9c5b9729d8 | ||
|
|
6950e493f2 | ||
|
|
286f0b74da | ||
|
|
a1191abc43 | ||
|
|
75799b81e8 | ||
|
|
511a187f49 | ||
|
|
01ecfcdf8d | ||
|
|
14a55fcb83 | ||
|
|
49c146b3dc | ||
|
|
e2c5988bea | ||
|
|
3d2e9ef063 | ||
|
|
28c7d178c4 | ||
|
|
024f461e94 | ||
|
|
a25823f5b5 | ||
|
|
4d4d8e4955 | ||
|
|
7488db81c1 | ||
|
|
e8c6d388f2 | ||
|
|
10d8d7f28a | ||
|
|
986406a880 | ||
|
|
2946c8ce34 | ||
|
|
fef12cb747 | ||
|
|
4d8d4b77c1 | ||
|
|
7cb172d60a | ||
|
|
970b2d21a9 | ||
|
|
f7804b627e | ||
|
|
a7bb4a7ac4 | ||
|
|
06c67c1024 | ||
|
|
03024f192a | ||
|
|
b1baccf0a5 | ||
|
|
ad047f4c06 | ||
|
|
6f589d7af9 | ||
|
|
eeaaa40259 | ||
|
|
45cc0aec93 | ||
|
|
0bd80ad900 | ||
|
|
1214241dab | ||
|
|
6a03008ac9 | ||
|
|
cc215d6ad0 | ||
|
|
e28217e5ec | ||
|
|
0d8edbbb64 | ||
|
|
2baf392129 | ||
|
|
d478246edc | ||
|
|
ea375a026d | ||
|
|
9101d5bdb8 | ||
|
|
811df12524 | ||
|
|
3ee469aef3 | ||
|
|
7b503337b1 | ||
|
|
dd65a4a716 | ||
|
|
45f2bd4a15 | ||
|
|
1848ceb8f7 | ||
|
|
938c598cfb | ||
|
|
bea9ede941 | ||
|
|
6c4b217b1b | ||
|
|
f1de3e6b84 | ||
|
|
6cc9a420bf | ||
|
|
5b1eb546fd | ||
|
|
3c9d81756b | ||
|
|
51b6c1086e | ||
|
|
63012b31ac | ||
|
|
f5c6f95b27 | ||
|
|
b7fd730c5e | ||
|
|
3df918ef00 | ||
|
|
a200c2ebe0 | ||
|
|
a471bae727 | ||
|
|
9f73219c85 | ||
|
|
5a474585b5 | ||
|
|
c48048bd32 | ||
|
|
8fd8296c69 | ||
|
|
130910308d | ||
|
|
56cc369a77 | ||
|
|
8aee3b27af | ||
|
|
63edd741ba | ||
|
|
d7007eec59 | ||
|
|
277a732df0 | ||
|
|
a4b15b4731 | ||
|
|
07c6bbd7e1 | ||
|
|
ad504a17e0 | ||
|
|
d16ca6967f | ||
|
|
785fde0eaf | ||
|
|
af761f7472 | ||
|
|
5235511041 | ||
|
|
272f6c7b39 | ||
|
|
22bc9f43bd | ||
|
|
c2747590e0 | ||
|
|
794f8a631c | ||
|
|
04c0071b83 | ||
|
|
e5de639757 | ||
|
|
553980cf73 | ||
|
|
ff7390f1e6 | ||
|
|
4927f414f7 | ||
|
|
329d3fc622 | ||
|
|
1b6d80dfe9 | ||
|
|
dd45558e6a | ||
|
|
dc273edf3c | ||
|
|
621069eee7 | ||
|
|
a385d41cc3 | ||
|
|
9e6414fcb1 | ||
|
|
f6a3c65129 | ||
|
|
d930a9e95a | ||
|
|
3dea48b54e | ||
|
|
f1c00c6b20 | ||
|
|
099ff42404 | ||
|
|
f8e1832172 | ||
|
|
9e19684d40 | ||
|
|
56c226919e | ||
|
|
c6d6180c3c | ||
|
|
9265397f29 | ||
|
|
7aea8d71aa | ||
|
|
40f8ab6101 | ||
|
|
d7f490a0e8 | ||
|
|
01a5b859a9 | ||
|
|
bafe18f6e1 | ||
|
|
cd310eac17 | ||
|
|
cbdf1cd92e | ||
|
|
759dd34c76 | ||
|
|
3fbb2ab0ca | ||
|
|
ad107aadf1 | ||
|
|
e6e0f1d5db | ||
|
|
d3dfdace9f | ||
|
|
88abbc26d1 | ||
|
|
095b2ff27e | ||
|
|
28f03c3d7e | ||
|
|
3db0cedf7e | ||
|
|
11fdd96352 | ||
|
|
b6dfb393a1 | ||
|
|
268af2e84e | ||
|
|
225ef0fc8d | ||
|
|
d382d15f78 | ||
|
|
0833c09e98 | ||
|
|
3e62007e6a | ||
|
|
d5550bf99c | ||
|
|
1bdf0cb2ea | ||
|
|
e3ccccd1f3 | ||
|
|
ecfc8cd1e7 | ||
|
|
ba0bcefec4 | ||
|
|
35d0ab10a9 | ||
|
|
d9db6c1b36 |
@@ -1,728 +0,0 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : pandora
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50640
|
||||
Source Host : localhost:3306
|
||||
Source Schema : qmplus
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50640
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 31/08/2020 23:00:11
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for casbin_rule
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `casbin_rule`;
|
||||
CREATE TABLE `casbin_rule` (
|
||||
`p_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v0` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v1` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v3` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v4` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`v5` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of casbin_rule
|
||||
-- ----------------------------
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/login', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/register', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/createApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getApiList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getApiById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/updateCasbin', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/customer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/customer', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/customer', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/customer', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/customerList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/base/login', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/base/register', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/createApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getApiList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getApiById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/updateCasbin', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/customer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/customer', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/customer', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/customer', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/customerList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/autoCode/createTemp', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/base/login', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/base/register', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/createApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getApiList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getApiById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/updateAuthority', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/copyAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/deleteUser', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/setUserInfo', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/updateCasbin', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customerList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/createTemp', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/getTables', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/getDB', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/getColume', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionaryDetail/createSysDictionaryDetail', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionaryDetail/deleteSysDictionaryDetail', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionaryDetail/updateSysDictionaryDetail', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionaryDetail/findSysDictionaryDetail', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionaryDetail/getSysDictionaryDetailList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionary/createSysDictionary', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionary/deleteSysDictionary', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionary/updateSysDictionary', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionary/findSysDictionary', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysDictionary/getSysDictionaryList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/createSysOperationRecord', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/deleteSysOperationRecord', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/updateSysOperationRecord', 'PUT', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/findSysOperationRecord', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/getSysOperationRecordList', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/sysOperationRecord/deleteSysOperationRecordByIds', 'DELETE', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/simpleUploader/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/simpleUploader/checkFileMd5', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/simpleUploader/mergeFileMd5', 'GET', '', '', '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for exa_customers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `exa_customers`;
|
||||
CREATE TABLE `exa_customers` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '客户名',
|
||||
`customer_phone_data` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '客户电话',
|
||||
`sys_user_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '负责员工id',
|
||||
`sys_user_authority_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '负责员工角色',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_exa_customers_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of exa_customers
|
||||
-- ----------------------------
|
||||
INSERT INTO `exa_customers` VALUES (1, '2020-02-25 18:01:48', '2020-04-10 12:29:29', NULL, '测试客户', '1761111111', 10, '888');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for exa_file_chunks
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `exa_file_chunks`;
|
||||
CREATE TABLE `exa_file_chunks` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`exa_file_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '文件id',
|
||||
`file_chunk_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '切片路径',
|
||||
`file_chunk_number` int(11) NULL DEFAULT NULL COMMENT '切片标号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_exa_file_chunks_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for exa_file_upload_and_downloads
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `exa_file_upload_and_downloads`;
|
||||
CREATE TABLE `exa_file_upload_and_downloads` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件名',
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件URL',
|
||||
`tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件类型',
|
||||
`key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '标记',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE,
|
||||
INDEX `idx_exa_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of exa_file_upload_and_downloads
|
||||
-- ----------------------------
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (17, '2020-04-26 11:51:39', '2020-04-26 11:51:39', NULL, '10.png', 'http://qmplusimg.henrongyi.top/gvalogo.png', 'png', '158787308910.png');
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (19, '2020-04-27 15:48:38', '2020-04-27 15:48:38', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1576554439myAvatar.png', 'png', '1587973709logo.png');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for exa_files
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `exa_files`;
|
||||
CREATE TABLE `exa_files` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件名',
|
||||
`file_md5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件md5',
|
||||
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件路径',
|
||||
`chunk_total` int(11) NULL DEFAULT NULL COMMENT '切片总数',
|
||||
`is_finish` tinyint(1) NULL DEFAULT NULL COMMENT '是否完整',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_exa_files_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for exa_simple_uploaders
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `exa_simple_uploaders`;
|
||||
CREATE TABLE `exa_simple_uploaders` (
|
||||
`chunk_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '当前切片标记',
|
||||
`current_chunk_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '当前切片容量',
|
||||
`current_chunk_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '切片本地路径',
|
||||
`total_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '总容量',
|
||||
`identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件标识(md5)',
|
||||
`filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件名',
|
||||
`total_chunks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '切片总数',
|
||||
`is_done` tinyint(1) NULL DEFAULT NULL COMMENT '是否上传完成',
|
||||
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '文件本地路径'
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of exa_simple_uploaders
|
||||
-- ----------------------------
|
||||
INSERT INTO `exa_simple_uploaders` VALUES ('', '', '', '', '031d02b42ad9135daa052a56ad47a26a', 'consul.exe', '', 1, './finish/consul.exe');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for jwt_blacklists
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `jwt_blacklists`;
|
||||
CREATE TABLE `jwt_blacklists` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`jwt` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'jwt',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_jwt_blacklists_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_apis
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_apis`;
|
||||
CREATE TABLE `sys_apis` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`authority_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '角色id',
|
||||
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '路由path',
|
||||
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '路由描述',
|
||||
`api_group` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '路由分组',
|
||||
`method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT 'POST' COMMENT '请求方法',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE,
|
||||
INDEX `idx_sys_apis_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 104 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_apis
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_apis` VALUES (1, '2019-09-28 11:23:49', '2019-09-28 17:06:16', NULL, NULL, '/base/login', '用户登录', 'base', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (2, '2019-09-28 11:32:46', '2019-09-28 17:06:11', NULL, NULL, '/base/register', '用户注册', 'base', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (3, '2019-09-28 11:33:41', '2020-05-10 16:33:48', NULL, NULL, '/api/createApi', '创建api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (4, '2019-09-28 14:09:04', '2019-09-28 17:05:59', NULL, NULL, '/api/getApiList', '获取api列表', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (5, '2019-09-28 14:15:50', '2019-09-28 17:05:53', NULL, NULL, '/api/getApiById', '获取api详细信息', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (7, '2019-09-28 14:19:26', '2019-09-28 17:05:44', NULL, NULL, '/api/deleteApi', '删除Api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (8, '2019-09-28 14:19:48', '2019-09-28 17:05:39', NULL, NULL, '/api/updateApi', '更新Api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (10, '2019-09-30 15:05:38', '2019-09-30 15:05:38', NULL, NULL, '/api/getAllApis', '获取所有api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (11, '2019-09-30 15:23:09', '2019-09-30 15:23:09', NULL, NULL, '/authority/createAuthority', '创建角色', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (12, '2019-09-30 15:23:33', '2019-09-30 15:23:33', NULL, NULL, '/authority/deleteAuthority', '删除角色', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (13, '2019-09-30 15:23:57', '2019-09-30 15:23:57', NULL, NULL, '/authority/getAuthorityList', '获取角色列表', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (14, '2019-09-30 15:24:20', '2019-09-30 15:24:20', NULL, NULL, '/menu/getMenu', '获取菜单树', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (15, '2019-09-30 15:24:50', '2019-09-30 15:24:50', NULL, NULL, '/menu/getMenuList', '分页获取基础menu列表', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (16, '2019-09-30 15:25:07', '2019-09-30 15:25:07', NULL, NULL, '/menu/addBaseMenu', '新增菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (17, '2019-09-30 15:25:25', '2019-09-30 15:25:25', NULL, NULL, '/menu/getBaseMenuTree', '获取用户动态路由', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (18, '2019-09-30 15:25:53', '2019-09-30 15:25:53', NULL, NULL, '/menu/addMenuAuthority', '增加menu和角色关联关系', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (19, '2019-09-30 15:26:20', '2019-09-30 15:26:20', NULL, NULL, '/menu/getMenuAuthority', '获取指定角色menu', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (20, '2019-09-30 15:26:43', '2019-09-30 15:26:43', NULL, NULL, '/menu/deleteBaseMenu', '删除菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (21, '2019-09-30 15:28:05', '2019-09-30 15:28:05', NULL, NULL, '/menu/updateBaseMenu', '更新菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (22, '2019-09-30 15:28:21', '2019-09-30 15:28:21', NULL, NULL, '/menu/getBaseMenuById', '根据id获取菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (23, '2019-09-30 15:29:19', '2019-09-30 15:29:19', NULL, NULL, '/user/changePassword', '修改密码', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (24, '2019-09-30 15:29:33', '2019-09-30 15:29:33', NULL, NULL, '/user/uploadHeaderImg', '上传头像', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (25, '2019-09-30 15:30:00', '2019-09-30 15:30:00', NULL, NULL, '/user/getInfoList', '分页获取用户列表', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (28, '2019-10-09 15:15:17', '2019-10-09 15:17:07', NULL, NULL, '/user/getUserList', '获取用户列表', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/updateCasbin', '更改角色api权限', 'casbin', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (36, '2020-01-06 17:56:36', '2020-01-06 17:56:36', NULL, NULL, '/authority/setDataAuthority', '设置角色资源权限', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (37, '2020-01-13 14:04:05', '2020-01-13 14:04:05', NULL, NULL, '/system/getSystemConfig', '获取配置文件内容', 'system', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (38, '2020-01-13 15:02:06', '2020-01-13 15:02:06', NULL, NULL, '/system/setSystemConfig', '设置配置文件内容', 'system', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (39, '2020-02-25 15:32:39', '2020-02-25 15:32:39', NULL, NULL, '/customer/customer', '创建客户', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (40, '2020-02-25 15:32:51', '2020-02-25 15:34:56', NULL, NULL, '/customer/customer', '更新客户', 'customer', 'PUT');
|
||||
INSERT INTO `sys_apis` VALUES (41, '2020-02-25 15:33:57', '2020-02-25 15:33:57', NULL, NULL, '/customer/customer', '删除客户', 'customer', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (42, '2020-02-25 15:36:48', '2020-02-25 15:37:16', NULL, NULL, '/customer/customer', '获取单一客户', 'customer', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (43, '2020-02-25 15:37:06', '2020-02-25 15:37:06', NULL, NULL, '/customer/customerList', '获取客户列表', 'customer', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (44, '2020-03-12 14:36:54', '2020-03-12 14:56:50', NULL, NULL, '/casbin/casbinTest/:pathParam', 'RESTFUL模式测试', 'casbin', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28', NULL, NULL, '/autoCode/createTemp', '自动化代码', 'autoCode', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (46, '2020-04-15 12:46:58', '2020-04-15 12:46:58', NULL, NULL, '/authority/updateAuthority', '更新角色信息', 'authority', 'PUT');
|
||||
INSERT INTO `sys_apis` VALUES (47, '2020-04-20 15:14:25', '2020-04-20 15:14:25', NULL, NULL, '/authority/copyAuthority', '拷贝角色', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (64, '2020-05-10 16:44:25', '2020-05-10 16:44:25', NULL, NULL, '/user/deleteUser', '删除用户', 'user', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (81, '2020-06-23 18:40:50', '2020-06-23 18:40:50', NULL, NULL, '/sysDictionaryDetail/createSysDictionaryDetail', '新增字典内容', 'sysDictionaryDetail', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (82, '2020-06-23 18:40:50', '2020-06-23 18:40:50', NULL, NULL, '/sysDictionaryDetail/deleteSysDictionaryDetail', '删除字典内容', 'sysDictionaryDetail', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (83, '2020-06-23 18:40:50', '2020-06-23 18:40:50', NULL, NULL, '/sysDictionaryDetail/updateSysDictionaryDetail', '更新字典内容', 'sysDictionaryDetail', 'PUT');
|
||||
INSERT INTO `sys_apis` VALUES (84, '2020-06-23 18:40:50', '2020-06-23 18:40:50', NULL, NULL, '/sysDictionaryDetail/findSysDictionaryDetail', '根据ID获取字典内容', 'sysDictionaryDetail', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (85, '2020-06-23 18:40:50', '2020-06-23 18:40:50', NULL, NULL, '/sysDictionaryDetail/getSysDictionaryDetailList', '获取字典内容列表', 'sysDictionaryDetail', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (86, '2020-06-23 18:48:13', '2020-06-23 18:48:13', NULL, NULL, '/sysDictionary/createSysDictionary', '新增字典', 'sysDictionary', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (87, '2020-06-23 18:48:13', '2020-06-23 18:48:13', NULL, NULL, '/sysDictionary/deleteSysDictionary', '删除字典', 'sysDictionary', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (88, '2020-06-23 18:48:13', '2020-06-23 18:48:13', NULL, NULL, '/sysDictionary/updateSysDictionary', '更新字典', 'sysDictionary', 'PUT');
|
||||
INSERT INTO `sys_apis` VALUES (89, '2020-06-23 18:48:13', '2020-06-23 18:48:13', NULL, NULL, '/sysDictionary/findSysDictionary', '根据ID获取字典', 'sysDictionary', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (90, '2020-06-23 18:48:13', '2020-06-23 18:48:13', NULL, NULL, '/sysDictionary/getSysDictionaryList', '获取字典列表', 'sysDictionary', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (91, '2020-06-29 13:21:35', '2020-06-29 13:21:35', NULL, NULL, '/sysOperationRecord/createSysOperationRecord', '新增操作记录', 'sysOperationRecord', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (92, '2020-06-29 13:21:35', '2020-06-29 13:21:35', NULL, NULL, '/sysOperationRecord/deleteSysOperationRecord', '删除操作记录', 'sysOperationRecord', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (93, '2020-06-29 13:21:35', '2020-06-29 13:21:35', NULL, NULL, '/sysOperationRecord/updateSysOperationRecord', '更新操作记录', 'sysOperationRecord', 'PUT');
|
||||
INSERT INTO `sys_apis` VALUES (94, '2020-06-29 13:21:35', '2020-06-29 13:21:35', NULL, NULL, '/sysOperationRecord/findSysOperationRecord', '根据ID获取操作记录', 'sysOperationRecord', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (95, '2020-06-29 13:21:35', '2020-06-29 13:21:35', NULL, NULL, '/sysOperationRecord/getSysOperationRecordList', '获取操作记录列表', 'sysOperationRecord', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (96, '2020-07-05 14:34:20', '2020-07-05 14:34:20', NULL, NULL, '/autoCode/getTables', '获取数据库表', 'autoCode', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (97, '2020-07-05 15:02:07', '2020-07-05 15:02:07', NULL, NULL, '/autoCode/getDB', '获取所有数据库', 'autoCode', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (98, '2020-07-05 16:32:08', '2020-07-05 16:32:08', NULL, NULL, '/autoCode/getColume', '获取所选table的所有字段', 'autoCode', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (99, '2020-07-07 15:59:53', '2020-07-07 15:59:53', NULL, NULL, '/sysOperationRecord/deleteSysOperationRecordByIds', '批量删除操作历史', 'sysOperationRecord', 'DELETE');
|
||||
INSERT INTO `sys_apis` VALUES (100, '2020-08-15 12:10:55', '2020-08-15 12:10:55', NULL, NULL, '/simpleUploader/upload', '插件版分片上传', 'simpleUploader', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (101, '2020-08-15 19:53:53', '2020-08-15 19:53:53', NULL, NULL, '/simpleUploader/checkFileMd5', '文件完整度验证', 'simpleUploader', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (102, '2020-08-15 22:28:04', '2020-08-15 22:28:04', NULL, NULL, '/simpleUploader/mergeFileMd5', '上传完成合并文件', 'simpleUploader', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (103, '2020-08-31 22:47:44', '2020-08-31 22:47:44', NULL, NULL, '/user/setUserInfo', '设置用户信息', 'user', 'PUT');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_authorities
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_authorities`;
|
||||
CREATE TABLE `sys_authorities` (
|
||||
`authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色id',
|
||||
`authority_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色名',
|
||||
`parent_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '父角色',
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`authority_id`) USING BTREE,
|
||||
UNIQUE INDEX `authority_id`(`authority_id`) USING BTREE,
|
||||
INDEX `idx_sys_authorities_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_authorities
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', '2020-06-13 16:07:37', NULL);
|
||||
INSERT INTO `sys_authorities` VALUES ('8881', '普通用户子角色', '888', '2020-04-04 11:44:56', '2020-04-24 10:16:42', NULL);
|
||||
INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 11:44:56', '2020-04-24 10:16:42', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_authority_menus
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_authority_menus`;
|
||||
CREATE TABLE `sys_authority_menus` (
|
||||
`sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '角色id',
|
||||
`sys_base_menu_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '菜单id',
|
||||
PRIMARY KEY (`sys_authority_authority_id`, `sys_base_menu_id`) USING BTREE,
|
||||
INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_authority_menus
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 1);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 2);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 3);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 4);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 5);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 6);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 17);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 18);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 19);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 20);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 21);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 22);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 23);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 26);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 33);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 34);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 38);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 40);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 41);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 42);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 50);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 51);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 52);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('888', 53);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 1);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 2);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 18);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 38);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 40);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('8881', 41);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 1);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 2);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 3);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 4);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 5);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 6);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 17);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 18);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 19);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 20);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 21);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 22);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 23);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 26);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 33);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 34);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 38);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 40);
|
||||
INSERT INTO `sys_authority_menus` VALUES ('9528', 41);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_base_menu_parameters
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_base_menu_parameters`;
|
||||
CREATE TABLE `sys_base_menu_parameters` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
`sys_base_menu_id` int(10) UNSIGNED NULL DEFAULT NULL,
|
||||
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_base_menu_parameters_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_base_menus
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_base_menus`;
|
||||
CREATE TABLE `sys_base_menus` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`menu_level` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '菜单等级(暂未使用)',
|
||||
`parent_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '父菜单id',
|
||||
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '菜单path(路由path)',
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '菜单name(路由name)',
|
||||
`hidden` tinyint(1) NULL DEFAULT NULL COMMENT '是否在列表隐藏',
|
||||
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '组件位置',
|
||||
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '显示名字',
|
||||
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '显示图标',
|
||||
`nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '菜单别名',
|
||||
`sort` int(255) NULL DEFAULT NULL COMMENT '排序',
|
||||
`keep_alive` tinyint(1) NULL DEFAULT NULL COMMENT '是否缓存菜单内容',
|
||||
`default_menu` tinyint(1) NULL DEFAULT NULL COMMENT '默认菜单(暂未使用)',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_base_menus_deleted_at`(`deleted_at`) USING BTREE,
|
||||
INDEX `idx_sys_base_menus_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 54 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_base_menus
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-05-30 15:43:06', NULL, 0, 0, 'dashboard', 'dashboard', 0, 'view/dashboard/index.vue', '仪表盘', 'setting', '仪表盘', 1, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-08-23 16:25:25', NULL, 0, 0, 'about/:id', 'about', 0, 'view/about/index.vue', '关于我们', 'info', '测试菜单', 7, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2020-04-24 10:16:43', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', 3, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2020-05-30 15:43:25', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', 1, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2020-04-30 17:45:27', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', 2, 1, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2020-04-24 10:16:43', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3, 1, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2020-04-24 10:16:43', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2020-05-10 21:31:36', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'message-solid', '个人信息', 4, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-04-24 10:16:43', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2020-04-24 10:16:42', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2020-04-24 10:16:43', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2020-04-24 10:16:43', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2020-04-24 10:16:43', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2020-04-24 10:16:43', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-04-24 10:16:43', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-04-24 10:16:43', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-04-24 10:16:43', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-05-03 21:38:49', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1, 1, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-05-03 21:38:43', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2, 1, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-24 10:16:43', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (45, '2020-04-29 17:19:34', '2020-07-04 18:27:22', NULL, 0, 0, 'iconList', 'iconList', 0, 'view/iconList/index.vue', '图标集合', 'star-on', NULL, 2, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (50, '2020-06-24 19:49:54', '2020-06-28 20:34:47', NULL, 0, 3, 'dictionary', 'dictionary', 0, 'view/superAdmin/dictionary/sysDictionary.vue', '字典管理', 'notebook-2', NULL, 5, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (51, '2020-06-24 19:51:33', '2020-06-28 20:35:04', NULL, 0, 3, 'dictionaryDetail/:id', 'dictionaryDetail', 1, 'view/superAdmin/dictionary/sysDictionaryDetail.vue', '字典详情', 's-order', NULL, 1, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (52, '2020-06-29 13:31:17', '2020-07-07 16:05:34', NULL, 0, 3, 'operation', 'operation', 0, 'view/superAdmin/operation/sysOperationRecord.vue', '操作历史', 'time', NULL, 6, 0, 0);
|
||||
INSERT INTO `sys_base_menus` VALUES (53, '2020-08-15 11:41:49', '2020-08-15 11:43:15', NULL, 0, 19, 'simpleUploader', 'simpleUploader', 0, 'view/example/simpleUploader/simpleUploader', '断点续传(插件版)', 'upload', NULL, 6, 0, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_data_authority_ids
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_data_authority_ids`;
|
||||
CREATE TABLE `sys_data_authority_ids` (
|
||||
`sys_authority_authority_id` int(11) NOT NULL,
|
||||
`data_authority_id_authority_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`sys_authority_authority_id`, `data_authority_id_authority_id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_data_authority_ids
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_data_authority_ids` VALUES (888, 888);
|
||||
INSERT INTO `sys_data_authority_ids` VALUES (888, 8881);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dictionaries
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_dictionaries`;
|
||||
CREATE TABLE `sys_dictionaries` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '字典名(中)',
|
||||
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '字典名(英)',
|
||||
`status` tinyint(1) NULL DEFAULT NULL COMMENT '状态',
|
||||
`desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '描述',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_dictionaries_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dictionaries
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_dictionaries` VALUES (2, '2020-06-24 20:44:00', '2020-06-24 20:44:00', NULL, '性别', 'sex', 1, '性别字典');
|
||||
INSERT INTO `sys_dictionaries` VALUES (3, '2020-07-05 15:27:31', '2020-07-05 15:27:31', NULL, '数据库int类型', 'int', 1, 'int类型对应的数据库类型');
|
||||
INSERT INTO `sys_dictionaries` VALUES (4, '2020-07-05 15:33:07', '2020-07-05 16:07:18', NULL, '数据库时间日期类型', 'time.Time', 1, '数据库时间日期类型');
|
||||
INSERT INTO `sys_dictionaries` VALUES (5, '2020-07-05 15:34:23', '2020-07-05 15:52:45', NULL, '数据库浮点型', 'float64', 1, '数据库浮点型');
|
||||
INSERT INTO `sys_dictionaries` VALUES (6, '2020-07-05 15:35:05', '2020-07-05 15:35:05', NULL, '数据库字符串', 'string', 1, '数据库字符串');
|
||||
INSERT INTO `sys_dictionaries` VALUES (7, '2020-07-05 15:36:48', '2020-07-05 15:36:48', NULL, '数据库bool类型', 'bool', 1, '数据库bool类型');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dictionary_details
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_dictionary_details`;
|
||||
CREATE TABLE `sys_dictionary_details` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
`label` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '展示值',
|
||||
`value` int(11) NULL DEFAULT NULL COMMENT '字典值',
|
||||
`status` tinyint(1) NULL DEFAULT NULL COMMENT '启用状态',
|
||||
`sort` int(11) NULL DEFAULT NULL COMMENT '排序标记',
|
||||
`sys_dictionary_id` int(11) NULL DEFAULT NULL COMMENT '关联标记',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_dictionary_details_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dictionary_details
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_dictionary_details` VALUES (12, '2020-07-05 15:31:41', '2020-07-05 15:31:41', NULL, 'smallint', 1, 1, 1, 3);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (13, '2020-07-05 15:31:52', '2020-07-05 15:31:52', NULL, 'mediumint', 2, 1, 2, 3);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (14, '2020-07-05 15:32:04', '2020-07-05 15:32:04', NULL, 'int', 3, 1, 3, 3);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (15, '2020-07-05 15:32:11', '2020-07-05 15:32:11', NULL, 'bigint', 4, 1, 4, 3);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (19, '2020-07-05 15:33:16', '2020-07-05 15:33:16', NULL, 'data', 0, 1, 0, 4);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (20, '2020-07-05 15:33:21', '2020-07-05 15:33:21', NULL, 'time', 1, 1, 1, 4);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (21, '2020-07-05 15:33:25', '2020-07-05 15:33:25', NULL, 'year', 2, 1, 2, 4);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (22, '2020-07-05 15:33:35', '2020-07-05 15:33:35', NULL, 'datetime', 3, 1, 3, 4);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (23, '2020-07-05 15:33:42', '2020-07-05 15:33:42', NULL, 'timestamp', 5, 1, 5, 4);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (24, '2020-07-05 15:34:30', '2020-07-05 15:34:30', NULL, 'float', 0, 1, 0, 5);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (25, '2020-07-05 15:34:35', '2020-07-05 15:34:35', NULL, 'double', 1, 1, 1, 5);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (26, '2020-07-05 15:34:41', '2020-07-05 15:34:41', NULL, 'decimal', 2, 1, 2, 5);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (27, '2020-07-05 15:37:45', '2020-07-05 15:37:45', NULL, 'tinyint', 0, 1, 0, 7);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (28, '2020-07-05 15:53:25', '2020-07-05 15:53:25', NULL, 'char', 0, 1, 0, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (29, '2020-07-05 15:53:29', '2020-07-05 15:53:29', NULL, 'varchar', 1, 1, 1, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (30, '2020-07-05 15:53:35', '2020-07-05 15:53:35', NULL, 'tinyblob', 2, 1, 2, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (31, '2020-07-05 15:53:40', '2020-07-05 15:53:40', NULL, 'tinytext', 3, 1, 3, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (32, '2020-07-05 15:53:48', '2020-07-05 15:53:48', NULL, 'text', 4, 1, 4, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (33, '2020-07-05 15:53:55', '2020-07-05 15:53:55', NULL, 'blob', 5, 1, 5, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (34, '2020-07-05 15:54:02', '2020-07-05 15:54:02', NULL, 'mediumblob', 6, 1, 6, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (35, '2020-07-05 15:54:09', '2020-07-05 15:54:09', NULL, 'mediumtext', 7, 1, 7, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (36, '2020-07-05 15:54:16', '2020-07-05 15:54:16', NULL, 'longblob', 8, 1, 8, 6);
|
||||
INSERT INTO `sys_dictionary_details` VALUES (37, '2020-07-05 15:54:24', '2020-07-05 15:54:24', NULL, 'longtext', 9, 1, 9, 6);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_operation_records
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_operation_records`;
|
||||
CREATE TABLE `sys_operation_records` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求ip',
|
||||
`method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求方法',
|
||||
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求路由',
|
||||
`status` int(11) NULL DEFAULT NULL COMMENT '状态',
|
||||
`latency` bigint(20) NULL DEFAULT NULL,
|
||||
`agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`error_message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`body` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '请求Body',
|
||||
`user_id` int(11) NULL DEFAULT NULL COMMENT '用户id',
|
||||
`resp` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '响应Body',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_operation_records_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 166 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_users
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_users`;
|
||||
CREATE TABLE `sys_users` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`uuid` varbinary(255) NULL DEFAULT NULL COMMENT 'uuid',
|
||||
`nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT 'QMPlusUser' COMMENT '用户昵称',
|
||||
`header_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT 'http://www.henrongyi.top/avatar/lufu.jpg' COMMENT '用户头像',
|
||||
`authority_id` double NULL DEFAULT 888 COMMENT '用户角色',
|
||||
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '登录用户名',
|
||||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '登录密码',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_users_deleted_at`(`deleted_at`) USING BTREE,
|
||||
INDEX `idx_sys_users_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_users
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_users` VALUES (10, '2019-09-13 17:23:46', '2020-08-31 22:58:43', NULL, 0x63653064363638352D633135662D343132362D613562342D383930626339643233353664, '超级管理员', 'http://qmplusimg.henrongyi.top/gvalogo.png', 888, 'admin', 'e10adc3949ba59abbe56e057f20f883e');
|
||||
INSERT INTO `sys_users` VALUES (11, '2019-09-13 17:27:29', '2019-09-13 17:27:29', NULL, 0x66643665663739622D393434632D343838382D383337372D616265326432363038383538, 'QMPlusUser', 'http://qmplusimg.henrongyi.top/gvalogo.png', 9528, 'a303176530', '3ec063004a6f31642261936a379fde3d');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_workflow_step_infos
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_workflow_step_infos`;
|
||||
CREATE TABLE `sys_workflow_step_infos` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`updated_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`deleted_at` timestamp(0) NULL DEFAULT NULL,
|
||||
`workflow_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '节点id',
|
||||
`is_strat` tinyint(1) NULL DEFAULT NULL COMMENT '是否是开始节点',
|
||||
`step_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '步骤name',
|
||||
`step_no` double NULL DEFAULT NULL COMMENT '第几步',
|
||||
`step_authority_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '可操作者角色',
|
||||
`is_end` tinyint(1) NULL DEFAULT NULL COMMENT '是否是结尾',
|
||||
`sys_workflow_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '关联工作流id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_workflow_step_infos_deleted_at`(`deleted_at`) USING BTREE,
|
||||
INDEX `idx_sys_workflow_step_infos_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_workflows
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_workflows`;
|
||||
CREATE TABLE `sys_workflows` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(0) NULL DEFAULT NULL,
|
||||
`updated_at` datetime(0) NULL DEFAULT NULL,
|
||||
`deleted_at` datetime(0) NULL DEFAULT NULL,
|
||||
`workflow_nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '工作流中文名称',
|
||||
`workflow_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '工作流英文名称',
|
||||
`workflow_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '工作流描述',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_workflows_deleted_at`(`deleted_at`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- View structure for authority_menu
|
||||
-- ----------------------------
|
||||
DROP VIEW IF EXISTS `authority_menu`;
|
||||
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`)));
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,26 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log logs/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
rewrite ^/api/(.*)$ /$1 break; #重写
|
||||
proxy_pass http://177.7.0.12:8888; # 设置代理服务器的协议和地址
|
||||
}
|
||||
|
||||
location /api/swagger/index.html {
|
||||
proxy_pass http://127.0.0.1:8888/swagger/index.html;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,5 @@
|
||||
#! /bin/bash
|
||||
|
||||
rm -f ./core/server.go
|
||||
# 生成server.go文件, 添加Router.Static("/admin", "./resource/dist")这个代码
|
||||
touch ./core/server.go
|
||||
filename="./core/server.go"
|
||||
cat>"${filename}"<<EOF
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/initialize"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
)
|
||||
|
||||
type server interface {
|
||||
ListenAndServe() error
|
||||
}
|
||||
|
||||
func RunWindowsServer() {
|
||||
if global.GVA_CONFIG.System.UseMultipoint {
|
||||
// 初始化redis服务
|
||||
initialize.Redis()
|
||||
}
|
||||
Router := initialize.Routers()
|
||||
Router.Static("/form-generator", "./resource/page")
|
||||
Router.Static("/admin", "./resource/dist")
|
||||
|
||||
//InstallPlugs(Router)
|
||||
// end 插件描述
|
||||
|
||||
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
|
||||
s := initServer(address, Router)
|
||||
// 保证文本顺序输出
|
||||
// In order to ensure that the text order output can be deleted
|
||||
time.Sleep(10 * time.Microsecond)
|
||||
global.GVA_LOG.Debug("server run success on ", zap.String("address", address))
|
||||
|
||||
fmt.Printf("欢迎使用 Gin-Vue-Admin默认自动化文档地址:http://127.0.0.1%s/swagger/index.html\n 默认前端文件运行地址:http://127.0.0.1:8888/admin\n", address)
|
||||
global.GVA_LOG.Error(s.ListenAndServe().Error())
|
||||
}
|
||||
EOF
|
||||
|
||||
rm -f ./config.yaml
|
||||
# 生成config.yaml文件, 用于docker-compose的使用
|
||||
touch ./config.yaml
|
||||
@@ -50,78 +7,79 @@ filename="./config.yaml"
|
||||
cat>"${filename}"<<EOF
|
||||
# Gin-Vue-Admin Global Configuration
|
||||
|
||||
# casbin configuration
|
||||
casbin:
|
||||
model-path: './resource/rbac_model.conf'
|
||||
|
||||
# jwt configuration
|
||||
jwt:
|
||||
signing-key: 'qmPlus'
|
||||
|
||||
# mysql connect configuration
|
||||
mysql:
|
||||
username: root
|
||||
password: 'Aa@6447985'
|
||||
path: mysql
|
||||
db-name: 'qmPlus'
|
||||
config: 'charset=utf8mb4&parseTime=True&loc=Local'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
log-mode: true
|
||||
|
||||
#sqlite 配置
|
||||
sqlite:
|
||||
path: db.db
|
||||
log-mode: true
|
||||
config: 'loc=Asia/Shanghai'
|
||||
|
||||
# oss configuration
|
||||
|
||||
# 切换本地与七牛云上传,分配头像和文件路径
|
||||
localupload:
|
||||
local: false
|
||||
avatar-path: uploads/avatar
|
||||
file-path: uploads/file
|
||||
|
||||
# 请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址
|
||||
qiniu:
|
||||
access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
|
||||
secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
|
||||
bucket: 'qm-plus-img'
|
||||
img-path: 'http://qmplusimg.henrongyi.top'
|
||||
|
||||
# redis configuration
|
||||
redis:
|
||||
addr: redis:6379
|
||||
password: ''
|
||||
db: 0
|
||||
|
||||
# system configuration
|
||||
system:
|
||||
use-multipoint: true
|
||||
env: 'public' # Change to "develop" to skip authentication for development mode
|
||||
addr: 8888
|
||||
db-type: "mysql" # support mysql/sqlite
|
||||
|
||||
# captcha configuration
|
||||
captcha:
|
||||
key-long: 6
|
||||
img-width: 240
|
||||
img-height: 80
|
||||
signing-key: 'qmPlus'
|
||||
|
||||
# zap logger configuration
|
||||
zap:
|
||||
# 可使用 "debug", "info", "warn", "error", "dpanic", "panic", "fatal",
|
||||
level: 'debug'
|
||||
# console: 控制台, json: json格式输出
|
||||
level: 'info'
|
||||
format: 'console'
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
director: 'log'
|
||||
link_name: 'latest_log'
|
||||
show_line: true
|
||||
# LowercaseLevelEncoder:小写, LowercaseColorLevelEncoder:小写带颜色,CapitalLevelEncoder: 大写, CapitalColorLevelEncoder: 大写带颜色,
|
||||
encode_level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace_key: 'stacktrace'
|
||||
log_in_console: true
|
||||
link-name: 'latest_log'
|
||||
show-line: true
|
||||
encode-level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace-key: 'stacktrace'
|
||||
log-in-console: true
|
||||
|
||||
# redis configuration
|
||||
redis:
|
||||
db: 0
|
||||
addr: '177.7.0.14:6379'
|
||||
password: ''
|
||||
|
||||
# email configuration
|
||||
email:
|
||||
to: 'xxx@qq.com'
|
||||
port: 465
|
||||
from: 'xxx@163.com'
|
||||
host: 'smtp.163.com'
|
||||
is-ssl: true
|
||||
secret: 'xxx'
|
||||
nickname: 'test'
|
||||
|
||||
# casbin configuration
|
||||
casbin:
|
||||
model-path: './resource/rbac_model.conf'
|
||||
|
||||
# system configuration
|
||||
system:
|
||||
env: 'public' # Change to "develop" to skip authentication for development mode
|
||||
addr: 8888
|
||||
db-type: 'mysql'
|
||||
oss-type: 'local'
|
||||
use-multipoint: false
|
||||
|
||||
# captcha configuration
|
||||
captcha:
|
||||
key-long: 6
|
||||
img-width: 240
|
||||
img-height: 80
|
||||
|
||||
# mysql connect configuration
|
||||
mysql:
|
||||
path: '177.7.0.13:3306'
|
||||
config: 'charset=utf8mb4&parseTime=True&loc=Local'
|
||||
db-name: 'qmPlus'
|
||||
username: 'root'
|
||||
password: 'Aa@6447985'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
log-mode: false
|
||||
|
||||
# local configuration
|
||||
local:
|
||||
path: 'uploads/file'
|
||||
|
||||
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
|
||||
qiniu:
|
||||
zone: 'ZoneHuadong'
|
||||
bucket: 'qm-plus-img'
|
||||
img-path: 'http://qmplusimg.henrongyi.top'
|
||||
use-https: false
|
||||
access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
|
||||
secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
|
||||
use-cdn-domains: false
|
||||
EOF
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
rm -f .env.production
|
||||
touch .env.production
|
||||
filename="./.env.production"
|
||||
cat>"${filename}"<<EOF
|
||||
ENV = 'production'
|
||||
VUE_APP_BASE_API = ''
|
||||
EOF
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: issues模板
|
||||
about: 请严格按照要求进行提交issues! 如果未能按照要求,我们将会close您的issues,敬请谅解!
|
||||
---
|
||||
<!-- 在提交问题之前,请先回答这些问题。谢谢! -->
|
||||
|
||||
### 1. 您使用的是哪个版本的`Go`和系统类型/架构 ?
|
||||
|
||||
<!--
|
||||
请从您的终端粘贴命令 `go version` 的输出。
|
||||
期望看到像: `go version go1.14.4 darwin/amd64`
|
||||
-->
|
||||
|
||||
### 2. 您使用的是哪个版本的 `Nodejs` 和 `npm` 或 `cnpm` ?
|
||||
|
||||
<!--
|
||||
请从您的终端粘贴命令 `node -v` 的输出。
|
||||
期望看到像: `v12.16.1`
|
||||
-->
|
||||
|
||||
<!--
|
||||
请从您的终端粘贴命令 `npm -v` 的输出。
|
||||
期望看到像: `6.13.4`
|
||||
-->
|
||||
|
||||
<!--
|
||||
请从您的终端粘贴命令 `cnpm -v` 的输出。
|
||||
期望看到的像: `
|
||||
cnpm@6.1.1 (/usr/local/lib/node_modules/cnpm/lib/parse_argv.js)
|
||||
npm@6.14.2 (/usr/local/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
|
||||
node@12.16.1 (/usr/local/bin/node)
|
||||
npminstall@3.27.0 (/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
|
||||
prefix=/usr/local
|
||||
darwin x64 19.6.0
|
||||
registry=https://r.npm.taobao.org
|
||||
`
|
||||
-->
|
||||
|
||||
### 3. 您使用的是哪个版本的 `gin-vue-admin` ?
|
||||
|
||||
<!--
|
||||
您如果克隆的是master就写master,
|
||||
如果是在Releases中下载的zip/tar.gz对应的tag版本,
|
||||
如:`v2.3.0`
|
||||
-->
|
||||
|
||||
|
||||
|
||||
### 4. 可以在master版本中复现此问题吗 ?
|
||||
|
||||
|
||||
|
||||
### 5. 您做了什么 ?
|
||||
|
||||
<!--
|
||||
如果可能,请提供最短代码的副本以重现该错误。
|
||||
一个完整的可运行程序是最好的。
|
||||
-->
|
||||
|
||||
|
||||
|
||||
### 6. 您期望看到什么 ?
|
||||
|
||||
|
||||
|
||||
### 7. 您看到了什么 ?
|
||||
|
||||
|
||||
|
||||
### 8. 错误堆栈或者SQL打印
|
||||
@@ -1,66 +1,64 @@
|
||||
name: gin-vue-admin build test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths-ignore:
|
||||
- './db/**'
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths-ignore:
|
||||
- './db/**'
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
paths-ignore:
|
||||
- "./db/**"
|
||||
- "**.md"
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
paths-ignore:
|
||||
- "./db/**"
|
||||
- "**.md"
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
name: Frontend build
|
||||
name: Frontend build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
|
||||
- name: Check out branch
|
||||
uses: actions/checkout@v2
|
||||
- name: Check out branch
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Build test
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
working-directory: ./web
|
||||
|
||||
- name: Build test
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
working-directory: ./web
|
||||
|
||||
backend:
|
||||
name: Backend build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.14
|
||||
id: go
|
||||
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
id: go
|
||||
- name: Check out branch
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check out branch
|
||||
uses: actions/checkout@v2
|
||||
- name: Download dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
if [ -f Gopkg.toml ]; then
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
dep ensure
|
||||
fi
|
||||
working-directory: ./server
|
||||
|
||||
- name: Download dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
if [ -f Gopkg.toml ]; then
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
dep ensure
|
||||
fi
|
||||
working-directory: ./server
|
||||
|
||||
- name: Test and Build
|
||||
run: |
|
||||
go build -v -race
|
||||
working-directory: ./server
|
||||
- name: Test and Build
|
||||
run: |
|
||||
go build -v -race
|
||||
working-directory: ./server
|
||||
|
||||
@@ -24,6 +24,7 @@ yarn-error.log*
|
||||
|
||||
go.sum
|
||||
/server/log/
|
||||
/server/gva
|
||||
/server/latest_log
|
||||
|
||||
*.iml
|
||||
|
||||
+94
-42
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
<div align=center>
|
||||
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
|
||||
</div>
|
||||
@@ -62,18 +62,19 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
|
||||
### 1.3 Version list
|
||||
|
||||
- master: 2.0 code, for prod
|
||||
|
||||
- develop: 2.0 dev code, for test
|
||||
|
||||
- [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 is no longer compatible with v1.0)
|
||||
|
||||
- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (stop maintenance)
|
||||
|
||||
- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (stop maintenance)
|
||||
|
||||
- [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1](https://v1.gorm.io) Stable branch)
|
||||
- [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2](https://v2.gorm.io) Development branch)
|
||||
|
||||
## 2. Getting started
|
||||
|
||||
```
|
||||
- node version > v8.6.0
|
||||
- golang version >= v1.14
|
||||
- IDE recommendation: Goland
|
||||
- We recommend you to apply for your own cloud service in QINIU. Replace the public key, private key, warehouse name and default url address with your own, so as not to mess up the test database.
|
||||
```
|
||||
|
||||
> Use docker-compose to experience this project
|
||||
- Installation docker-compose [Official document](https://docs.docker.com/compose/install/)
|
||||
- ```shell script
|
||||
@@ -95,6 +96,7 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
|
||||
- ```git
|
||||
git clone https://github.com/flipped-aurora/gin-vue-admin.git
|
||||
```
|
||||
|
||||
- Use docker-compose up to start the startup project with one click
|
||||
- ```shell script
|
||||
# Use docker-compose to start four containers
|
||||
@@ -105,17 +107,39 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
- Web project preview [http://127.0.0.1:8888/admin](http://127.0.0.1:8888/admin)
|
||||
- Web project preview [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
|
||||
- swagger APIs [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
|
||||
|
||||
```
|
||||
- node version > v8.6.0
|
||||
- golang version >= v1.11
|
||||
- IDE recommendation: Goland
|
||||
- After you clone the project, use the scripts in directory db to create your own database.
|
||||
- We recommend you to apply for your own cloud service in QINIU. Replace the public key, private key, warehouse name and default url address with your own, so as not to mess up the test database.
|
||||
```
|
||||
- If the internal ip of the server's 177.7.0.12 container is occupied, the place to be modified is
|
||||
|
||||
- Replace 177.7.0.12 on line 39 of [docker-compose.yaml](./docker-compose.yaml) with the ip you want
|
||||
- Replace 177.7.0.12 in line 20 of [.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf) with the ip you want
|
||||
|
||||
- docker-compose uses a custom docker network
|
||||
|
||||
- ```dockerfile
|
||||
networks:
|
||||
network:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: '177.7.0.0/16'
|
||||
```
|
||||
|
||||
- Subnet address, the default gateway is 177.7.0.1 (docker-compose V2 needs to write, V3 does not need),For specific information, see the [official document](https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address)
|
||||
|
||||
- The default network name is gin-vue-admin_network, and the default is bridge mode
|
||||
|
||||
- If the subnet is modified, the ipv4_address of each service needs to be modified, and the ip of the server on line 20 of [.docker-compose/nginx/conf.d/my.conf](.docker-compose/nginx/conf.d/my.conf) also needs to be modified
|
||||
|
||||
> <font color=red>**Use docker-compose to deploy this project need attention**</font>
|
||||
|
||||
- For mysql database, please use a local database installed on the server disk.
|
||||
- Avoid using mysql in the docker container, there may be write problems, io is lower than the host machine, docker's persistence mechanism problem
|
||||
- [init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql) is for docker-compose ==experience this project==, prohibit the use of [init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql) to initialize project data, Database initialization[Please use this method](https://www.gin-vue-admin.com/docs/help#step1%EF%BC%9A%E6%95%B0%E6%8D%AE%E5%BA%93%E5%88%9D%E5%A7%8B%E5%8C%96)
|
||||
- Use [init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql) to initialize all problems, please bear it yourself, and have nothing to do with this project
|
||||
- When deploying using docker-compose of this project,Please modify the [nginx configuration](.docker-compose/nginx/conf.d/my.conf), mysql configuration, networks configuration, redis configuration corresponding to [docker-compose.yaml](./docker-compose.yaml), and make changes as needed.
|
||||
|
||||
### 2.1 Web
|
||||
|
||||
@@ -145,6 +169,47 @@ go list (go mod tidy)
|
||||
go build
|
||||
```
|
||||
|
||||
> Zap log library usage guide && configuration guide
|
||||
|
||||
The configuration of the Zap log library selects zap under [config.yaml](./server/config.yaml)
|
||||
|
||||
```yaml
|
||||
# zap logger configuration
|
||||
zap:
|
||||
level: 'debug'
|
||||
format: 'console'
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
director: 'log'
|
||||
link_name: 'latest_log'
|
||||
show_line: true
|
||||
encode_level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace_key: 'stacktrace'
|
||||
log_in_console: true
|
||||
```
|
||||
|
||||
| Configuration Name | Type Of Configuration | Description |
|
||||
| ------------------ | --------------------- | ------------------------------------------------------------ |
|
||||
| level | string | For a detailed description of the level mode, please see the official [zap documentation](https://pkg.go.dev/go.uber.org/zap?tab=doc#pkg-constants) <br />info: info mode, stack information without errors, only output information<br />debug: debug mode, stack details with errors<br />warn:warn mode<br />error: error mode, stack details with error<br />dpanic: dpanic mode<br />panic: panic mode<br />fatal: fatal mode<br /> |
|
||||
| format | string | console: Output log in console format<br />json: json format output log |
|
||||
| prefix | string | Log prefix |
|
||||
| director | string | The folder to store the log can be modified, no need to create it manually |
|
||||
| link_name | string | [A soft connection file](https://baike.baidu.com/item/%E8%BD%AF%E9%93%BE%E6%8E%A5) of link_name will be generated in the server directory, and the link is the latest log file of the director configuration item |
|
||||
| show_line | bool | Display the line number, the default is true, it is not recommended to modify |
|
||||
| encode_level | string | LowercaseLevelEncoder: lowercase<br /> LowercaseColorLevelEncoder: lowercase with color<br />CapitalLevelEncoder: uppercase<br />CapitalColorLevelEncoder: uppercase with color |
|
||||
| stacktrace_key | string | The name of the stack, that is, the key of josn when outputting the log in json format |
|
||||
| log_in_console | bool | Whether to output to the console, the default is true |
|
||||
|
||||
- Development environment || Debug environment configuration recommendations
|
||||
- `level:debug`
|
||||
- `format:console`
|
||||
- `encode_level:LowercaseColorLevelEncoder`或者`encode_leve:CapitalColorLevelEncoder`
|
||||
- Deployment environment configuration recommendations
|
||||
- `level:error`
|
||||
- `format:json`
|
||||
- `encode_level: LowercaseLevelEncoder `或者 `encode_level:CapitalLevelEncoder`
|
||||
- `log_in_console: false`
|
||||
- <font color=red>Suggestions are only suggestions, you can proceed according to your own needs, and suggestions are for reference only</font>
|
||||
|
||||
### 2.3 API docs auto-generation using swagger
|
||||
|
||||
#### 2.3.1 install swagger
|
||||
@@ -155,11 +220,10 @@ go get -u github.com/swaggo/swag/cmd/swag
|
||||
````
|
||||
|
||||
##### (2) In mainland China
|
||||
|
||||
|
||||
In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/)
|
||||
|
||||
````bash
|
||||
|
||||
If you are using Go version 1.13 and above (recommended)
|
||||
# Enable Go Modules function
|
||||
go env -w GO111MODULE=on
|
||||
@@ -169,11 +233,8 @@ If you are using Go version 1.12 and below
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.io
|
||||
|
||||
# get swag
|
||||
go get -g -v github.com/swaggo/swag/cmd/swag
|
||||
|
||||
# cd GOPATH/src/github.com/swaggo/swag/cmd/swag
|
||||
go install
|
||||
# Use the following command to download swag
|
||||
go get -u github.com/swaggo/swag/cmd/swag
|
||||
````
|
||||
|
||||
#### 2.3.2 API docs generation
|
||||
@@ -212,7 +273,6 @@ After executing the above command,`docs` will show in `server/`,then open yo
|
||||
│ ├─api (API entrance)
|
||||
│ ├─config (config file)
|
||||
│ ├─core (core code)
|
||||
│ ├─db (db scripts)
|
||||
│ ├─docs (swagger APIs docs)
|
||||
│ ├─global (global objet)
|
||||
│ ├─initialiaze (initialiazation)
|
||||
@@ -278,7 +338,7 @@ backend code file: model\dnModel\api.go
|
||||
|
||||
(1) Development environment course
|
||||
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
|
||||
|
||||
|
||||
(2) Template course
|
||||
> Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/
|
||||
|
||||
@@ -293,27 +353,18 @@ backend code file: model\dnModel\api.go
|
||||
### 8.1 Groups
|
||||
#### QQ group: 622360840
|
||||
|
||||
| QQ group |
|
||||
| :---: |
|
||||
| QQ group |d
|
||||
| :---: |
|
||||
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
|
||||
|
||||
|
||||
#### Wechat group: add anyone above, comment "加入gin-vue-admin交流群"
|
||||
#### Wechat group: comment "加入gin-vue-admin交流群"
|
||||
|
||||
### 8.2 Team members
|
||||
| Jiang | Yan | Yin | Du | Yin | Song |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryr.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryx.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrdjl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrygl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrsong.png"> |
|
||||
| Wechat |
|
||||
| :---: |
|
||||
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
|
||||
|
||||
| Nick name | Project position | First name |
|
||||
| ---- | ---- | ---- |
|
||||
| [@piexlmax](https://github.com/piexlmax) | Project sponsor | Jiang |
|
||||
| [@Ruio9244](https://github.com/Ruio9244) | Architect | Yan |
|
||||
| [@granty1](https://github.com/granty1) | Backend developer | Yin |
|
||||
| [@1319612909](https://github.com/1319612909) | UI developer | Du |
|
||||
| [@krank666](https://github.com/krank666) | Frontend developer | Yin |
|
||||
| [@chen-chen-up](https://github.com/chen-chen-up) | Novice developer | Song |
|
||||
| [@SliverHorn](https://github.com/SliverHorn) | Community Administrator | Lai |
|
||||
#### [About Us](https://www.gin-vue-admin.com/about/)
|
||||
|
||||
## 9. Donate
|
||||
|
||||
@@ -322,3 +373,4 @@ If you find this project useful, you can buy author a glass of juice :tropical_d
|
||||
## 10. Commercial considerations
|
||||
|
||||
If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.
|
||||
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
|
||||
[English](./README-en.md) | 简体中文
|
||||
|
||||
[gitee地址](https://gitee.com/pixelmax/gin-vue-admin)|
|
||||
[github地址](https://github.com/flipped-aurora/gin-vue-admin)
|
||||
|
||||
# 项目文档
|
||||
[在线文档](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/
|
||||
|
||||
[从环境到部署教学视频](https://www.bilibili.com/video/BV1fV411y7dT)
|
||||
|
||||
[开发教学](https://www.gin-vue-admin.com/docs/help) (贡献者: <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
|
||||
- 前端UI框架:[element-ui](https://github.com/ElemeFE/element)
|
||||
- 后台框架:[gin](https://github.com/gin-gonic/gin)
|
||||
@@ -57,23 +62,16 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
|
||||
### 1.3 版本列表
|
||||
|
||||
- master: 2.0, 用于生产环境
|
||||
|
||||
- develop: 2.0, 用于测试环境
|
||||
|
||||
- [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 不再兼容 v1.0)
|
||||
|
||||
- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0停止维护)
|
||||
|
||||
- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (v1.0停止维护)
|
||||
|
||||
- [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1版本](https://v1.gorm.io)稳定分支)
|
||||
- [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2版本](https://v2.gorm.io)开发分支)
|
||||
|
||||
## 2. 使用说明
|
||||
|
||||
```
|
||||
- node版本 > v8.6.0
|
||||
- golang版本 >= v1.11
|
||||
- golang版本 >= v1.14
|
||||
- IDE推荐:Goland
|
||||
- 各位在clone项目以后,把db文件导入自己创建的库后,最好前往七牛云申请自己的空间地址。
|
||||
- gormv2版本初始化数据库可以利用批量创建功能,这里已经写好初始化代码,需要在main.go内打开 initialize.Data() 的注释即可
|
||||
- 替换掉项目中的七牛云公钥,私钥,仓名和默认url地址,以免发生测试文件数据错乱
|
||||
```
|
||||
@@ -99,6 +97,7 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
|
||||
- ```git
|
||||
git clone https://github.com/flipped-aurora/gin-vue-admin.git
|
||||
```
|
||||
|
||||
- 使用docker-compose up一键启动启动项目
|
||||
- ```shell script
|
||||
# 使用docker-compose启动四个容器
|
||||
@@ -109,11 +108,39 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
- web项目预览 [http://127.0.0.1:8888/admin](http://127.0.0.1:8888/admin)
|
||||
- web项目预览 [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
|
||||
- swagger文档 [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
|
||||
|
||||
- 如果server的177.7.0.12这个容器内部ip被占用了,需要修改地方为
|
||||
|
||||
- [docker-compose.yaml](./docker-compose.yaml)的第39行的177.7.0.12更换为你想要的ip
|
||||
- [.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf)的第20行的177.7.0.12更换为你想要的ip
|
||||
|
||||
- docker-compose使用自定义的一个docker网络
|
||||
|
||||
- ```dockerfile
|
||||
networks:
|
||||
network:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: '177.7.0.0/16'
|
||||
```
|
||||
|
||||
- 子网地址, 默认网关是177.7.0.1(docker-compose V2需要写,V3则不需要),具体信息看[官方文档](https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address)
|
||||
|
||||
- 默认的network名为gin-vue-admin_network,默认是bridge模式
|
||||
|
||||
- 如果修改了子网,对应的每个service的ipv4_address都需要修改,还有[.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf)的第20行的server的ip也需要修改
|
||||
|
||||
> <font color=red>**使用docker-compose进行部署本项目需注意的问题**</font>
|
||||
|
||||
- mysql数据库请使用装在服务器磁盘的本地数据库.
|
||||
- 避免使用docker容器内的mysql,可能会出现写入的问题, io比宿主机低 docker的持久化机制问题
|
||||
- [init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql)是给docker-compose进行<font color=red>体验本项目</font>的, 禁止[init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql)使用进行项目数据的初始化, 数据库初始化[请使用此方法](https://www.gin-vue-admin.com/docs/help#step1%EF%BC%9A%E6%95%B0%E6%8D%AE%E5%BA%93%E5%88%9D%E5%A7%8B%E5%8C%96)
|
||||
- 使用[init.sql](.docker-compose/docker-entrypoint-initdb.d/init.sql)进行初始化出现的所有问题,请自行承担,与本项目无关
|
||||
- 使用本项目的docker-compose进行部署时,请修改[docker-compose.yaml](./docker-compose.yaml)对应的[nginx配置](.docker-compose/nginx/conf.d/my.conf),mysql配置,networks配置,redis配置,按需自行更改.
|
||||
|
||||
### 2.1 web端
|
||||
|
||||
@@ -143,6 +170,47 @@ go list (go mod tidy)
|
||||
go build
|
||||
```
|
||||
|
||||
> Zap日志库使用指南&&配置指南
|
||||
|
||||
Zap日志库的配置选择在[config.yaml](./server/config.yaml)下的zap
|
||||
|
||||
```yaml
|
||||
# zap logger configuration
|
||||
zap:
|
||||
level: 'debug'
|
||||
format: 'console'
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
director: 'log'
|
||||
link_name: 'latest_log'
|
||||
show_line: true
|
||||
encode_level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace_key: 'stacktrace'
|
||||
log_in_console: true
|
||||
```
|
||||
|
||||
| 配置名 | 配置的类型 | 说明 |
|
||||
| -------------- | ---------- | ------------------------------------------------------------ |
|
||||
| level | string | level的模式的详细说明,请看[zap官方文档](https://pkg.go.dev/go.uber.org/zap?tab=doc#pkg-constants) <br />info: info模式,无错误的堆栈信息,只输出信息<br />debug:debug模式,有错误的堆栈详细信息<br />warn:warn模式<br />error: error模式,有错误的堆栈详细信息<br />dpanic: dpanic模式<br />panic: panic模式<br />fatal: fatal模式<br /> |
|
||||
| format | string | console: 控制台形式输出日志<br />json: json格式输出日志 |
|
||||
| prefix | string | 日志的前缀 |
|
||||
| director | string | 存放日志的文件夹,修改即可,不需要手动创建 |
|
||||
| link_name | string | 在server目录下会生成一个link_name的[软连接文件](https://baike.baidu.com/item/%E8%BD%AF%E9%93%BE%E6%8E%A5),链接的是director配置项的最新日志文件 |
|
||||
| show_line | bool | 显示行号, 默认为true,不建议修改 |
|
||||
| encode_level | string | LowercaseLevelEncoder:小写<br /> LowercaseColorLevelEncoder:小写带颜色<br />CapitalLevelEncoder: 大写<br />CapitalColorLevelEncoder: 大写带颜色 |
|
||||
| stacktrace_key | string | 堆栈的名称,即在json格式输出日志时的josn的key |
|
||||
| log_in_console | bool | 是否输出到控制台,默认为true |
|
||||
|
||||
- 开发环境 || 调试环境配置建议
|
||||
- `level:debug`
|
||||
- `format:console`
|
||||
- `encode_level:LowercaseColorLevelEncoder`或者`encode_leve:CapitalColorLevelEncoder`
|
||||
- 部署环境配置建议
|
||||
- `level:error`
|
||||
- `format:json`
|
||||
- `encode_level: LowercaseLevelEncoder `或者 `encode_level:CapitalLevelEncoder`
|
||||
- `log_in_console: false`
|
||||
- <font color=red>建议只是建议,按照自己的需求进行即可,给出建议仅供参考</font>
|
||||
|
||||
### 2.3 swagger自动化API文档
|
||||
|
||||
#### 2.3.1 安装 swagger
|
||||
@@ -163,11 +231,8 @@ go env -w GO111MODULE=on
|
||||
# 配置 GOPROXY 环境变量
|
||||
go env -w GOPROXY=https://goproxy.io,direct
|
||||
|
||||
# 执行
|
||||
go get -g -v github.com/swaggo/swag/cmd/swag
|
||||
|
||||
# 到GOPATH的/src/github.com/swaggo/swag/cmd/swag路径下执行
|
||||
go install
|
||||
# 使用如下命令下载swag
|
||||
go get -u github.com/swaggo/swag/cmd/swag
|
||||
```
|
||||
|
||||
#### 2.3.2 生成API文档
|
||||
@@ -206,7 +271,6 @@ swag init
|
||||
│ ├─api (API)
|
||||
│ ├─config (配置包)
|
||||
│ ├─core (內核)
|
||||
│ ├─db (数据库脚本)
|
||||
│ ├─docs (swagger文档目录)
|
||||
│ ├─global (全局对象)
|
||||
│ ├─initialiaze (初始化)
|
||||
@@ -270,7 +334,7 @@ swag init
|
||||
|
||||
(1)环境搭建
|
||||
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/ (v1.0版本视频,v2.0操作相同目录不同)
|
||||
|
||||
|
||||
(2)模板使用
|
||||
> Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/ (v1.0版本视频,v2.0操作相同目录不同)
|
||||
|
||||
@@ -285,27 +349,18 @@ swag init
|
||||
### 8.1 技术群
|
||||
|
||||
### QQ交流群:622360840
|
||||
| QQ 群(满) |
|
||||
| :---: |
|
||||
| QQ 群 |
|
||||
| :---: |
|
||||
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
|
||||
|
||||
### 微信交流群
|
||||
可以添加上面任意一位开发者,备注"加入gin-vue-admin交流群"
|
||||
| 微信 |
|
||||
| :---: |
|
||||
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
|
||||
|
||||
### 8.2 项目组成员
|
||||
| 蒋 | 严 | 尹 | 杜 | 印 | 宋 |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryr.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryx.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrdjl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrygl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrsong.png"> |
|
||||
添加微信,备注"加入gin-vue-admin交流群"
|
||||
|
||||
| 昵称 | 项目职务 | 姓 |
|
||||
| ---- | ---- | ---- |
|
||||
| [@piexlmax](https://github.com/piexlmax) | 项目发起者 | 蒋 |
|
||||
| [@Ruio9244](https://github.com/Ruio9244) | 架构师 | 严 |
|
||||
| [@granty1](https://github.com/granty1) | 后台开发 | 印 |
|
||||
| [@1319612909](https://github.com/1319612909) | 前端UI开发 | 杜 |
|
||||
| [@krank666](https://github.com/krank666) | 前端开发 | 尹 |
|
||||
| [@chen-chen-up](https://github.com/chen-chen-up) | 新手开发 | 宋 |
|
||||
| [@SliverHorn](https://github.com/SliverHorn) | 社区管理员 | 赖 |
|
||||
### [关于我们](https://www.gin-vue-admin.com/about/)
|
||||
|
||||
## 9. 捐赠
|
||||
|
||||
|
||||
+37
-5
@@ -1,17 +1,45 @@
|
||||
version: "3.8"
|
||||
|
||||
networks:
|
||||
network:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: '177.7.0.0/16'
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./dockerfile_web
|
||||
container_name: gva-web
|
||||
restart: always
|
||||
ports:
|
||||
- '8080:8080'
|
||||
depends_on:
|
||||
- server
|
||||
command: [ 'nginx-debug', '-g', 'daemon off;' ]
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.7.0.11
|
||||
|
||||
server:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./dockerfile_server
|
||||
container_name: gva-server # 容器名
|
||||
container_name: gva-server
|
||||
restart: always
|
||||
ports:
|
||||
- '8888:8888'
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
links:
|
||||
- mysql
|
||||
- redis
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.7.0.12
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0.21
|
||||
@@ -19,16 +47,20 @@ services:
|
||||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
|
||||
restart: always
|
||||
ports:
|
||||
- "13306:3306" # host物理直接映射端口为6606
|
||||
- "13306:3306" # host物理直接映射端口为13306
|
||||
environment:
|
||||
MYSQL_DATABASE: 'qmPlus' # 初始化启动时要创建的数据库的名称
|
||||
MYSQL_ROOT_PASSWORD: 'Aa@6447985' # root管理员用户密码
|
||||
volumes:
|
||||
- '.docker-compose/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d'
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.7.0.13
|
||||
|
||||
redis:
|
||||
image: redis:6.0.6
|
||||
container_name: gva-redis # 容器名
|
||||
restart: always
|
||||
ports:
|
||||
- '6379:6379'
|
||||
- '16379:6379'
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.7.0.14
|
||||
Executable → Regular
+11
-45
@@ -1,65 +1,31 @@
|
||||
FROM node:12.16.1 as gva-web
|
||||
|
||||
WORKDIR /gva_web/
|
||||
COPY web/ .
|
||||
|
||||
RUN cat .env.production
|
||||
COPY .docker-compose/shell/web-handle.sh .
|
||||
RUN ls -al
|
||||
RUN sh ./web-handle.sh
|
||||
RUN cat .env.production
|
||||
RUN rm -f web-handle.sh
|
||||
|
||||
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
RUN cnpm install || npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM golang:alpine as gva-server
|
||||
FROM golang:alpine
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.io,direct
|
||||
WORKDIR /go/src/gin-vue-admin
|
||||
COPY server/ ./
|
||||
|
||||
RUN cat ./core/server.go
|
||||
RUN cat ./config.yaml
|
||||
COPY .docker-compose/shell/server-handle.sh .
|
||||
RUN ls -al
|
||||
RUN sh ./server-handle.sh
|
||||
RUN rm -f server-handle.sh
|
||||
RUN cat ./core/server.go
|
||||
RUN cat ./config.yaml
|
||||
|
||||
RUN go env && go list && go build -o gva-server .
|
||||
RUN go build -o gva cmd/main.go
|
||||
RUN go env && go build -o server .
|
||||
|
||||
|
||||
FROM nginx:alpine
|
||||
LABEL MAINTAINER="SliverHorn"
|
||||
FROM alpine:latest
|
||||
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
|
||||
|
||||
WORKDIR gva/
|
||||
|
||||
# copy web
|
||||
COPY --from=gva-web /gva_web/dist ./resource/dist
|
||||
# copy server
|
||||
COPY --from=gva-server /go/src/gin-vue-admin/gva-server ./
|
||||
COPY --from=gva-server /go/src/gin-vue-admin/config.yaml ./
|
||||
COPY --from=gva-server /go/src/gin-vue-admin/resource ./resource
|
||||
WORKDIR /go/src/gin-vue-admin
|
||||
|
||||
COPY --from=0 /go/src/gin-vue-admin/gva ./
|
||||
COPY --from=0 /go/src/gin-vue-admin/server ./
|
||||
COPY --from=0 /go/src/gin-vue-admin/config.yaml ./
|
||||
COPY --from=0 /go/src/gin-vue-admin/resource ./resource
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
ENTRYPOINT ./gva-server
|
||||
|
||||
# 根据Dockerfile生成Docker镜像
|
||||
|
||||
# docker build -t gva-server:1.0 .
|
||||
|
||||
#- 根据Docker镜像启动Docker容器
|
||||
# - 后台运行
|
||||
# - ```
|
||||
# docker run -d -p 8888:8888 --name gva-server-v1 gva-server:1.0
|
||||
# ```
|
||||
# - 以可交互模式运行, Ctrl + p + q
|
||||
# - ```
|
||||
# docker run -it -p 8888:8888 --name gva-server-v1 gva-server:1.0
|
||||
# ```
|
||||
ENTRYPOINT ./gva initdb && ./server
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM node:12.16.1
|
||||
|
||||
WORKDIR /gva_web/
|
||||
COPY web/ .
|
||||
|
||||
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
RUN cnpm install || npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
|
||||
|
||||
COPY .docker-compose/nginx/conf.d/my.conf /etc/nginx/conf.d/my.conf
|
||||
COPY --from=0 /gva_web/dist /usr/share/nginx/html
|
||||
RUN cat /etc/nginx/nginx.conf
|
||||
RUN cat /etc/nginx/conf.d/my.conf
|
||||
RUN ls -al /usr/share/nginx/html
|
||||
CMD ls -al /usr/share/nginx/html
|
||||
+15
-14
@@ -1,19 +1,20 @@
|
||||
FROM golang:alpine as builder
|
||||
FROM golang:alpine
|
||||
|
||||
# 设置go mod proxy 国内代理
|
||||
# 设置golang path
|
||||
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \
|
||||
GO111MODULE=on \
|
||||
CGO_ENABLED=1
|
||||
WORKDIR /ginvue
|
||||
RUN go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.io,direct
|
||||
|
||||
WORKDIR /go/src/gin-vue-admin
|
||||
COPY . .
|
||||
RUN go env && go list && go build -o app main.go
|
||||
RUN go env && go build -o server .
|
||||
|
||||
FROM alpine:latest
|
||||
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
|
||||
|
||||
WORKDIR /go/src/gin-vue-admin
|
||||
COPY --from=0 /go/src/gin-vue-admin/server ./
|
||||
COPY --from=0 /go/src/gin-vue-admin/config.yaml ./
|
||||
COPY --from=0 /go/src/gin-vue-admin/resource ./resource
|
||||
|
||||
EXPOSE 8888
|
||||
ENTRYPOINT /ginvue/app
|
||||
|
||||
# 根据Dockerfile生成Docker镜像
|
||||
# docker build -t ginvue .
|
||||
# 根据Docker镜像启动Docker容器
|
||||
# docker run -itd -p 8888:8888 --name ginvue ginvue
|
||||
ENTRYPOINT ./server
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
.PHONY: all build run gotool clean help
|
||||
|
||||
BINARY="server"
|
||||
GVA = "gva"
|
||||
|
||||
all: check gva initdb run
|
||||
|
||||
gva:
|
||||
go build -o ${GVA} cmd/main.go
|
||||
|
||||
initdb:
|
||||
@if [ -f ${GVA} ] ; then ./gva initdb && rm ${GVA} ; fi
|
||||
|
||||
linux-build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||
|
||||
windows-build:
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ${BINARY}.exe
|
||||
|
||||
mac-build:
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ${BINARY}
|
||||
|
||||
run:
|
||||
@go run main.go
|
||||
|
||||
check:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
clean:
|
||||
@if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
||||
@if [ -f ${GVA} ] ; then rm ${GVA} ; fi
|
||||
|
||||
help:
|
||||
@echo "make - 构建gva终端工具并初始化数据,初始化数据后删除gva终端工具,启动server项目"
|
||||
@echo "make gva - 构建gva终端工具"
|
||||
@echo "make initdb - 如果有gva终端工具就初始化数据,初始化数据后删除gva终端工具,没有则不会执行"
|
||||
@echo "make linux-build - 编译 Go 代码, 生成Linux系统的二进制文件"
|
||||
@echo "make windows-build - 编译 Go 代码, 生成Windows系统的exe文件"
|
||||
@echo "make mac-build - 编译 Go 代码, 生成Mac系统的二进制文件"
|
||||
@echo "make run - 直接运行 main.go"
|
||||
@echo "make clean - 移除二进制文件"
|
||||
@echo "make check - 运行 Go 工具 'fmt' and 'vet'"
|
||||
@@ -1,12 +1,12 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
)
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "an example for breakpoint resume, 断点续传示例"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}"
|
||||
// @Router /fileUploadAndDownload/breakpointContinue [post]
|
||||
func BreakpointContinue(c *gin.Context) {
|
||||
fileMd5 := c.Request.FormValue("fileMd5")
|
||||
@@ -27,32 +27,39 @@ func BreakpointContinue(c *gin.Context) {
|
||||
chunkTotal, _ := strconv.Atoi(c.Request.FormValue("chunkTotal"))
|
||||
_, FileHeader, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("接收文件失败", c)
|
||||
return
|
||||
}
|
||||
f, err := FileHeader.Open()
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
global.GVA_LOG.Error("文件读取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("文件读取失败", c)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
cen, _ := ioutil.ReadAll(f)
|
||||
if flag := utils.CheckMd5(cen, chunkMd5); !flag {
|
||||
if !utils.CheckMd5(cen, chunkMd5) {
|
||||
global.GVA_LOG.Error("检查md5失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("检查md5失败", c)
|
||||
return
|
||||
}
|
||||
err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
global.GVA_LOG.Error("查找或创建记录失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查找或创建记录失败", c)
|
||||
return
|
||||
}
|
||||
err, pathc := utils.BreakPointContinue(cen, fileName, chunkNumber, chunkTotal, fileMd5)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
global.GVA_LOG.Error("断点续传失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("断点续传失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
if err = service.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
global.GVA_LOG.Error("创建文件记录失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建文件记录失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("切片创建成功", c)
|
||||
@@ -72,14 +79,15 @@ func FindFile(c *gin.Context) {
|
||||
chunkTotal, _ := strconv.Atoi(c.Query("chunkTotal"))
|
||||
err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查找失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查找失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.FileResponse{File: file}, c)
|
||||
response.OkWithDetailed(response.FileResponse{File: file},"查找成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 查找文件
|
||||
// @Summary 创建文件
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
@@ -91,9 +99,10 @@ func BreakpointContinueFinish(c *gin.Context) {
|
||||
fileName := c.Query("fileName")
|
||||
err, filePath := utils.MakeFile(fileName, fileMd5)
|
||||
if err != nil {
|
||||
response.FailWithDetailed(response.ERROR, resp.FilePathResponse{FilePath: filePath}, fmt.Sprintf("文件创建失败:%v", err), c)
|
||||
global.GVA_LOG.Error("文件创建失败!", zap.Any("err", err))
|
||||
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建失败", c)
|
||||
} else {
|
||||
response.OkDetailed(resp.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
|
||||
response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +112,7 @@ func BreakpointContinueFinish(c *gin.Context) {
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "删除缓存切片"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"缓存切片删除成功"}"
|
||||
// @Router /fileUploadAndDownload/removeChunk [post]
|
||||
func RemoveChunk(c *gin.Context) {
|
||||
fileMd5 := c.Query("fileMd5")
|
||||
@@ -112,8 +121,9 @@ func RemoveChunk(c *gin.Context) {
|
||||
err := utils.RemoveChunk(fileMd5)
|
||||
err = service.DeleteFileChunk(fileMd5, fileName, filePath)
|
||||
if err != nil {
|
||||
response.FailWithDetailed(response.ERROR, resp.FilePathResponse{FilePath: filePath}, fmt.Sprintf("缓存切片删除失败:%v", err), c)
|
||||
global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err))
|
||||
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath},"缓存切片删除失败", c)
|
||||
} else {
|
||||
response.OkDetailed(resp.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
|
||||
response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,164 +2,140 @@ package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags ExaCustomer
|
||||
// @Summary 创建客户
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ExaCustomer true "创建客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.ExaCustomer true "客户用户名, 客户手机号码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /customer/customer [post]
|
||||
func CreateExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
CustomerVerify := utils.Rules{
|
||||
"CustomerName": {utils.NotEmpty()},
|
||||
"CustomerPhoneData": {utils.NotEmpty()},
|
||||
}
|
||||
CustomerVerifyErr := utils.Verify(cu, CustomerVerify)
|
||||
if CustomerVerifyErr != nil {
|
||||
response.FailWithMessage(CustomerVerifyErr.Error(), c)
|
||||
var customer model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&customer)
|
||||
if err := utils.Verify(customer, utils.CustomerVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
cu.SysUserID = waitUse.ID
|
||||
cu.SysUserAuthorityID = waitUse.AuthorityId
|
||||
err := service.CreateExaCustomer(cu)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败:%v", err), c)
|
||||
customer.SysUserID = getUserID(c)
|
||||
customer.SysUserAuthorityID = getUserAuthorityId(c)
|
||||
if err := service.CreateExaCustomer(customer); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags ExaCustomer
|
||||
// @Summary 删除客户
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ExaCustomer true "删除客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.ExaCustomer true "客户ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /customer/customer [delete]
|
||||
func DeleteExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
CustomerVerify := utils.Rules{
|
||||
"ID": {utils.NotEmpty()},
|
||||
}
|
||||
CustomerVerifyErr := utils.Verify(cu.Model, CustomerVerify)
|
||||
if CustomerVerifyErr != nil {
|
||||
response.FailWithMessage(CustomerVerifyErr.Error(), c)
|
||||
var customer model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&customer)
|
||||
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.DeleteExaCustomer(cu)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败:%v", err), c)
|
||||
if err := service.DeleteExaCustomer(customer); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags ExaCustomer
|
||||
// @Summary 更新客户信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ExaCustomer true "创建客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.ExaCustomer true "客户ID, 客户信息"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /customer/customer [put]
|
||||
func UpdateExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
IdCustomerVerify := utils.Rules{
|
||||
"ID": {utils.NotEmpty()},
|
||||
}
|
||||
IdCustomerVerifyErr := utils.Verify(cu.Model, IdCustomerVerify)
|
||||
if IdCustomerVerifyErr != nil {
|
||||
response.FailWithMessage(IdCustomerVerifyErr.Error(), c)
|
||||
var customer model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&customer)
|
||||
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
CustomerVerify := utils.Rules{
|
||||
"CustomerName": {utils.NotEmpty()},
|
||||
"CustomerPhoneData": {utils.NotEmpty()},
|
||||
}
|
||||
CustomerVerifyErr := utils.Verify(cu, CustomerVerify)
|
||||
if CustomerVerifyErr != nil {
|
||||
response.FailWithMessage(CustomerVerifyErr.Error(), c)
|
||||
if err := utils.Verify(customer, utils.CustomerVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.UpdateExaCustomer(&cu)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("更新失败:%v", err), c)
|
||||
if err := service.UpdateExaCustomer(&customer); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败!", c)
|
||||
} else {
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags ExaCustomer
|
||||
// @Summary 获取单一客户信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ExaCustomer true "获取单一客户信息"
|
||||
// @Param data body model.ExaCustomer true "客户ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/customer [get]
|
||||
func GetExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindQuery(&cu)
|
||||
IdCustomerVerify := utils.Rules{
|
||||
"ID": {utils.NotEmpty()},
|
||||
}
|
||||
IdCustomerVerifyErr := utils.Verify(cu.Model, IdCustomerVerify)
|
||||
if IdCustomerVerifyErr != nil {
|
||||
response.FailWithMessage(IdCustomerVerifyErr.Error(), c)
|
||||
var customer model.ExaCustomer
|
||||
_ = c.ShouldBindQuery(&customer)
|
||||
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, customer := service.GetExaCustomer(cu.ID)
|
||||
err, data := service.GetExaCustomer(customer.ID)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c)
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.ExaCustomerResponse{Customer: customer}, c)
|
||||
response.OkWithDetailed(response.ExaCustomerResponse{Customer: data}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 获取权限客户列表
|
||||
// @Tags ExaCustomer
|
||||
// @Summary 分页获取权限客户列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "获取权限客户列表"
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/customerList [get]
|
||||
func GetExaCustomerList(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindQuery(&pageInfo)
|
||||
PageVerifyErr := utils.Verify(pageInfo, utils.CustomizeMap["PageVerify"])
|
||||
if PageVerifyErr != nil {
|
||||
response.FailWithMessage(PageVerifyErr.Error(), c)
|
||||
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, customerList, total := service.GetCustomerInfoList(waitUse.AuthorityId, pageInfo)
|
||||
err, customerList, total := service.GetCustomerInfoList(getUserAuthorityId(c), pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: customerList,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"strings"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
@@ -22,42 +19,21 @@ import (
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Router /fileUploadAndDownload/upload [post]
|
||||
func UploadFile(c *gin.Context) {
|
||||
var file model.ExaFileUploadAndDownload
|
||||
noSave := c.DefaultQuery("noSave", "0")
|
||||
_, header, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("上传文件失败,%v", err), c)
|
||||
} else {
|
||||
// 文件上传后拿到文件路径
|
||||
var uploadErr error
|
||||
var filePath string
|
||||
var key string
|
||||
if global.GVA_CONFIG.LocalUpload.Local {
|
||||
// 本地上传
|
||||
uploadErr, filePath, key = utils.UploadFileLocal(header)
|
||||
} else {
|
||||
// 七牛云上传
|
||||
uploadErr, filePath, key = utils.UploadRemote(header)
|
||||
}
|
||||
if uploadErr != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("接收返回值失败,%v", err), c)
|
||||
} else {
|
||||
// 修改数据库后得到修改后的user并且返回供前端使用
|
||||
var file model.ExaFileUploadAndDownload
|
||||
file.Url = filePath
|
||||
file.Name = header.Filename
|
||||
s := strings.Split(file.Name, ".")
|
||||
file.Tag = s[len(s)-1]
|
||||
file.Key = key
|
||||
if noSave == "0" {
|
||||
err = service.Upload(file)
|
||||
}
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("修改数据库链接失败,%v", err), c)
|
||||
} else {
|
||||
response.OkDetailed(resp.ExaFileResponse{File: file}, "上传成功", c)
|
||||
}
|
||||
}
|
||||
global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("接收文件失败", c)
|
||||
return
|
||||
}
|
||||
err, file = service.UploadFile(header, noSave) // 文件上传后拿到文件路径
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("修改数据库链接失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("修改数据库链接失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.ExaFileResponse{File: file}, "上传成功", c)
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
@@ -65,28 +41,17 @@ func UploadFile(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body model.ExaFileUploadAndDownload true "传入文件里面id即可"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /fileUploadAndDownload/deleteFile [post]
|
||||
func DeleteFile(c *gin.Context) {
|
||||
var file model.ExaFileUploadAndDownload
|
||||
_ = c.ShouldBindJSON(&file)
|
||||
err, f := service.FindFile(file.ID)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
err = utils.DeleteFile(f.Key)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
|
||||
} else {
|
||||
err = service.DeleteFile(f)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
if err := service.DeleteFile(file); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
@@ -94,7 +59,7 @@ func DeleteFile(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取文件户列表"
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /fileUploadAndDownload/getFileList [post]
|
||||
func GetFileList(c *gin.Context) {
|
||||
@@ -102,13 +67,14 @@ func GetFileList(c *gin.Context) {
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, list, total := service.GetFileRecordInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
},"获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SimpleUploader
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "断点续传插件版示例"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}"
|
||||
// @Router /simpleUploader/upload [post]
|
||||
func SimpleUploaderUpload(c *gin.Context) {
|
||||
var chunk model.ExaSimpleUploader
|
||||
@@ -29,42 +30,46 @@ func SimpleUploaderUpload(c *gin.Context) {
|
||||
var chunkDir = "./chunk/" + chunk.Identifier + "/"
|
||||
hasDir, _ := utils.PathExists(chunkDir)
|
||||
if !hasDir {
|
||||
utils.CreateDir(chunkDir)
|
||||
if err := utils.CreateDir(chunkDir); err != nil {
|
||||
global.GVA_LOG.Error("创建目录失败!", zap.Any("err", err))
|
||||
}
|
||||
}
|
||||
chunkPath := chunkDir + chunk.Filename + chunk.ChunkNumber
|
||||
err = c.SaveUploadedFile(header, chunkPath)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("切片创建失败,%v", err), c)
|
||||
global.GVA_LOG.Error("切片创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("切片创建失败", c)
|
||||
return
|
||||
}
|
||||
chunk.CurrentChunkPath = chunkPath
|
||||
err = service.SaveChunk(chunk)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("切片创建失败,%v", err), c)
|
||||
global.GVA_LOG.Error("切片创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("切片创建失败", c)
|
||||
return
|
||||
} else {
|
||||
response.Ok(c)
|
||||
response.OkWithMessage("切片创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SimpleUploader
|
||||
// @Summary 断点续传插件版示例
|
||||
// @Security ApiKeyAuth
|
||||
|
||||
// @Produce application/json
|
||||
// @Param md5 query string true "测试文件是否已经存在和判断已经上传过的切片"
|
||||
// @Param md5 query string true "md5"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /simpleUploader/checkFileMd5 [get]
|
||||
func CheckFileMd5(c *gin.Context) {
|
||||
md5 := c.Query("md5")
|
||||
err, chunks, isDone := service.CheckFileMd5(md5)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("md5读取失败,%v", err), c)
|
||||
global.GVA_LOG.Error("md5读取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("md5读取失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{
|
||||
response.OkWithDetailed(gin.H{
|
||||
"chunks": chunks,
|
||||
"isDone": isDone,
|
||||
}, c)
|
||||
},"查询成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +77,7 @@ func CheckFileMd5(c *gin.Context) {
|
||||
// @Summary 合并文件
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param md5 query string true "合并文件"
|
||||
// @Param md5 query string true "md5"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"合并成功"}"
|
||||
// @Router /simpleUploader/mergeFileMd5 [get]
|
||||
func MergeFileMd5(c *gin.Context) {
|
||||
@@ -80,8 +85,9 @@ func MergeFileMd5(c *gin.Context) {
|
||||
fileName := c.Query("fileName")
|
||||
err := service.MergeFileMd5(md5, fileName)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("md5读取失败,%v", err), c)
|
||||
global.GVA_LOG.Error("md5读取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("md5读取失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{}, c)
|
||||
response.OkWithMessage("合并成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
+48
-70
@@ -1,14 +1,14 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SysApi
|
||||
@@ -16,60 +16,47 @@ import (
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysApi true "创建api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysApi true "api路径, api中文描述, api组, 方法"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /api/createApi [post]
|
||||
func CreateApi(c *gin.Context) {
|
||||
var api model.SysApi
|
||||
_ = c.ShouldBindJSON(&api)
|
||||
ApiVerify := utils.Rules{
|
||||
"Path": {utils.NotEmpty()},
|
||||
"Description": {utils.NotEmpty()},
|
||||
"ApiGroup": {utils.NotEmpty()},
|
||||
"Method": {utils.NotEmpty()},
|
||||
}
|
||||
ApiVerifyErr := utils.Verify(api, ApiVerify)
|
||||
if ApiVerifyErr != nil {
|
||||
response.FailWithMessage(ApiVerifyErr.Error(), c)
|
||||
if err := utils.Verify(api, utils.ApiVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.CreateApi(api)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
if err := service.CreateApi(api); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 删除指定api
|
||||
// @Summary 删除api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysApi true "删除api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysApi true "ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /api/deleteApi [post]
|
||||
func DeleteApi(c *gin.Context) {
|
||||
var a model.SysApi
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
ApiVerify := utils.Rules{
|
||||
"ID": {utils.NotEmpty()},
|
||||
}
|
||||
ApiVerifyErr := utils.Verify(a.Model, ApiVerify)
|
||||
if ApiVerifyErr != nil {
|
||||
response.FailWithMessage(ApiVerifyErr.Error(), c)
|
||||
var api model.SysApi
|
||||
_ = c.ShouldBindJSON(&api)
|
||||
if err := utils.Verify(api.GVA_MODEL, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.DeleteApi(a)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
if err := service.DeleteApi(api); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// 条件搜索后端看此api
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 分页获取API列表
|
||||
// @Security ApiKeyAuth
|
||||
@@ -79,24 +66,22 @@ func DeleteApi(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/getApiList [post]
|
||||
func GetApiList(c *gin.Context) {
|
||||
// 此结构体仅本方法使用
|
||||
var sp request.SearchApiParams
|
||||
_ = c.ShouldBindJSON(&sp)
|
||||
PageVerifyErr := utils.Verify(sp.PageInfo, utils.CustomizeMap["PageVerify"])
|
||||
if PageVerifyErr != nil {
|
||||
response.FailWithMessage(PageVerifyErr.Error(), c)
|
||||
var pageInfo request.SearchApiParams
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
if err := utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, list, total := service.GetAPIInfoList(sp.SysApi, sp.PageInfo, sp.OrderKey, sp.Desc)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, list, total := service.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: sp.PageInfo.Page,
|
||||
PageSize: sp.PageInfo.PageSize,
|
||||
}, c)
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,16 +96,16 @@ func GetApiList(c *gin.Context) {
|
||||
func GetApiById(c *gin.Context) {
|
||||
var idInfo request.GetById
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
IdVerifyErr := utils.Verify(idInfo, utils.CustomizeMap["IdVerify"])
|
||||
if IdVerifyErr != nil {
|
||||
response.FailWithMessage(IdVerifyErr.Error(), c)
|
||||
if err := utils.Verify(idInfo, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, api := service.GetApiById(idInfo.Id)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysAPIResponse{Api: api}, c)
|
||||
response.OkWithData(response.SysAPIResponse{Api: api}, c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,28 +114,21 @@ func GetApiById(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysApi true "创建api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysApi true "api路径, api中文描述, api组, 方法"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /api/updateApi [post]
|
||||
func UpdateApi(c *gin.Context) {
|
||||
var api model.SysApi
|
||||
_ = c.ShouldBindJSON(&api)
|
||||
ApiVerify := utils.Rules{
|
||||
"Path": {utils.NotEmpty()},
|
||||
"Description": {utils.NotEmpty()},
|
||||
"ApiGroup": {utils.NotEmpty()},
|
||||
"Method": {utils.NotEmpty()},
|
||||
}
|
||||
ApiVerifyErr := utils.Verify(api, ApiVerify)
|
||||
if ApiVerifyErr != nil {
|
||||
response.FailWithMessage(ApiVerifyErr.Error(), c)
|
||||
if err := utils.Verify(api, utils.ApiVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.UpdateApi(api)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("修改数据失败,%v", err), c)
|
||||
if err := service.UpdateApi(api); err != nil {
|
||||
global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("修改失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("修改数据成功", c)
|
||||
response.OkWithMessage("修改成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,10 +140,10 @@ func UpdateApi(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/getAllApis [post]
|
||||
func GetAllApis(c *gin.Context) {
|
||||
err, apis := service.GetAllApis()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, apis := service.GetAllApis(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysAPIListResponse{Apis: apis}, c)
|
||||
response.OkWithDetailed(response.SysAPIListResponse{Apis: apis}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,166 +1,141 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags authority
|
||||
// @Tags Authority
|
||||
// @Summary 创建角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysAuthority true "创建角色"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysAuthority true "权限id, 权限名, 父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /authority/createAuthority [post]
|
||||
func CreateAuthority(c *gin.Context) {
|
||||
var auth model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
AuthorityVerify := utils.Rules{
|
||||
"AuthorityId": {utils.NotEmpty()},
|
||||
"AuthorityName": {utils.NotEmpty()},
|
||||
"ParentId": {utils.NotEmpty()},
|
||||
}
|
||||
AuthorityVerifyErr := utils.Verify(auth, AuthorityVerify)
|
||||
if AuthorityVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityVerifyErr.Error(), c)
|
||||
var authority model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&authority)
|
||||
if err := utils.Verify(authority, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, authBack := service.CreateAuthority(auth)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
if err, authBack := service.CreateAuthority(authority); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysAuthorityResponse{Authority: authBack}, c)
|
||||
response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Tags Authority
|
||||
// @Summary 拷贝角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body response.SysAuthorityCopyResponse true "拷贝角色"
|
||||
// @Param data body response.SysAuthorityCopyResponse true "旧角色id, 新权限id, 新权限名, 新父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拷贝成功"}"
|
||||
// @Router /authority/copyAuthority [post]
|
||||
func CopyAuthority(c *gin.Context) {
|
||||
var copyInfo resp.SysAuthorityCopyResponse
|
||||
var copyInfo response.SysAuthorityCopyResponse
|
||||
_ = c.ShouldBindJSON(©Info)
|
||||
OldAuthorityVerify := utils.Rules{
|
||||
"OldAuthorityId": {utils.NotEmpty()},
|
||||
}
|
||||
OldAuthorityVerifyErr := utils.Verify(copyInfo, OldAuthorityVerify)
|
||||
if OldAuthorityVerifyErr != nil {
|
||||
response.FailWithMessage(OldAuthorityVerifyErr.Error(), c)
|
||||
if err := utils.Verify(copyInfo, utils.OldAuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
AuthorityVerify := utils.Rules{
|
||||
"AuthorityId": {utils.NotEmpty()},
|
||||
"AuthorityName": {utils.NotEmpty()},
|
||||
"ParentId": {utils.NotEmpty()},
|
||||
}
|
||||
AuthorityVerifyErr := utils.Verify(copyInfo.Authority, AuthorityVerify)
|
||||
if AuthorityVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityVerifyErr.Error(), c)
|
||||
if err := utils.Verify(copyInfo.Authority, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, authBack := service.CopyAuthority(copyInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("拷贝失败,%v", err), c)
|
||||
if err, authBack := service.CopyAuthority(copyInfo); err != nil {
|
||||
global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("拷贝失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysAuthorityResponse{Authority: authBack}, c)
|
||||
response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Tags Authority
|
||||
// @Summary 删除角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysAuthority true "删除角色"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /authority/deleteAuthority [post]
|
||||
func DeleteAuthority(c *gin.Context) {
|
||||
var a model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
AuthorityIdVerifyErr := utils.Verify(a, utils.CustomizeMap["AuthorityIdVerify"])
|
||||
if AuthorityIdVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityIdVerifyErr.Error(), c)
|
||||
var authority model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&authority)
|
||||
if err := utils.Verify(authority, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
// 删除角色之前需要判断是否有用户正在使用此角色
|
||||
err := service.DeleteAuthority(&a)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
if err := service.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Summary 设置角色资源权限
|
||||
// @Tags Authority
|
||||
// @Summary 更新角色信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysAuthority true "设置角色资源权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Param data body model.SysAuthority true "权限id, 权限名, 父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /authority/updateAuthority [post]
|
||||
func UpdateAuthority(c *gin.Context) {
|
||||
var auth model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
AuthorityVerify := utils.Rules{
|
||||
"AuthorityId": {utils.NotEmpty()},
|
||||
"AuthorityName": {utils.NotEmpty()},
|
||||
"ParentId": {utils.NotEmpty()},
|
||||
}
|
||||
AuthorityVerifyErr := utils.Verify(auth, AuthorityVerify)
|
||||
if AuthorityVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityVerifyErr.Error(), c)
|
||||
if err := utils.Verify(auth, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, authority := service.UpdateAuthority(auth)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
|
||||
if err, authority := service.UpdateAuthority(auth); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysAuthorityResponse{Authority: authority}, c)
|
||||
response.OkWithDetailed(response.SysAuthorityResponse{Authority: authority}, "更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Tags Authority
|
||||
// @Summary 分页获取角色列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取用户列表"
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /authority/getAuthorityList [post]
|
||||
func GetAuthorityList(c *gin.Context) {
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
PageVerifyErr := utils.Verify(pageInfo, utils.CustomizeMap["PageVerify"])
|
||||
if PageVerifyErr != nil {
|
||||
response.FailWithMessage(PageVerifyErr.Error(), c)
|
||||
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, list, total := service.GetAuthorityInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, list, total := service.GetAuthorityInfoList(pageInfo); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Tags Authority
|
||||
// @Summary 设置角色资源权限
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
@@ -171,15 +146,14 @@ func GetAuthorityList(c *gin.Context) {
|
||||
func SetDataAuthority(c *gin.Context) {
|
||||
var auth model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
AuthorityIdVerifyErr := utils.Verify(auth, utils.CustomizeMap["AuthorityIdVerify"])
|
||||
if AuthorityIdVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityIdVerifyErr.Error(), c)
|
||||
if err := utils.Verify(auth, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.SetDataAuthority(auth)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("设置关联失败,%v", err), c)
|
||||
if err := service.SetDataAuthority(auth); err != nil {
|
||||
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("设置失败"+err.Error(), c)
|
||||
} else {
|
||||
response.Ok(c)
|
||||
response.OkWithMessage("设置成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,18 @@ package v1
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags AutoCode
|
||||
// @Summary 自动代码模板
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
@@ -23,132 +25,87 @@ import (
|
||||
func CreateTemp(c *gin.Context) {
|
||||
var a model.AutoCodeStruct
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
AutoCodeVerify := utils.Rules{
|
||||
"Abbreviation": {utils.NotEmpty()},
|
||||
"StructName": {utils.NotEmpty()},
|
||||
"PackageName": {utils.NotEmpty()},
|
||||
"Fields": {utils.NotEmpty()},
|
||||
}
|
||||
WKVerifyErr := utils.Verify(a, AutoCodeVerify)
|
||||
if WKVerifyErr != nil {
|
||||
response.FailWithMessage(WKVerifyErr.Error(), c)
|
||||
if err := utils.Verify(a, utils.AutoCodeVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if a.AutoCreateApiToSql {
|
||||
apiList := [6]model.SysApi{
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "create" + a.StructName,
|
||||
Description: "新增" + a.Description,
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "POST",
|
||||
},
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "delete" + a.StructName,
|
||||
Description: "删除" + a.Description,
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "DELETE",
|
||||
},
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "delete" + a.StructName+"ByIds",
|
||||
Description: "批量删除" + a.Description,
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "DELETE",
|
||||
},
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "update" + a.StructName,
|
||||
Description: "更新" + a.Description,
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "PUT",
|
||||
},
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "find" + a.StructName,
|
||||
Description: "根据ID获取" + a.Description,
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "GET",
|
||||
},
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "get" + a.StructName + "List",
|
||||
Description: "获取" + a.Description + "列表",
|
||||
ApiGroup: a.Abbreviation,
|
||||
Method: "GET",
|
||||
},
|
||||
}
|
||||
for _, v := range apiList {
|
||||
errC := service.CreateApi(v)
|
||||
if errC != nil {
|
||||
c.Writer.Header().Add("success", "false")
|
||||
c.Writer.Header().Add("msg", url.QueryEscape(fmt.Sprintf("自动化创建失败,%v,请自行清空垃圾数据", errC)))
|
||||
return
|
||||
}
|
||||
if err := service.AutoCreateApi(&a); err != nil {
|
||||
global.GVA_LOG.Error("自动化创建失败!请自行清空垃圾数据!", zap.Any("err", err))
|
||||
c.Writer.Header().Add("success", "false")
|
||||
c.Writer.Header().Add("msg", url.QueryEscape("自动化创建失败!请自行清空垃圾数据!"))
|
||||
return
|
||||
}
|
||||
}
|
||||
err := service.CreateTemp(a)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
os.Remove("./ginvueadmin.zip")
|
||||
if errors.Is(err, model.AutoMoveErr) {
|
||||
c.Writer.Header().Add("success", "false")
|
||||
c.Writer.Header().Add("msgtype", "success")
|
||||
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
|
||||
} else {
|
||||
c.Writer.Header().Add("success", "false")
|
||||
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
|
||||
_ = os.Remove("./ginvueadmin.zip")
|
||||
}
|
||||
|
||||
} else {
|
||||
c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "ginvueadmin.zip")) // fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名
|
||||
c.Writer.Header().Add("Content-Type", "application/json")
|
||||
c.Writer.Header().Add("success", "true")
|
||||
c.File("./ginvueadmin.zip")
|
||||
os.Remove("./ginvueadmin.zip")
|
||||
_ = os.Remove("./ginvueadmin.zip")
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags AutoCode
|
||||
// @Summary 获取当前数据库所有表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /autoCode/getTables [get]
|
||||
|
||||
func GetTables(c *gin.Context) {
|
||||
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
|
||||
err, tables := service.GetTables(dbName)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
|
||||
global.GVA_LOG.Error("查询table失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查询table失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{
|
||||
"tables": tables,
|
||||
}, c)
|
||||
response.OkWithDetailed(gin.H{"tables": tables}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags AutoCode
|
||||
// @Summary 获取当前所有数据库
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /autoCode/getDatabase [get]
|
||||
func GetDB(c *gin.Context) {
|
||||
err, dbs := service.GetDB()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
|
||||
if err, dbs := service.GetDB(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{
|
||||
"dbs": dbs,
|
||||
}, c)
|
||||
response.OkWithDetailed(gin.H{"dbs": dbs}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Tags AutoCode
|
||||
// @Summary 获取当前表所有字段
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /autoCode/getDatabase [get]
|
||||
func GetColume(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /autoCode/getColumn [get]
|
||||
func GetColumn(c *gin.Context) {
|
||||
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
|
||||
tableName := c.Query("tableName")
|
||||
err, columes := service.GetColume(tableName, dbName)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
|
||||
if err, columns := service.GetColumn(tableName, dbName); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{
|
||||
"columes": columes,
|
||||
}, c)
|
||||
response.OkWithDetailed(gin.H{"columns": columns}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,32 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mojocn/base64Captcha"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var store = base64Captcha.DefaultMemStore
|
||||
|
||||
// @Tags base
|
||||
// @Tags Base
|
||||
// @Summary 生成验证码
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"验证码获取成功"}"
|
||||
// @Router /base/captcha [post]
|
||||
func Captcha(c *gin.Context) {
|
||||
//字符,公式,验证码配置
|
||||
// 生成默认数字的driver
|
||||
driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
|
||||
cp := base64Captcha.NewCaptcha(driver, store)
|
||||
id, b64s, err := cp.Generate()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if id, b64s, err := cp.Generate(); err != nil {
|
||||
global.GVA_LOG.Error("验证码获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("验证码获取失败", c)
|
||||
} else {
|
||||
response.OkDetailed(resp.SysCaptchaResponse{
|
||||
response.OkWithDetailed(response.SysCaptchaResponse{
|
||||
CaptchaId: id,
|
||||
PicPath: b64s,
|
||||
}, "验证码获取成功", c)
|
||||
|
||||
+21
-23
@@ -1,56 +1,54 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags casbin
|
||||
// @Summary 更改角色api权限
|
||||
// @Tags Casbin
|
||||
// @Summary 更新角色api权限
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.CasbinInReceive true "更改角色api权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body request.CasbinInReceive true "权限id, 权限模型列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /casbin/UpdateCasbin [post]
|
||||
func UpdateCasbin(c *gin.Context) {
|
||||
var cmr request.CasbinInReceive
|
||||
_ = c.ShouldBindJSON(&cmr)
|
||||
AuthorityIdVerifyErr := utils.Verify(cmr, utils.CustomizeMap["AuthorityIdVerify"])
|
||||
if AuthorityIdVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityIdVerifyErr.Error(), c)
|
||||
if err := utils.Verify(cmr, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("添加规则失败,%v", err), c)
|
||||
if err := service.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("添加规则成功", c)
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags casbin
|
||||
// @Tags Casbin
|
||||
// @Summary 获取权限列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.CasbinInReceive true "获取权限列表"
|
||||
// @Param data body request.CasbinInReceive true "权限id, 权限模型列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/getPolicyPathByAuthorityId [post]
|
||||
func GetPolicyPathByAuthorityId(c *gin.Context) {
|
||||
var cmr request.CasbinInReceive
|
||||
_ = c.ShouldBindJSON(&cmr)
|
||||
AuthorityIdVerifyErr := utils.Verify(cmr, utils.CustomizeMap["AuthorityIdVerify"])
|
||||
if AuthorityIdVerifyErr != nil {
|
||||
response.FailWithMessage(AuthorityIdVerifyErr.Error(), c)
|
||||
var casbin request.CasbinInReceive
|
||||
_ = c.ShouldBindJSON(&casbin)
|
||||
if err := utils.Verify(casbin, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
paths := service.GetPolicyPathByAuthorityId(cmr.AuthorityId)
|
||||
response.OkWithData(resp.PolicyPathResponse{Paths: paths}, c)
|
||||
paths := service.GetPolicyPathByAuthorityId(casbin.AuthorityId)
|
||||
response.OkWithDetailed(response.PolicyPathResponse{Paths: paths}, "获取成功", c)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SysDictionary
|
||||
@@ -15,15 +16,15 @@ import (
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionary true "创建SysDictionary"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysDictionary true "SysDictionary模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /sysDictionary/createSysDictionary [post]
|
||||
func CreateSysDictionary(c *gin.Context) {
|
||||
var sysDictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&sysDictionary)
|
||||
err := service.CreateSysDictionary(sysDictionary)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
var dictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&dictionary)
|
||||
if err := service.CreateSysDictionary(dictionary); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
@@ -34,15 +35,15 @@ func CreateSysDictionary(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionary true "删除SysDictionary"
|
||||
// @Param data body model.SysDictionary true "SysDictionary模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /sysDictionary/deleteSysDictionary [delete]
|
||||
func DeleteSysDictionary(c *gin.Context) {
|
||||
var sysDictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&sysDictionary)
|
||||
err := service.DeleteSysDictionary(sysDictionary)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
var dictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&dictionary)
|
||||
if err := service.DeleteSysDictionary(dictionary); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
@@ -53,15 +54,15 @@ func DeleteSysDictionary(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionary true "更新SysDictionary"
|
||||
// @Param data body model.SysDictionary true "SysDictionary模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /sysDictionary/updateSysDictionary [put]
|
||||
func UpdateSysDictionary(c *gin.Context) {
|
||||
var sysDictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&sysDictionary)
|
||||
err := service.UpdateSysDictionary(&sysDictionary)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
|
||||
var dictionary model.SysDictionary
|
||||
_ = c.ShouldBindJSON(&dictionary)
|
||||
if err := service.UpdateSysDictionary(&dictionary); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
@@ -72,17 +73,17 @@ func UpdateSysDictionary(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionary true "用id查询SysDictionary"
|
||||
// @Param data body model.SysDictionary true "ID或字典英名"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /sysDictionary/findSysDictionary [get]
|
||||
func FindSysDictionary(c *gin.Context) {
|
||||
var sysDictionary model.SysDictionary
|
||||
_ = c.ShouldBindQuery(&sysDictionary)
|
||||
err, resysDictionary := service.GetSysDictionary(sysDictionary.Type, sysDictionary.ID)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
|
||||
var dictionary model.SysDictionary
|
||||
_ = c.ShouldBindQuery(&dictionary)
|
||||
if err, sysDictionary := service.GetSysDictionary(dictionary.Type, dictionary.ID); err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查询失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{"resysDictionary": resysDictionary}, c)
|
||||
response.OkWithDetailed(gin.H{"resysDictionary": sysDictionary}, "查询成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,21 +92,25 @@ func FindSysDictionary(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.SysDictionarySearch true "分页获取SysDictionary列表"
|
||||
// @Param data body request.SysDictionarySearch true "页码, 每页大小, 搜索条件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /sysDictionary/getSysDictionaryList [get]
|
||||
func GetSysDictionaryList(c *gin.Context) {
|
||||
var pageInfo request.SysDictionarySearch
|
||||
_ = c.ShouldBindQuery(&pageInfo)
|
||||
err, list, total := service.GetSysDictionaryInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err := utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, list, total := service.GetSysDictionaryInfoList(pageInfo); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SysDictionaryDetail
|
||||
@@ -15,15 +16,15 @@ import (
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionaryDetail true "创建SysDictionaryDetail"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysDictionaryDetail true "SysDictionaryDetail模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /sysDictionaryDetail/createSysDictionaryDetail [post]
|
||||
func CreateSysDictionaryDetail(c *gin.Context) {
|
||||
var sysDictionaryDetail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
||||
err := service.CreateSysDictionaryDetail(sysDictionaryDetail)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
var detail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&detail)
|
||||
if err := service.CreateSysDictionaryDetail(detail); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
@@ -34,15 +35,15 @@ func CreateSysDictionaryDetail(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysDictionaryDetail true "删除SysDictionaryDetail"
|
||||
// @Param data body model.SysDictionaryDetail true "SysDictionaryDetail模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete]
|
||||
func DeleteSysDictionaryDetail(c *gin.Context) {
|
||||
var sysDictionaryDetail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
||||
err := service.DeleteSysDictionaryDetail(sysDictionaryDetail)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
var detail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&detail)
|
||||
if err := service.DeleteSysDictionaryDetail(detail); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
@@ -57,11 +58,11 @@ func DeleteSysDictionaryDetail(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put]
|
||||
func UpdateSysDictionaryDetail(c *gin.Context) {
|
||||
var sysDictionaryDetail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
||||
err := service.UpdateSysDictionaryDetail(&sysDictionaryDetail)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
|
||||
var detail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindJSON(&detail)
|
||||
if err := service.UpdateSysDictionaryDetail(&detail); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
@@ -76,13 +77,17 @@ func UpdateSysDictionaryDetail(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /sysDictionaryDetail/findSysDictionaryDetail [get]
|
||||
func FindSysDictionaryDetail(c *gin.Context) {
|
||||
var sysDictionaryDetail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindQuery(&sysDictionaryDetail)
|
||||
err, resysDictionaryDetail := service.GetSysDictionaryDetail(sysDictionaryDetail.ID)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
|
||||
var detail model.SysDictionaryDetail
|
||||
_ = c.ShouldBindQuery(&detail)
|
||||
if err := utils.Verify(detail, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, resysDictionaryDetail := service.GetSysDictionaryDetail(detail.ID); err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查询失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, c)
|
||||
response.OkWithDetailed(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, "查询成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,21 +96,21 @@ func FindSysDictionaryDetail(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.SysDictionaryDetailSearch true "分页获取SysDictionaryDetail列表"
|
||||
// @Param data body request.SysDictionaryDetailSearch true "页码, 每页大小, 搜索条件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get]
|
||||
func GetSysDictionaryDetailList(c *gin.Context) {
|
||||
var pageInfo request.SysDictionaryDetailSearch
|
||||
_ = c.ShouldBindQuery(&pageInfo)
|
||||
err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags system
|
||||
// @Tags System
|
||||
// @Summary 发送测试邮件
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}"
|
||||
// @Router /email/emailTest [post]
|
||||
func EmailTest(c *gin.Context) {
|
||||
err := service.EmailTest()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("发送失败,%v", err), c)
|
||||
if err := service.EmailTest(); err != nil {
|
||||
global.GVA_LOG.Error("发送失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("发送失败", c)
|
||||
} else {
|
||||
response.OkWithData("发送成功", c)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags jwt
|
||||
// @Tags Jwt
|
||||
// @Summary jwt加入黑名单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
@@ -17,12 +18,10 @@ import (
|
||||
// @Router /jwt/jsonInBlacklist [post]
|
||||
func JsonInBlacklist(c *gin.Context) {
|
||||
token := c.Request.Header.Get("x-token")
|
||||
modelJwt := model.JwtBlacklist{
|
||||
Jwt: token,
|
||||
}
|
||||
err := service.JsonInBlacklist(modelJwt)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("jwt作废失败,%v", err), c)
|
||||
jwt := model.JwtBlacklist{Jwt: token}
|
||||
if err := service.JsonInBlacklist(jwt); err != nil {
|
||||
global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("jwt作废失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("jwt作废成功", c)
|
||||
}
|
||||
|
||||
+122
-162
@@ -1,259 +1,219 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Tags AuthorityMenu
|
||||
// @Summary 获取用户动态路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body request.RegisterAndLoginStruct true "可以什么都不填"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Param data body request.Empty true "空"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getMenu [post]
|
||||
func GetMenu(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
err, menus := service.GetMenuTree(waitUse.AuthorityId)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败,%v", err), c)
|
||||
if err, menus := service.GetMenuTree(getUserAuthorityId(c)); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysMenusResponse{Menus: menus}, c)
|
||||
response.OkWithDetailed(response.SysMenusResponse{Menus: menus}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 分页获取基础menu列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取基础menu列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getMenuList [post]
|
||||
func GetMenuList(c *gin.Context) {
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
PageVerifyErr := utils.Verify(pageInfo, utils.CustomizeMap["PageVerify"])
|
||||
if PageVerifyErr != nil {
|
||||
response.FailWithMessage(PageVerifyErr.Error(), c)
|
||||
return
|
||||
}
|
||||
err, menuList, total := service.GetInfoList()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
List: menuList,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 新增菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysBaseMenu true "新增菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/addBaseMenu [post]
|
||||
func AddBaseMenu(c *gin.Context) {
|
||||
var menu model.SysBaseMenu
|
||||
_ = c.ShouldBindJSON(&menu)
|
||||
MenuVerify := utils.Rules{
|
||||
"Path": {utils.NotEmpty()},
|
||||
"ParentId": {utils.NotEmpty()},
|
||||
"Name": {utils.NotEmpty()},
|
||||
"Component": {utils.NotEmpty()},
|
||||
"Sort": {utils.Ge("0")},
|
||||
}
|
||||
MenuVerifyErr := utils.Verify(menu, MenuVerify)
|
||||
if MenuVerifyErr != nil {
|
||||
response.FailWithMessage(MenuVerifyErr.Error(), c)
|
||||
return
|
||||
}
|
||||
MetaVerify := utils.Rules{
|
||||
"Title": {utils.NotEmpty()},
|
||||
}
|
||||
MetaVerifyErr := utils.Verify(menu.Meta, MetaVerify)
|
||||
if MetaVerifyErr != nil {
|
||||
response.FailWithMessage(MetaVerifyErr.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.AddBaseMenu(menu)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("添加失败,%v", err), c)
|
||||
} else {
|
||||
response.OkWithMessage("添加成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Tags AuthorityMenu
|
||||
// @Summary 获取用户动态路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body request.RegisterAndLoginStruct true "可以什么都不填"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Param data body request.Empty true "空"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getBaseMenuTree [post]
|
||||
func GetBaseMenuTree(c *gin.Context) {
|
||||
err, menus := service.GetBaseMenuTree()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败,%v", err), c)
|
||||
if err, menus := service.GetBaseMenuTree(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysBaseMenusResponse{Menus: menus}, c)
|
||||
response.OkWithDetailed(response.SysBaseMenusResponse{Menus: menus}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Tags AuthorityMenu
|
||||
// @Summary 增加menu和角色关联关系
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.AddMenuAuthorityInfo true "增加menu和角色关联关系"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body request.AddMenuAuthorityInfo true "角色ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
// @Router /menu/addMenuAuthority [post]
|
||||
func AddMenuAuthority(c *gin.Context) {
|
||||
var addMenuAuthorityInfo request.AddMenuAuthorityInfo
|
||||
_ = c.ShouldBindJSON(&addMenuAuthorityInfo)
|
||||
MenuVerify := utils.Rules{
|
||||
"AuthorityId": {"notEmpty"},
|
||||
}
|
||||
MenuVerifyErr := utils.Verify(addMenuAuthorityInfo, MenuVerify)
|
||||
if MenuVerifyErr != nil {
|
||||
response.FailWithMessage(MenuVerifyErr.Error(), c)
|
||||
var authorityMenu request.AddMenuAuthorityInfo
|
||||
_ = c.ShouldBindJSON(&authorityMenu)
|
||||
if err := utils.Verify(authorityMenu, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("添加失败,%v", err), c)
|
||||
if err := service.AddMenuAuthority(authorityMenu.Menus, authorityMenu.AuthorityId); err != nil {
|
||||
global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("添加失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("添加成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Tags AuthorityMenu
|
||||
// @Summary 获取指定角色menu
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.AuthorityIdInfo true "增加menu和角色关联关系"
|
||||
// @Param data body request.GetAuthorityId true "角色ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/GetMenuAuthority [post]
|
||||
func GetMenuAuthority(c *gin.Context) {
|
||||
var authorityIdInfo request.AuthorityIdInfo
|
||||
_ = c.ShouldBindJSON(&authorityIdInfo)
|
||||
MenuVerify := utils.Rules{
|
||||
"AuthorityId": {"notEmpty"},
|
||||
}
|
||||
MenuVerifyErr := utils.Verify(authorityIdInfo, MenuVerify)
|
||||
if MenuVerifyErr != nil {
|
||||
response.FailWithMessage(MenuVerifyErr.Error(), c)
|
||||
var param request.GetAuthorityId
|
||||
_ = c.ShouldBindJSON(¶m)
|
||||
if err := utils.Verify(param, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, menus := service.GetMenuAuthority(authorityIdInfo.AuthorityId)
|
||||
if err != nil {
|
||||
response.FailWithDetailed(response.ERROR, resp.SysMenusResponse{Menus: menus}, fmt.Sprintf("添加失败,%v", err), c)
|
||||
if err, menus := service.GetMenuAuthority(¶m); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithDetailed(response.SysMenusResponse{Menus: menus}, "获取失败", c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"menus": menus}, "获取成功", c)
|
||||
response.OkWithDetailed(gin.H{"menus": menus}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Tags Menu
|
||||
// @Summary 新增菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
// @Router /menu/addBaseMenu [post]
|
||||
func AddBaseMenu(c *gin.Context) {
|
||||
var menu model.SysBaseMenu
|
||||
_ = c.ShouldBindJSON(&menu)
|
||||
if err := utils.Verify(menu, utils.MenuVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := utils.Verify(menu.Meta, utils.MenuMetaVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := service.AddBaseMenu(menu); err != nil {
|
||||
global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
|
||||
|
||||
response.FailWithMessage("添加失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("添加成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Menu
|
||||
// @Summary 删除菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.GetById true "删除菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body request.GetById true "菜单id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /menu/deleteBaseMenu [post]
|
||||
func DeleteBaseMenu(c *gin.Context) {
|
||||
var idInfo request.GetById
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
IdVerifyErr := utils.Verify(idInfo, utils.CustomizeMap["IdVerify"])
|
||||
if IdVerifyErr != nil {
|
||||
response.FailWithMessage(IdVerifyErr.Error(), c)
|
||||
var menu request.GetById
|
||||
_ = c.ShouldBindJSON(&menu)
|
||||
if err := utils.Verify(menu, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.DeleteBaseMenu(idInfo.Id)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败:%v", err), c)
|
||||
if err := service.DeleteBaseMenu(menu.Id); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Tags Menu
|
||||
// @Summary 更新菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysBaseMenu true "更新菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Param data body model.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /menu/updateBaseMenu [post]
|
||||
func UpdateBaseMenu(c *gin.Context) {
|
||||
var menu model.SysBaseMenu
|
||||
_ = c.ShouldBindJSON(&menu)
|
||||
MenuVerify := utils.Rules{
|
||||
"Path": {"notEmpty"},
|
||||
"ParentId": {utils.NotEmpty()},
|
||||
"Name": {utils.NotEmpty()},
|
||||
"Component": {utils.NotEmpty()},
|
||||
"Sort": {utils.Ge("0")},
|
||||
}
|
||||
MenuVerifyErr := utils.Verify(menu, MenuVerify)
|
||||
if MenuVerifyErr != nil {
|
||||
response.FailWithMessage(MenuVerifyErr.Error(), c)
|
||||
if err := utils.Verify(menu, utils.MenuVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
MetaVerify := utils.Rules{
|
||||
"Title": {utils.NotEmpty()},
|
||||
}
|
||||
MetaVerifyErr := utils.Verify(menu.Meta, MetaVerify)
|
||||
if MetaVerifyErr != nil {
|
||||
response.FailWithMessage(MetaVerifyErr.Error(), c)
|
||||
if err := utils.Verify(menu.Meta, utils.MenuMetaVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.UpdateBaseMenu(menu)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("修改失败:%v", err), c)
|
||||
if err := service.UpdateBaseMenu(menu); err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("修改成功", c)
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Tags Menu
|
||||
// @Summary 根据id获取菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.GetById true "根据id获取菜单"
|
||||
// @Param data body request.GetById true "菜单id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getBaseMenuById [post]
|
||||
func GetBaseMenuById(c *gin.Context) {
|
||||
var idInfo request.GetById
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
MenuVerify := utils.Rules{
|
||||
"Id": {"notEmpty"},
|
||||
}
|
||||
MenuVerifyErr := utils.Verify(idInfo, MenuVerify)
|
||||
if MenuVerifyErr != nil {
|
||||
response.FailWithMessage(MenuVerifyErr.Error(), c)
|
||||
if err := utils.Verify(idInfo, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, menu := service.GetBaseMenuById(idInfo.Id)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询失败:%v", err), c)
|
||||
if err, menu := service.GetBaseMenuById(idInfo.Id); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysBaseMenuResponse{Menu: menu}, c)
|
||||
response.OkWithDetailed(response.SysBaseMenuResponse{Menu: menu}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Menu
|
||||
// @Summary 分页获取基础menu列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getMenuList [post]
|
||||
func GetMenuList(c *gin.Context) {
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, menuList, total := service.GetInfoList(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: menuList,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
},"获取成功", c)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags SysOperationRecord
|
||||
@@ -21,9 +22,9 @@ import (
|
||||
func CreateSysOperationRecord(c *gin.Context) {
|
||||
var sysOperationRecord model.SysOperationRecord
|
||||
_ = c.ShouldBindJSON(&sysOperationRecord)
|
||||
err := service.CreateSysOperationRecord(sysOperationRecord)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
||||
if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
@@ -34,15 +35,15 @@ func CreateSysOperationRecord(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysOperationRecord true "删除SysOperationRecord"
|
||||
// @Param data body model.SysOperationRecord true "SysOperationRecord模型"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /sysOperationRecord/deleteSysOperationRecord [delete]
|
||||
func DeleteSysOperationRecord(c *gin.Context) {
|
||||
var sysOperationRecord model.SysOperationRecord
|
||||
_ = c.ShouldBindJSON(&sysOperationRecord)
|
||||
err := service.DeleteSysOperationRecord(sysOperationRecord)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
@@ -54,16 +55,16 @@ func DeleteSysOperationRecord(c *gin.Context) {
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除SysOperationRecord"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
|
||||
// @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete]
|
||||
func DeleteSysOperationRecordByIds(c *gin.Context) {
|
||||
var IDS request.IdsReq
|
||||
_ = c.ShouldBindJSON(&IDS)
|
||||
err := service.DeleteSysOperationRecordByIds(IDS)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
if err := service.DeleteSysOperationRecordByIds(IDS); err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("批量删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,17 +73,21 @@ func DeleteSysOperationRecordByIds(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysOperationRecord true "用id查询SysOperationRecord"
|
||||
// @Param data body model.SysOperationRecord true "Id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /sysOperationRecord/findSysOperationRecord [get]
|
||||
func FindSysOperationRecord(c *gin.Context) {
|
||||
var sysOperationRecord model.SysOperationRecord
|
||||
_ = c.ShouldBindQuery(&sysOperationRecord)
|
||||
err, resysOperationRecord := service.GetSysOperationRecord(sysOperationRecord.ID)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
|
||||
if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, resysOperationRecord := service.GetSysOperationRecord(sysOperationRecord.ID); err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查询失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{"resysOperationRecord": resysOperationRecord}, c)
|
||||
response.OkWithDetailed(gin.H{"resysOperationRecord": resysOperationRecord}, "查询成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,21 +96,21 @@ func FindSysOperationRecord(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.SysOperationRecordSearch true "分页获取SysOperationRecord列表"
|
||||
// @Param data body request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /sysOperationRecord/getSysOperationRecordList [get]
|
||||
func GetSysOperationRecordList(c *gin.Context) {
|
||||
var pageInfo request.SysOperationRecordSearch
|
||||
_ = c.ShouldBindQuery(&pageInfo)
|
||||
err, list, total := service.GetSysOperationRecordInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
+39
-22
@@ -1,62 +1,79 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags system
|
||||
// @Tags System
|
||||
// @Summary 获取配置文件内容
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/getSystemConfig [post]
|
||||
func GetSystemConfig(c *gin.Context) {
|
||||
err, config := service.GetSystemConfig()
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败,%v", err), c)
|
||||
if err, config := service.GetSystemConfig(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.SysConfigResponse{Config: config}, c)
|
||||
response.OkWithDetailed(response.SysConfigResponse{Config: config}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags system
|
||||
// @Tags System
|
||||
// @Summary 设置配置文件内容
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body model.System true "设置配置文件内容"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Router /system/setSystemConfig [post]
|
||||
func SetSystemConfig(c *gin.Context) {
|
||||
var sys model.System
|
||||
_ = c.ShouldBindJSON(&sys)
|
||||
err := service.SetSystemConfig(sys)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("设置失败,%v", err), c)
|
||||
if err := service.SetSystemConfig(sys); err != nil {
|
||||
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("设置失败", c)
|
||||
} else {
|
||||
response.OkWithData("设置成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// 本方法开发中 开发者windows系统 缺少linux系统所需的包 因此搁置
|
||||
// @Tags system
|
||||
// @Summary 设置配置文件内容
|
||||
// @Tags System
|
||||
// @Summary 重启系统
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body model.System true "设置配置文件内容"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Param data body model.System true "重启系统"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"重启系统成功"}"
|
||||
// @Router /system/ReloadSystem [post]
|
||||
func ReloadSystem(c *gin.Context) {
|
||||
var sys model.System
|
||||
_ = c.ShouldBindJSON(&sys)
|
||||
err := service.SetSystemConfig(sys)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("设置失败,%v", err), c)
|
||||
if err := service.SetSystemConfig(sys); err != nil {
|
||||
global.GVA_LOG.Error("重启系统失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("重启系统失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("设置成功", c)
|
||||
response.OkWithMessage("重启系统成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags System
|
||||
// @Summary 获取服务器信息
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/getServerInfo [post]
|
||||
func GetServerInfo(c *gin.Context) {
|
||||
if server, err := service.GetServerInfo(); err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
return
|
||||
} else {
|
||||
response.OkWithDetailed(gin.H{"server": server}, "获取成功", c)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+128
-119
@@ -1,90 +1,50 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/middleware"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
resp "gin-vue-admin/model/response"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-redis/redis"
|
||||
"mime/multipart"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
)
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户注册账号
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysUser true "用户注册接口"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
|
||||
// @Router /base/register [post]
|
||||
func Register(c *gin.Context) {
|
||||
var R request.RegisterStruct
|
||||
_ = c.ShouldBindJSON(&R)
|
||||
UserVerify := utils.Rules{
|
||||
"Username": {utils.NotEmpty()},
|
||||
"NickName": {utils.NotEmpty()},
|
||||
"Password": {utils.NotEmpty()},
|
||||
"AuthorityId": {utils.NotEmpty()},
|
||||
}
|
||||
UserVerifyErr := utils.Verify(R, UserVerify)
|
||||
if UserVerifyErr != nil {
|
||||
response.FailWithMessage(UserVerifyErr.Error(), c)
|
||||
return
|
||||
}
|
||||
user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
|
||||
err, userReturn := service.Register(*user)
|
||||
if err != nil {
|
||||
response.FailWithDetailed(response.ERROR, resp.SysUserResponse{User: userReturn}, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
response.OkDetailed(resp.SysUserResponse{User: userReturn}, "注册成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户登录
|
||||
// @Produce application/json
|
||||
// @Param data body request.RegisterAndLoginStruct true "用户登录接口"
|
||||
// @Param data body request.Login true "用户名, 密码, 验证码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /base/login [post]
|
||||
func Login(c *gin.Context) {
|
||||
var L request.RegisterAndLoginStruct
|
||||
var L request.Login
|
||||
_ = c.ShouldBindJSON(&L)
|
||||
UserVerify := utils.Rules{
|
||||
"CaptchaId": {utils.NotEmpty()},
|
||||
"Captcha": {utils.NotEmpty()},
|
||||
"Username": {utils.NotEmpty()},
|
||||
"Password": {utils.NotEmpty()},
|
||||
}
|
||||
UserVerifyErr := utils.Verify(L, UserVerify)
|
||||
if UserVerifyErr != nil {
|
||||
response.FailWithMessage(UserVerifyErr.Error(), c)
|
||||
if err := utils.Verify(L, utils.LoginVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if store.Verify(L.CaptchaId, L.Captcha, true) {
|
||||
U := &model.SysUser{Username: L.Username, Password: L.Password}
|
||||
if err, user := service.Login(U); err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("用户名密码错误或%v", err), c)
|
||||
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误", zap.Any("err", err))
|
||||
response.FailWithMessage("用户名不存在或者密码错误", c)
|
||||
} else {
|
||||
tokenNext(c, *user)
|
||||
}
|
||||
} else {
|
||||
response.FailWithMessage("验证码错误", c)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 登录以后签发jwt
|
||||
func tokenNext(c *gin.Context, user model.SysUser) {
|
||||
j := &middleware.JWT{
|
||||
SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey), // 唯一签名
|
||||
}
|
||||
clams := request.CustomClaims{
|
||||
j := &middleware.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名
|
||||
claims := request.CustomClaims{
|
||||
UUID: user.UUID,
|
||||
ID: user.ID,
|
||||
NickName: user.NickName,
|
||||
@@ -97,32 +57,34 @@ func tokenNext(c *gin.Context, user model.SysUser) {
|
||||
Issuer: "qmPlus", // 签名的发行者
|
||||
},
|
||||
}
|
||||
token, err := j.CreateToken(clams)
|
||||
token, err := j.CreateToken(claims)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取token失败", zap.Any("err", err))
|
||||
response.FailWithMessage("获取token失败", c)
|
||||
return
|
||||
}
|
||||
if !global.GVA_CONFIG.System.UseMultipoint {
|
||||
response.OkWithData(resp.LoginResponse{
|
||||
response.OkWithDetailed(response.LoginResponse{
|
||||
User: user,
|
||||
Token: token,
|
||||
ExpiresAt: clams.StandardClaims.ExpiresAt * 1000,
|
||||
}, c)
|
||||
ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
|
||||
}, "登录成功", c)
|
||||
return
|
||||
}
|
||||
err, jwtStr := service.GetRedisJWT(user.Username)
|
||||
if err == redis.Nil {
|
||||
if err, jwtStr := service.GetRedisJWT(user.Username); err == redis.Nil {
|
||||
if err := service.SetRedisJWT(token, user.Username); err != nil {
|
||||
global.GVA_LOG.Error("设置登录状态失败", zap.Any("err", err))
|
||||
response.FailWithMessage("设置登录状态失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(resp.LoginResponse{
|
||||
response.OkWithDetailed(response.LoginResponse{
|
||||
User: user,
|
||||
Token: token,
|
||||
ExpiresAt: clams.StandardClaims.ExpiresAt * 1000,
|
||||
}, c)
|
||||
ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
|
||||
}, "登录成功", c)
|
||||
} else if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("%v", err), c)
|
||||
global.GVA_LOG.Error("设置登录状态失败", zap.Any("err", err))
|
||||
response.FailWithMessage("设置登录状态失败", c)
|
||||
} else {
|
||||
var blackJWT model.JwtBlacklist
|
||||
blackJWT.Jwt = jwtStr
|
||||
@@ -130,15 +92,38 @@ func tokenNext(c *gin.Context, user model.SysUser) {
|
||||
response.FailWithMessage("jwt作废失败", c)
|
||||
return
|
||||
}
|
||||
if err := service.SetRedisJWT(jwtStr, user.Username); err != nil {
|
||||
if err := service.SetRedisJWT(token, user.Username); err != nil {
|
||||
response.FailWithMessage("设置登录状态失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(resp.LoginResponse{
|
||||
response.OkWithDetailed(response.LoginResponse{
|
||||
User: user,
|
||||
Token: token,
|
||||
ExpiresAt: clams.StandardClaims.ExpiresAt * 1000,
|
||||
}, c)
|
||||
ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
|
||||
}, "登录成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysUser
|
||||
// @Summary 用户注册账号
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysUser true "用户名, 昵称, 密码, 角色ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
|
||||
// @Router /user/register [post]
|
||||
func Register(c *gin.Context) {
|
||||
var R request.Register
|
||||
_ = c.ShouldBindJSON(&R)
|
||||
if err := utils.Verify(R, utils.RegisterVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
|
||||
err, userReturn := service.Register(*user)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("注册失败", zap.Any("err", err))
|
||||
response.FailWithDetailed(response.SysUserResponse{User: userReturn}, "注册失败", c)
|
||||
} else {
|
||||
response.OkWithDetailed(response.SysUserResponse{User: userReturn}, "注册成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,60 +131,50 @@ func tokenNext(c *gin.Context, user model.SysUser) {
|
||||
// @Summary 用户修改密码
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body request.ChangePasswordStruct true "用户修改密码"
|
||||
// @Param data body request.ChangePasswordStruct true "用户名, 原密码, 新密码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /user/changePassword [put]
|
||||
func ChangePassword(c *gin.Context) {
|
||||
var params request.ChangePasswordStruct
|
||||
_ = c.ShouldBindJSON(¶ms)
|
||||
UserVerify := utils.Rules{
|
||||
"Username": {utils.NotEmpty()},
|
||||
"Password": {utils.NotEmpty()},
|
||||
"NewPassword": {utils.NotEmpty()},
|
||||
}
|
||||
UserVerifyErr := utils.Verify(params, UserVerify)
|
||||
if UserVerifyErr != nil {
|
||||
response.FailWithMessage(UserVerifyErr.Error(), c)
|
||||
var user request.ChangePasswordStruct
|
||||
_ = c.ShouldBindJSON(&user)
|
||||
if err := utils.Verify(user, utils.ChangePasswordVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
U := &model.SysUser{Username: params.Username, Password: params.Password}
|
||||
if err, _ := service.ChangePassword(U, params.NewPassword); err != nil {
|
||||
response.FailWithMessage("修改失败,请检查用户名密码", c)
|
||||
U := &model.SysUser{Username: user.Username, Password: user.Password}
|
||||
if err, _ := service.ChangePassword(U, user.NewPassword); err != nil {
|
||||
global.GVA_LOG.Error("修改失败", zap.Any("err", err))
|
||||
response.FailWithMessage("修改失败,原密码与当前账户不符", c)
|
||||
} else {
|
||||
response.OkWithMessage("修改成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
type UserHeaderImg struct {
|
||||
HeaderImg multipart.File `json:"headerImg"`
|
||||
}
|
||||
|
||||
// @Tags SysUser
|
||||
// @Summary 分页获取用户列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取用户列表"
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /user/getUserList [post]
|
||||
func GetUserList(c *gin.Context) {
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
PageVerifyErr := utils.Verify(pageInfo, utils.CustomizeMap["PageVerify"])
|
||||
if PageVerifyErr != nil {
|
||||
response.FailWithMessage(PageVerifyErr.Error(), c)
|
||||
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err, list, total := service.GetUserInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
if err, list, total := service.GetUserInfoList(pageInfo); err != nil {
|
||||
global.GVA_LOG.Error("获取失败", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败", c)
|
||||
} else {
|
||||
response.OkWithData(resp.PageResult{
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, c)
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,24 +183,19 @@ func GetUserList(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.SetUserAuth true "设置用户权限"
|
||||
// @Param data body request.SetUserAuth true "用户UUID, 角色ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /user/setUserAuthority [post]
|
||||
func SetUserAuthority(c *gin.Context) {
|
||||
var sua request.SetUserAuth
|
||||
_ = c.ShouldBindJSON(&sua)
|
||||
UserVerify := utils.Rules{
|
||||
"UUID": {utils.NotEmpty()},
|
||||
"AuthorityId": {utils.NotEmpty()},
|
||||
}
|
||||
UserVerifyErr := utils.Verify(sua, UserVerify)
|
||||
if UserVerifyErr != nil {
|
||||
if UserVerifyErr := utils.Verify(sua, utils.SetUserAuthorityVerify); UserVerifyErr != nil {
|
||||
response.FailWithMessage(UserVerifyErr.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.SetUserAuthority(sua.UUID, sua.AuthorityId)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("修改失败,%v", err), c)
|
||||
if err := service.SetUserAuthority(sua.UUID, sua.AuthorityId); err != nil {
|
||||
global.GVA_LOG.Error("修改失败", zap.Any("err", err))
|
||||
response.FailWithMessage("修改失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("修改成功", c)
|
||||
}
|
||||
@@ -236,42 +206,81 @@ func SetUserAuthority(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.GetById true "删除用户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Param data body request.GetById true "用户ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /user/deleteUser [delete]
|
||||
func DeleteUser(c *gin.Context) {
|
||||
var reqId request.GetById
|
||||
_ = c.ShouldBindJSON(&reqId)
|
||||
IdVerifyErr := utils.Verify(reqId, utils.CustomizeMap["IdVerify"])
|
||||
if IdVerifyErr != nil {
|
||||
response.FailWithMessage(IdVerifyErr.Error(), c)
|
||||
if err := utils.Verify(reqId, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.DeleteUser(reqId.Id)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
||||
jwtId := getUserID(c)
|
||||
if jwtId == uint(reqId.Id) {
|
||||
response.FailWithMessage("删除失败, 自杀失败", c)
|
||||
return
|
||||
}
|
||||
if err := service.DeleteUser(reqId.Id); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysUser
|
||||
// @Summary 删除用户
|
||||
// @Summary 设置用户信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SysUser true "删除用户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Param data body model.SysUser true "ID, 用户名, 昵称, 头像链接"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Router /user/setUserInfo [put]
|
||||
func SetUserInfo(c *gin.Context) {
|
||||
var user model.SysUser
|
||||
c.ShouldBindJSON(&user)
|
||||
err, ReqUser := service.SetUserInfo(user)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
|
||||
_ = c.ShouldBindJSON(&user)
|
||||
if err := utils.Verify(user, utils.SetUserVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, ReqUser := service.SetUserInfo(user); err != nil {
|
||||
global.GVA_LOG.Error("设置失败", zap.Any("err", err))
|
||||
response.FailWithMessage("设置失败", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{
|
||||
"userInfo": ReqUser,
|
||||
}, c)
|
||||
response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "设置成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// 从Gin的Context中获取从jwt解析出来的用户ID
|
||||
func getUserID(c *gin.Context) uint {
|
||||
if claims, exists := c.Get("claims"); !exists {
|
||||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户ID失败, 请检查路由是否使用jwt中间件")
|
||||
return 0
|
||||
} else {
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
return waitUse.ID
|
||||
}
|
||||
}
|
||||
|
||||
// 从Gin的Context中获取从jwt解析出来的用户UUID
|
||||
func getUserUuid(c *gin.Context) string {
|
||||
if claims, exists := c.Get("claims"); !exists {
|
||||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件")
|
||||
return ""
|
||||
} else {
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
return waitUse.UUID.String()
|
||||
}
|
||||
}
|
||||
|
||||
// 从Gin的Context中获取从jwt解析出来的用户角色id
|
||||
func getUserAuthorityId(c *gin.Context) string {
|
||||
if claims, exists := c.Get("claims"); !exists {
|
||||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件")
|
||||
return ""
|
||||
} else {
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
return waitUse.AuthorityId
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @Tags workflow
|
||||
@@ -18,21 +19,14 @@ import (
|
||||
func CreateWorkFlow(c *gin.Context) {
|
||||
var wk model.SysWorkflow
|
||||
_ = c.ShouldBindJSON(&wk)
|
||||
WKVerify := utils.Rules{
|
||||
"WorkflowNickName": {utils.NotEmpty()},
|
||||
"WorkflowName": {utils.NotEmpty()},
|
||||
"WorkflowDescription": {utils.NotEmpty()},
|
||||
"WorkflowStepInfo": {utils.NotEmpty()},
|
||||
}
|
||||
WKVerifyErr := utils.Verify(wk, WKVerify)
|
||||
if WKVerifyErr != nil {
|
||||
response.FailWithMessage(WKVerifyErr.Error(), c)
|
||||
if err := utils.Verify(wk, utils.WorkFlowVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err := service.Create(wk)
|
||||
if err != nil {
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c)
|
||||
if err := service.Create(wk); err != nil {
|
||||
global.GVA_LOG.Error("注册失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("注册失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("获取成功", c)
|
||||
response.OkWithMessage("注册成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func InitAuthorityMenu(db *gorm.DB) {
|
||||
if err := db.Exec("CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`, `sys_base_menus`.`updated_at` AS `updated_at`, `sys_base_menus`.`deleted_at` AS `deleted_at`, `sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`, `sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on ((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`)))").Error; err != nil {
|
||||
color.Danger.Println("authority_menu视图已存在!")
|
||||
return
|
||||
}
|
||||
color.Info.Println("authority_menu视图创建成功!")
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Apis = []model.SysApi{
|
||||
{global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/base/login", "用户登录", "base", "POST"},
|
||||
{global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/register", "用户注册", "user", "POST"},
|
||||
{global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/createApi", "创建api", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiList", "获取api列表", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiById", "获取api详细信息", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApi", "删除Api", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/updateApi", "更新Api", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getAllApis", "获取所有api", "api", "POST"},
|
||||
{global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/createAuthority", "创建角色", "authority", "POST"},
|
||||
{global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/deleteAuthority", "删除角色", "authority", "POST"},
|
||||
{global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/getAuthorityList", "获取角色列表", "authority", "POST"},
|
||||
{global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenu", "获取菜单树", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuList", "分页获取基础menu列表", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addBaseMenu", "新增菜单", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuTree", "获取用户动态路由", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addMenuAuthority", "增加menu和角色关联关系", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuAuthority", "获取指定角色menu", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/deleteBaseMenu", "删除菜单", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/updateBaseMenu", "更新菜单", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuById", "根据id获取菜单", "menu", "POST"},
|
||||
{global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/changePassword", "修改密码", "user", "POST"},
|
||||
{global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/getUserList", "获取用户列表", "user", "POST"},
|
||||
{global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserAuthority", "修改用户角色", "user", "POST"},
|
||||
{global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/upload", "文件上传示例", "fileUploadAndDownload", "POST"},
|
||||
{global.GVA_MODEL{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/getFileList", "获取上传文件列表", "fileUploadAndDownload", "POST"},
|
||||
{global.GVA_MODEL{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/updateCasbin", "更改角色api权限", "casbin", "POST"},
|
||||
{global.GVA_MODEL{ID: 28, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/getPolicyPathByAuthorityId", "获取权限列表", "casbin", "POST"},
|
||||
{global.GVA_MODEL{ID: 29, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/deleteFile", "删除文件", "fileUploadAndDownload", "POST"},
|
||||
{global.GVA_MODEL{ID: 30, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/jwt/jsonInBlacklist", "jwt加入黑名单", "jwt", "POST"},
|
||||
{global.GVA_MODEL{ID: 31, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/setDataAuthority", "设置角色资源权限", "authority", "POST"},
|
||||
{global.GVA_MODEL{ID: 32, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/getSystemConfig", "获取配置文件内容", "system", "POST"},
|
||||
{global.GVA_MODEL{ID: 33, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/setSystemConfig", "设置配置文件内容", "system", "POST"},
|
||||
{global.GVA_MODEL{ID: 34, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "创建客户", "customer", "POST"},
|
||||
{global.GVA_MODEL{ID: 35, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "更新客户", "customer", "PUT"},
|
||||
{global.GVA_MODEL{ID: 36, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "删除客户", "customer", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 37, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "获取单一客户", "customer", "GET"},
|
||||
{global.GVA_MODEL{ID: 38, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customerList", "获取客户列表", "customer", "GET"},
|
||||
{global.GVA_MODEL{ID: 39, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/casbinTest/:pathParam", "RESTFUL模式测试", "casbin", "GET"},
|
||||
{global.GVA_MODEL{ID: 40, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/createTemp", "自动化代码", "autoCode", "POST"},
|
||||
{global.GVA_MODEL{ID: 41, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/updateAuthority", "更新角色信息", "authority", "PUT"},
|
||||
{global.GVA_MODEL{ID: 42, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/copyAuthority", "拷贝角色", "authority", "POST"},
|
||||
{global.GVA_MODEL{ID: 43, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/deleteUser", "删除用户", "user", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 44, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/createSysDictionaryDetail", "新增字典内容", "sysDictionaryDetail", "POST"},
|
||||
{global.GVA_MODEL{ID: 45, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/deleteSysDictionaryDetail", "删除字典内容", "sysDictionaryDetail", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 46, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/updateSysDictionaryDetail", "更新字典内容", "sysDictionaryDetail", "PUT"},
|
||||
{global.GVA_MODEL{ID: 47, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/findSysDictionaryDetail", "根据ID获取字典内容", "sysDictionaryDetail", "GET"},
|
||||
{global.GVA_MODEL{ID: 48, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/getSysDictionaryDetailList", "获取字典内容列表", "sysDictionaryDetail", "GET"},
|
||||
{global.GVA_MODEL{ID: 49, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/createSysDictionary", "新增字典", "sysDictionary", "POST"},
|
||||
{global.GVA_MODEL{ID: 50, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/deleteSysDictionary", "删除字典", "sysDictionary", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 51, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/updateSysDictionary", "更新字典", "sysDictionary", "PUT"},
|
||||
{global.GVA_MODEL{ID: 52, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/findSysDictionary", "根据ID获取字典", "sysDictionary", "GET"},
|
||||
{global.GVA_MODEL{ID: 53, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/getSysDictionaryList", "获取字典列表", "sysDictionary", "GET"},
|
||||
{global.GVA_MODEL{ID: 54, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/createSysOperationRecord", "新增操作记录", "sysOperationRecord", "POST"},
|
||||
{global.GVA_MODEL{ID: 55, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecord", "删除操作记录", "sysOperationRecord", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 56, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/findSysOperationRecord", "根据ID获取操作记录", "sysOperationRecord", "GET"},
|
||||
{global.GVA_MODEL{ID: 57, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/getSysOperationRecordList", "获取操作记录列表", "sysOperationRecord", "GET"},
|
||||
{global.GVA_MODEL{ID: 58, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getTables", "获取数据库表", "autoCode", "GET"},
|
||||
{global.GVA_MODEL{ID: 59, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getDB", "获取所有数据库", "autoCode", "GET"},
|
||||
{global.GVA_MODEL{ID: 60, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getColumn", "获取所选table的所有字段", "autoCode", "GET"},
|
||||
{global.GVA_MODEL{ID: 61, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecordByIds", "批量删除操作历史", "sysOperationRecord", "DELETE"},
|
||||
{global.GVA_MODEL{ID: 62, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/upload", "插件版分片上传", "simpleUploader", "POST"},
|
||||
{global.GVA_MODEL{ID: 63, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/checkFileMd5", "文件完整度验证", "simpleUploader", "GET"},
|
||||
{global.GVA_MODEL{ID: 64, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/mergeFileMd5", "上传完成合并文件", "simpleUploader", "GET"},
|
||||
{global.GVA_MODEL{ID: 65, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserInfo", "设置用户信息", "user", "PUT"},
|
||||
{global.GVA_MODEL{ID: 66, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/getServerInfo", "获取服务器信息", "system", "POST"},
|
||||
{global.GVA_MODEL{ID: 67, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/email/emailTest", "发送测试邮件", "email", "POST"},
|
||||
}
|
||||
|
||||
func InitSysApi(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 67}).Find(&[]model.SysApi{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_apis表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Apis).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_apis 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Authorities = []model.SysAuthority{
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "888", AuthorityName: "普通用户", ParentId: "0"},
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "8881", AuthorityName: "普通用户子角色", ParentId: "888"},
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "9528", AuthorityName: "测试角色", ParentId: "0"},
|
||||
}
|
||||
|
||||
func InitSysAuthority(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("authority_id IN ? ", []string{"888", "9528"}).Find(&[]model.SysAuthority{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_authorities表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Authorities).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_authorities 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
)
|
||||
|
||||
type SysDataAuthorityId struct {
|
||||
SysAuthorityAuthorityId string
|
||||
DataAuthorityIdAuthorityId string
|
||||
}
|
||||
|
||||
var DataAuthorityId = []SysDataAuthorityId{
|
||||
{"888", "888"},
|
||||
{"888", "8881"},
|
||||
{"888", "9528"},
|
||||
{"9528", "8881"},
|
||||
{"9528", "9528"},
|
||||
}
|
||||
|
||||
func InitSysDataAuthorityId(db *gorm.DB) {
|
||||
if err := db.Table("sys_data_authority_id").Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("sys_authority_authority_id IN ?", []string{"888", "9528"}).Find(&[]SysDataAuthorityId{}).RowsAffected == 5 {
|
||||
color.Danger.Println("sys_data_authority_id表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&DataAuthorityId).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_data_authority_id 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
)
|
||||
|
||||
type SysAuthorityMenus struct {
|
||||
SysAuthorityAuthorityId string
|
||||
SysBaseMenuId uint
|
||||
}
|
||||
|
||||
var AuthorityMenus = []SysAuthorityMenus{
|
||||
{"888", 1},
|
||||
{"888", 2},
|
||||
{"888", 3},
|
||||
{"888", 4},
|
||||
{"888", 5},
|
||||
{"888", 6},
|
||||
{"888", 7},
|
||||
{"888", 8},
|
||||
{"888", 9},
|
||||
{"888", 10},
|
||||
{"888", 11},
|
||||
{"888", 12},
|
||||
{"888", 13},
|
||||
{"888", 14},
|
||||
{"888", 15},
|
||||
{"888", 16},
|
||||
{"888", 17},
|
||||
{"888", 18},
|
||||
{"888", 19},
|
||||
{"888", 20},
|
||||
{"888", 21},
|
||||
{"888", 22},
|
||||
{"888", 23},
|
||||
{"888", 24},
|
||||
{"888", 25},
|
||||
{"888", 26},
|
||||
{"888", 27},
|
||||
{"8881", 1},
|
||||
{"8881", 2},
|
||||
{"8881", 8},
|
||||
{"8881", 17},
|
||||
{"8881", 18},
|
||||
{"8881", 19},
|
||||
{"8881", 20},
|
||||
{"9528", 1},
|
||||
{"9528", 2},
|
||||
{"9528", 3},
|
||||
{"9528", 4},
|
||||
{"9528", 5},
|
||||
{"9528", 6},
|
||||
{"9528", 7},
|
||||
{"9528", 8},
|
||||
{"9528", 9},
|
||||
{"9528", 10},
|
||||
{"9528", 11},
|
||||
{"9528", 12},
|
||||
{"9528", 13},
|
||||
{"9528", 14},
|
||||
{"9528", 15},
|
||||
{"9528", 17},
|
||||
{"9528", 18},
|
||||
{"9528", 19},
|
||||
{"9528", 20},
|
||||
}
|
||||
|
||||
func InitSysAuthorityMenus(db *gorm.DB) {
|
||||
if err := db.Table("sys_authority_menus").Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("sys_authority_authority_id IN ?", []string{"888", "8881", "9528"}).Find(&[]SysAuthorityMenus{}).RowsAffected == 53 {
|
||||
color.Danger.Println("sys_authority_menus表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&AuthorityMenus).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_authority_menus 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
"github.com/gookit/color"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
)
|
||||
|
||||
var Carbines = []gormadapter.CasbinRule{
|
||||
{PType: "p", V0: "888", V1: "/base/login", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/user/register", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/createApi", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/getApiList", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/getApiById", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/deleteApi", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/updateApi", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/api/getAllApis", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/authority/createAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/authority/deleteAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/authority/getAuthorityList", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/authority/setDataAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/authority/updateAuthority", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/authority/copyAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/getMenu", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/getMenuList", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/addBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/getBaseMenuTree", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/addMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/getMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/deleteBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/updateBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/menu/getBaseMenuById", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/user/changePassword", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/user/getUserList", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/user/setUserAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/user/deleteUser", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/upload", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/casbin/updateCasbin", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/casbin/casbinTest/:pathParam", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/jwt/jsonInBlacklist", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/system/getSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/system/setSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/system/getServerInfo", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/customer/customer", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/customer/customer", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/customer/customer", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/customer/customer", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/customer/customerList", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/autoCode/createTemp", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/autoCode/getTables", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/autoCode/getDB", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/autoCode/getColumn", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/createSysDictionaryDetail", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/deleteSysDictionaryDetail", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/updateSysDictionaryDetail", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/findSysDictionaryDetail", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/getSysDictionaryDetailList", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionary/createSysDictionary", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionary/deleteSysDictionary", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionary/updateSysDictionary", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionary/findSysDictionary", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysDictionary/getSysDictionaryList", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/createSysOperationRecord", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecord", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/updateSysOperationRecord", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/findSysOperationRecord", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/getSysOperationRecordList", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecordByIds", V2: "DELETE"},
|
||||
{PType: "p", V0: "888", V1: "/user/setUserInfo", V2: "PUT"},
|
||||
{PType: "p", V0: "888", V1: "/email/emailTest", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/simpleUploader/upload", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/simpleUploader/checkFileMd5", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/simpleUploader/mergeFileMd5", V2: "GET"},
|
||||
{PType: "p", V0: "8881", V1: "/base/login", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/user/register", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/getApiList", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/getApiById", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/deleteApi", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/updateApi", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/getAllApis", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/authority/createAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/authority/deleteAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/authority/getAuthorityList", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/authority/setDataAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/getMenu", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/getMenuList", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/addBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/getBaseMenuTree", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/addMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/getMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/deleteBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/updateBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/menu/getBaseMenuById", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/user/changePassword", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/user/getUserList", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/user/setUserAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/upload", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/casbin/updateCasbin", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/jwt/jsonInBlacklist", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/system/getSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/system/setSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "PUT"},
|
||||
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "DELETE"},
|
||||
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "GET"},
|
||||
{PType: "p", V0: "8881", V1: "/customer/customerList", V2: "GET"},
|
||||
{PType: "p", V0: "9528", V1: "/base/login", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/user/register", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/createApi", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/getApiList", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/getApiById", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/deleteApi", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/updateApi", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/api/getAllApis", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/authority/createAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/authority/deleteAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/authority/getAuthorityList", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/authority/setDataAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/getMenu", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/getMenuList", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/addBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/getBaseMenuTree", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/addMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/getMenuAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/deleteBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/updateBaseMenu", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/menu/getBaseMenuById", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/user/changePassword", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/user/getUserList", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/user/setUserAuthority", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/upload", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/casbin/updateCasbin", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/jwt/jsonInBlacklist", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/system/getSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/system/setSystemConfig", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "POST"},
|
||||
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "PUT"},
|
||||
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "DELETE"},
|
||||
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "GET"},
|
||||
{PType: "p", V0: "9528", V1: "/customer/customerList", V2: "GET"},
|
||||
{PType: "p", V0: "9528", V1: "/autoCode/createTemp", V2: "POST"},
|
||||
}
|
||||
|
||||
func InitCasbinModel(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("p_type = ? AND v0 IN ?", "p", []string{"888", "8881", "9528"}).Find(&[]gormadapter.CasbinRule{}).RowsAffected == 142 {
|
||||
color.Danger.Println("casbin_rule表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Carbines).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> casbin_rule 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Customers = []model.ExaCustomer{
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, CustomerName: "测试客户", CustomerPhoneData: "1761111111", SysUserID: 1, SysUserAuthorityID: "888"},
|
||||
}
|
||||
|
||||
func InitExaCustomer(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ? ", []int{1}).Find(&[]model.ExaCustomer{}).RowsAffected == 1 {
|
||||
color.Danger.Println("exa_customers表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Customers).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> exa_customers 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func InitSysDictionary(db *gorm.DB) {
|
||||
var status = new(bool)
|
||||
*status = true
|
||||
Dictionaries := []model.SysDictionary{
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库浮点型", Type: "float64", Status: status, Desc: "数据库浮点型"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库字符串", Type: "string", Status: status, Desc: "数据库字符串"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"},
|
||||
}
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 6}).Find(&[]model.SysDictionary{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_dictionaries表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Dictionaries).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_dictionaries 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func InitSysDictionaryDetail(db *gorm.DB) {
|
||||
status := new(bool)
|
||||
*status = true
|
||||
DictionaryDetail := []model.SysDictionaryDetail{
|
||||
{global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "smallint", 1, status, 1, 2},
|
||||
{global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumint", 2, status, 2, 2},
|
||||
{global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "int", 3, status, 3, 2},
|
||||
{global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "bigint", 4, status, 4, 2},
|
||||
{global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "date", 0, status, 0, 3},
|
||||
{global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "time", 1, status, 1, 3},
|
||||
{global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "year", 2, status, 2, 3},
|
||||
{global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "datetime", 3, status, 3, 3},
|
||||
{global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "timestamp", 5, status, 5, 3},
|
||||
{global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "float", 0, status, 0, 4},
|
||||
{global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "double", 1, status, 1, 4},
|
||||
{global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "decimal", 2, status, 2, 4},
|
||||
{global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "char", 0, status, 0, 5},
|
||||
{global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "varchar", 1, status, 1, 5},
|
||||
{global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyblob", 2, status, 2, 5},
|
||||
{global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinytext", 3, status, 3, 5},
|
||||
{global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "text", 4, status, 4, 5},
|
||||
{global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "blob", 5, status, 5, 5},
|
||||
{global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumblob", 6, status, 6, 5},
|
||||
{global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumtext", 7, status, 7, 5},
|
||||
{global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longblob", 8, status, 8, 5},
|
||||
{global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longtext", 9, status, 9, 5},
|
||||
{global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyint", 0, status, 0, 6},
|
||||
}
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 23}).Find(&[]model.SysDictionaryDetail{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_dictionary_details表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&DictionaryDetail).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_dictionary_details 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Files = []model.ExaFileUploadAndDownload{
|
||||
{global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "http://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"},
|
||||
{global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "http://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"},
|
||||
}
|
||||
|
||||
func InitExaFileUploadAndDownload(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 2}).Find(&[]model.ExaFileUploadAndDownload{}).RowsAffected == 2 {
|
||||
color.Danger.Println("exa_file_upload_and_downloads表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Files).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
color.Info.Println("[Mysql]-->初始化数据成功")
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> exa_file_upload_and_downloads 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/model"
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
"github.com/gookit/color"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
)
|
||||
|
||||
func InitMysqlData(db *gorm.DB) {
|
||||
InitSysApi(db)
|
||||
InitSysUser(db)
|
||||
InitExaCustomer(db)
|
||||
InitCasbinModel(db)
|
||||
InitSysAuthority(db)
|
||||
InitSysBaseMenus(db)
|
||||
InitAuthorityMenu(db)
|
||||
InitSysDictionary(db)
|
||||
InitSysAuthorityMenus(db)
|
||||
InitSysDataAuthorityId(db)
|
||||
InitSysDictionaryDetail(db)
|
||||
InitExaFileUploadAndDownload(db)
|
||||
}
|
||||
|
||||
func InitMysqlTables(db *gorm.DB) {
|
||||
var err error
|
||||
if !db.Migrator().HasTable("casbin_rule") {
|
||||
err = db.Migrator().CreateTable(&gormadapter.CasbinRule{})
|
||||
}
|
||||
err = db.AutoMigrate(
|
||||
model.SysApi{},
|
||||
model.SysUser{},
|
||||
model.ExaFile{},
|
||||
model.ExaCustomer{},
|
||||
model.SysBaseMenu{},
|
||||
model.SysWorkflow{},
|
||||
model.SysAuthority{},
|
||||
model.JwtBlacklist{},
|
||||
model.ExaFileChunk{},
|
||||
model.SysDictionary{},
|
||||
model.ExaSimpleUploader{},
|
||||
model.SysOperationRecord{},
|
||||
model.SysWorkflowStepInfo{},
|
||||
model.SysDictionaryDetail{},
|
||||
model.SysBaseMenuParameter{},
|
||||
model.ExaFileUploadAndDownload{},
|
||||
)
|
||||
if err != nil {
|
||||
color.Warn.Printf("[Mysql]-->初始化数据表失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
color.Info.Println("[Mysql]-->初始化数据表成功")
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var BaseMenus = []model.SysBaseMenu{
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "dashboard", Name: "dashboard", Hidden: false, Component: "view/dashboard/index.vue", Sort: 1, Meta: model.Meta{Title: "仪表盘", Icon: "setting"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "about", Name: "about", Component: "view/about/index.vue", Sort: 7, Meta: model.Meta{Title: "关于我们", Icon: "info"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "admin", Name: "superAdmin", Component: "view/superAdmin/index.vue", Sort: 3, Meta: model.Meta{Title: "超级管理员", Icon: "user-solid"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "authority", Name: "authority", Component: "view/superAdmin/authority/authority.vue", Sort: 1, Meta: model.Meta{Title: "角色管理", Icon: "s-custom"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "menu", Name: "menu", Component: "view/superAdmin/menu/menu.vue", Sort: 2, Meta: model.Meta{Title: "菜单管理", Icon: "s-order", KeepAlive: true}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "api", Name: "api", Component: "view/superAdmin/api/api.vue", Sort: 3, Meta: model.Meta{Title: "api管理", Icon: "s-platform", KeepAlive: true}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "user", Name: "user", Component: "view/superAdmin/user/user.vue", Sort: 4, Meta: model.Meta{Title: "用户管理", Icon: "coordinate"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "0", Path: "person", Name: "person", Component: "view/person/person.vue", Sort: 4, Meta: model.Meta{Title: "个人信息", Icon: "message-solid"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "example", Name: "example", Component: "view/example/index.vue", Sort: 6, Meta: model.Meta{Title: "示例文件", Icon: "s-management"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "table", Name: "table", Component: "view/example/table/table.vue", Sort: 1, Meta: model.Meta{Title: "表格示例", Icon: "s-order"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "form", Name: "form", Component: "view/example/form/form.vue", Sort: 2, Meta: model.Meta{Title: "表单示例", Icon: "document"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "rte", Name: "rte", Component: "view/example/rte/rte.vue", Sort: 3, Meta: model.Meta{Title: "富文本编辑器", Icon: "reading"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "excel", Name: "excel", Component: "view/example/excel/excel.vue", Sort: 4, Meta: model.Meta{Title: "excel导入导出", Icon: "s-marketing"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "upload", Name: "upload", Component: "view/example/upload/upload.vue", Sort: 5, Meta: model.Meta{Title: "上传下载", Icon: "upload"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "breakpoint", Name: "breakpoint", Component: "view/example/breakpoint/breakpoint.vue", Sort: 6, Meta: model.Meta{Title: "断点续传", Icon: "upload"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "customer", Name: "customer", Component: "view/example/customer/customer.vue", Sort: 7, Meta: model.Meta{Title: "客户列表(资源示例)", Icon: "s-custom"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "systemTools", Name: "systemTools", Component: "view/systemTools/index.vue", Sort: 5, Meta: model.Meta{Title: "系统工具", Icon: "s-cooperation"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "autoCode", Name: "autoCode", Component: "view/systemTools/autoCode/index.vue", Sort: 1, Meta: model.Meta{Title: "代码生成器", Icon: "cpu", KeepAlive: true}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "formCreate", Name: "formCreate", Component: "view/systemTools/formCreate/index.vue", Sort: 2, Meta: model.Meta{Title: "表单生成器", Icon: "magic-stick", KeepAlive: true}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "system", Name: "system", Component: "view/systemTools/system/system.vue", Sort: 3, Meta: model.Meta{Title: "系统配置", Icon: "s-operation"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "iconList", Name: "iconList", Component: "view/iconList/index.vue", Sort: 2, Meta: model.Meta{Title: "图标集合", Icon: "star-on"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "dictionary", Name: "dictionary", Component: "view/superAdmin/dictionary/sysDictionary.vue", Sort: 5, Meta: model.Meta{Title: "字典管理", Icon: "notebook-2"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: model.Meta{Title: "字典详情", Icon: "s-order"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: model.Meta{Title: "操作历史", Icon: "time"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "simpleUploader", Name: "simpleUploader", Component: "view/example/simpleUploader/simpleUploader", Sort: 6, Meta: model.Meta{Title: "断点续传(插件版)", Icon: "upload"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: model.Meta{Title: "官方网站", Icon: "s-home"}},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "state", Name: "state", Hidden: false, Component: "view/system/state.vue", Sort: 6, Meta: model.Meta{Title: "服务器状态", Icon: "cloudy"}},
|
||||
}
|
||||
|
||||
func InitSysBaseMenus(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 27}).Find(&[]model.SysBaseMenu{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_base_menus表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&BaseMenus).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_base_menus 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package datas
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gin-vue-admin/model"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Users = []model.SysUser{
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "admin", Password: "e10adc3949ba59abbe56e057f20f883e", NickName: "超级管理员", HeaderImg: "http://qmplusimg.henrongyi.top/gva_header.jpg", AuthorityId: "888"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "a303176530", Password: "3ec063004a6f31642261936a379fde3d", NickName: "QMPlusUser", HeaderImg: "http://qmplusimg.henrongyi.top/1572075907logo.png", AuthorityId: "9528"},
|
||||
}
|
||||
|
||||
func InitSysUser(db *gorm.DB) {
|
||||
if err := db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 2}).Find(&[]model.SysUser{}).RowsAffected == 2 {
|
||||
color.Danger.Println("sys_users表的初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
if err := tx.Create(&Users).Error; err != nil { // 遇到错误时回滚事务
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
color.Warn.Printf("[Mysql]--> sys_users 表的初始数据失败,err: %v\n", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright © 2020 SliverHorn
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package gva
|
||||
|
||||
import (
|
||||
"gin-vue-admin/cmd/datas"
|
||||
"gin-vue-admin/core"
|
||||
"gin-vue-admin/initialize"
|
||||
|
||||
"github.com/gookit/color"
|
||||
|
||||
_ "gin-vue-admin/core"
|
||||
"gin-vue-admin/global"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// initdbCmd represents the initdb command
|
||||
var initdbCmd = &cobra.Command{
|
||||
Use: "initdb",
|
||||
Short: "gin-vue-admin初始化数据",
|
||||
Long: `gin-vue-admin初始化数据适配数据库情况:
|
||||
1. mysql完美适配,
|
||||
2. postgresql不能保证完美适配,
|
||||
3. sqlite未适配,
|
||||
4. sqlserver未适配`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
path, _ := cmd.Flags().GetString("path")
|
||||
global.GVA_VP = core.Viper(path)
|
||||
global.GVA_LOG = core.Zap() // 初始化zap日志库
|
||||
db := initialize.GormMysql()
|
||||
switch global.GVA_CONFIG.System.DbType {
|
||||
case "mysql":
|
||||
datas.InitMysqlTables(db)
|
||||
datas.InitMysqlData(db)
|
||||
case "postgresql":
|
||||
color.Info.Println("postgresql功能开发中")
|
||||
case "sqlite":
|
||||
color.Info.Println("sqlite功能开发中")
|
||||
case "sqlserver":
|
||||
color.Info.Println("sqlserver功能开发中")
|
||||
default:
|
||||
datas.InitMysqlTables(db)
|
||||
datas.InitMysqlData(db)
|
||||
}
|
||||
frame, _ := cmd.Flags().GetString("frame")
|
||||
if frame == "gf" {
|
||||
color.Info.Println("gf功能开发中")
|
||||
return
|
||||
} else {
|
||||
return
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(initdbCmd)
|
||||
initdbCmd.Flags().StringP("path", "p", "./config.yaml", "自定配置文件路径(绝对路径)")
|
||||
initdbCmd.Flags().StringP("frame", "f", "gin", "可选参数为gin,gf")
|
||||
initdbCmd.Flags().StringP("type", "t", "mysql", "可选参数为mysql,postgresql,sqlite,sqlserver")
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright © 2020 SliverHorn
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package gva
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"os"
|
||||
|
||||
"github.com/gookit/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var cfgFile string
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "gva",
|
||||
Short: "这是一款amazing的终端工具",
|
||||
Long: `欢迎使用gva终端工具
|
||||
________ ____ ____ _____
|
||||
/ _____/ \ \ / / / _ \
|
||||
/ \ ___ \ Y / / /_\ \
|
||||
\ \_\ \ \ / / | \
|
||||
\______ / \___/ \____|__ /
|
||||
\/ \/
|
||||
`,
|
||||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
// Run: func(cmd *cobra.Command, args []string) { },
|
||||
}
|
||||
|
||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
color.Warn.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
// Cobra supports persistent flags, which, if defined here,
|
||||
// will be global for your application.
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.gva.yaml)")
|
||||
|
||||
// Cobra also supports local flags, which will only run
|
||||
// when this action is called directly.
|
||||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
if cfgFile != "" {
|
||||
// Use config file from the flag.
|
||||
viper.SetConfigFile(cfgFile)
|
||||
} else {
|
||||
// Find home directory.
|
||||
home, err := homedir.Dir()
|
||||
if err != nil {
|
||||
color.Warn.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Search config in home directory with name ".gva" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigName(".gva")
|
||||
}
|
||||
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
||||
// If a config file is found, read it in.
|
||||
if err := viper.ReadInConfig(); err == nil {
|
||||
color.Warn.Println("Using config file:", viper.ConfigFileUsed())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package gva
|
||||
|
||||
import (
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
|
||||
// runCmd represents the run command
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run",
|
||||
Short: "running go codes with hot-compiled-like feature",
|
||||
Long: `
|
||||
The "run" command is used for running go codes with hot-compiled-like feature,
|
||||
which compiles and runs the go codes asynchronously when codes change.
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
w := utils.NewWatch()
|
||||
t := utils.NewT()
|
||||
path, _ := os.Getwd()
|
||||
go w.Watch(path, t)
|
||||
t.RunTask()
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(runCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// runCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// runCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright © 2020 SliverHorn
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package gva
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// versionCmd represents the version command
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "版本信息",
|
||||
Long: `版本的长信息`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
color.Green.Println("v0.0.3")
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright © 2020 SliverHorn
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package main
|
||||
|
||||
import "gin-vue-admin/cmd/gva"
|
||||
|
||||
func main() {
|
||||
gva.Execute()
|
||||
}
|
||||
+51
-91
@@ -1,82 +1,48 @@
|
||||
# Gin-Vue-Admin Global Configuration
|
||||
|
||||
# casbin configuration
|
||||
casbin:
|
||||
model-path: './resource/rbac_model.conf'
|
||||
|
||||
# jwt configuration
|
||||
jwt:
|
||||
signing-key: 'qmPlus'
|
||||
|
||||
# mysql connect configuration
|
||||
mysql:
|
||||
username: root
|
||||
password: 'Aa@6447985'
|
||||
path: '127.0.0.1:3306'
|
||||
db-name: 'qmPlus'
|
||||
config: 'charset=utf8mb4&parseTime=True&loc=Local'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
log-mode: false
|
||||
|
||||
# Postgresql connect configuration
|
||||
postgresql:
|
||||
username: 'gorm'
|
||||
password: 'gorm'
|
||||
db-name: 'gorm'
|
||||
port: '9920'
|
||||
config: 'sslmode=disable TimeZone=Asia/Shanghai'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
logger: false
|
||||
prefer-simple-protocol: true
|
||||
|
||||
# sqlite connect configuration
|
||||
# sqlite需要gcc支持 windows用户需要自行安装gcc
|
||||
sqlite:
|
||||
# path: 'file::memory:?cache=shared' # 内存模式
|
||||
path: 'db.db'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
logger: true
|
||||
|
||||
# Sqlserver connect configuration
|
||||
sqlserver:
|
||||
username: 'gorm'
|
||||
password: 'LoremIpsum86'
|
||||
db-name: 'gorm'
|
||||
path: 'localhost:9930'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 10
|
||||
logger: true
|
||||
|
||||
# oss configuration
|
||||
|
||||
# 切换本地与七牛云上传,分配头像和文件路径
|
||||
localupload:
|
||||
local: false
|
||||
file-path: uploads/file
|
||||
|
||||
# 请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址
|
||||
qiniu:
|
||||
access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
|
||||
secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
|
||||
bucket: 'qm-plus-img'
|
||||
img-path: 'http://qmplusimg.henrongyi.top'
|
||||
# zap logger configuration
|
||||
zap:
|
||||
level: 'info'
|
||||
format: 'console'
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
director: 'log'
|
||||
link-name: 'latest_log'
|
||||
show-line: true
|
||||
encode-level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace-key: 'stacktrace'
|
||||
log-in-console: true
|
||||
|
||||
# redis configuration
|
||||
redis:
|
||||
db: 0
|
||||
addr: '127.0.0.1:6379'
|
||||
password: ''
|
||||
db: 0
|
||||
|
||||
# email configuration
|
||||
email:
|
||||
to: 'xxx@qq.com'
|
||||
port: 465
|
||||
from: 'xxx@163.com'
|
||||
host: 'smtp.163.com'
|
||||
is-ssl: true
|
||||
secret: 'xxx'
|
||||
nickname: 'test'
|
||||
|
||||
# casbin configuration
|
||||
casbin:
|
||||
model-path: './resource/rbac_model.conf'
|
||||
|
||||
# system configuration
|
||||
system:
|
||||
use-multipoint: false
|
||||
env: 'public' # Change to "develop" to skip authentication for development mode
|
||||
addr: 8888
|
||||
db-type: "mysql" # support mysql/postgresql/sqlite/sqlserver
|
||||
need-init-data: false
|
||||
db-type: 'mysql'
|
||||
oss-type: 'local'
|
||||
use-multipoint: false
|
||||
|
||||
# captcha configuration
|
||||
captcha:
|
||||
@@ -84,33 +50,27 @@ captcha:
|
||||
img-width: 240
|
||||
img-height: 80
|
||||
|
||||
# logger configuration
|
||||
log:
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
log-file: true
|
||||
stdout: 'DEBUG'
|
||||
file: 'DEBUG'
|
||||
# mysql connect configuration
|
||||
mysql:
|
||||
path: '127.0.0.1:3306'
|
||||
config: 'charset=utf8mb4&parseTime=True&loc=Local'
|
||||
db-name: 'qmPlus'
|
||||
username: 'root'
|
||||
password: 'Aa@6447985'
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 100
|
||||
log-mode: false
|
||||
|
||||
# zap logger configuration
|
||||
zap:
|
||||
# 可使用 "debug", "info", "warn", "error", "dpanic", "panic", "fatal",
|
||||
level: 'debug'
|
||||
# console: 控制台, json: json格式输出
|
||||
format: 'console'
|
||||
prefix: '[GIN-VUE-ADMIN]'
|
||||
director: 'log'
|
||||
link_name: 'latest_log'
|
||||
show_line: true
|
||||
# LowercaseLevelEncoder:小写, LowercaseColorLevelEncoder:小写带颜色,CapitalLevelEncoder: 大写, CapitalColorLevelEncoder: 大写带颜色,
|
||||
encode_level: 'LowercaseColorLevelEncoder'
|
||||
stacktrace_key: 'stacktrace'
|
||||
log_in_console: true
|
||||
# local configuration
|
||||
local:
|
||||
path: 'uploads/file'
|
||||
|
||||
email:
|
||||
email_from: 'xxx@163.com'
|
||||
email_nick_name: 'test'
|
||||
email_secret: 'xxx'
|
||||
email_to: 'xxx@qq.com'
|
||||
email_host: 'smtp.163.com'
|
||||
email_port: 465
|
||||
email_isSSL: true
|
||||
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket �?域名地址)
|
||||
qiniu:
|
||||
zone: 'ZoneHuadong'
|
||||
bucket: 'qm-plus-img'
|
||||
img-path: 'http://qmplusimg.henrongyi.top'
|
||||
use-https: false
|
||||
access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
|
||||
secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
|
||||
use-cdn-domains: false
|
||||
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
type Captcha struct {
|
||||
KeyLong int `mapstructure:"key-long" json:"keyLong" yaml:"key-long"`
|
||||
ImgWidth int `mapstructure:"img-width" json:"imgWidth" yaml:"img-width"`
|
||||
ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"`
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package config
|
||||
|
||||
type Casbin struct {
|
||||
ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
|
||||
}
|
||||
+12
-115
@@ -1,119 +1,16 @@
|
||||
package config
|
||||
|
||||
type Server struct {
|
||||
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
|
||||
Postgresql Postgresql `mapstructure:"postgresql" json:"postgresql" yaml:"postgresql"`
|
||||
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
|
||||
Sqlserver Sqlserver `mapstructure:"sqlserver" json:"sqlserver" yaml:"sqlserver"`
|
||||
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
|
||||
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
|
||||
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
|
||||
System System `mapstructure:"system" json:"system" yaml:"system"`
|
||||
JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
|
||||
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
|
||||
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
|
||||
LocalUpload LocalUpload `mapstructure:"localUpload" json:"localUpload" yaml:"localUpload"`
|
||||
Email Email `mapstructure:"email" json:"email" yaml:"email"`
|
||||
}
|
||||
|
||||
type System struct {
|
||||
UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint" yaml:"use-multipoint"`
|
||||
Env string `mapstructure:"env" json:"env" yaml:"env"`
|
||||
Addr int `mapstructure:"addr" json:"addr" yaml:"addr"`
|
||||
DbType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"`
|
||||
NeedInitData bool `mapstructure:"need-init-data" json:"needInitData" yaml:"need-init-data"`
|
||||
}
|
||||
|
||||
type JWT struct {
|
||||
SigningKey string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`
|
||||
}
|
||||
|
||||
type Casbin struct {
|
||||
ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
|
||||
}
|
||||
|
||||
type Mysql struct {
|
||||
Username string `mapstructure:"username" json:"username" yaml:"username"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path"`
|
||||
Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
|
||||
Config string `mapstructure:"config" json:"config" yaml:"config"`
|
||||
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
|
||||
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
|
||||
LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
|
||||
}
|
||||
|
||||
type Postgresql struct {
|
||||
Username string `mapstructure:"username" json:"username" yaml:"username"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
|
||||
Port string `mapstructure:"port" json:"port" yaml:"port"`
|
||||
Config string `mapstructure:"config" json:"config" yaml:"config"`
|
||||
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
|
||||
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
|
||||
Logger bool `mapstructure:"logger" json:"logger" yaml:"logger"`
|
||||
PreferSimpleProtocol bool `mapstructure:"prefer-simple-protocol" json:"preferSimpleProtocol" yaml:"prefer-simple-protocol"`
|
||||
}
|
||||
|
||||
type Sqlite struct {
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path"`
|
||||
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
|
||||
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
|
||||
Logger bool `mapstructure:"logger" json:"logger" yaml:"logger"`
|
||||
}
|
||||
|
||||
type Sqlserver struct {
|
||||
Username string `mapstructure:"username" json:"username" yaml:"username"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path"`
|
||||
Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
|
||||
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
|
||||
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
|
||||
Logger bool `mapstructure:"logger" json:"logger" yaml:"logger"`
|
||||
}
|
||||
|
||||
type Redis struct {
|
||||
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
DB int `mapstructure:"db" json:"db" yaml:"db"`
|
||||
}
|
||||
|
||||
type LocalUpload struct {
|
||||
Local bool `mapstructure:"local" json:"local" yaml:"local"`
|
||||
FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
|
||||
}
|
||||
|
||||
type Qiniu struct {
|
||||
AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
|
||||
SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
|
||||
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
|
||||
ImgPath string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
|
||||
}
|
||||
|
||||
type Captcha struct {
|
||||
KeyLong int `mapstructure:"key-long" json:"keyLong" yaml:"key-long"`
|
||||
ImgWidth int `mapstructure:"img-width" json:"imgWidth" yaml:"img-width"`
|
||||
ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"`
|
||||
}
|
||||
|
||||
type Zap struct {
|
||||
Level string `mapstructure:"level" json:"level" yaml:"level"`
|
||||
Format string `mapstructure:"format" json:"format" yaml:"format"`
|
||||
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
|
||||
Director string `mapstructure:"director" json:"director" yaml:"director"`
|
||||
LinkName string `mapstructure:"link_name" json:"linkName" yaml:"link_name"`
|
||||
ShowLine bool `mapstructure:"show_line" json:"showLine" yaml:"showLine"`
|
||||
EncodeLevel string `mapstructure:"encode_level" json:"encodeLevel" yaml:"encode_level"`
|
||||
StacktraceKey string `mapstructure:"stacktrace_key" json:"stacktraceKey" yaml:"stacktrace_key"`
|
||||
LogInConsole bool `mapstructure:"log_in_console" json:"logInConsole" yaml:"log_in_console"`
|
||||
}
|
||||
|
||||
type Email struct {
|
||||
EmailFrom string `mapstructure:"email_from" json:"emailFrom" yaml:"email_from"`
|
||||
EmailNickName string `mapstructure:"email_nick_name" json:"emailNickName" yaml:"email_nick_name"`
|
||||
EmailSecret string `mapstructure:"email_secret" json:"emailSecret" yaml:"email_secret"`
|
||||
EmailTo string `mapstructure:"email_to" json:"emailTo" yaml:"email_to"`
|
||||
EmailHost string `mapstructure:"email_host" json:"emailHost" yaml:"email_host"`
|
||||
EmailPort int `mapstructure:"email_port" json:"emailPort" yaml:"email_port"`
|
||||
EmailIsSSL bool `mapstructure:"email_isSSL" json:"emailIsSSL" yaml:"email_isSSL"`
|
||||
JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
|
||||
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
|
||||
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
|
||||
Email Email `mapstructure:"email" json:"email" yaml:"email"`
|
||||
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
|
||||
System System `mapstructure:"system" json:"system" yaml:"system"`
|
||||
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
|
||||
// gorm
|
||||
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
|
||||
// oss
|
||||
Local Local `mapstructure:"local" json:"local" yaml:"local"`
|
||||
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
type Email struct {
|
||||
To string `mapstructure:"to" json:"to" yaml:"to"`
|
||||
Port int `mapstructure:"port" json:"port" yaml:"port"`
|
||||
From string `mapstructure:"from" json:"from" yaml:"from"`
|
||||
Host string `mapstructure:"host" json:"host" yaml:"host"`
|
||||
IsSSL bool `mapstructure:"is-ssl" json:"isSSL" yaml:"is-ssl"`
|
||||
Secret string `mapstructure:"secret" json:"secret" yaml:"secret"`
|
||||
Nickname string `mapstructure:"nickname" json:"nickname" yaml:"nickname"`
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package config
|
||||
|
||||
type Mysql struct {
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path"`
|
||||
Config string `mapstructure:"config" json:"config" yaml:"config"`
|
||||
Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
|
||||
Username string `mapstructure:"username" json:"username" yaml:"username"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
|
||||
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
|
||||
LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package config
|
||||
|
||||
type JWT struct {
|
||||
SigningKey string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package config
|
||||
|
||||
type Local struct {
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path" `
|
||||
}
|
||||
|
||||
type Qiniu struct {
|
||||
Zone string `mapstructure:"zone" json:"zone" yaml:"zone"`
|
||||
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
|
||||
ImgPath string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
|
||||
UseHTTPS bool `mapstructure:"use-https" json:"useHttps" yaml:"use-https"`
|
||||
AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
|
||||
SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
|
||||
UseCdnDomains bool `mapstructure:"use-cdn-domains" json:"useCdnDomains" yaml:"use-cdn-domains"`
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
type Redis struct {
|
||||
DB int `mapstructure:"db" json:"db" yaml:"db"`
|
||||
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"`
|
||||
Password string `mapstructure:"password" json:"password" yaml:"password"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
type System struct {
|
||||
Env string `mapstructure:"env" json:"env" yaml:"env"`
|
||||
Addr int `mapstructure:"addr" json:"addr" yaml:"addr"`
|
||||
DbType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"`
|
||||
OssType string `mapstructure:"oss-type" json:"ossType" yaml:"oss-type"`
|
||||
UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint" yaml:"use-multipoint"`
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package config
|
||||
|
||||
type Zap struct {
|
||||
Level string `mapstructure:"level" json:"level" yaml:"level"`
|
||||
Format string `mapstructure:"format" json:"format" yaml:"format"`
|
||||
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
|
||||
Director string `mapstructure:"director" json:"director" yaml:"director"`
|
||||
LinkName string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
|
||||
ShowLine bool `mapstructure:"show-line" json:"showLine" yaml:"showLine"`
|
||||
EncodeLevel string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
|
||||
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
|
||||
LogInConsole bool `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
_ "gin-vue-admin/packfile"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const defaultConfigFile = "config.yaml"
|
||||
|
||||
func init() {
|
||||
v := viper.New()
|
||||
v.SetConfigFile(defaultConfigFile)
|
||||
err := v.ReadInConfig()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("Fatal error config file: %s \n", err))
|
||||
}
|
||||
v.WatchConfig()
|
||||
|
||||
v.OnConfigChange(func(e fsnotify.Event) {
|
||||
fmt.Println("config file changed:", e.Name)
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
})
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
global.GVA_VP = v
|
||||
}
|
||||
@@ -25,11 +25,14 @@ func RunWindowsServer() {
|
||||
// 保证文本顺序输出
|
||||
// In order to ensure that the text order output can be deleted
|
||||
time.Sleep(10 * time.Microsecond)
|
||||
global.GVA_LOG.Debug("server run success on ", zap.String("address", address))
|
||||
global.GVA_LOG.Info("server run success on ", zap.String("address", address))
|
||||
|
||||
fmt.Printf(`欢迎使用 Gin-Vue-Admin
|
||||
fmt.Printf(`
|
||||
欢迎使用 Gin-Vue-Admin
|
||||
当前版本:V2.3.7
|
||||
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
|
||||
默认前端文件运行地址:http://127.0.0.1:8080
|
||||
如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
|
||||
`, address)
|
||||
global.GVA_LOG.Error(s.ListenAndServe().Error())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
_ "gin-vue-admin/packfile"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Viper(path ...string) *viper.Viper {
|
||||
var config string
|
||||
if len(path) == 0 {
|
||||
flag.StringVar(&config, "c", "", "choose config file.")
|
||||
flag.Parse()
|
||||
if config == "" { // 优先级: 命令行 > 环境变量 > 默认值
|
||||
if configEnv := os.Getenv(utils.ConfigEnv); configEnv == "" {
|
||||
config = utils.ConfigFile
|
||||
fmt.Printf("您正在使用config的默认值,config的路径为%v\n", utils.ConfigFile)
|
||||
} else {
|
||||
config = configEnv
|
||||
fmt.Printf("您正在使用GVA_CONFIG环境变量,config的路径为%v\n", config)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("您正在使用命令行的-c参数传递的值,config的路径为%v\n", config)
|
||||
}
|
||||
} else {
|
||||
config = path[0]
|
||||
fmt.Printf("您正在使用func Viper()传递的值,config的路径为%v\n", config)
|
||||
}
|
||||
|
||||
v := viper.New()
|
||||
v.SetConfigFile(config)
|
||||
err := v.ReadInConfig()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("Fatal error config file: %s \n", err))
|
||||
}
|
||||
v.WatchConfig()
|
||||
|
||||
v.OnConfigChange(func(e fsnotify.Event) {
|
||||
fmt.Println("config file changed:", e.Name)
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
})
|
||||
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
+17
-44
@@ -4,20 +4,15 @@ import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/utils"
|
||||
zaprotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
err error
|
||||
level zapcore.Level
|
||||
writer zapcore.WriteSyncer
|
||||
)
|
||||
var level zapcore.Level
|
||||
|
||||
func init() {
|
||||
func Zap() (logger *zap.Logger) {
|
||||
if ok, _ := utils.PathExists(global.GVA_CONFIG.Zap.Director); !ok { // 判断是否有Director文件夹
|
||||
fmt.Printf("create %v directory\n", global.GVA_CONFIG.Zap.Director)
|
||||
_ = os.Mkdir(global.GVA_CONFIG.Zap.Director, os.ModePerm)
|
||||
@@ -42,34 +37,15 @@ func init() {
|
||||
level = zap.InfoLevel
|
||||
}
|
||||
|
||||
writer, err = getWriteSyncer() // 使用file-rotatelogs进行日志分割
|
||||
if err != nil {
|
||||
fmt.Printf("Get Write Syncer Failed err:%v", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if level == zap.DebugLevel || level == zap.ErrorLevel {
|
||||
global.GVA_LOG = zap.New(getEncoderCore(), zap.AddStacktrace(level))
|
||||
logger = zap.New(getEncoderCore(), zap.AddStacktrace(level))
|
||||
} else {
|
||||
global.GVA_LOG = zap.New(getEncoderCore())
|
||||
logger = zap.New(getEncoderCore())
|
||||
}
|
||||
if global.GVA_CONFIG.Zap.ShowLine {
|
||||
global.GVA_LOG.WithOptions(zap.AddCaller())
|
||||
logger = logger.WithOptions(zap.AddCaller())
|
||||
}
|
||||
}
|
||||
|
||||
// getWriteSyncer zap logger中加入file-rotatelogs
|
||||
func getWriteSyncer() (zapcore.WriteSyncer, error) {
|
||||
fileWriter, err := zaprotatelogs.New(
|
||||
global.GVA_CONFIG.Zap.Director+string(os.PathSeparator)+"%Y-%m-%d.log",
|
||||
zaprotatelogs.WithLinkName(global.GVA_CONFIG.Zap.LinkName),
|
||||
zaprotatelogs.WithMaxAge(7*24*time.Hour),
|
||||
zaprotatelogs.WithRotationTime(24*time.Hour),
|
||||
)
|
||||
if global.GVA_CONFIG.Zap.LogInConsole {
|
||||
return zapcore.NewMultiWriteSyncer(zapcore.AddSync(os.Stdout), zapcore.AddSync(fileWriter)), err
|
||||
}
|
||||
return zapcore.AddSync(fileWriter), err
|
||||
return logger
|
||||
}
|
||||
|
||||
// getEncoderConfig 获取zapcore.EncoderConfig
|
||||
@@ -82,27 +58,19 @@ func getEncoderConfig() (config zapcore.EncoderConfig) {
|
||||
CallerKey: "caller",
|
||||
StacktraceKey: global.GVA_CONFIG.Zap.StacktraceKey,
|
||||
LineEnding: zapcore.DefaultLineEnding,
|
||||
EncodeLevel: zapcore.CapitalLevelEncoder,
|
||||
EncodeLevel: zapcore.LowercaseLevelEncoder,
|
||||
EncodeTime: CustomTimeEncoder,
|
||||
EncodeDuration: zapcore.SecondsDurationEncoder,
|
||||
EncodeCaller: zapcore.FullCallerEncoder,
|
||||
}
|
||||
switch {
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console" : // console小写编码器
|
||||
switch {
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder": // 小写编码器(默认)
|
||||
config.EncodeLevel = zapcore.LowercaseLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json" : // json小写编码器
|
||||
config.EncodeLevel = zapcore.LowercaseLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console小写编码器带颜色
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder": // 小写编码器带颜色
|
||||
config.EncodeLevel = zapcore.LowercaseColorLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json小写编码器带颜色
|
||||
config.EncodeLevel = zapcore.LowercaseColorLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console大写编码器
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder": // 大写编码器
|
||||
config.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json大写编码器
|
||||
config.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console 大写编码器带颜色
|
||||
config.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json 大写编码器带颜色
|
||||
case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder": // 大写编码器带颜色
|
||||
config.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
default:
|
||||
config.EncodeLevel = zapcore.LowercaseLevelEncoder
|
||||
@@ -120,6 +88,11 @@ func getEncoder() zapcore.Encoder {
|
||||
|
||||
// getEncoderCore 获取Encoder的zapcore.Core
|
||||
func getEncoderCore() (core zapcore.Core) {
|
||||
writer, err := utils.GetWriteSyncer() // 使用file-rotatelogs进行日志分割
|
||||
if err != nil {
|
||||
fmt.Printf("Get Write Syncer Failed err:%v", err.Error())
|
||||
return
|
||||
}
|
||||
return zapcore.NewCore(getEncoder(), writer, level)
|
||||
}
|
||||
|
||||
|
||||
+521
-290
File diff suppressed because it is too large
Load Diff
+520
-288
File diff suppressed because it is too large
Load Diff
+390
-245
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GVA_MODEL struct {
|
||||
ID uint `gorm:"primarykey"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
}
|
||||
+13
-8
@@ -1,8 +1,9 @@
|
||||
module gin-vue-admin
|
||||
|
||||
go 1.12
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
|
||||
github.com/casbin/casbin v1.9.1
|
||||
github.com/casbin/casbin/v2 v2.11.0
|
||||
@@ -12,31 +13,35 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/go-openapi/spec v0.19.7 // indirect
|
||||
github.com/go-openapi/swag v0.19.8 // indirect
|
||||
github.com/go-playground/validator/v10 v10.3.0 // indirect
|
||||
github.com/go-redis/redis v6.15.7+incompatible
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/golang/protobuf v1.4.2 // indirect
|
||||
github.com/gookit/color v1.3.1
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
||||
github.com/jordan-wright/email v0.0.0-20200824153738-3f5bafa1cd84
|
||||
github.com/json-iterator/go v1.1.10 // indirect
|
||||
github.com/lestrrat-go/file-rotatelogs v2.3.0+incompatible
|
||||
github.com/lestrrat-go/strftime v1.0.3 // indirect
|
||||
github.com/mailru/easyjson v0.7.1 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/mitchellh/mapstructure v1.2.2 // indirect
|
||||
github.com/mojocn/base64Captcha v1.3.1
|
||||
github.com/onsi/ginkgo v1.7.0 // indirect
|
||||
github.com/onsi/gomega v1.4.3 // indirect
|
||||
github.com/pelletier/go-toml v1.6.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/qiniu/api.v7/v7 v7.4.1
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/shirou/gopsutil v2.20.8+incompatible
|
||||
github.com/spf13/afero v1.2.2 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.6.2
|
||||
github.com/spf13/viper v1.7.0
|
||||
github.com/swaggo/gin-swagger v1.2.0
|
||||
github.com/swaggo/swag v1.6.7
|
||||
github.com/tebeka/strftime v0.1.3 // indirect
|
||||
@@ -48,8 +53,8 @@ require (
|
||||
google.golang.org/protobuf v1.24.0 // indirect
|
||||
gopkg.in/ini.v1 v1.55.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||
gorm.io/driver/mysql v0.3.1
|
||||
gorm.io/driver/postgres v0.2.6
|
||||
gorm.io/driver/sqlserver v0.2.4
|
||||
gorm.io/gorm v0.2.35
|
||||
gorm.io/driver/mysql v0.3.0
|
||||
gorm.io/gorm v1.20.5
|
||||
)
|
||||
|
||||
replace github.com/casbin/gorm-adapter/v3 => github.com/casbin/gorm-adapter/v3 v3.0.2
|
||||
@@ -1,485 +0,0 @@
|
||||
package init_data
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
"github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysAuthorityMenus struct {
|
||||
SysAuthorityAuthorityId string
|
||||
SysBaseMenuId uint
|
||||
}
|
||||
|
||||
type SysDataAuthorityId struct {
|
||||
SysAuthorityAuthorityId string
|
||||
DataAuthorityIdAuthorityId string
|
||||
}
|
||||
|
||||
func InitSysApi() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysApi{
|
||||
{gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/base/login", "用户登录", "base", "POST"},
|
||||
{gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/base/register", "用户注册", "base", "POST"},
|
||||
{gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/createApi", "创建api", "api", "POST"},
|
||||
{gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiList", "获取api列表", "api", "POST"},
|
||||
{gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiById", "获取api详细信息", "api", "POST"},
|
||||
{gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApi", "删除Api", "api", "POST"},
|
||||
{gorm.Model{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/updateApi", "更新Api", "api", "POST"},
|
||||
{gorm.Model{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getAllApis", "获取所有api", "api", "POST"},
|
||||
{gorm.Model{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/createAuthority", "创建角色", "authority", "POST"},
|
||||
{gorm.Model{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/deleteAuthority", "删除角色", "authority", "POST"},
|
||||
{gorm.Model{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/getAuthorityList", "获取角色列表", "authority", "POST"},
|
||||
{gorm.Model{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenu", "获取菜单树", "menu", "POST"},
|
||||
{gorm.Model{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuList", "分页获取基础menu列表", "menu", "POST"},
|
||||
{gorm.Model{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addBaseMenu", "新增菜单", "menu", "POST"},
|
||||
{gorm.Model{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuTree", "获取用户动态路由", "menu", "POST"},
|
||||
{gorm.Model{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addMenuAuthority", "增加menu和角色关联关系", "menu", "POST"},
|
||||
{gorm.Model{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuAuthority", "获取指定角色menu", "menu", "POST"},
|
||||
{gorm.Model{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/deleteBaseMenu", "删除菜单", "menu", "POST"},
|
||||
{gorm.Model{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/updateBaseMenu", "更新菜单", "menu", "POST"},
|
||||
{gorm.Model{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuById", "根据id获取菜单", "menu", "POST"},
|
||||
{gorm.Model{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/changePassword", "修改密码", "user", "POST"},
|
||||
{gorm.Model{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/getUserList", "获取用户列表", "user", "POST"},
|
||||
{gorm.Model{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserAuthority", "修改用户角色", "user", "POST"},
|
||||
{gorm.Model{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/upload", "文件上传示例", "fileUploadAndDownload", "POST"},
|
||||
{gorm.Model{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/getFileList", "获取上传文件列表", "fileUploadAndDownload", "POST"},
|
||||
{gorm.Model{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/updateCasbin", "更改角色api权限", "casbin", "POST"},
|
||||
{gorm.Model{ID: 28, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/getPolicyPathByAuthorityId", "获取权限列表", "casbin", "POST"},
|
||||
{gorm.Model{ID: 29, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/deleteFile", "删除文件", "fileUploadAndDownload", "POST"},
|
||||
{gorm.Model{ID: 30, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/jwt/jsonInBlacklist", "jwt加入黑名单", "jwt", "POST"},
|
||||
{gorm.Model{ID: 31, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/setDataAuthority", "设置角色资源权限", "authority", "POST"},
|
||||
{gorm.Model{ID: 32, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/getSystemConfig", "获取配置文件内容", "system", "POST"},
|
||||
{gorm.Model{ID: 33, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/setSystemConfig", "设置配置文件内容", "system", "POST"},
|
||||
{gorm.Model{ID: 34, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "创建客户", "customer", "POST"},
|
||||
{gorm.Model{ID: 35, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "更新客户", "customer", "PUT"},
|
||||
{gorm.Model{ID: 36, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "删除客户", "customer", "DELETE"},
|
||||
{gorm.Model{ID: 37, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "获取单一客户", "customer", "GET"},
|
||||
{gorm.Model{ID: 38, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customerList", "获取客户列表", "customer", "GET"},
|
||||
{gorm.Model{ID: 39, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/casbinTest/:pathParam", "RESTFUL模式测试", "casbin", "GET"},
|
||||
{gorm.Model{ID: 40, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/createTemp", "自动化代码", "autoCode", "POST"},
|
||||
{gorm.Model{ID: 41, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/updateAuthority", "更新角色信息", "authority", "PUT"},
|
||||
{gorm.Model{ID: 42, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/copyAuthority", "拷贝角色", "authority", "POST"},
|
||||
{gorm.Model{ID: 43, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/deleteUser", "删除用户", "user", "DELETE"},
|
||||
{gorm.Model{ID: 44, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/createSysDictionaryDetail", "新增字典内容", "sysDictionaryDetail", "POST"},
|
||||
{gorm.Model{ID: 45, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/deleteSysDictionaryDetail", "删除字典内容", "sysDictionaryDetail", "DELETE"},
|
||||
{gorm.Model{ID: 46, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/updateSysDictionaryDetail", "更新字典内容", "sysDictionaryDetail", "PUT"},
|
||||
{gorm.Model{ID: 47, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/findSysDictionaryDetail", "根据ID获取字典内容", "sysDictionaryDetail", "GET"},
|
||||
{gorm.Model{ID: 48, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/getSysDictionaryDetailList", "获取字典内容列表", "sysDictionaryDetail", "GET"},
|
||||
{gorm.Model{ID: 49, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/createSysDictionary", "新增字典", "sysDictionary", "POST"},
|
||||
{gorm.Model{ID: 50, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/deleteSysDictionary", "删除字典", "sysDictionary", "DELETE"},
|
||||
{gorm.Model{ID: 51, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/updateSysDictionary", "更新字典", "sysDictionary", "PUT"},
|
||||
{gorm.Model{ID: 52, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/findSysDictionary", "根据ID获取字典", "sysDictionary", "GET"},
|
||||
{gorm.Model{ID: 53, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/getSysDictionaryList", "获取字典列表", "sysDictionary", "GET"},
|
||||
{gorm.Model{ID: 54, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/createSysOperationRecord", "新增操作记录", "sysOperationRecord", "POST"},
|
||||
{gorm.Model{ID: 55, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecord", "删除操作记录", "sysOperationRecord", "DELETE"},
|
||||
{gorm.Model{ID: 56, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/findSysOperationRecord", "根据ID获取操作记录", "sysOperationRecord", "GET"},
|
||||
{gorm.Model{ID: 57, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/getSysOperationRecordList", "获取操作记录列表", "sysOperationRecord", "GET"},
|
||||
{gorm.Model{ID: 58, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getTables", "获取数据库表", "autoCode", "GET"},
|
||||
{gorm.Model{ID: 59, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getDB", "获取所有数据库", "autoCode", "GET"},
|
||||
{gorm.Model{ID: 60, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getColume", "获取所选table的所有字段", "autoCode", "GET"},
|
||||
{gorm.Model{ID: 61, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecordByIds", "批量删除操作历史", "sysOperationRecord", "DELETE"},
|
||||
{gorm.Model{ID: 62, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/upload", "插件版分片上传", "simpleUploader", "POST"},
|
||||
{gorm.Model{ID: 63, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/checkFileMd5", "文件完整度验证", "simpleUploader", "GET"},
|
||||
{gorm.Model{ID: 64, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/mergeFileMd5", "上传完成合并文件", "simpleUploader", "GET"},
|
||||
{gorm.Model{ID: 65, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserInfo", "设置用户信息", "user", "PUT"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysUser() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysUser{
|
||||
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "admin", Password: "e10adc3949ba59abbe56e057f20f883e", NickName: "超级管理员", HeaderImg: "http://qmplusimg.henrongyi.top/1571627762timg.jpg", AuthorityId: "888"},
|
||||
{Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "a303176530", Password: "3ec063004a6f31642261936a379fde3d", NickName: "QMPlusUser", HeaderImg: "http://qmplusimg.henrongyi.top/1572075907logo.png", AuthorityId: "9528"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitExaCustomer() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.ExaCustomer{
|
||||
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, CustomerName: "测试客户", CustomerPhoneData: "1761111111", SysUserID: 1, SysUserAuthorityID: "888"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitCasbinModel() (err error) {
|
||||
if !global.GVA_DB.Migrator().HasTable("casbin_rule") {
|
||||
if err := global.GVA_DB.Migrator().CreateTable(&gormadapter.CasbinRule{}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.CasbinModel{
|
||||
{"p", "888", "/base/login", "POST"},
|
||||
{"p", "888", "/base/register", "POST"},
|
||||
{"p", "888", "/api/createApi", "POST"},
|
||||
{"p", "888", "/api/getApiList", "POST"},
|
||||
{"p", "888", "/api/getApiById", "POST"},
|
||||
{"p", "888", "/api/deleteApi", "POST"},
|
||||
{"p", "888", "/api/updateApi", "POST"},
|
||||
{"p", "888", "/api/getAllApis", "POST"},
|
||||
{"p", "888", "/authority/createAuthority", "POST"},
|
||||
{"p", "888", "/authority/deleteAuthority", "POST"},
|
||||
{"p", "888", "/authority/getAuthorityList", "POST"},
|
||||
{"p", "888", "/authority/setDataAuthority", "POST"},
|
||||
{"p", "888", "/authority/updateAuthority", "PUT"},
|
||||
{"p", "888", "/authority/copyAuthority", "POST"},
|
||||
{"p", "888", "/menu/getMenu", "POST"},
|
||||
{"p", "888", "/menu/getMenuList", "POST"},
|
||||
{"p", "888", "/menu/addBaseMenu", "POST"},
|
||||
{"p", "888", "/menu/getBaseMenuTree", "POST"},
|
||||
{"p", "888", "/menu/addMenuAuthority", "POST"},
|
||||
{"p", "888", "/menu/getMenuAuthority", "POST"},
|
||||
{"p", "888", "/menu/deleteBaseMenu", "POST"},
|
||||
{"p", "888", "/menu/updateBaseMenu", "POST"},
|
||||
{"p", "888", "/menu/getBaseMenuById", "POST"},
|
||||
{"p", "888", "/user/changePassword", "POST"},
|
||||
{"p", "888", "/user/getUserList", "POST"},
|
||||
{"p", "888", "/user/setUserAuthority", "POST"},
|
||||
{"p", "888", "/user/deleteUser", "DELETE"},
|
||||
{"p", "888", "/fileUploadAndDownload/upload", "POST"},
|
||||
{"p", "888", "/fileUploadAndDownload/getFileList", "POST"},
|
||||
{"p", "888", "/fileUploadAndDownload/deleteFile", "POST"},
|
||||
{"p", "888", "/casbin/updateCasbin", "POST"},
|
||||
{"p", "888", "/casbin/getPolicyPathByAuthorityId", "POST"},
|
||||
{"p", "888", "/casbin/casbinTest/:pathParam", "GET"},
|
||||
{"p", "888", "/jwt/jsonInBlacklist", "POST"},
|
||||
{"p", "888", "/system/getSystemConfig", "POST"},
|
||||
{"p", "888", "/system/setSystemConfig", "POST"},
|
||||
{"p", "888", "/customer/customer", "POST"},
|
||||
{"p", "888", "/customer/customer", "PUT"},
|
||||
{"p", "888", "/customer/customer", "DELETE"},
|
||||
{"p", "888", "/customer/customer", "GET"},
|
||||
{"p", "888", "/customer/customerList", "GET"},
|
||||
{"p", "888", "/autoCode/createTemp", "POST"},
|
||||
{"p", "888", "/autoCode/getTables", "GET"},
|
||||
{"p", "888", "/autoCode/getDB", "GET"},
|
||||
{"p", "888", "/autoCode/getColume", "GET"},
|
||||
{"p", "888", "/sysDictionaryDetail/createSysDictionaryDetail", "POST"},
|
||||
{"p", "888", "/sysDictionaryDetail/deleteSysDictionaryDetail", "DELETE"},
|
||||
{"p", "888", "/sysDictionaryDetail/updateSysDictionaryDetail", "PUT"},
|
||||
{"p", "888", "/sysDictionaryDetail/findSysDictionaryDetail", "GET"},
|
||||
{"p", "888", "/sysDictionaryDetail/getSysDictionaryDetailList", "GET"},
|
||||
{"p", "888", "/sysDictionary/createSysDictionary", "POST"},
|
||||
{"p", "888", "/sysDictionary/deleteSysDictionary", "DELETE"},
|
||||
{"p", "888", "/sysDictionary/updateSysDictionary", "PUT"},
|
||||
{"p", "888", "/sysDictionary/findSysDictionary", "GET"},
|
||||
{"p", "888", "/sysDictionary/getSysDictionaryList", "GET"},
|
||||
{"p", "888", "/sysOperationRecord/createSysOperationRecord", "POST"},
|
||||
{"p", "888", "/sysOperationRecord/deleteSysOperationRecord", "DELETE"},
|
||||
{"p", "888", "/sysOperationRecord/updateSysOperationRecord", "PUT"},
|
||||
{"p", "888", "/sysOperationRecord/findSysOperationRecord", "GET"},
|
||||
{"p", "888", "/sysOperationRecord/getSysOperationRecordList", "GET"},
|
||||
{"p", "888", "/sysOperationRecord/deleteSysOperationRecordByIds", "DELETE"},
|
||||
{"p", "888", "/user/setUserInfo", "PUT"},
|
||||
{"p", "8881", "/base/login", "POST"},
|
||||
{"p", "8881", "/base/register", "POST"},
|
||||
{"p", "8881", "/api/createApi", "POST"},
|
||||
{"p", "8881", "/api/getApiList", "POST"},
|
||||
{"p", "8881", "/api/getApiById", "POST"},
|
||||
{"p", "8881", "/api/deleteApi", "POST"},
|
||||
{"p", "8881", "/api/updateApi", "POST"},
|
||||
{"p", "8881", "/api/getAllApis", "POST"},
|
||||
{"p", "8881", "/authority/createAuthority", "POST"},
|
||||
{"p", "8881", "/authority/deleteAuthority", "POST"},
|
||||
{"p", "8881", "/authority/getAuthorityList", "POST"},
|
||||
{"p", "8881", "/authority/setDataAuthority", "POST"},
|
||||
{"p", "8881", "/menu/getMenu", "POST"},
|
||||
{"p", "8881", "/menu/getMenuList", "POST"},
|
||||
{"p", "8881", "/menu/addBaseMenu", "POST"},
|
||||
{"p", "8881", "/menu/getBaseMenuTree", "POST"},
|
||||
{"p", "8881", "/menu/addMenuAuthority", "POST"},
|
||||
{"p", "8881", "/menu/getMenuAuthority", "POST"},
|
||||
{"p", "8881", "/menu/deleteBaseMenu", "POST"},
|
||||
{"p", "8881", "/menu/updateBaseMenu", "POST"},
|
||||
{"p", "8881", "/menu/getBaseMenuById", "POST"},
|
||||
{"p", "8881", "/user/changePassword", "POST"},
|
||||
{"p", "8881", "/user/getUserList", "POST"},
|
||||
{"p", "8881", "/user/setUserAuthority", "POST"},
|
||||
{"p", "8881", "/fileUploadAndDownload/upload", "POST"},
|
||||
{"p", "8881", "/fileUploadAndDownload/getFileList", "POST"},
|
||||
{"p", "8881", "/fileUploadAndDownload/deleteFile", "POST"},
|
||||
{"p", "8881", "/casbin/updateCasbin", "POST"},
|
||||
{"p", "8881", "/casbin/getPolicyPathByAuthorityId", "POST"},
|
||||
{"p", "8881", "/jwt/jsonInBlacklist", "POST"},
|
||||
{"p", "8881", "/system/getSystemConfig", "POST"},
|
||||
{"p", "8881", "/system/setSystemConfig", "POST"},
|
||||
{"p", "8881", "/customer/customer", "POST"},
|
||||
{"p", "8881", "/customer/customer", "PUT"},
|
||||
{"p", "8881", "/customer/customer", "DELETE"},
|
||||
{"p", "8881", "/customer/customer", "GET"},
|
||||
{"p", "8881", "/customer/customerList", "GET"},
|
||||
{"p", "9528", "/base/login", "POST"},
|
||||
{"p", "9528", "/base/register", "POST"},
|
||||
{"p", "9528", "/api/createApi", "POST"},
|
||||
{"p", "9528", "/api/getApiList", "POST"},
|
||||
{"p", "9528", "/api/getApiById", "POST"},
|
||||
{"p", "9528", "/api/deleteApi", "POST"},
|
||||
{"p", "9528", "/api/updateApi", "POST"},
|
||||
{"p", "9528", "/api/getAllApis", "POST"},
|
||||
{"p", "9528", "/authority/createAuthority", "POST"},
|
||||
{"p", "9528", "/authority/deleteAuthority", "POST"},
|
||||
{"p", "9528", "/authority/getAuthorityList", "POST"},
|
||||
{"p", "9528", "/authority/setDataAuthority", "POST"},
|
||||
{"p", "9528", "/menu/getMenu", "POST"},
|
||||
{"p", "9528", "/menu/getMenuList", "POST"},
|
||||
{"p", "9528", "/menu/addBaseMenu", "POST"},
|
||||
{"p", "9528", "/menu/getBaseMenuTree", "POST"},
|
||||
{"p", "9528", "/menu/addMenuAuthority", "POST"},
|
||||
{"p", "9528", "/menu/getMenuAuthority", "POST"},
|
||||
{"p", "9528", "/menu/deleteBaseMenu", "POST"},
|
||||
{"p", "9528", "/menu/updateBaseMenu", "POST"},
|
||||
{"p", "9528", "/menu/getBaseMenuById", "POST"},
|
||||
{"p", "9528", "/user/changePassword", "POST"},
|
||||
{"p", "9528", "/user/getUserList", "POST"},
|
||||
{"p", "9528", "/user/setUserAuthority", "POST"},
|
||||
{"p", "9528", "/fileUploadAndDownload/upload", "POST"},
|
||||
{"p", "9528", "/fileUploadAndDownload/getFileList", "POST"},
|
||||
{"p", "9528", "/fileUploadAndDownload/deleteFile", "POST"},
|
||||
{"p", "9528", "/casbin/updateCasbin", "POST"},
|
||||
{"p", "9528", "/casbin/getPolicyPathByAuthorityId", "POST"},
|
||||
{"p", "9528", "/jwt/jsonInBlacklist", "POST"},
|
||||
{"p", "9528", "/system/getSystemConfig", "POST"},
|
||||
{"p", "9528", "/system/setSystemConfig", "POST"},
|
||||
{"p", "9528", "/customer/customer", "POST"},
|
||||
{"p", "9528", "/customer/customer", "PUT"},
|
||||
{"p", "9528", "/customer/customer", "DELETE"},
|
||||
{"p", "9528", "/customer/customer", "GET"},
|
||||
{"p", "9528", "/customer/customerList", "GET"},
|
||||
{"p", "9528", "/autoCode/createTemp", "POST"},
|
||||
}
|
||||
if tx.Table("casbin_rule").Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysAuthority() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysAuthority{
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "888", AuthorityName: "普通用户", ParentId: "0"},
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "8881", AuthorityName: "普通用户子角色", ParentId: "888"},
|
||||
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "9528", AuthorityName: "测试角色", ParentId: "0"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysBaseMenus() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysBaseMenu{
|
||||
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "dashboard", Name: "dashboard", Hidden: false, Component: "view/dashboard/index.vue", Sort: 1, Meta: model.Meta{Title: "仪表盘", Icon: "setting"}},
|
||||
{Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "about", Name: "about", Component: "view/about/index.vue", Sort: 7, Meta: model.Meta{Title: "关于我们", Icon: "info"}},
|
||||
{Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "admin", Name: "superAdmin", Component: "view/superAdmin/index.vue", Sort: 3, Meta: model.Meta{Title: "超级管理员", Icon: "user-solid"}},
|
||||
{Model: gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "authority", Name: "authority", Component: "view/superAdmin/authority/authority.vue", Sort: 1, Meta: model.Meta{Title: "角色管理", Icon: "s-custom"}},
|
||||
{Model: gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "menu", Name: "menu", Component: "view/superAdmin/menu/menu.vue", Sort: 2, Meta: model.Meta{Title: "菜单管理", Icon: "s-order", KeepAlive: true}},
|
||||
{Model: gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "api", Name: "api", Component: "view/superAdmin/api/api.vue", Sort: 3, Meta: model.Meta{Title: "api管理", Icon: "s-platform", KeepAlive: true}},
|
||||
{Model: gorm.Model{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "user", Name: "user", Component: "view/superAdmin/user/user.vue", Sort: 4, Meta: model.Meta{Title: "用户管理", Icon: "coordinate"}},
|
||||
{Model: gorm.Model{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "0", Path: "person", Name: "person", Component: "view/person/person.vue", Sort: 4, Meta: model.Meta{Title: "个人信息", Icon: "message-solid"}},
|
||||
{Model: gorm.Model{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "example", Name: "example", Component: "view/example/index.vue", Sort: 6, Meta: model.Meta{Title: "示例文件", Icon: "s-management"}},
|
||||
{Model: gorm.Model{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "table", Name: "table", Component: "view/example/table/table.vue", Sort: 1, Meta: model.Meta{Title: "表格示例", Icon: "s-order"}},
|
||||
{Model: gorm.Model{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "form", Name: "form", Component: "view/example/form/form.vue", Sort: 2, Meta: model.Meta{Title: "表单示例", Icon: "document"}},
|
||||
{Model: gorm.Model{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "rte", Name: "rte", Component: "view/example/rte/rte.vue", Sort: 3, Meta: model.Meta{Title: "富文本编辑器", Icon: "reading"}},
|
||||
{Model: gorm.Model{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "excel", Name: "excel", Component: "view/example/excel/excel.vue", Sort: 4, Meta: model.Meta{Title: "excel导入导出", Icon: "s-marketing"}},
|
||||
{Model: gorm.Model{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "upload", Name: "upload", Component: "view/example/upload/upload.vue", Sort: 5, Meta: model.Meta{Title: "上传下载", Icon: "upload"}},
|
||||
{Model: gorm.Model{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "breakpoint", Name: "breakpoint", Component: "view/example/breakpoint/breakpoint.vue", Sort: 6, Meta: model.Meta{Title: "断点续传", Icon: "upload"}},
|
||||
{Model: gorm.Model{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "customer", Name: "customer", Component: "view/example/customer/customer.vue", Sort: 7, Meta: model.Meta{Title: "客户列表(资源示例)", Icon: "s-custom"}},
|
||||
{Model: gorm.Model{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "systemTools", Name: "systemTools", Component: "view/systemTools/index.vue", Sort: 5, Meta: model.Meta{Title: "系统工具", Icon: "s-cooperation"}},
|
||||
{Model: gorm.Model{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "autoCode", Name: "autoCode", Component: "view/systemTools/autoCode/index.vue", Sort: 1, Meta: model.Meta{Title: "代码生成器", Icon: "cpu", KeepAlive: true}},
|
||||
{Model: gorm.Model{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "formCreate", Name: "formCreate", Component: "view/systemTools/formCreate/index.vue", Sort: 2, Meta: model.Meta{Title: "表单生成器", Icon: "magic-stick", KeepAlive: true}},
|
||||
{Model: gorm.Model{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "system", Name: "system", Component: "view/systemTools/system/system.vue", Sort: 3, Meta: model.Meta{Title: "系统配置", Icon: "s-operation"}},
|
||||
{Model: gorm.Model{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "iconList", Name: "iconList", Component: "view/iconList/index.vue", Sort: 2, Meta: model.Meta{Title: "图标集合", Icon: "star-on"}},
|
||||
{Model: gorm.Model{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "dictionary", Name: "dictionary", Component: "view/superAdmin/dictionary/sysDictionary.vue", Sort: 5, Meta: model.Meta{Title: "字典管理", Icon: "notebook-2"}},
|
||||
{Model: gorm.Model{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: model.Meta{Title: "字典详情", Icon: "s-order"}},
|
||||
{Model: gorm.Model{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: model.Meta{Title: "操作历史", Icon: "time"}},
|
||||
{Model: gorm.Model{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "simpleUploader", Name: "simpleUploader", Component: "view/example/simpleUploader/simpleUploader", Sort: 6, Meta: model.Meta{Title: "断点续传(插件版)", Icon: "upload"}},
|
||||
{Model: gorm.Model{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: model.Meta{Title: "官方网站", Icon: "s-home"}},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitAuthorityMenu() (err error) {
|
||||
return global.GVA_DB.Exec("CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`, `sys_base_menus`.`updated_at` AS `updated_at`, `sys_base_menus`.`deleted_at` AS `deleted_at`, `sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`, `sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on ((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`)))").Error
|
||||
}
|
||||
|
||||
func InitSysDictionary() (err error) {
|
||||
status := new(bool)
|
||||
*status = true
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysDictionary{
|
||||
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"},
|
||||
{Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"},
|
||||
{Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"},
|
||||
{Model: gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库浮点型", Type: "float64", Status: status, Desc: "数据库浮点型"},
|
||||
{Model: gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库字符串", Type: "string", Status: status, Desc: "数据库字符串"},
|
||||
{Model: gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysAuthorityMenus() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []SysAuthorityMenus{
|
||||
{"888", 1},
|
||||
{"888", 2},
|
||||
{"888", 3},
|
||||
{"888", 4},
|
||||
{"888", 5},
|
||||
{"888", 6},
|
||||
{"888", 7},
|
||||
{"888", 8},
|
||||
{"888", 9},
|
||||
{"888", 10},
|
||||
{"888", 11},
|
||||
{"888", 12},
|
||||
{"888", 13},
|
||||
{"888", 14},
|
||||
{"888", 15},
|
||||
{"888", 16},
|
||||
{"888", 17},
|
||||
{"888", 18},
|
||||
{"888", 19},
|
||||
{"888", 20},
|
||||
{"888", 21},
|
||||
{"888", 22},
|
||||
{"888", 23},
|
||||
{"888", 24},
|
||||
{"888", 25},
|
||||
{"888", 26},
|
||||
{"8881", 1},
|
||||
{"8881", 2},
|
||||
{"8881", 8},
|
||||
{"8881", 17},
|
||||
{"8881", 18},
|
||||
{"8881", 19},
|
||||
{"8881", 20},
|
||||
{"9528", 1},
|
||||
{"9528", 2},
|
||||
{"9528", 3},
|
||||
{"9528", 4},
|
||||
{"9528", 5},
|
||||
{"9528", 6},
|
||||
{"9528", 7},
|
||||
{"9528", 8},
|
||||
{"9528", 9},
|
||||
{"9528", 10},
|
||||
{"9528", 11},
|
||||
{"9528", 12},
|
||||
{"9528", 13},
|
||||
{"9528", 14},
|
||||
{"9528", 15},
|
||||
{"9528", 17},
|
||||
{"9528", 18},
|
||||
{"9528", 19},
|
||||
{"9528", 20},
|
||||
}
|
||||
if tx.Table("sys_authority_menus").Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysDataAuthorityId() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []SysDataAuthorityId{
|
||||
{"888", "888"},
|
||||
{"888", "8881"},
|
||||
{"888", "9528"},
|
||||
{"9528", "8881"},
|
||||
{"9528", "9528"},
|
||||
}
|
||||
if tx.Table("sys_data_authority_ids").Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitSysDictionaryDetail() (err error) {
|
||||
status := new(bool)
|
||||
*status = true
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.SysDictionaryDetail{
|
||||
{gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "smallint", 1, status, 1, 2},
|
||||
{gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumint", 2, status, 2, 2},
|
||||
{gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "int", 3, status, 3, 2},
|
||||
{gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "bigint", 4, status, 4, 2},
|
||||
{gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "data", 0, status, 0, 3},
|
||||
{gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "time", 1, status, 1, 3},
|
||||
{gorm.Model{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "year", 2, status, 2, 3},
|
||||
{gorm.Model{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "datetime", 3, status, 3, 3},
|
||||
{gorm.Model{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "timestamp", 5, status, 5, 3},
|
||||
{gorm.Model{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "float", 0, status, 0, 4},
|
||||
{gorm.Model{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "double", 1, status, 1, 4},
|
||||
{gorm.Model{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "decimal", 2, status, 2, 4},
|
||||
{gorm.Model{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "char", 0, status, 0, 5},
|
||||
{gorm.Model{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "varchar", 1, status, 1, 5},
|
||||
{gorm.Model{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyblob", 2, status, 2, 5},
|
||||
{gorm.Model{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinytext", 3, status, 3, 5},
|
||||
{gorm.Model{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "text", 4, status, 4, 5},
|
||||
{gorm.Model{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "blob", 5, status, 5, 5},
|
||||
{gorm.Model{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumblob", 6, status, 6, 5},
|
||||
{gorm.Model{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumtext", 7, status, 7, 5},
|
||||
{gorm.Model{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longblob", 8, status, 8, 5},
|
||||
{gorm.Model{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longtext", 9, status, 9, 5},
|
||||
{gorm.Model{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyint", 0, status, 0, 6},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitExaFileUploadAndDownload() (err error) {
|
||||
tx := global.GVA_DB.Begin() // 开始事务
|
||||
insert := []model.ExaFileUploadAndDownload{
|
||||
{gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "http://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"},
|
||||
{gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "http://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"},
|
||||
}
|
||||
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
}
|
||||
|
||||
func InitData() {
|
||||
var err error
|
||||
err = InitSysApi()
|
||||
err = InitSysUser()
|
||||
err = InitExaCustomer()
|
||||
err = InitCasbinModel()
|
||||
err = InitSysAuthority()
|
||||
err = InitSysBaseMenus()
|
||||
err = InitAuthorityMenu()
|
||||
err = InitSysDictionary()
|
||||
err = InitSysAuthorityMenus()
|
||||
err = InitSysDataAuthorityId()
|
||||
err = InitSysDictionaryDetail()
|
||||
err = InitExaFileUploadAndDownload()
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("initialize data failed", zap.Any("err", err))
|
||||
}
|
||||
global.GVA_LOG.Debug("initialize data success")
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@echo ##########Formatting code#########################################
|
||||
go fmt ./ && go vet ./
|
||||
@echo ##########Format the code successfully############################
|
||||
@echo ##########Compiling gva.exe#######################################
|
||||
go build -o gva.exe cmd/main.go
|
||||
@echo ##########Successfully compiled gva.exe###########################
|
||||
@echo ##########Initializing data using gva.exe#########################
|
||||
gva.exe initdb
|
||||
@echo ##########Use gva.exe to initialize data successfully#############
|
||||
@echo ##########Deleting gva.exe########################################
|
||||
del gva.exe
|
||||
@echo ##########Deleting gva.exe successfully###########################
|
||||
+17
-76
@@ -5,31 +5,23 @@ import (
|
||||
"gin-vue-admin/model"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/driver/sqlserver"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
"os"
|
||||
)
|
||||
|
||||
var err error
|
||||
|
||||
// Gorm 初始化数据库并产生数据库全局变量
|
||||
func Gorm() {
|
||||
func Gorm() *gorm.DB {
|
||||
switch global.GVA_CONFIG.System.DbType {
|
||||
case "mysql":
|
||||
GormMysql()
|
||||
case "postgresql":
|
||||
GormPostgreSql()
|
||||
//case "sqlite": // sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可
|
||||
// GormSqlite()
|
||||
case "sqlserver":
|
||||
GormSqlServer()
|
||||
return GormMysql()
|
||||
default:
|
||||
return GormMysql()
|
||||
}
|
||||
}
|
||||
|
||||
// GormDBTables 注册数据库表专用
|
||||
func GormDBTables(db *gorm.DB) {
|
||||
// MysqlTables 注册数据库表专用
|
||||
func MysqlTables(db *gorm.DB) {
|
||||
err := db.AutoMigrate(
|
||||
model.SysUser{},
|
||||
model.SysAuthority{},
|
||||
@@ -52,11 +44,11 @@ func GormDBTables(db *gorm.DB) {
|
||||
global.GVA_LOG.Error("register table failed", zap.Any("err", err))
|
||||
os.Exit(0)
|
||||
}
|
||||
global.GVA_LOG.Debug("register table success")
|
||||
global.GVA_LOG.Info("register table success")
|
||||
}
|
||||
|
||||
// GormMysql 初始化Mysql数据库
|
||||
func GormMysql() {
|
||||
func GormMysql() *gorm.DB {
|
||||
m := global.GVA_CONFIG.Mysql
|
||||
dsn := m.Username + ":" + m.Password + "@tcp(" + m.Path + ")/" + m.Dbname + "?" + m.Config
|
||||
mysqlConfig := mysql.Config{
|
||||
@@ -67,80 +59,29 @@ func GormMysql() {
|
||||
DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列
|
||||
SkipInitializeWithVersion: false, // 根据版本自动配置
|
||||
}
|
||||
gormConfig := config(m.LogMode)
|
||||
if global.GVA_DB, err = gorm.Open(mysql.New(mysqlConfig), gormConfig); err != nil {
|
||||
if db, err := gorm.Open(mysql.New(mysqlConfig), gormConfig(m.LogMode)); err != nil {
|
||||
global.GVA_LOG.Error("MySQL启动异常", zap.Any("err", err))
|
||||
os.Exit(0)
|
||||
return nil
|
||||
} else {
|
||||
GormDBTables(global.GVA_DB)
|
||||
sqlDB, _ := global.GVA_DB.DB()
|
||||
sqlDB, _ := db.DB()
|
||||
sqlDB.SetMaxIdleConns(m.MaxIdleConns)
|
||||
sqlDB.SetMaxOpenConns(m.MaxOpenConns)
|
||||
return db
|
||||
}
|
||||
}
|
||||
|
||||
// GormPostgreSql 初始化PostgreSql数据库
|
||||
func GormPostgreSql() {
|
||||
p := global.GVA_CONFIG.Postgresql
|
||||
dsn := "user=" + p.Username + " password=" + p.Password + " dbname=" + p.Dbname + " port=" + p.Port + " " + p.Config
|
||||
postgresConfig := postgres.Config{
|
||||
DSN: dsn, // DSN data source name
|
||||
PreferSimpleProtocol: p.PreferSimpleProtocol, // 禁用隐式 prepared statement
|
||||
}
|
||||
gormConfig := config(p.Logger)
|
||||
if global.GVA_DB, err = gorm.Open(postgres.New(postgresConfig), gormConfig); err != nil {
|
||||
global.GVA_LOG.Error("PostgreSql启动异常", zap.Any("err", err))
|
||||
os.Exit(0)
|
||||
} else {
|
||||
GormDBTables(global.GVA_DB)
|
||||
sqlDB, _ := global.GVA_DB.DB()
|
||||
sqlDB.SetMaxIdleConns(p.MaxIdleConns)
|
||||
sqlDB.SetMaxOpenConns(p.MaxOpenConns)
|
||||
}
|
||||
}
|
||||
|
||||
// GormSqlite 初始化Sqlite数据库 sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可
|
||||
//func GormSqlite() {
|
||||
// s := global.GVA_CONFIG.Sqlite
|
||||
// gormConfig := config(s.Logger)
|
||||
// if global.GVA_DB, err = gorm.Open(sqlite.Open(s.Path), gormConfig); err != nil {
|
||||
// global.GVA_LOG.Error("Sqlite启动异常", zap.Any("err", err))
|
||||
// os.Exit(0)
|
||||
// } else {
|
||||
// GormDBTables(global.GVA_DB)
|
||||
// sqlDB, _ := global.GVA_DB.DB()
|
||||
// sqlDB.SetMaxIdleConns(s.MaxIdleConns)
|
||||
// sqlDB.SetMaxOpenConns(s.MaxOpenConns)
|
||||
// }
|
||||
//}
|
||||
|
||||
// GormSqlServer 初始化SqlServer数据库
|
||||
func GormSqlServer() {
|
||||
ss := global.GVA_CONFIG.Sqlserver
|
||||
dsn := "sqlserver://" + ss.Username + ":" + ss.Password + "@" + ss.Path + "?database=gorm"
|
||||
if global.GVA_DB, err = gorm.Open(sqlserver.Open(dsn), &gorm.Config{}); err != nil {
|
||||
global.GVA_LOG.Error("SqlServer启动异常", zap.Any("err", err))
|
||||
os.Exit(0)
|
||||
} else {
|
||||
GormDBTables(global.GVA_DB)
|
||||
sqlDB, _ := global.GVA_DB.DB()
|
||||
sqlDB.SetMaxIdleConns(ss.MaxIdleConns)
|
||||
sqlDB.SetMaxOpenConns(ss.MaxOpenConns)
|
||||
}
|
||||
}
|
||||
|
||||
// config 根据配置决定是否开启日志
|
||||
func config(mod bool) (c *gorm.Config) {
|
||||
// gormConfig 根据配置决定是否开启日志
|
||||
func gormConfig(mod bool) *gorm.Config {
|
||||
if mod {
|
||||
c = &gorm.Config{
|
||||
return &gorm.Config{
|
||||
Logger: logger.Default.LogMode(logger.Info),
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
}
|
||||
} else {
|
||||
c = &gorm.Config{
|
||||
return &gorm.Config{
|
||||
Logger: logger.Default.LogMode(logger.Silent),
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
+28
-24
@@ -15,35 +15,39 @@ import (
|
||||
|
||||
func Routers() *gin.Engine {
|
||||
var Router = gin.Default()
|
||||
// 为用户头像和文件提供静态地址
|
||||
Router.StaticFS(global.GVA_CONFIG.LocalUpload.FilePath, http.Dir(global.GVA_CONFIG.LocalUpload.FilePath))
|
||||
Router.StaticFS(global.GVA_CONFIG.Local.Path, http.Dir(global.GVA_CONFIG.Local.Path)) // 为用户头像和文件提供静态地址
|
||||
// Router.Use(middleware.LoadTls()) // 打开就能玩https了
|
||||
global.GVA_LOG.Debug("use middleware logger")
|
||||
global.GVA_LOG.Info("use middleware logger")
|
||||
// 跨域
|
||||
Router.Use(middleware.Cors())
|
||||
global.GVA_LOG.Debug("use middleware cors")
|
||||
global.GVA_LOG.Info("use middleware cors")
|
||||
Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
global.GVA_LOG.Debug("register swagger handler")
|
||||
global.GVA_LOG.Info("register swagger handler")
|
||||
// 方便统一添加路由组前缀 多服务器上线使用
|
||||
ApiGroup := Router.Group("")
|
||||
router.InitUserRouter(ApiGroup) // 注册用户路由
|
||||
router.InitBaseRouter(ApiGroup) // 注册基础功能路由 不做鉴权
|
||||
router.InitMenuRouter(ApiGroup) // 注册menu路由
|
||||
router.InitAuthorityRouter(ApiGroup) // 注册角色路由
|
||||
router.InitApiRouter(ApiGroup) // 注册功能api路由
|
||||
router.InitFileUploadAndDownloadRouter(ApiGroup) // 文件上传下载功能路由
|
||||
router.InitSimpleUploaderRouter(ApiGroup) // 断点续传(插件版)
|
||||
router.InitWorkflowRouter(ApiGroup) // 工作流相关路由
|
||||
router.InitCasbinRouter(ApiGroup) // 权限相关路由
|
||||
router.InitJwtRouter(ApiGroup) // jwt相关路由
|
||||
router.InitSystemRouter(ApiGroup) // system相关路由
|
||||
router.InitCustomerRouter(ApiGroup) // 客户路由
|
||||
router.InitAutoCodeRouter(ApiGroup) // 创建自动化代码
|
||||
router.InitSysDictionaryDetailRouter(ApiGroup) // 字典详情管理
|
||||
router.InitSysDictionaryRouter(ApiGroup) // 字典管理
|
||||
router.InitSysOperationRecordRouter(ApiGroup) // 操作记录
|
||||
router.InitEmailRouter(ApiGroup) // 邮件相关路由
|
||||
|
||||
PublicGroup := Router.Group("")
|
||||
{
|
||||
router.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
|
||||
}
|
||||
PrivateGroup := Router.Group("")
|
||||
PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
router.InitApiRouter(PrivateGroup) // 注册功能api路由
|
||||
router.InitJwtRouter(PrivateGroup) // jwt相关路由
|
||||
router.InitUserRouter(PrivateGroup) // 注册用户路由
|
||||
router.InitMenuRouter(PrivateGroup) // 注册menu路由
|
||||
router.InitEmailRouter(PrivateGroup) // 邮件相关路由
|
||||
router.InitSystemRouter(PrivateGroup) // system相关路由
|
||||
router.InitCasbinRouter(PrivateGroup) // 权限相关路由
|
||||
router.InitWorkflowRouter(PrivateGroup) // 工作流相关路由
|
||||
router.InitCustomerRouter(PrivateGroup) // 客户路由
|
||||
router.InitAutoCodeRouter(PrivateGroup) // 创建自动化代码
|
||||
router.InitAuthorityRouter(PrivateGroup) // 注册角色路由
|
||||
router.InitSimpleUploaderRouter(PrivateGroup) // 断点续传(插件版)
|
||||
router.InitSysDictionaryRouter(PrivateGroup) // 字典管理
|
||||
router.InitSysOperationRecordRouter(PrivateGroup) // 操作记录
|
||||
router.InitSysDictionaryDetailRouter(PrivateGroup) // 字典详情管理
|
||||
router.InitFileUploadAndDownloadRouter(PrivateGroup) // 文件上传下载功能路由
|
||||
}
|
||||
global.GVA_LOG.Info("router register success")
|
||||
return Router
|
||||
}
|
||||
|
||||
+4
-5
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"gin-vue-admin/core"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/gva/init_data"
|
||||
"gin-vue-admin/initialize"
|
||||
)
|
||||
|
||||
@@ -15,10 +14,10 @@ import (
|
||||
// @name x-token
|
||||
// @BasePath /
|
||||
func main() {
|
||||
initialize.Gorm()
|
||||
if global.GVA_CONFIG.System.NeedInitData {
|
||||
init_data.InitData() // 通过配置文件初始化数据 默认为 false 首次运行需要将 ./config.yaml中 system下的 need-init-data 修改为true
|
||||
}
|
||||
global.GVA_VP = core.Viper() // 初始化Viper
|
||||
global.GVA_LOG = core.Zap() // 初始化zap日志库
|
||||
global.GVA_DB = initialize.Gorm() // gorm连接数据库
|
||||
initialize.MysqlTables(global.GVA_DB) // 初始化表
|
||||
// 程序结束前关闭数据库链接
|
||||
db, _ := global.GVA_DB.DB()
|
||||
defer db.Close()
|
||||
|
||||
@@ -2,8 +2,8 @@ package middleware
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -25,7 +25,7 @@ func CasbinHandler() gin.HandlerFunc {
|
||||
if global.GVA_CONFIG.System.Env == "develop" || success {
|
||||
c.Next()
|
||||
} else {
|
||||
response.Result(response.ERROR, gin.H{}, "权限不足", c)
|
||||
response.FailWithDetailed(gin.H{}, "权限不足", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
@@ -9,8 +9,9 @@ import (
|
||||
func Cors() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
method := c.Request.Method
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id\"")
|
||||
origin := c.Request.Header.Get("Origin")
|
||||
c.Header("Access-Control-Allow-Origin", origin)
|
||||
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id")
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT")
|
||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/service"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ErrorToEmail() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
var username string
|
||||
if claims, ok := c.Get("claims"); ok {
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
username = waitUse.Username
|
||||
} else {
|
||||
id, _ := strconv.Atoi(c.Request.Header.Get("x-user-id"))
|
||||
err, user := service.FindUserById(id)
|
||||
if err != nil {
|
||||
username = "Unknown"
|
||||
}
|
||||
username = user.Username
|
||||
}
|
||||
body, _ := ioutil.ReadAll(c.Request.Body)
|
||||
record := model.SysOperationRecord{
|
||||
Ip: c.ClientIP(),
|
||||
Method: c.Request.Method,
|
||||
Path: c.Request.URL.Path,
|
||||
Agent: c.Request.UserAgent(),
|
||||
Body: string(body),
|
||||
}
|
||||
now := time.Now()
|
||||
|
||||
c.Next()
|
||||
|
||||
latency := time.Now().Sub(now)
|
||||
status := c.Writer.Status()
|
||||
record.ErrorMessage = c.Errors.ByType(gin.ErrorTypePrivate).String()
|
||||
str := "接收到的请求为" + record.Body + "\n" + "请求方式为" + record.Method + "\n" + "报错信息如下" + record.ErrorMessage + "\n" + "耗时" + latency.String() + "\n"
|
||||
if status != 200 {
|
||||
subject := username + "" + record.Ip + "调用了" + record.Path + "报错了"
|
||||
if err := utils.ErrorToEmail(subject, str); err != nil {
|
||||
global.GVA_LOG.Error("ErrorToEmail Failed, err:", zap.Any("err", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-26
@@ -3,9 +3,9 @@ package middleware
|
||||
import (
|
||||
"errors"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -16,19 +16,15 @@ import (
|
||||
|
||||
func JWTAuth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localSstorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
|
||||
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localStorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
|
||||
token := c.Request.Header.Get("x-token")
|
||||
if token == "" {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "未登录或非法访问", c)
|
||||
response.FailWithDetailed(gin.H{"reload": true}, "未登录或非法访问", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if service.IsBlacklist(token) {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "您的帐户异地登陆或令牌失效", c)
|
||||
response.FailWithDetailed(gin.H{"reload": true}, "您的帐户异地登陆或令牌失效", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
@@ -37,34 +33,34 @@ func JWTAuth() gin.HandlerFunc {
|
||||
claims, err := j.ParseToken(token)
|
||||
if err != nil {
|
||||
if err == TokenExpired {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "授权已过期", c)
|
||||
response.FailWithDetailed(gin.H{"reload": true}, "授权已过期", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, err.Error(), c)
|
||||
response.FailWithDetailed(gin.H{"reload": true}, err.Error(), c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if claims.ExpiresAt - time.Now().Unix()<claims.BufferTime {
|
||||
if err, _ = service.FindUserByUuid(claims.UUID.String()); err != nil {
|
||||
_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: token})
|
||||
response.FailWithDetailed(gin.H{"reload": true}, err.Error(), c)
|
||||
c.Abort()
|
||||
}
|
||||
if claims.ExpiresAt-time.Now().Unix() < claims.BufferTime {
|
||||
claims.ExpiresAt = time.Now().Unix() + 60*60*24*7
|
||||
newToken,_ := j.CreateToken(*claims)
|
||||
newClaims,_ := j.ParseToken(newToken)
|
||||
c.Header("new-token",newToken)
|
||||
c.Header("new-expires-at",strconv.FormatInt(newClaims.ExpiresAt,10))
|
||||
newToken, _ := j.CreateToken(*claims)
|
||||
newClaims, _ := j.ParseToken(newToken)
|
||||
c.Header("new-token", newToken)
|
||||
c.Header("new-expires-at", strconv.FormatInt(newClaims.ExpiresAt, 10))
|
||||
if global.GVA_CONFIG.System.UseMultipoint {
|
||||
err,RedisJwtToken := service.GetRedisJWT(newClaims.Username)
|
||||
if err!=nil {
|
||||
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
|
||||
}else{
|
||||
service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
|
||||
//当之前的取成功时才进行拉黑操作
|
||||
err, RedisJwtToken := service.GetRedisJWT(newClaims.Username)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
|
||||
} else { // 当之前的取成功时才进行拉黑操作
|
||||
_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
|
||||
}
|
||||
// 无论如何都要记录当前的活跃状态
|
||||
_ = service.SetRedisJWT(newToken,newClaims.Username)
|
||||
_ = service.SetRedisJWT(newToken, newClaims.Username)
|
||||
}
|
||||
}
|
||||
c.Set("claims", claims)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
func OperationRecord() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
var body []byte
|
||||
var userId int
|
||||
if c.Request.Method != http.MethodGet {
|
||||
var err error
|
||||
body, err = ioutil.ReadAll(c.Request.Body)
|
||||
@@ -25,9 +27,15 @@ func OperationRecord() gin.HandlerFunc {
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
}
|
||||
}
|
||||
userId, err := strconv.Atoi(c.Request.Header.Get("x-user-id"))
|
||||
if err != nil {
|
||||
userId = 0
|
||||
if claims, ok := c.Get("claims"); ok {
|
||||
waitUse := claims.(*request.CustomClaims)
|
||||
userId = int(waitUse.ID)
|
||||
} else {
|
||||
id, err := strconv.Atoi(c.Request.Header.Get("x-user-id"))
|
||||
if err != nil {
|
||||
userId = 0
|
||||
}
|
||||
userId = id
|
||||
}
|
||||
record := model.SysOperationRecord{
|
||||
Ip: c.ClientIP(),
|
||||
@@ -37,6 +45,11 @@ func OperationRecord() gin.HandlerFunc {
|
||||
Body: string(body),
|
||||
UserID: userId,
|
||||
}
|
||||
// 存在某些未知错误 TODO
|
||||
//values := c.Request.Header.Values("content-type")
|
||||
//if len(values) >0 && strings.Contains(values[0], "boundary") {
|
||||
// record.Body = "file"
|
||||
//}
|
||||
writer := responseBodyWriter{
|
||||
ResponseWriter: c.Writer,
|
||||
body: &bytes.Buffer{},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
// file struct, 文件结构体
|
||||
type ExaFile struct {
|
||||
gorm.Model
|
||||
global.GVA_MODEL
|
||||
FileName string
|
||||
FileMd5 string
|
||||
FilePath string
|
||||
@@ -17,7 +17,7 @@ type ExaFile struct {
|
||||
|
||||
// file chunk struct, 切片结构体
|
||||
type ExaFileChunk struct {
|
||||
gorm.Model
|
||||
global.GVA_MODEL
|
||||
ExaFileID uint
|
||||
FileChunkNumber int
|
||||
FileChunkPath string
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
type ExaCustomer struct {
|
||||
gorm.Model
|
||||
CustomerName string `json:"customerName" form:"customerName" gorm:"comment:'客户名'"`
|
||||
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:'客户手机号'"`
|
||||
SysUserID uint `json:"sysUserId" form:"sysUserId" gorm:"comment:'管理ID'"`
|
||||
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:'管理角色ID'"`
|
||||
SysUser SysUser `json:"sysUser" form:"sysUser" gorm:"comment:'管理详情'"`
|
||||
global.GVA_MODEL
|
||||
CustomerName string `json:"customerName" form:"customerName" gorm:"comment:客户名"`
|
||||
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:客户手机号"`
|
||||
SysUserID uint `json:"sysUserId" form:"sysUserId" gorm:"comment:管理ID"`
|
||||
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:管理角色ID"`
|
||||
SysUser SysUser `json:"sysUser" form:"sysUser" gorm:"comment:管理详情"`
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
type ExaFileUploadAndDownload struct {
|
||||
gorm.Model
|
||||
Name string `json:"name" gorm:"comment:'文件名'"`
|
||||
Url string `json:"url" gorm:"comment:'文件地址'"`
|
||||
Tag string `json:"tag" gorm:"comment:'文件标签'"`
|
||||
Key string `json:"key" gorm:"comment:'编号'"`
|
||||
global.GVA_MODEL
|
||||
Name string `json:"name" gorm:"comment:文件名"`
|
||||
Url string `json:"url" gorm:"comment:文件地址"`
|
||||
Tag string `json:"tag" gorm:"comment:文件标签"`
|
||||
Key string `json:"key" gorm:"comment:编号"`
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package model
|
||||
|
||||
type ExaSimpleUploader struct {
|
||||
ChunkNumber string `json:"chunkNumber" gorm:"comment:'当前切片标记'"`
|
||||
CurrentChunkSize string `json:"currentChunkSize" gorm:"comment:'当前切片容量'"`
|
||||
CurrentChunkPath string `json:"currentChunkPath" gorm:"comment:'切片本地路径'"`
|
||||
TotalSize string `json:"totalSize" gorm:"comment:'总容量'"`
|
||||
Identifier string `json:"identifier" gorm:"comment:'文件标识(md5)'"`
|
||||
Filename string `json:"filename" gorm:"comment:'文件名'"`
|
||||
TotalChunks string `json:"totalChunks" gorm:"comment:'切片总数'"`
|
||||
IsDone bool `json:"isDone" gorm:"comment:'是否上传完成'"`
|
||||
FilePath string `json:"filePath" gorm:"comment:'文件本地路径'"`
|
||||
ChunkNumber string `json:"chunkNumber" gorm:"comment:当前切片标记"`
|
||||
CurrentChunkSize string `json:"currentChunkSize" gorm:"comment:当前切片容量"`
|
||||
CurrentChunkPath string `json:"currentChunkPath" gorm:"comment:切片本地路径"`
|
||||
TotalSize string `json:"totalSize" gorm:"comment:总容量"`
|
||||
Identifier string `json:"identifier" gorm:"comment:文件标识(md5)"`
|
||||
Filename string `json:"filename" gorm:"comment:文件名"`
|
||||
TotalChunks string `json:"totalChunks" gorm:"comment:切片总数"`
|
||||
IsDone bool `json:"isDone" gorm:"comment:是否上传完成"`
|
||||
FilePath string `json:"filePath" gorm:"comment:文件本地路径"`
|
||||
}
|
||||
|
||||
@@ -13,4 +13,11 @@ type GetById struct {
|
||||
|
||||
type IdsReq struct {
|
||||
Ids []int `json:"ids" form:"ids"`
|
||||
}
|
||||
}
|
||||
|
||||
// Get role by id structure
|
||||
type GetAuthorityId struct {
|
||||
AuthorityId string
|
||||
}
|
||||
|
||||
type Empty struct {}
|
||||
@@ -1,16 +1,16 @@
|
||||
package request
|
||||
|
||||
type DBReq struct {
|
||||
Database string `json:"database";gorm:"column:database"`
|
||||
Database string `json:"database" gorm:"column:database"`
|
||||
}
|
||||
|
||||
type TableReq struct {
|
||||
TableName string `json:"tableName"`
|
||||
}
|
||||
|
||||
type ColumeReq struct {
|
||||
ColumeName string `json:"columeName";gorm:"column:colume_name"`
|
||||
DataType string `json:"dataType";gorm:"column:data_type"`
|
||||
DataTypeLong string `json:"dataTypeLong";gorm:"column:data_type_long"`
|
||||
ColumeComment string `json:"columeComment";gorm:"column:colume_comment"`
|
||||
type ColumnReq struct {
|
||||
ColumnName string `json:"columnName" gorm:"column:column_name"`
|
||||
DataType string `json:"dataType" gorm:"column:data_type"`
|
||||
DataTypeLong string `json:"dataTypeLong" gorm:"column:data_type_long"`
|
||||
ColumnComment string `json:"columnComment" gorm:"column:column_comment"`
|
||||
}
|
||||
|
||||
@@ -7,8 +7,3 @@ type AddMenuAuthorityInfo struct {
|
||||
Menus []model.SysBaseMenu
|
||||
AuthorityId string
|
||||
}
|
||||
|
||||
// Get role by id structure
|
||||
type AuthorityIdInfo struct {
|
||||
AuthorityId string
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package request
|
||||
import uuid "github.com/satori/go.uuid"
|
||||
|
||||
// User register structure
|
||||
type RegisterStruct struct {
|
||||
type Register struct {
|
||||
Username string `json:"userName"`
|
||||
Password string `json:"passWord"`
|
||||
NickName string `json:"nickName" gorm:"default:'QMPlusUser'"`
|
||||
@@ -12,7 +12,7 @@ type RegisterStruct struct {
|
||||
}
|
||||
|
||||
// User login structure
|
||||
type RegisterAndLoginStruct struct {
|
||||
type Login struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Captcha string `json:"captcha"`
|
||||
|
||||
@@ -37,7 +37,7 @@ func OkWithData(data interface{}, c *gin.Context) {
|
||||
Result(SUCCESS, data, "操作成功", c)
|
||||
}
|
||||
|
||||
func OkDetailed(data interface{}, message string, c *gin.Context) {
|
||||
func OkWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(SUCCESS, data, message, c)
|
||||
}
|
||||
|
||||
@@ -49,6 +49,6 @@ func FailWithMessage(message string, c *gin.Context) {
|
||||
Result(ERROR, map[string]interface{}{}, message, c)
|
||||
}
|
||||
|
||||
func FailWithDetailed(code int, data interface{}, message string, c *gin.Context) {
|
||||
Result(code, data, message, c)
|
||||
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(ERROR, data, message, c)
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
type SysApi struct {
|
||||
gorm.Model
|
||||
Path string `json:"path" gorm:"comment:'api路径'"`
|
||||
Description string `json:"description" gorm:"comment:'api中文描述'"`
|
||||
ApiGroup string `json:"apiGroup" gorm:"comment:'api组'"`
|
||||
Method string `json:"method" gorm:"default:'POST'" gorm:"comment:'方法'"`
|
||||
global.GVA_MODEL
|
||||
Path string `json:"path" gorm:"comment:api路径"`
|
||||
Description string `json:"description" gorm:"comment:api中文描述"`
|
||||
ApiGroup string `json:"apiGroup" gorm:"comment:api组"`
|
||||
Method string `json:"method" gorm:"default:POST" gorm:"comment:方法"`
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ type SysAuthority struct {
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time `sql:"index"`
|
||||
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key;comment:'角色ID';size:90"`
|
||||
AuthorityName string `json:"authorityName" gorm:"comment:'角色名'"`
|
||||
ParentId string `json:"parentId" gorm:"comment:'父角色ID'"`
|
||||
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;size:90"`
|
||||
AuthorityName string `json:"authorityName" gorm:"comment:角色名"`
|
||||
ParentId string `json:"parentId" gorm:"comment:父角色ID"`
|
||||
DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id"`
|
||||
Children []SysAuthority `json:"children" gorm:"-"`
|
||||
SysBaseMenus []SysBaseMenu `json:"menus" gorm:"many2many:sys_authority_menus;"`
|
||||
|
||||
@@ -2,8 +2,8 @@ package model
|
||||
|
||||
type SysMenu struct {
|
||||
SysBaseMenu
|
||||
MenuId string `json:"menuId" gorm:"comment:'菜单ID'"`
|
||||
AuthorityId string `json:"-" gorm:"comment:'角色ID'"`
|
||||
MenuId string `json:"menuId" gorm:"comment:菜单ID"`
|
||||
AuthorityId string `json:"-" gorm:"comment:角色ID"`
|
||||
Children []SysMenu `json:"children" gorm:"-"`
|
||||
Parameters []SysBaseMenuParameter `json:"parameters" gorm:"foreignKey:SysBaseMenuID;references:MenuId"`
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package model
|
||||
|
||||
import "errors"
|
||||
|
||||
// 初始版本自动化代码工具
|
||||
type AutoCodeStruct struct {
|
||||
StructName string `json:"structName"`
|
||||
@@ -8,6 +10,7 @@ type AutoCodeStruct struct {
|
||||
Abbreviation string `json:"abbreviation"`
|
||||
Description string `json:"description"`
|
||||
AutoCreateApiToSql bool `json:"autoCreateApiToSql"`
|
||||
AutoMoveFile bool `json:"autoMoveFile"`
|
||||
Fields []Field `json:"fields"`
|
||||
}
|
||||
|
||||
@@ -23,3 +26,5 @@ type Field struct {
|
||||
FieldSearchType string `json:"fieldSearchType"`
|
||||
DictType string `json:"dictType"`
|
||||
}
|
||||
|
||||
var AutoMoveErr error = errors.New("创建代码成功并移动文件成功")
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
type SysBaseMenu struct {
|
||||
gorm.Model
|
||||
global.GVA_MODEL
|
||||
MenuLevel uint `json:"-"`
|
||||
ParentId string `json:"parentId" gorm:"comment:'父菜单ID'"`
|
||||
Path string `json:"path" gorm:"comment:'路由path'"`
|
||||
Name string `json:"name" gorm:"comment:'路由name'"`
|
||||
Hidden bool `json:"hidden" gorm:"comment:'是否在列表隐藏'"`
|
||||
Component string `json:"component" gorm:"comment:'对应前端文件路径'"`
|
||||
Sort int `json:"sort" gorm:"comment:'排序标记'"`
|
||||
Meta `json:"meta" gorm:"comment:'附加属性'"`
|
||||
ParentId string `json:"parentId" gorm:"comment:父菜单ID"`
|
||||
Path string `json:"path" gorm:"comment:路由path"`
|
||||
Name string `json:"name" gorm:"comment:路由name"`
|
||||
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"`
|
||||
Component string `json:"component" gorm:"comment:对应前端文件路径"`
|
||||
Sort int `json:"sort" gorm:"comment:排序标记"`
|
||||
Meta `json:"meta" gorm:"comment:附加属性"`
|
||||
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
|
||||
Children []SysBaseMenu `json:"children" gorm:"-"`
|
||||
Parameters []SysBaseMenuParameter `json:"parameters"`
|
||||
}
|
||||
|
||||
type Meta struct {
|
||||
KeepAlive bool `json:"keepAlive" gorm:"comment:'是否缓存'"`
|
||||
DefaultMenu bool `json:"defaultMenu" gorm:"comment:'是否是基础路由(开发中)'"`
|
||||
Title string `json:"title" gorm:"comment:'菜单名'"`
|
||||
Icon string `json:"icon" gorm:"comment:'菜单图标'"`
|
||||
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"`
|
||||
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"`
|
||||
Title string `json:"title" gorm:"comment:菜单名"`
|
||||
Icon string `json:"icon" gorm:"comment:菜单图标"`
|
||||
}
|
||||
|
||||
type SysBaseMenuParameter struct {
|
||||
gorm.Model
|
||||
global.GVA_MODEL
|
||||
SysBaseMenuID uint
|
||||
Type string `json:"type" gorm:"commit:'地址栏携带参数为params还是query'"`
|
||||
Key string `json:"key" gorm:"commit:'地址栏携带参数的key'"`
|
||||
Value string `json:"value" gorm:"commit:'地址栏携带参数的值'"`
|
||||
Type string `json:"type" gorm:"comment:地址栏携带参数为params还是query"`
|
||||
Key string `json:"key" gorm:"comment:地址栏携带参数的key"`
|
||||
Value string `json:"value" gorm:"comment:地址栏携带参数的值"`
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
// 如果含有time.Time 请自行import time包
|
||||
type SysDictionary struct {
|
||||
gorm.Model
|
||||
Name string `json:"name" form:"name" gorm:"column:name;comment:'字典名(中)'"`
|
||||
Type string `json:"type" form:"type" gorm:"column:type;comment:'字典名(英)'"`
|
||||
Status *bool `json:"status" form:"status" gorm:"column:status;comment:'状态'"`
|
||||
Desc string `json:"desc" form:"desc" gorm:"column:desc;comment:'描述'"`
|
||||
global.GVA_MODEL
|
||||
Name string `json:"name" form:"name" gorm:"column:name;comment:字典名(中)"`
|
||||
Type string `json:"type" form:"type" gorm:"column:type;comment:字典名(英)"`
|
||||
Status *bool `json:"status" form:"status" gorm:"column:status;comment:状态"`
|
||||
Desc string `json:"desc" form:"desc" gorm:"column:desc;comment:描述"`
|
||||
SysDictionaryDetails []SysDictionaryDetail `json:"sysDictionaryDetails" form:"sysDictionaryDetails"`
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
// 如果含有time.Time 请自行import time包
|
||||
type SysDictionaryDetail struct {
|
||||
gorm.Model
|
||||
Label string `json:"label" form:"label" gorm:"column:label;comment:'展示值'"`
|
||||
Value int `json:"value" form:"value" gorm:"column:value;comment:'字典值'"`
|
||||
Status *bool `json:"status" form:"status" gorm:"column:status;comment:'启用状态'"`
|
||||
Sort int `json:"sort" form:"sort" gorm:"column:sort;comment:'排序标记'"`
|
||||
SysDictionaryID int `json:"sysDictionaryID" form:"sysDictionaryID" gorm:"column:sys_dictionary_id;comment:'关联标记'"`
|
||||
global.GVA_MODEL
|
||||
Label string `json:"label" form:"label" gorm:"column:label;comment:展示值"`
|
||||
Value int `json:"value" form:"value" gorm:"column:value;comment:字典值"`
|
||||
Status *bool `json:"status" form:"status" gorm:"column:status;comment:启用状态"`
|
||||
Sort int `json:"sort" form:"sort" gorm:"column:sort;comment:排序标记"`
|
||||
SysDictionaryID int `json:"sysDictionaryID" form:"sysDictionaryID" gorm:"column:sys_dictionary_id;comment:关联标记"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
type JwtBlacklist struct {
|
||||
gorm.Model
|
||||
Jwt string `gorm:"type:text;comment:'jwt'"`
|
||||
global.GVA_MODEL
|
||||
Jwt string `gorm:"type:text;comment:jwt"`
|
||||
}
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gin-vue-admin/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 如果含有time.Time 请自行import time包
|
||||
type SysOperationRecord struct {
|
||||
gorm.Model
|
||||
Ip string `json:"ip" form:"ip" gorm:"column:ip;comment:'请求ip'"`
|
||||
Method string `json:"method" form:"method" gorm:"column:method;comment:''"`
|
||||
Path string `json:"path" form:"path" gorm:"column:path;comment:''"`
|
||||
Status int `json:"status" form:"status" gorm:"column:status;comment:''"`
|
||||
Latency time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:''"`
|
||||
Agent string `json:"agent" form:"agent" gorm:"column:agent;comment:''"`
|
||||
ErrorMessage string `json:"error_message" form:"error_message" gorm:"column:error_message;comment:''"`
|
||||
Body string `json:"body" form:"body" gorm:"column:body;comment:'请求Body'"`
|
||||
Resp string `json:"resp" form:"resp" gorm:"type:longtext;column:resp;comment:'响应Body'"`
|
||||
UserID int `json:"user_id" form:"user_id" gorm:"column:user_id;comment:''"`
|
||||
global.GVA_MODEL
|
||||
Ip string `json:"ip" form:"ip" gorm:"column:ip;comment:请求ip"`
|
||||
Method string `json:"method" form:"method" gorm:"column:method;comment:请求方法"`
|
||||
Path string `json:"path" form:"path" gorm:"column:path;comment:请求路径"`
|
||||
Status int `json:"status" form:"status" gorm:"column:status;comment:请求状态"`
|
||||
Latency time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:延迟"`
|
||||
Agent string `json:"agent" form:"agent" gorm:"column:agent;comment:代理"`
|
||||
ErrorMessage string `json:"error_message" form:"error_message" gorm:"column:error_message;comment:错误信息"`
|
||||
Body string `json:"body" form:"body" gorm:"type:longtext;column:body;comment:请求Body"`
|
||||
Resp string `json:"resp" form:"resp" gorm:"type:longtext;column:resp;comment:响应Body"`
|
||||
UserID int `json:"user_id" form:"user_id" gorm:"column:user_id;comment:用户id"`
|
||||
User SysUser `json:"user"`
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/satori/go.uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SysUser struct {
|
||||
gorm.Model
|
||||
UUID uuid.UUID `json:"uuid" gorm:"comment:'用户UUID'"`
|
||||
Username string `json:"userName" gorm:"comment:'用户登录名'"`
|
||||
Password string `json:"-" gorm:"comment:'用户登录密码'"`
|
||||
NickName string `json:"nickName" gorm:"default:'系统用户';comment:'用户昵称'" `
|
||||
HeaderImg string `json:"headerImg" gorm:"default:'http://qmplusimg.henrongyi.top/head.png';comment:'用户头像'"`
|
||||
Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:'用户角色'"`
|
||||
AuthorityId string `json:"authorityId" gorm:"default:888;comment:'用户角色ID'"`
|
||||
global.GVA_MODEL
|
||||
UUID uuid.UUID `json:"uuid" gorm:"comment:用户UUID"`
|
||||
Username string `json:"userName" gorm:"comment:用户登录名"`
|
||||
Password string `json:"-" gorm:"comment:用户登录密码"`
|
||||
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称" `
|
||||
HeaderImg string `json:"headerImg" gorm:"default:http://qmplusimg.henrongyi.top/head.png;comment:用户头像"`
|
||||
Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
|
||||
AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"`
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user