Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
f5a7697e
Commit
f5a7697e
authored
Jan 07, 2015
by
杨翌文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加控制器
parent
a1c6e58f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
0 deletions
+120
-0
forumGroup.js
app/controllers/forumGroup.js
+43
-0
forumInfo.js
app/controllers/forumInfo.js
+43
-0
forumShare.js
app/models/forumShare.js
+34
-0
No files found.
app/controllers/forumGroup.js
0 → 100644
View file @
f5a7697e
'use strict'
;
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
returnCode
=
require
(
'../utils/returnCode'
),
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/forum'
,
router
);
};
//新增论坛组
router
.
post
(
'/group/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
group
=
new
mongodb
.
ForumGroup
(
req
.
body
);
group
.
save
(
function
(
err
,
group
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
group
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
//获取目标论坛组信息
router
.
get
(
'/group/info/:gid'
,
function
(
req
,
res
,
next
)
{
var
gid
=
req
.
params
.
gid
||
null
;
var
rs
=
{};
if
(
gid
)
{
mongodb
.
ForumGroup
.
findById
(
gid
,
function
(
err
,
group
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
group
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ No newline at end of file
app/controllers/forumInfo.js
0 → 100644
View file @
f5a7697e
'use strict'
;
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
returnCode
=
require
(
'../utils/returnCode'
),
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/forum'
,
router
);
};
//新增论坛板块
router
.
post
(
'/info/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
forum
=
new
mongodb
.
ForumInfo
(
req
.
body
);
forum
.
save
(
function
(
err
,
forum
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
forum
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
//获取目标论坛板块
router
.
get
(
'/info/get/:fid'
,
function
(
req
,
res
,
next
)
{
var
fid
=
req
.
params
.
fid
||
null
;
var
rs
=
{};
if
(
fid
)
{
mongodb
.
ForumInfo
.
findById
(
fid
,
function
(
err
,
forum
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
group
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ No newline at end of file
app/models/forumShare.js
0 → 100644
View file @
f5a7697e
'use strict'
;
var
mongoose
=
require
(
'mongoose'
),
Schema
=
mongoose
.
Schema
;
//分享内容
var
ForumShareSchema
=
new
Schema
({
ent_code
:
{
type
:
Number
,
require
:
true
,
index
:
true
},
title
:
{
//分享标题
type
:
String
,
require
:
true
},
description
:
{
//分享内容
type
:
String
,
require
:
true
},
icon
:
{
//分享图片
type
:
String
,
require
:
true
},
url
:
{
//分享链接
type
:
String
,
require
:
true
}
},
{
'collection'
:
'pisns_forum_share'
});
module
.
exports
=
mongoose
.
model
(
'ForumShare'
,
ForumShareSchema
);
\ No newline at end of file
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