q-koa 11.8.2 → 11.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/file/plugins/douyin_user/config.js +11 -3
- package/core/file/plugins/h5_user/config.js +8 -0
- package/core/file/plugins/h5_user/model.js +1 -1
- package/core/file/plugins/open_user/config.js +23 -0
- package/core/file/plugins/open_user/model.js +59 -0
- package/core/file/plugins/system/controller.js +12 -5
- package/core/file/plugins/toutiao_user/config.js +11 -3
- package/core/file/plugins/toutiao_user/model.js +1 -1
- package/package.json +1 -1
|
@@ -3,13 +3,21 @@ module.exports = {
|
|
|
3
3
|
belongs: 'page',
|
|
4
4
|
multiple: false,
|
|
5
5
|
availableSort: false,
|
|
6
|
-
order: [
|
|
7
|
-
select: [{
|
|
6
|
+
order: ['created_at'],
|
|
7
|
+
select: [{ key: 'user_id' }, { key: 'nick_name' }],
|
|
8
8
|
excludes: [],
|
|
9
9
|
limit: 20,
|
|
10
10
|
defaultOrder: [{ sort: 'descending', type: 'id' }],
|
|
11
|
-
comment: {
|
|
11
|
+
comment: { created_at: '创建时间' },
|
|
12
12
|
sortOrder: 1,
|
|
13
13
|
reference: [],
|
|
14
14
|
excludeAuth: [],
|
|
15
|
+
indexList: [
|
|
16
|
+
{
|
|
17
|
+
name: 'openid',
|
|
18
|
+
unique: true,
|
|
19
|
+
fields: ['openid'],
|
|
20
|
+
},
|
|
21
|
+
{ fields: ['user_id'] },
|
|
22
|
+
],
|
|
15
23
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: '微信开放平台用户',
|
|
3
|
+
belongs: 'page',
|
|
4
|
+
multiple: false,
|
|
5
|
+
availableSort: false,
|
|
6
|
+
order: ['created_at'],
|
|
7
|
+
select: [{ key: 'user_id' }, { key: 'nick_name' }],
|
|
8
|
+
excludes: [],
|
|
9
|
+
limit: 20,
|
|
10
|
+
defaultOrder: [{ sort: 'descending', type: 'id' }],
|
|
11
|
+
comment: { created_at: '创建时间' },
|
|
12
|
+
sortOrder: 1,
|
|
13
|
+
reference: [],
|
|
14
|
+
excludeAuth: [],
|
|
15
|
+
indexList: [
|
|
16
|
+
{
|
|
17
|
+
name: 'openid',
|
|
18
|
+
unique: true,
|
|
19
|
+
fields: ['openid'],
|
|
20
|
+
},
|
|
21
|
+
{ fields: ['user_id'] },
|
|
22
|
+
],
|
|
23
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const { Sequelize, Random } = require('q-koa')
|
|
2
|
+
|
|
3
|
+
exports.openid = {
|
|
4
|
+
type: Sequelize.STRING,
|
|
5
|
+
comment: 'openid',
|
|
6
|
+
allowNull: false,
|
|
7
|
+
is_mock: false,
|
|
8
|
+
defaultValue: '',
|
|
9
|
+
sortOrder: 1,
|
|
10
|
+
unique: ['openid'],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.user_id = {
|
|
14
|
+
type: Sequelize.MEDIUMINT.UNSIGNED,
|
|
15
|
+
comment: '用户',
|
|
16
|
+
allowNull: false,
|
|
17
|
+
is_mock: false,
|
|
18
|
+
defaultValue: 0,
|
|
19
|
+
sortOrder: 2,
|
|
20
|
+
hasOne: true,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.nick_name = {
|
|
24
|
+
type: Sequelize.STRING,
|
|
25
|
+
comment: '昵称',
|
|
26
|
+
allowNull: false,
|
|
27
|
+
is_mock: false,
|
|
28
|
+
defaultValue: '',
|
|
29
|
+
sortOrder: 3,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.avatar = {
|
|
33
|
+
type: Sequelize.STRING(1000),
|
|
34
|
+
comment: '头像',
|
|
35
|
+
allowNull: false,
|
|
36
|
+
is_mock: false,
|
|
37
|
+
defaultValue: '',
|
|
38
|
+
sortOrder: 8,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.appid = {
|
|
42
|
+
type: Sequelize.STRING,
|
|
43
|
+
comment: 'app_id',
|
|
44
|
+
allowNull: false,
|
|
45
|
+
is_mock: true,
|
|
46
|
+
defaultValue: '',
|
|
47
|
+
sortOrder: 10,
|
|
48
|
+
mock: () => Random.ctitle(),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.unionid = {
|
|
52
|
+
type: Sequelize.STRING,
|
|
53
|
+
comment: 'unionid',
|
|
54
|
+
allowNull: false,
|
|
55
|
+
is_mock: true,
|
|
56
|
+
defaultValue: '',
|
|
57
|
+
sortOrder: 11,
|
|
58
|
+
mock: () => Random.ctitle(),
|
|
59
|
+
}
|
|
@@ -28,12 +28,17 @@ const compareIndex = (tableIndexList, modelIndexList = [], model) => {
|
|
|
28
28
|
return !(
|
|
29
29
|
((i.name.startsWith(model) &&
|
|
30
30
|
i.fields.every((f) => i.name.includes(f))) ||
|
|
31
|
-
modelIndexList
|
|
32
|
-
|
|
31
|
+
modelIndexList
|
|
32
|
+
.filter((i) => i.name !== 'PRIMARY')
|
|
33
|
+
.some((m) => m.name === i.name)) &&
|
|
34
|
+
modelIndexList
|
|
35
|
+
.filter((i) => i.name !== 'PRIMARY')
|
|
36
|
+
.some((m) => isSameArray(m.fields, i.fields, true))
|
|
33
37
|
)
|
|
34
38
|
}).length === 0 &&
|
|
35
39
|
tableIndexList.filter((i) => i.name !== 'PRIMARY').length ===
|
|
36
|
-
modelIndexList.length
|
|
40
|
+
modelIndexList.filter((i) => i.name !== 'PRIMARY').length
|
|
41
|
+
|
|
37
42
|
return flag
|
|
38
43
|
}
|
|
39
44
|
|
|
@@ -726,7 +731,7 @@ exports.checkIndex = async (ctx) => {
|
|
|
726
731
|
...res,
|
|
727
732
|
[current]: {
|
|
728
733
|
isSame,
|
|
729
|
-
tableIndexList,
|
|
734
|
+
indexList: tableIndexList.filter((i) => i.name !== 'PRIMARY'),
|
|
730
735
|
},
|
|
731
736
|
}
|
|
732
737
|
}
|
|
@@ -746,7 +751,9 @@ exports.checkIndex = async (ctx) => {
|
|
|
746
751
|
const isSame = compareIndex(tableIndexList, modelIndexList, model)
|
|
747
752
|
return ctx.SUCCESS({
|
|
748
753
|
isSame,
|
|
749
|
-
...(isSame
|
|
754
|
+
...(isSame
|
|
755
|
+
? {}
|
|
756
|
+
: { indexList: tableIndexList.filter((i) => i.name !== 'PRIMARY') }),
|
|
750
757
|
})
|
|
751
758
|
}
|
|
752
759
|
}
|
|
@@ -3,13 +3,21 @@ module.exports = {
|
|
|
3
3
|
belongs: 'page',
|
|
4
4
|
multiple: false,
|
|
5
5
|
availableSort: false,
|
|
6
|
-
order: [
|
|
7
|
-
select: [{
|
|
6
|
+
order: ['created_at'],
|
|
7
|
+
select: [{ key: 'user_id' }, { key: 'nick_name' }],
|
|
8
8
|
excludes: [],
|
|
9
9
|
limit: 20,
|
|
10
10
|
defaultOrder: [{ sort: 'descending', type: 'id' }],
|
|
11
|
-
comment: {
|
|
11
|
+
comment: { created_at: '创建时间' },
|
|
12
12
|
sortOrder: 1,
|
|
13
13
|
reference: [],
|
|
14
14
|
excludeAuth: [],
|
|
15
|
+
indexList: [
|
|
16
|
+
{
|
|
17
|
+
name: 'openid',
|
|
18
|
+
unique: true,
|
|
19
|
+
fields: ['openid'],
|
|
20
|
+
},
|
|
21
|
+
{ fields: ['user_id'] },
|
|
22
|
+
],
|
|
15
23
|
}
|