Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
3dd34c7f
Commit
3dd34c7f
authored
Jun 24, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
4cce9bef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletions
+49
-1
center-manage/app/base/controller/impl/common/articleCtl.js
+6
-0
center-manage/app/base/db/impl/common/articleDao.js
+29
-0
center-manage/app/base/db/models/common/article.js
+14
-1
No files found.
center-manage/app/base/controller/impl/common/articleCtl.js
View file @
3dd34c7f
...
@@ -4,5 +4,11 @@ class ArticleCtl extends CtlBase {
...
@@ -4,5 +4,11 @@ class ArticleCtl extends CtlBase {
constructor
()
{
constructor
()
{
super
(
"common"
,
CtlBase
.
getServiceName
(
ArticleCtl
));
super
(
"common"
,
CtlBase
.
getServiceName
(
ArticleCtl
));
}
}
async
create
(
p
,
q
,
req
){
p
.
creator_id
=
p
.
userid
p
.
creator
=
p
.
username
let
rtn
=
await
this
.
service
.
create
(
p
,
q
,
req
)
return
system
.
getResult
(
rtn
)
}
}
}
module
.
exports
=
ArticleCtl
;
module
.
exports
=
ArticleCtl
;
center-manage/app/base/db/impl/common/articleDao.js
0 → 100644
View file @
3dd34c7f
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
ArticleDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
ArticleDao
));
}
orderBy
(
qobj
)
{
//return {"key":"include","value":{model:this.db.models.app}};
if
(
!
qobj
.
orderInfo
||
qobj
.
orderInfo
.
length
==
0
){
return
[[
"created_at"
,
"ASC"
]];
}
else
{
return
qobj
.
orderInfo
;
}
}
}
module
.
exports
=
ArticleDao
;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
center-manage/app/base/db/models/common/article.js
View file @
3dd34c7f
...
@@ -7,6 +7,14 @@ module.exports = (db, DataTypes) => {
...
@@ -7,6 +7,14 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
},
//和user的from相同,在注册user时,去创建
desc
:
{
//概述
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
},
//和us
listimg
:
{
//简图
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
},
//和us
isPubed
:{
isPubed
:{
type
:
DataTypes
.
BOOLEAN
,
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
defaultValue
:
false
...
@@ -23,6 +31,11 @@ module.exports = (db, DataTypes) => {
...
@@ -23,6 +31,11 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
allowNull
:
false
,
},
},
seq
:{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
},
creator_id
:{
creator_id
:{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
allowNull
:
false
,
...
@@ -32,7 +45,7 @@ module.exports = (db, DataTypes) => {
...
@@ -32,7 +45,7 @@ module.exports = (db, DataTypes) => {
allowNull
:
false
,
allowNull
:
false
,
}
}
},
{
},
{
paranoid
:
tru
e
,
//假的删除
paranoid
:
fals
e
,
//假的删除
underscored
:
true
,
underscored
:
true
,
version
:
true
,
version
:
true
,
freezeTableName
:
true
,
freezeTableName
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment