├── .gitignore ├── models ├── user.js ├── like.js ├── zymryj.js ├── site.js ├── message.js ├── relation.js ├── repwd.js ├── reply.js └── article.js ├── source ├── stylesheets │ ├── about.css │ ├── followlist.css │ ├── message.css │ ├── admin.css │ ├── jcrop.css │ ├── jquery.atwho.css │ ├── shijian.css │ ├── set.css │ ├── msgbox.css │ ├── pretty.css │ ├── zoom.css │ ├── loginreg.css │ ├── pubarticle.css │ ├── user.css │ └── jquery.qeditor.css └── javascripts │ ├── msgbox.js │ └── texiao.js ├── public ├── images │ ├── b.png │ ├── bg.jpg │ ├── fk.gif │ ├── sr.jpg │ ├── 38sr.png │ ├── close.png │ ├── favicon.ico │ ├── indexbg.jpg │ ├── linebg.gif │ ├── loading.gif │ ├── y_pwdbg.png │ ├── admin_bg.jpg │ ├── background.png │ ├── imgloading.gif │ ├── lanren_top.jpg │ ├── y_emailbg.png │ ├── background2.png │ ├── share │ │ ├── douban.png │ │ ├── qzone.png │ │ ├── tweibo.png │ │ ├── weibo.png │ │ └── twitter.png │ ├── y_accountbg.png │ ├── y_nicknamebg.png │ └── icon-arrow-up.png ├── music │ ├── pic │ │ ├── 0.jpg │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ └── 8.jpg │ ├── ykzzldx.mp3 │ └── b17eca8065380cd708f159eda344ad34588281c7.jpg ├── fonts │ ├── icomoon.eot │ ├── icomoon.ttf │ ├── icomoon.woff │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 ├── weixin.js ├── tpl │ └── pagination.html ├── javascripts │ └── lib │ │ └── zoom.min.js └── stylesheets │ └── pretty.css ├── views ├── partial │ ├── tagssidebar.ejs │ ├── sitesidebar.ejs │ ├── locatesidebar.ejs │ ├── paginationmore.ejs │ ├── pubsidebar.ejs │ ├── header.ejs │ ├── userarticle.ejs │ ├── indexsidebar.ejs │ ├── pagination.ejs │ ├── article.js │ ├── sidebar.ejs │ └── nav.ejs ├── admin │ ├── partial │ │ ├── footer.ejs │ │ ├── nav1.ejs │ │ ├── nav.ejs │ │ ├── header.ejs │ │ ├── pagination.ejs │ │ ├── catasidebar1.ejs │ │ └── catasidebar.ejs │ ├── regmail.ejs │ ├── index.ejs │ ├── login.ejs │ ├── register.ejs │ ├── addarticle1.ejs │ ├── updatearticle1.ejs │ ├── addarticle.ejs │ ├── updatesite1.ejs │ ├── updatearticle.ejs │ ├── updatesite.ejs │ ├── userlist1.ejs │ ├── addsite1.ejs │ ├── addsite.ejs │ └── articlelist1.ejs ├── _partials │ ├── pagination.ejs │ └── article.ejs ├── follower.ejs ├── hefollower.ejs ├── publink.ejs ├── forgetpwd.ejs ├── getpwdmail.ejs ├── about.ejs ├── accountset.ejs ├── login.ejs ├── common │ ├── 404.ejs │ └── 500.ejs ├── resetpwd.ejs ├── register.ejs ├── avatarset.ejs ├── indexlink.ejs ├── shijian.ejs ├── message.ejs ├── tag.ejs ├── baseset.ejs └── feedback.ejs ├── routes ├── common │ ├── 404.js │ └── 500.js ├── other │ ├── weixin.js │ ├── yangchengtong.js │ └── api.js ├── logout.js ├── search.js ├── admin │ ├── logout.js │ ├── admin.js │ └── user.js ├── about.js ├── mobile │ ├── mryjjson.js │ ├── likejson.js │ ├── loginjson.js │ ├── writejson.js │ ├── commentjson.js │ ├── xqjson.js │ ├── articlejson.js │ └── uploadjson.js ├── like.js ├── message.js ├── reply.js ├── relation.js ├── feedback.js └── pubarticle.js ├── common ├── redis.js └── cache.js ├── dao ├── likedao.js ├── replydao.js ├── zymryjdao.js └── sitedao.js ├── backup.sh ├── process ├── process3.js ├── process1.js ├── process4.js └── process.js ├── package.json ├── README.md ├── temp_config.js ├── app.js └── lib └── at.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | config.js 3 | tupian.js 4 | app.js -------------------------------------------------------------------------------- /models/user.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/models/user.js -------------------------------------------------------------------------------- /source/stylesheets/about.css: -------------------------------------------------------------------------------- 1 | .srimgstyle { 2 | margin: 0 auto; 3 | text-align: center 4 | } -------------------------------------------------------------------------------- /public/images/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/b.png -------------------------------------------------------------------------------- /public/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/bg.jpg -------------------------------------------------------------------------------- /public/images/fk.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/fk.gif -------------------------------------------------------------------------------- /public/images/sr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/sr.jpg -------------------------------------------------------------------------------- /public/images/38sr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/38sr.png -------------------------------------------------------------------------------- /public/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/close.png -------------------------------------------------------------------------------- /public/music/pic/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/0.jpg -------------------------------------------------------------------------------- /public/music/pic/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/1.jpg -------------------------------------------------------------------------------- /public/music/pic/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/2.jpg -------------------------------------------------------------------------------- /public/music/pic/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/3.jpg -------------------------------------------------------------------------------- /public/music/pic/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/4.jpg -------------------------------------------------------------------------------- /public/music/pic/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/5.jpg -------------------------------------------------------------------------------- /public/music/pic/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/6.jpg -------------------------------------------------------------------------------- /public/music/pic/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/7.jpg -------------------------------------------------------------------------------- /public/music/pic/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/pic/8.jpg -------------------------------------------------------------------------------- /public/fonts/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/icomoon.eot -------------------------------------------------------------------------------- /public/fonts/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/icomoon.ttf -------------------------------------------------------------------------------- /public/fonts/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/icomoon.woff -------------------------------------------------------------------------------- /public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/favicon.ico -------------------------------------------------------------------------------- /public/images/indexbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/indexbg.jpg -------------------------------------------------------------------------------- /public/images/linebg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/linebg.gif -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/y_pwdbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/y_pwdbg.png -------------------------------------------------------------------------------- /public/music/ykzzldx.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/ykzzldx.mp3 -------------------------------------------------------------------------------- /public/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /public/images/admin_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/admin_bg.jpg -------------------------------------------------------------------------------- /public/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/background.png -------------------------------------------------------------------------------- /public/images/imgloading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/imgloading.gif -------------------------------------------------------------------------------- /public/images/lanren_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/lanren_top.jpg -------------------------------------------------------------------------------- /public/images/y_emailbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/y_emailbg.png -------------------------------------------------------------------------------- /public/images/background2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/background2.png -------------------------------------------------------------------------------- /public/images/share/douban.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/share/douban.png -------------------------------------------------------------------------------- /public/images/share/qzone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/share/qzone.png -------------------------------------------------------------------------------- /public/images/share/tweibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/share/tweibo.png -------------------------------------------------------------------------------- /public/images/share/weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/share/weibo.png -------------------------------------------------------------------------------- /public/images/y_accountbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/y_accountbg.png -------------------------------------------------------------------------------- /public/images/y_nicknamebg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/y_nicknamebg.png -------------------------------------------------------------------------------- /public/images/icon-arrow-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/icon-arrow-up.png -------------------------------------------------------------------------------- /public/images/share/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/images/share/twitter.png -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /public/music/b17eca8065380cd708f159eda344ad34588281c7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ForestCho/nodejs-38sr/HEAD/public/music/b17eca8065380cd708f159eda344ad34588281c7.jpg -------------------------------------------------------------------------------- /views/partial/tagssidebar.ejs: -------------------------------------------------------------------------------- 1 |
2 |
<%-d.tagname%>
3 |
共 <%-d.count%> 条记录
4 |
-------------------------------------------------------------------------------- /views/partial/sitesidebar.ejs: -------------------------------------------------------------------------------- 1 |
2 |
<%-d.sitename%>
3 |
共 <%-d.count%> 条记录
4 |
-------------------------------------------------------------------------------- /views/partial/locatesidebar.ejs: -------------------------------------------------------------------------------- 1 |
2 |
<%-d.locatename%>
3 |
共 <%-d.count%> 条记录
4 |
-------------------------------------------------------------------------------- /routes/common/404.js: -------------------------------------------------------------------------------- 1 | /** 2 | * [index description] 3 | * @param {[type]} req 4 | * @param {[type]} res 5 | * @return {[type]} 6 | */ 7 | exports.index = function(req, res){ 8 | res.render('common/404', { title: '404' }); 9 | }; -------------------------------------------------------------------------------- /routes/common/500.js: -------------------------------------------------------------------------------- 1 | /** 2 | * [index description] 3 | * @param {[type]} req 4 | * @param {[type]} res 5 | * @return {[type]} 6 | */ 7 | exports.index = function(req, res){ 8 | res.render('common/500', { title: '500' }); 9 | }; -------------------------------------------------------------------------------- /routes/other/weixin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * [test description] 3 | * @param {[type]} req 4 | * @param {[type]} res 5 | * @return {[type]} 6 | */ 7 | exports.test = function (req, res) { 8 | res.render('/other/weixin', { title: '中国古代八大美女'}); 9 | }; -------------------------------------------------------------------------------- /common/redis.js: -------------------------------------------------------------------------------- 1 | var Redis = require('ioredis'); 2 | 3 | /** 4 | * [client description] 5 | * @type {Redis} 6 | */ 7 | var client = new Redis({ 8 | port: 6379, 9 | host: '127.0.0.1', 10 | db: 0, 11 | }); 12 | 13 | exports = module.exports = client; -------------------------------------------------------------------------------- /public/weixin.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | $(".photo").before("
"); 3 | $(".photo").before("
"); 4 | $(".photo").after("
"); 5 | $(".photo").after("
"); 6 | }); -------------------------------------------------------------------------------- /source/stylesheets/followlist.css: -------------------------------------------------------------------------------- 1 | .followlist_wrap img{ 2 | 3 | } 4 | .followlist_wrap .perfollower { 5 | height: 85px; 6 | width: 88px; 7 | overflow: hidden; 8 | line-height: 18px; 9 | float: left; 10 | text-align: center; 11 | font-size: 12px; 12 | } -------------------------------------------------------------------------------- /views/partial/paginationmore.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 更多 5 | 6 |
-------------------------------------------------------------------------------- /models/like.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var likeSchema = new Schema( 5 | { 6 | uid:Number, 7 | tid:Number, 8 | islike: { type:Boolean,default:true}, 9 | create_date:{ type:Date,default:Date.now} 10 | }); 11 | 12 | module.exports = mongoose.model('Like',likeSchema); 13 | -------------------------------------------------------------------------------- /routes/logout.js: -------------------------------------------------------------------------------- 1 | var config = require('../config').config; 2 | 3 | /** 4 | * [logout 登出] 5 | * @param {[type]} req 6 | * @param {[type]} res 7 | * @return {[type]} 8 | */ 9 | exports.logout = function (req, res) { 10 | req.session.destroy(); 11 | res.clearCookie(config.cookie_name, { path: config.cookie_path }); 12 | res.redirect('/'); 13 | }; -------------------------------------------------------------------------------- /routes/search.js: -------------------------------------------------------------------------------- 1 | var config = require('../config').config; 2 | 3 | /** 4 | * [index description] 5 | * @param {[type]} req 6 | * @param {[type]} res 7 | * @return {[type]} 8 | */ 9 | exports.index = function (req, res) { 10 | var searchstr = req.query.searchstr; 11 | res.redirect('http://www.baidu.com/s?wd=site:'+config.site_name+' '+searchstr); 12 | }; -------------------------------------------------------------------------------- /routes/admin/logout.js: -------------------------------------------------------------------------------- 1 | var config = require('../../config').config; 2 | 3 | 4 | /** 5 | * [logout description] 6 | * @param {[type]} req 7 | * @param {[type]} res 8 | * @return {[type]} 9 | */ 10 | exports.logout = function (req, res) { 11 | req.session.destroy(); 12 | res.clearCookie(config.cookie_name, { path: config.cookie_path }); 13 | res.redirect('/admin/login'); 14 | }; -------------------------------------------------------------------------------- /models/zymryj.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var zymryjSchema = new Schema( 5 | { 6 | zyid:Number, 7 | cncontent:String, 8 | encontent:String, 9 | img:String, 10 | create_at:{ type:Date,default:Date.now} 11 | } 12 | ); 13 | 14 | module.exports = mongoose.model('Zymryj',zymryjSchema); 15 | -------------------------------------------------------------------------------- /models/site.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var mryjSchema = new Schema( 5 | { 6 | sid:Number, 7 | sdomain:String, 8 | sname:String, 9 | sbrief:String, 10 | spic:String, 11 | create_at:{ type:Date,default:Date.now} 12 | } 13 | ); 14 | 15 | module.exports = mongoose.model('Site',mryjSchema); 16 | -------------------------------------------------------------------------------- /models/message.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var messageSchema = new Schema( 5 | { 6 | type: { type: String }, 7 | uid: Number, 8 | refuid: Number, 9 | tid: Number, 10 | rid: Number, 11 | isread: { type:Boolean,default:false}, 12 | create_date:{ type:Date,default:Date.now} 13 | }); 14 | 15 | module.exports = mongoose.model('Message',messageSchema); 16 | -------------------------------------------------------------------------------- /models/relation.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var relationSchema = new Schema( 5 | { 6 | uid:Number, 7 | fuid:Number, 8 | create_date:{ type:Date,default:Date.now}, 9 | _uid_info:{ type: Schema.Types.ObjectId, ref:'User'} , 10 | _fuid_info:{ type: Schema.Types.ObjectId, ref:'User'} 11 | }); 12 | 13 | module.exports = mongoose.model('Relation',relationSchema); 14 | -------------------------------------------------------------------------------- /views/admin/partial/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /models/repwd.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var repwdSchema = new Schema({ 5 | uid: Number, 6 | createdata: { 7 | type: Date, 8 | default: Date.now 9 | }, 10 | outdate: { 11 | type: Date 12 | }, 13 | isvalid:{ type: Number, default: -1 }, 14 | }); 15 | //logintype 0 wu ´ú±íÔ­Éú̬Õ˺Š1΢²© 16 | module.exports = mongoose.model('Repwd', repwdSchema); -------------------------------------------------------------------------------- /source/stylesheets/message.css: -------------------------------------------------------------------------------- 1 | /*.head_text { 2 | font-size: 20px; 3 | border-bottom: 2px solid #f3f3f3; 4 | padding: 0 0 7px; 5 | margin-bottom: 10px; 6 | color: #555 7 | }*/ 8 | .msgwrap{ 9 | background-color: #fff; 10 | padding: 10px 20px 40px 20px; 11 | min-height: 600px; 12 | } 13 | .msgitem { 14 | padding: 10px; 15 | padding-top: 10px; 16 | border-bottom: 1px solid #F1F1F1; 17 | margin-left: 30px 18 | } 19 | .msgitem:hover{ 20 | background-color: #F8F8F8; 21 | } -------------------------------------------------------------------------------- /routes/about.js: -------------------------------------------------------------------------------- 1 | /** 2 | * [about 关于页面] 3 | * @param {[type]} req 4 | * @param {[type]} res 5 | * @return {[type]} 6 | */ 7 | exports.about = function (req, res) { 8 | var curpath = '/about'; 9 | res.render('about', { title: '关于38SR',curpath:curpath }); 10 | }; 11 | 12 | /** 13 | * [shijian 时间线页面] 14 | * @param {[type]} req 15 | * @param {[type]} res 16 | * @return {[type]} 17 | */ 18 | exports.shijian = function (req, res) { 19 | var curpath = '/shijian'; 20 | res.render('shijian', { title: '38SR成长录',curpath:curpath }); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /models/reply.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'); 2 | var Schema = mongoose.Schema; 3 | var ObjectId = Schema.ObjectId; 4 | 5 | var ReplySchema = new Schema({ 6 | rid: Number,//id 7 | content: String , 8 | tid: Number, 9 | replyid: Number, 10 | uid:Number, 11 | ruid:Number, 12 | create_at: { type: Date, default: Date.now }, 13 | update_at: { type: Date, default: Date.now }, 14 | _creator:{ type: Schema.Types.ObjectId, ref:'User'} , 15 | content_is_html: { type: Boolean } 16 | }); 17 | 18 | 19 | module.exports = mongoose.model('Reply',ReplySchema); -------------------------------------------------------------------------------- /source/stylesheets/admin.css: -------------------------------------------------------------------------------- 1 | .ad_wrap{ 2 | height: 400px; 3 | margin-top: 150px; 4 | } 5 | .ad_nav{ 6 | margin: 0 auto; 7 | text-align: center; 8 | } 9 | .ad_nav_cata{ 10 | display: inline-block; 11 | width: 140px; 12 | height: 50px; 13 | background-color: #449172; 14 | color: #fff; 15 | font-size: 18px; 16 | text-align: center; 17 | line-height: 50px; 18 | } 19 | .ad_nav_cata:hover{ 20 | color: #fff; 21 | text-decoration: none; 22 | background-color:#20855D; 23 | } 24 | .ad_pre{ 25 | display: block; 26 | margin: 0 auto; 27 | width: 73px; 28 | } -------------------------------------------------------------------------------- /source/stylesheets/jcrop.css: -------------------------------------------------------------------------------- 1 | /*! 38sr 2014-08-21 */ 2 | 3 | .jcrop-holder{text-align:left}.jcrop-hline,.jcrop-vline{font-size:0;position:absolute;background:url(Jcrop.gif) top left #fff}.jcrop-vline{height:100%;width:1px!important}.jcrop-hline{width:100%;height:1px!important}.jcrop-handle{font-size:1px;width:7px!important;height:7px!important;border:1px solid #eee;background-color:#333}.jcrop-tracker{width:100%;height:100%}.custom .jcrop-hline,.custom .jcrop-vline{background:#ff0}.custom .jcrop-handle{border-color:#000;background-color:#C7BB00;-moz-border-radius:3px;-webkit-border-radius:3px} -------------------------------------------------------------------------------- /views/_partials/pagination.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /views/partial/pubsidebar.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 25 |
26 |
-------------------------------------------------------------------------------- /views/partial/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%=title + ' - ' + config.site.name%> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dao/likedao.js: -------------------------------------------------------------------------------- 1 | var Like = require('../models/like'); 2 | 3 | /** 4 | * [getLikeNumByUidAndTid 获取赞的数量] 5 | * @param {[type]} uid 6 | * @param {[type]} tid 7 | * @param {Function} cb 8 | * @return {[type]} 9 | */ 10 | var getLikeNumByUidAndTid = function(uid,tid,cb){ 11 | Like.count({uid:uid,tid:tid},cb) 12 | } 13 | 14 | /** 15 | * [saveNewLike 保存赞] 16 | * @param {[type]} uid 17 | * @param {[type]} tid 18 | * @param {[type]} islike 19 | * @param {Function} cb 20 | * @return {[type]} 21 | */ 22 | var saveNewLike = function(uid,tid,islike,cb){ 23 | var like = new Like({ 24 | uid:uid, 25 | tid:tid, 26 | islike:islike 27 | }); 28 | like.save(cb); 29 | } 30 | 31 | 32 | exports.getLikeNumByUidAndTid = getLikeNumByUidAndTid; 33 | exports.saveNewLike = saveNewLike; -------------------------------------------------------------------------------- /public/tpl/pagination.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /routes/admin/admin.js: -------------------------------------------------------------------------------- 1 | var Article = require('../../models/article'); 2 | var UserDao = require('../../dao/userdao'); 3 | var util = require('../../lib/util'); 4 | var Relation = require('../../models/relation'); 5 | var relationdao = require('../../dao/relationdao'); 6 | var EventProxy = require('eventproxy'); 7 | var moment = require('moment'); 8 | 9 | /** 10 | * [login description] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.login = function(req, res) { 16 | return res.render('admin/login', { 17 | title: 'adminlogin' 18 | }); 19 | } 20 | 21 | /** 22 | * [index description] 23 | * @param {[type]} req 24 | * @param {[type]} res 25 | * @return {[type]} 26 | */ 27 | exports.index = function(req, res) { 28 | 29 | res.render('admin/index', { 30 | title: '首页' 31 | }); 32 | } -------------------------------------------------------------------------------- /views/follower.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | Ta的粉丝(<%=d.followernum %>) 8 |
9 |
10 | <% 11 | var followerlist = d.followerlist; 12 | var length1 = followerlist.length; 13 | %> 14 | <% 15 | for(i=0;i 18 |
19 | > 20 | <%=follower.name%> 21 |
22 | <%}%> 23 |
24 |
25 |
26 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/admin/regmail.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 |
6 | 7 |
8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 | 17 |
18 |
19 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 20 |
" role='alert'> 21 | <%-msg.content %> 22 |
23 | <% } %> 24 |
25 |
26 | 27 | -------------------------------------------------------------------------------- /views/hefollower.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | Ta的拥趸(<%=d.hefollowernum %>) 8 |
9 |
10 | <% 11 | var hefollowerlist = d.hefollowerlist; 12 | var length1 = hefollowerlist.length; 13 | %> 14 | <% 15 | for(i=0;i 18 |
19 | > 20 | <%=hefollower.name%> 21 |
22 | <%}%> 23 |
24 |
25 |
26 | <% include partial/footer %> -------------------------------------------------------------------------------- /backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /home/backupdata 4 | 5 | rarWebName=38sr_Web_$(date +"%Y%m%d").tar.gz 6 | rarDbName=38sr_Db_$(date +"%Y%m%d").tar.gz 7 | 8 | oldWebName=38sr_Web_$(date -d -3day +"%Y%m%d").tar.gz 9 | oldDbName=38sr_Db_$(date -d -3day +"%Y%m%d").tar.gz 10 | 11 | #delete data 3 day ago 12 | rm /home/backupdata/$oldWebName 13 | rm /home/backupdata/$oldDbName 14 | 15 | #compact 16 | tar zcvf /home/backupdata/$rarWebName /home/mongoblog/ 17 | 18 | mongodump -h 127.0.0.1 -d blogdb -o /home/backupdata/mongodb/ 19 | tar zcvf /home/backupdata/$rarDbName /home/backupdata/mongodb/ 20 | 21 | #ftp back 22 | /usr/bin/ftp -v -n v0.ftp.upyun.com << END 23 | user test/srbackup test 24 | type binary 25 | put $rarWebName 26 | put $rarDbName 27 | put /home/backupdata/backup.sh 28 | 29 | delete $oldWebName 30 | delete $oldDbName 31 | bye 32 | END 33 | 34 | rm /home/backupdata/$oldWebName 35 | rm /home/backupdata/$oldDbName 36 | -------------------------------------------------------------------------------- /source/stylesheets/jquery.atwho.css: -------------------------------------------------------------------------------- 1 | /*! 38sr 2014-08-21 */ 2 | 3 | .atwho-view { 4 | position: absolute; 5 | top: 0; 6 | left: 0; 7 | display: none; 8 | margin-top: 18px; 9 | background: #fff; 10 | border: 1px solid #DDD; 11 | border-radius: 3px; 12 | box-shadow: 0 0 5px rgba(0,0,0,.1); 13 | min-width: 120px; 14 | z-index: 11110!important 15 | } 16 | 17 | .atwho-view .cur { 18 | background: #36F; 19 | color: #fff 20 | } 21 | 22 | .atwho-view .cur small { 23 | color: #fff 24 | } 25 | 26 | .atwho-view strong { 27 | color: #36F 28 | } 29 | 30 | .atwho-view .cur strong { 31 | color: #fff; 32 | font: 700 33 | } 34 | 35 | .atwho-view ul { 36 | list-style: none; 37 | padding: 0; 38 | margin: auto 39 | } 40 | 41 | .atwho-view ul li { 42 | display: block; 43 | padding: 5px 10px; 44 | border-bottom: 1px solid #DDD; 45 | cursor: pointer 46 | } 47 | 48 | .atwho-view small { 49 | font-size: smaller; 50 | color: #777; 51 | font-weight: 400 52 | } -------------------------------------------------------------------------------- /views/admin/index.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 | 6 | <% include ./partial/catasidebar%> 7 | 8 | 9 |
10 | <% include ./partial/righttop%> 11 | 12 |
13 |
14 |

主页

15 | 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 | 28 | <% include ./partial/footer%> -------------------------------------------------------------------------------- /process/process3.js: -------------------------------------------------------------------------------- 1 | var ArticleDao = require('../dao/articledao'); 2 | var Article = require('../models/article'); 3 | var mongoose = require('mongoose'); 4 | var marked = require('marked'); 5 | var bosonnlp = require('bosonnlp'); 6 | var util = require('../lib/util'); 7 | var boson = new bosonnlp.BosonNLP("yoUTK8dE.3486.jTfMGWlrfZxc"); 8 | //mongoose.connect('mongodb://caosl:123456@107.170.206.235:27017/blogdb'); 9 | //mongoose.connect('mongodb://caosl:123456@127.0.0.1:27017/blogdb'); 10 | /* 11 | * GET find password page. 12 | */ 13 | Article.find({ 14 | tid: 3762 15 | }).sort({ 16 | 'post_date': -1 17 | }).exec(function(err, articlelist) { 18 | articlelist.forEach(function(article) { 19 | article.mcontent = article.mcontent.replace(/(##{1,4})/g,"$1# "); 20 | console.log(marked(article.mcontent)); 21 | article.content = marked(article.mcontent); 22 | article.save(); 23 | }); 24 | }) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "38sr", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app.js" 7 | }, 8 | "devDependencies": { 9 | "grunt": "^0.4.5", 10 | "grunt-contrib-jshint": "~0.10.0", 11 | "grunt-contrib-nodeunit": "~0.4.1", 12 | "grunt-contrib-uglify": "~0.5.0", 13 | "grunt-contrib-concat": "~0.5.0", 14 | "grunt-contrib-cssmin": "~0.10.0", 15 | "grunt-contrib-watch": "^0.6.1" 16 | }, 17 | "dependencies": { 18 | "async": "0.9.0", 19 | "bosonnlp": "0.0.9", 20 | "cheerio": "0.17.0", 21 | "connect-flash": "0.1.1", 22 | "ejs": "0.8.4", 23 | "eventproxy": "0.2.6", 24 | "express": "3.5.1", 25 | "gm": "1.16.0", 26 | "ioredis": "1.5.5", 27 | "lodash": "3.9.3", 28 | "marked": "0.3.5", 29 | "moment": "2.7.0", 30 | "mongoose": "3.8.8", 31 | "nodemailer": "0.7.1", 32 | "request": "2.58.0", 33 | "validator": "3.16.1", 34 | "xss": "0.1.10", 35 | "xss-filters": "1.1.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /process/process1.js: -------------------------------------------------------------------------------- 1 | var ArticleDao = require('../dao/articledao'); 2 | var Article = require('../models/article'); 3 | var mongoose = require('mongoose'); 4 | var bosonnlp = require('bosonnlp'); 5 | var util = require('../lib/util'); 6 | var boson = new bosonnlp.BosonNLP("yoUTK8dE.3486.jTfMGWlrfZxc"); 7 | //mongoose.connect('mongodb://caosl:123456@107.170.206.235:27017/blogdb'); 8 | //mongoose.connect('mongodb://caosl:123456@127.0.0.1:27017/blogdb'); 9 | /* 10 | * GET find password page. 11 | */ 12 | Article.find({ 13 | isdelete: false, 14 | classify: 2 15 | }).sort({ 16 | 'post_date': -1 17 | }).exec(function(err, articlelist) { 18 | articlelist.forEach(function(article) { 19 | console.log(article.content); 20 | var reg = /


<\/p>/g; 21 | var reg1 = /

 <\/p>/; 22 | article.content = article.content.replace(reg,''); 23 | article.content = article.content.replace(reg1,''); 24 | article.save(); 25 | }); 26 | }) -------------------------------------------------------------------------------- /views/publink.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |

6 |
7 |
8 |
9 |
10 | 11 | 12 |
13 |
14 | 18 |
19 |
20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | <% include partial/footer %> -------------------------------------------------------------------------------- /dao/replydao.js: -------------------------------------------------------------------------------- 1 | var Reply = require('../models/reply'); 2 | 3 | /** 4 | * [getReplyByTid 获取回复] 5 | * @param {[type]} tid 6 | * @param {Function} cb 7 | * @return {[type]} 8 | */ 9 | var getReplyByTid = function(tid,cb){ 10 | Reply.find({tid:tid}).sort({'create_at':-1}).populate('_creator').lean(true).exec(cb); 11 | } 12 | 13 | /** 14 | * [getReplyByTidLimit 获取回复] 15 | * @param {[type]} tid 16 | * @param {[type]} num 17 | * @param {Function} cb 18 | * @return {[type]} 19 | */ 20 | var getReplyByTidLimit = function(tid,num,cb){ 21 | Reply.find({tid:tid}).sort({'create_at':-1}).populate('_creator').limit(num).lean(true).exec(cb); 22 | } 23 | 24 | /** 25 | * [getReplyByAsObject 获取回复] 26 | * @param {[type]} replyLimit 27 | * @param {Function} cb 28 | * @return {[type]} 29 | */ 30 | var getReplyByAsObject = function(replyLimit,cb){ 31 | Reply.find(replyLimit).sort({'create_at':1}).populate('_creator').lean(true).exec(cb); 32 | } 33 | exports.getReplyByTid = getReplyByTid; 34 | exports.getReplyByAsObject = getReplyByAsObject; 35 | exports.getReplyByTidLimit = getReplyByTidLimit; -------------------------------------------------------------------------------- /process/process4.js: -------------------------------------------------------------------------------- 1 | var SiteDao = require('../dao/sitedao'); 2 | var Site = require('../models/site'); 3 | var ArticleDao = require('../dao/articledao'); 4 | var mongoose = require('mongoose'); 5 | var EventProxy = require('eventproxy'); 6 | var path = require('path'); 7 | var config = require('../config').config; 8 | var gm = require('gm'), 9 | fs = require('fs'), 10 | imageMagick = gm.subClass({ 11 | imageMagick: true 12 | }); 13 | mongoose.connect('mongodb://caosl:123456@107.170.206.235:27017/blogdb'); 14 | /* 15 | * GET publish a new site 16 | */ 17 | 18 | var ep = new EventProxy(); 19 | var domainName = "www.cnblogs.com"; 20 | var siteLimit = { 21 | sdomain: domainName 22 | }; 23 | SiteDao.getSiteByObj(siteLimit, function(err, data) { 24 | var _id = data._id; 25 | var domainRegex = new RegExp(domainName, 'i'); 26 | ArticleDao.updateArticleInfo({ 27 | title: domainRegex 28 | }, { 29 | $set: { 30 | _sid: _id 31 | } 32 | }, { 33 | upsert: false, 34 | multi: true 35 | }, function(err) { 36 | console.log("rspobj"); 37 | }); 38 | }); 39 | 40 | 41 | var cc = function() { 42 | console.log("cc"); 43 | } 44 | cc(); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 关于38sr 2 | * 一个使用`nodejs`开发和`expressjs`框架的网站,数据库用的mongodb,用户可以通过网站发表心情,发表文章,以及喜欢的网址,网站支持评论以及消息系统,效果查看[38sr](http://38sr.com) 3 | * 用它你可以建一个社区,新闻站点,个人博客,内容管理系统 4 | * 本项目是一个node,expressjs初学者的不错选择 5 | 6 | ##使用方法 7 | * 将项目clone到本地,`git clone git@github.com:ForestCho/nodejs-38sr.git` 8 | * 安装模块依赖项 `npm install` 9 | * 安装`ImageMagick`,`redis`本地模块 10 | * 将`temp_config.js`更名为`config.js`, 并在目录下执行`grunt`生成css和js 11 | * 启动项目`node app.js`,在服务器上为了防止非正常关闭,可以用`forever start app.js` 12 | * 通过`http://localhost:3000/`访问 13 | 14 | ##注意 15 | * 目前使用的3.5版本express 16 | * 系统的后台只提供简单的删除,未来的一些时间将增加一个后台系统,敬请关注 17 | * 时间限制,代码有些乱,比如存在尚未删除的文件,注释不完整,也敬请原谅,也将是改善的地方 18 | * 谢绝代码商用,如商用产生的后果自负 19 | 20 | ## 依赖模块 21 | * express 22 | * eventproxy 23 | * connect-flash 24 | * bosonnlp 25 | * nodemailer 26 | * mongoose 27 | * validator 28 | * ejs 29 | * moment 30 | * gm 31 | * marked 32 | * xss 33 | * cheerio 34 | * async 35 | * xss-filters 36 | * connect-redis 37 | * ioredis 38 | * lodash 39 | * request 40 | 41 | 42 | ## 示例 43 | ![](http://ww2.sinaimg.cn/large/5f13eab3gw1f4dd9voieyj211k0itdn8.jpg) 44 | 45 | ![](http://ww1.sinaimg.cn/large/5f13eab3gw1f4ddddkxetj211i0ivajy.jpg) -------------------------------------------------------------------------------- /common/cache.js: -------------------------------------------------------------------------------- 1 | var redis = require('./redis'); 2 | var _ = require('lodash'); 3 | 4 | /** 5 | * [get description] 6 | * @param {[type]} key 7 | * @param {Function} callback 8 | * @return {[type]} 9 | */ 10 | var get = function (key, callback) { 11 | var t = new Date(); 12 | redis.get(key, function (err, data) { 13 | if (err) { 14 | return callback(err); 15 | } 16 | if (!data) { 17 | return callback(); 18 | } 19 | data = JSON.parse(data); 20 | callback(null, data); 21 | }); 22 | }; 23 | 24 | 25 | /** 26 | * [set time 参数可选,秒为单位] 27 | * @param {[type]} key 28 | * @param {[type]} value 29 | * @param {[type]} time 30 | * @param {Function} callback 31 | */ 32 | var set = function (key, value, time, callback) { 33 | var t = new Date(); 34 | 35 | if (typeof time === 'function') { 36 | callback = time; 37 | time = null; 38 | } 39 | callback = callback || _.noop; 40 | value = JSON.stringify(value); 41 | 42 | if (!time) { 43 | redis.set(key, value, callback); 44 | } else { 45 | redis.setex(key, time, value, callback); 46 | } 47 | }; 48 | 49 | exports.get = get; 50 | exports.set = set; -------------------------------------------------------------------------------- /models/article.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | ObjectId = mongoose.ObjectId; 4 | var articleSchema = new Schema( 5 | { 6 | tid:Number, 7 | title:String, 8 | content:String, 9 | mcontent:String, 10 | uid:Number, 11 | type:{ type: Number, default: 0 }, 12 | classify:{ type: Number, default: 0 }, 13 | flag:{ type: Number}, 14 | read_count:{ type: Number, default: 0 }, 15 | unlike_count:{ type: Number, default: 0 }, 16 | like_count:{ type: Number, default: 0 }, 17 | reply_count: { type: Number, default: 0 }, 18 | view_count: { type: Number, default: 0 }, 19 | label:String, 20 | post_date:{ type:Date,default:Date.now}, 21 | isdelete: { type:Boolean,default:false}, 22 | location:String, 23 | _sid:{ type: Schema.Types.ObjectId, ref:'Site'}, 24 | _creator:{ type: Schema.Types.ObjectId, ref:'User'} 25 | } 26 | ); 27 | 28 | //classify 0 心情  29 | //classify 1 快链 title is url & content is brief & has a _sid 30 | //classify 2 wenzhang 31 | //flag 1 笑话 32 | //flag 2 娱乐 33 | //flag 3 爆料 34 | //flag 4 情感 35 | //flag 5 囧人糗事 36 | 37 | module.exports = mongoose.model('Article',articleSchema); 38 | -------------------------------------------------------------------------------- /views/admin/login.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 |

欢迎使用38SR后台系统

6 |
7 |
8 |
帐号
9 |
10 | 11 |
12 |
13 |
14 |
密码
15 |
16 | 17 |
18 |
19 |
20 |
21 | 22 |
23 |
24 |
25 |
26 |
27 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 28 |
" role='alert'> 29 | <%-msg.content %> 30 |
31 | <% } %> 32 |
33 |
34 | 35 | -------------------------------------------------------------------------------- /routes/admin/user.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../../dao/userdao'); 2 | var mongoose = require('mongoose'); 3 | var EventProxy = require('eventproxy'); 4 | var path = require('path'); 5 | var config = require('../../config').config; 6 | 7 | 8 | /** 9 | * [list description] 10 | * @param {[type]} req 11 | * @param {[type]} res 12 | * @return {[type]} 13 | */ 14 | exports.list = function(req, res) { 15 | var p = 1; //pageid 16 | var curpath = "/admin/userlist"; 17 | var pagesize = 14; 18 | var count = 0; 19 | if (req.query.p) { 20 | p = req.query.p; 21 | } 22 | var userLimit = { 23 | }; 24 | var ep = new EventProxy(); 25 | ep.assign("userlist", 'count', function(userlist, count) { 26 | var d = []; 27 | d.data = userlist; 28 | d.count = count; 29 | res.render('admin/userlist', { 30 | title: '用户列表', 31 | curpath: curpath, 32 | d: d, 33 | p: p 34 | }); 35 | }); 36 | 37 | UserDao.getNumberOUsersAsObect(userLimit, function(err, count) { 38 | ep.emit("count", count); 39 | }); 40 | 41 | UserDao.getUserListLimitAsObject(true, p, pagesize, userLimit, function(err, userlist) { 42 | ep.emit("userlist", userlist); 43 | }) 44 | }; 45 | -------------------------------------------------------------------------------- /routes/mobile/mryjjson.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../../dao/userdao'); 2 | var ZymryjDao = require('../../dao/zymryjdao'); 3 | var util = require('../../lib/util'); 4 | var ArticleDao = require('../../dao/articledao'); 5 | var moment = require('moment'); 6 | var config = require('../../config').config; 7 | var EventProxy = require('eventproxy'); 8 | 9 | /** 10 | * [index description] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.index = function (req, res) { 16 | var page = 1; 17 | var pagesize = config.index.list_article_size; 18 | var puretext = true; 19 | var list_hot_user_size = config.index.list_hot_user_size; 20 | var count = 0; 21 | var flag = 0; 22 | if(req.query.page){ 23 | page=req.query.page; 24 | } 25 | if(req.session.user){ 26 | res.locals.userinfo = req.session.user; 27 | } 28 | var ep = new EventProxy(); 29 | ep.assign('zymryj',function (zymryj) { 30 | var zy = {}; 31 | zy.tid=1; 32 | zy.pic=zymryj.img; 33 | zy.cncontent = zymryj.cncontent; 34 | zy.encontent = zymryj.encontent; 35 | var obj = {}; 36 | var shuzu = []; 37 | shuzu[0]=zy; 38 | obj.data = shuzu; 39 | res.json(obj); 40 | }); 41 | 42 | ZymryjDao.getZymryjOfCurrday(function(err,zymryj){ 43 | ep.emit("zymryj",zymryj); 44 | }); 45 | } 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /dao/zymryjdao.js: -------------------------------------------------------------------------------- 1 | var Zymryj = require('../models/zymryj'); 2 | var util = require('../lib/util'); 3 | 4 | /** 5 | * [getZymryjOfCurrday description] 6 | * @param {Function} cb 7 | * @return {[type]} 8 | */ 9 | var getZymryjOfCurrday = function(cb){ 10 | var now = new Date(); 11 | Zymryj.findOne({create_at:{$gt: util.getStartOfCurrDay(now),$lt: util.getEndOfCurrDay(now)}},null,{sort:{'create_at':-1},limit:1},function(err,tempzymryj){ 12 | var zymryj={}; 13 | zymryj.cncontent = "不敢犯错,可能把一切都错过。"; 14 | zymryj.encontent = "You may miss everything if you dare not make mistakes."; 15 | zymryj.img = "http://srpic.b0.upaiyun.com/mryj/1412436134767_RBSw2AowR5TDInst.jpg"; 16 | if(tempzymryj){ 17 | zymryj = tempzymryj; 18 | } 19 | cb(err,zymryj); 20 | }); 21 | } 22 | //添加 23 | /** 24 | * [saveNewZymryj description] 25 | * @param {[type]} cncontent 26 | * @param {[type]} encontent 27 | * @param {[type]} img 28 | * @param {[type]} create_at 29 | * @param {Function} cb 30 | * @return {[type]} 31 | */ 32 | var saveNewZymryj = function(cncontent,encontent,img,create_at,cb){ 33 | var zyItem = new Zymryj({ 34 | cncontent:cncontent, 35 | encontent:encontent, 36 | img:img, 37 | create_at:create_at 38 | }); 39 | zyItem.save(cb); 40 | } 41 | 42 | exports.getZymryjOfCurrday = getZymryjOfCurrday; 43 | exports.saveNewZymryj = saveNewZymryj; -------------------------------------------------------------------------------- /views/admin/partial/nav1.ejs: -------------------------------------------------------------------------------- 1 |
2 |

3 | 38SR 管理后台 4 |

5 | 6 | 7 |
8 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /views/_partials/article.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | {{ article._creator.name }} 6 | 7 |

{{ article.title }}

8 | 9 |
{{ article.newcontent }}
10 | 11 |
12 | 20 |
21 |
22 |
-------------------------------------------------------------------------------- /views/forgetpwd.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 找回密码 8 |
9 |
10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 | 35 |
36 |
37 |
38 |
39 |
40 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 41 |
" role='alert'> 42 | <%-msg.content %> 43 |
44 | <% } %> 45 |
46 |
47 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/getpwdmail.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 找回密码 8 |
9 |
10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 | 18 |
19 |
20 | 21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 | 36 |
37 |
38 |
39 |
40 |
41 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 42 |
" role='alert'> 43 | <%-msg.content %> 44 |
45 | <% } %> 46 |
47 |
48 | <% include partial/footer %> -------------------------------------------------------------------------------- /temp_config.js: -------------------------------------------------------------------------------- 1 | 2 | var path = require('path'); 3 | var config = { 4 | site_name: '38sr.com', 5 | cookie_name: '38srweb', 6 | cookie_path: '/', 7 | session_secret: '38srweb', 8 | 9 | index: { 10 | list_article_size : 14, 11 | list_new_user_size :9, 12 | list_hot_user_size :9, 13 | list_link_size : 18, 14 | list_admin_article_size : 10 15 | }, 16 | 17 | site:{ 18 | name: '38锶', 19 | description: '38锶', 20 | keywords: '心情,小清新,有点意思,囧事,爆料', 21 | author: 'caosl158' 22 | }, 23 | 24 | mailhost: { 25 | host:"smtp.38sr.com", 26 | secureConnection:true, 27 | port:465, 28 | auth: { 29 | user:"test@38sr.com", 30 | pass: "test" 31 | } 32 | }, 33 | upyun:{ 34 | bat: "srpic", 35 | opname: "test_name", 36 | oppwd: "test_pwd", 37 | photourl: "http://srpic.b0.upaiyun.com/photo/", 38 | cimgurl: "http://srpic.b0.upaiyun.com/cimg/", 39 | siteurl: "http://srpic.b0.upaiyun.com/site/", 40 | mryjurl: "http://srpic.b0.upaiyun.com/mryj/" 41 | 42 | }, 43 | upload_img_dir: path.join(__dirname, 'public','userimg'), 44 | rela_upload_img_dir: path.join('/userimg'), 45 | 46 | site_link:[ 47 | { 48 | text:"Shulen`s Blog", 49 | link:"http://forestcho.github.io" 50 | }, 51 | { 52 | text:"DigitalOcean", 53 | link:"https://www.digitalocean.com/?refcode=0f682e48abe3" 54 | }, 55 | { 56 | text:"羊城通余额查询", 57 | link:"http://www.38sr.com/yangchengtongv" 58 | } 59 | 60 | ] 61 | } 62 | 63 | 64 | exports.config = config; -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var express = require('express'); 6 | var http = require('http'); 7 | var path = require('path'); 8 | var routes = require('./routes'); 9 | var flash = require('connect-flash'); 10 | var mongoose = require('mongoose'); 11 | //mongoose.connect('mongodb://caosl:123456@107.170.206.235:27017/blogdb'); 12 | mongoose.connect('mongodb://127.0.0.1:27017/blogdb'); 13 | var app = express(); 14 | 15 | // all environments 16 | app.set('port', process.env.PORT || 3000); 17 | app.set('views', path.join(__dirname, 'views')); 18 | app.set('view engine', 'ejs'); 19 | 20 | 21 | app.use(express.favicon()); 22 | app.use(express.logger('dev')); 23 | app.use(express.json()); 24 | app.use(express.urlencoded()); 25 | app.use(express.bodyParser()); 26 | app.use(express.cookieParser()); 27 | app.use(express.methodOverride()); 28 | app.use(flash()); 29 | app.use(express.session({ 30 | cookie: { 31 | path: '/', 32 | httpOnly: false, 33 | maxAge: 24 * 60 * 60 * 1000 34 | }, 35 | secret: '1234567890QWERT' 36 | })); 37 | 38 | 39 | app.use(express.static(path.join(__dirname, 'public'))); 40 | 41 | // development only 42 | if ('development' == app.get('env')) { 43 | app.use(express.errorHandler()); 44 | } 45 | app.use(require('./routes/login').user_auth); 46 | app.use(app.router); 47 | 48 | 49 | //路由 50 | routes.run(app); 51 | 52 | http.createServer(app).listen(app.get('port'), function() { 53 | console.log('Express server listening on port ' + app.get('port')); 54 | }); -------------------------------------------------------------------------------- /views/about.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 关于38SR 8 |
9 | 15 |
16 |
17 |

为什么叫38Sr

18 |

38Sr中Sr是化学元素中锶元素的简写,是一种金属元素,而38代表锶元素的原子序号,非常好记。

19 |
20 |
21 |

本站是怎么开发的呢

22 |

站点基于nodejs的开发,前端采用bootstrap开发框架,后端用expressjs这个Web应用框架。服务器用的是DigitalOcean

23 |
24 |

我可以用本站做什么?

25 |

您可以在这上面发表文章,心情,以及发表一个你喜欢的链接,站点会自动通过链接获取文章信息。

26 |
27 |

联系我

28 |

有任何问题,请不吝email:caosl_158#sina.com[#换成@],或者在feedback反馈,我将尽力解决。

29 |
30 |
31 | 32 |
33 |
34 | 42 |
43 |
44 |
45 |
46 |
47 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/admin/partial/nav.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /routes/mobile/likejson.js: -------------------------------------------------------------------------------- 1 | var LikeDao = require('../../dao/likedao'); 2 | var ArticleDao = require('../../dao/articledao'); 3 | var path = require('path'); 4 | var mongoose = require('mongoose'); 5 | var EventProxy = require('eventproxy'); 6 | /* 7 | * GET process operator of like page. 8 | */ 9 | exports.like = function (req, res) { 10 | //status 0 error 11 | //status 1 success 12 | //status 2 have like 13 | //status 3 have not login 14 | if(!req.query.uid){ 15 | res.json({status: 3 } ); 16 | return ; 17 | } 18 | 19 | var tid = req.query.tid; 20 | var uid = req.query.uid; 21 | var islike = req.query.islike; 22 | if(tid < 0 || uid < 0){ 23 | res.json({status: 0 }); 24 | return; 25 | } 26 | 27 | LikeDao.getLikeNumByUidAndTid(uid,tid,function(err,count){ 28 | if(err){ 29 | res.json({status: 0 }); 30 | return; 31 | } 32 | if(count > 1 || count === 1){ 33 | res.json({status: 2}); 34 | return; 35 | } 36 | LikeDao.saveNewLike(uid,tid,islike,function(err,like){ 37 | if (err){ 38 | res.json({status: 0 }); 39 | return; 40 | } 41 | var condition = {tid: tid}; 42 | var update; 43 | if(islike === 'true'){ 44 | update = {$inc: {like_count:1}}; 45 | }else{ 46 | update = {$inc: {unlike_count:1}}; 47 | } 48 | var options = { multi: false }; 49 | ArticleDao.updateArticleInfo(condition,update,options,function(err,numberAffected, raw){ 50 | if (err){ 51 | res.json({status: 0 }); 52 | return; 53 | } 54 | res.json({status: 1 }); 55 | }); 56 | }); 57 | }); 58 | } 59 | -------------------------------------------------------------------------------- /public/javascripts/lib/zoom.min.js: -------------------------------------------------------------------------------- 1 | !function(a){function b(b){function c(){function b(a){g.html(a),a.show(),g.removeClass("imgloading")}var c=a(this),d=parseInt(g.css("borderLeftWidth")),e=k-2*d,f=l-2*d,h=c.width(),i=c.height();if(h==g.width()&&e>=h&&i==g.height()&&f>=i)return void b(c);if(h>e||i>f){var j=i>f?f:i,m=h>e?e:h;m/h>=j/i?(c.width(Math.round(h*j/i)),c.height(j)):(c.width(m),c.height(Math.round(i*m/h)))}g.animate({width:c.width(),height:c.height(),marginTop:-(c.height()/2)-d,marginLeft:-(c.width()/2)-d},100,function(){b(c)})}b&&b.preventDefault();var d=a(this),m=d.attr("href");if(m){i||(i=!0,f.show(),e.addClass("zoomed"));var n=a(new Image).hide().css({width:"auto"});e.append(n),g.html("").delay(500).addClass("imgloading"),g.prepend(h),n.load(c).attr("src",m),j=d}}function c(a){a&&a.preventDefault(),i=!1,j=null,f.hide(),e.removeClass("zoomed"),g.empty()}function d(){k=a(window).width(),l=a(window).height()}var e=a("body");e.append('
');var f=a("#zoom").hide(),g=a("#zoom .content"),h='
',i=!1,j=null,k=a(window).width(),l=a(window).height();!function(){f.on("click",function(b){b.preventDefault(),"zoom"==a(b.target).attr("id")&&c()}),a("#zoom .close").on("click",c),a(document).keydown(function(a){j&&((38==a.which||40==a.which)&&a.preventDefault(),27==a.which&&c())}),a(".articleitem .article_msg_content a,.articleitem .msg_content a").on("click",b)}(),function(){a(window).on("resize",d)}(),function(){a(window).on("mousewheel DOMMouseScroll",function(a){j&&(a.stopPropagation(),a.preventDefault(),a.cancelBubble=!1)})}()}(jQuery); -------------------------------------------------------------------------------- /source/stylesheets/shijian.css: -------------------------------------------------------------------------------- 1 | .shijianpanel{ 2 | padding-top: 20px; 3 | padding-bottom: 20px; 4 | padding-left: 50px; 5 | width: 100%; 6 | } 7 | .through{ 8 | position: relative; 9 | } 10 | 11 | .through:before{ 12 | display: block; 13 | position: absolute; 14 | content: ' '; 15 | top: 0; 16 | bottom: 0; 17 | left: 190px; 18 | width: 0; 19 | border-left: 2px solid rgba(0,0,0,.06); 20 | height: 100%; 21 | 22 | } 23 | .through li{ 24 | height: 110px; 25 | vertical-align: bottom; 26 | overflow: hidden; 27 | position: relative; 28 | } 29 | 30 | .through li:hover:before{ 31 | box-shadow:0 0 0 3px rgba(0,0,0,.1) 32 | } 33 | 34 | .through li:before { 35 | position: absolute; 36 | display: inline-block; 37 | left: 181px; 38 | top: 18px; 39 | width: 20px; 40 | height: 20px; 41 | background-color: #00a090; 42 | border: 5px solid #fff; 43 | content: ' '; 44 | border-radius: 10px; 45 | transition: all .2s; 46 | -webkit-transition: all .2s; 47 | -moz-transition: all .2s; 48 | } 49 | #timewrap{ 50 | overflow: hidden; 51 | margin: 0 auto; 52 | padding: 60px 0px; 53 | } 54 | 55 | .through li .date{ 56 | margin-top: 20px; 57 | width: 150px; 58 | text-align: right; 59 | } 60 | 61 | .through li .detail { 62 | position: absolute; 63 | top: 0; 64 | left: 215px; 65 | height: 55px; 66 | width: 400px; 67 | text-align: left; 68 | } 69 | .through li .detail .detail-head{ 70 | font-size: 18px; 71 | margin-top: 20px; 72 | margin-left: 15px; 73 | } 74 | 75 | .through li .detail h5{ 76 | margin-left: 15px; 77 | } -------------------------------------------------------------------------------- /views/admin/partial/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= config.site.name + '-' + title %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /routes/mobile/loginjson.js: -------------------------------------------------------------------------------- 1 | var util = require('../../lib/util'); 2 | var MessageDao = require('../../dao/messagedao'); 3 | var UserDao = require('../../dao/userdao'); 4 | var EventProxy = require('eventproxy'); 5 | var sanitize = require('validator'); 6 | var config = require('../../config').config; 7 | 8 | /** 9 | * [dologin description] 10 | * @param {[type]} req 11 | * @param {[type]} res 12 | * @return {[type]} 13 | */ 14 | exports.dologin = function (req, res) { 15 | var name = sanitize.trim(req.body.uname); 16 | var pwd = sanitize.trim(req.body.pwd); 17 | var remember = req.body.remember; 18 | var id = 1; 19 | var md5pwd =util.md5_str(pwd); 20 | var msg ={}; 21 | var ep = new EventProxy(); 22 | 23 | if(name.length === 0){ 24 | msg.content = "账户不能为空,o(╯□╰)o!!" ; 25 | msg.status = 0 ; 26 | res.json(msg); 27 | return ; 28 | } 29 | if(pwd.length === 0){ 30 | msg.content = "密码不能为空,o(╯□╰)o!!" ; 31 | msg.status = 0 ; 32 | res.json(msg); 33 | return ; 34 | } 35 | 36 | UserDao.getUserInfoByName(name,function(err,tempuser){ 37 | if(err){ 38 | msg.content = "未知错误!!" ; 39 | msg.status = 0 ; 40 | res.json(msg); 41 | return ; 42 | } 43 | if(!tempuser){ 44 | msg.content = "账号不存在!!" ; 45 | msg.status = 0 ; 46 | res.json(msg); 47 | return ; 48 | } 49 | if(md5pwd != tempuser.pwd){ 50 | msg.content = "密码不正确!!" ; 51 | msg.status = 0 ; 52 | res.json(msg); 53 | return ; 54 | } 55 | console.log(tempuser); 56 | msg.userinfo = tempuser; 57 | msg.content = name ; 58 | msg.status = 1 ; 59 | res.json(msg); 60 | }) 61 | }; 62 | -------------------------------------------------------------------------------- /routes/like.js: -------------------------------------------------------------------------------- 1 | var LikeDao = require('../dao/likedao'); 2 | var ArticleDao = require('../dao/articledao'); 3 | var path = require('path'); 4 | var mongoose = require('mongoose'); 5 | var EventProxy = require('eventproxy'); 6 | /** 7 | * [like process operator of like page.] 8 | * @param {[type]} req 9 | * @param {[type]} res 10 | * @return {[type]} 11 | */ 12 | exports.like = function (req, res) { 13 | //status 0 success 14 | //status 1 have not login 15 | //status 2 have like 16 | //status 3 error 17 | if(!req.session.user){ 18 | res.json({status: 1 } ); 19 | return ; 20 | } 21 | 22 | var tid = req.query.tid; 23 | var uid = req.session.user.uid; 24 | var islike = req.query.islike; 25 | if(tid < 0 || uid < 0){ 26 | res.json({status: 3 }); 27 | return; 28 | } 29 | 30 | LikeDao.getLikeNumByUidAndTid(uid,tid,function(err,count){ 31 | if(err){ 32 | res.json({status: 3 }); 33 | return; 34 | } 35 | if(count > 1 || count === 1){ 36 | res.json({status: 2 }); 37 | return; 38 | } 39 | LikeDao.saveNewLike(uid,tid,islike,function(err,like){ 40 | if (err){ 41 | res.json({status: 3 }); 42 | return; 43 | } 44 | var condition = {tid: tid}; 45 | var update; 46 | if(islike === 'true'){ 47 | update = {$inc: {like_count:1}}; 48 | }else{ 49 | update = {$inc: {unlike_count:1}}; 50 | } 51 | var options = { multi: false }; 52 | ArticleDao.updateArticleInfo(condition,update,options,function(err,numberAffected, raw){ 53 | if (err){ 54 | res.json({status: 3 }); 55 | return; 56 | } 57 | res.json({status: 0 }); 58 | }); 59 | }); 60 | }); 61 | } 62 | -------------------------------------------------------------------------------- /views/partial/userarticle.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | <% include partial/sidebar %> 8 |
9 |
10 | <% if(visituser){ %> 11 |

<%=visituser %>(<%=typeof(d.userinfo.signature) !== 'undefined'?d.userinfo.signature:'这家伙很懒,什么都没留下~~' %>)

12 |

Ta的最近心情

13 | <% } %> 14 |
15 | <% var nearArticle = d.data; 16 | for(var i=0;i 17 |
18 |
<%= nearArticle[i].convertdate %> 说 19 | 20 | <% if(typeof(locals.userinfo) !== 'undefined' && locals.userinfo.name === visituser){%> 21 | 删除 22 | <% }%> 23 | <% if(locals.userinfo){ %> 24 | 回复 25 | <% }else{%> 26 | 回复 27 | <%}%> 28 |
29 |
30 |
<%- nearArticle[i].newcontent %> 
31 |
32 |
33 | <% } %> 34 | <% if(nearArticle.length > 6 ){%> 35 | 36 |
查看<%= visituser%>更多心情
37 |
38 | <%}%> 39 |
40 |
41 |
42 |
43 | <% include partial/footer %> -------------------------------------------------------------------------------- /routes/message.js: -------------------------------------------------------------------------------- 1 | var util = require('../lib/util'); 2 | var MessageDao = require('../dao/messagedao'); 3 | var EventProxy = require('eventproxy'); 4 | 5 | /** 6 | * [index 消息页面] 7 | * @param {[type]} req 8 | * @param {[type]} res 9 | * @param {Function} next 10 | * @return {[type]} 11 | */ 12 | exports.index = function (req, res,next) { 13 | var uid = req.session.user.uid; 14 | var ep = new EventProxy(); 15 | 16 | ep.all('have_read_msg', 'not_read_msg', function (have_read_msg, not_read_msg) { 17 | 18 | for(var i=0;i
56 | <% include partial/footer %> -------------------------------------------------------------------------------- /routes/other/yangchengtong.js: -------------------------------------------------------------------------------- 1 | var EventProxy = require('eventproxy'); 2 | var http = require('http'); 3 | var cheerio = require('cheerio'); 4 | 5 | /** 6 | * [view description] 7 | * @param {[type]} req 8 | * @param {[type]} res 9 | * @return {[type]} 10 | */ 11 | exports.view = function (req, res) { 12 | res.render('/other/yct', { title: 'yangchengtong' }); 13 | }; 14 | exports.index = function (req, res) { 15 | var cardid = req.query.cardid; 16 | var baseUrl = "http://112.94.161.30/busiqry/user-card-balance!otherBalanceQry.action?openid=oKYOJjrmYzlhXoYcI0wEPKJOfhek&cardno=";//qiongrenqiongshi 17 | ep.assign('html',function(html){ 18 | $ = cheerio.load(html); 19 | var tablewrap = $(".btn-blue"); 20 | var resulthtml = tablewrap.text();//[0].chirldren[0]); 21 | var id = resulthtml.substring(resulthtml.indexOf("卡号")+3,resulthtml.indexOf("数据")).trim(); 22 | var time = resulthtml.substring(resulthtml.indexOf("时间")+3,resulthtml.indexOf("余额")).trim(); 23 | var remain = resulthtml.substring(resulthtml.indexOf("元)")+3).trim(); 24 | var info = {}; 25 | info.id = id; 26 | info.time = time; 27 | info.remain = remain; 28 | res.json(info); 29 | }); 30 | get(baseUrl+cardid,function(err,data){ 31 | var html; 32 | if(data != null){ 33 | html = data.toString(); 34 | } 35 | ep.emit('html',html); 36 | }); 37 | }; 38 | 39 | var ep = new EventProxy(); 40 | 41 | //定义一个爬去方法 42 | var get = function(url, cb){ 43 | http.get(url, function(res) { 44 | var size = 0; 45 | var chunks = []; 46 | res.on('data', function(chunk){ 47 | size += chunk.length; 48 | chunks.push(chunk); 49 | }); 50 | res.on('end', function(){ 51 | var data = Buffer.concat(chunks, size); 52 | cb(null, data); 53 | }); 54 | }).on('error', function(e) { 55 | cb(e, null); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /routes/mobile/commentjson.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../../dao/userdao'); 2 | var ArticleDao = require('../../dao/articledao'); 3 | var ReplyDao = require('../../dao/replydao'); 4 | var util = require('../../lib/util'); 5 | var at = require('../../lib/at'); 6 | var relationdao = require('../../dao/relationdao'); 7 | var EventProxy = require('eventproxy'); 8 | 9 | /** 10 | * [index article detail page] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.index = function (req, res) { 16 | var tid = req.query.tid; 17 | var ep = new EventProxy(); 18 | var proxy = new EventProxy(); 19 | 20 | ep.assign("d",function (d) { 21 | res.json(d); 22 | }); 23 | 24 | ArticleDao.getArticleByTid(tid,function(err,data){ 25 | data.view_count +=1; 26 | data.save(); 27 | data.convertdate = util.date_format(data.post_date,true,true); 28 | ReplyDao.getReplyByTid(tid,function(err,data1){ 29 | for(var i = 0 ; i < data1.length ; i++){ 30 | (function (j) { 31 | data1[j].convertdate = util.date_format(data1[j].create_at,true,true); 32 | at.linkUsers(data1[i].content,function(err , str){ 33 | if(err){ 34 | res.redirect('500'); 35 | return ; 36 | } 37 | data1[j].content = str; 38 | data1[j].name = data1[j]._creator.name; 39 | data1[j].avatar = data1[j]._creator.photo; 40 | data1[j].createat = data1[j].create_at; 41 | proxy.emit("reply_find"); 42 | }); 43 | })(i); 44 | } 45 | 46 | proxy.after('reply_find', data1.length, function(){ 47 | UserDao.getUserInfoByUid(data._creator.uid,function(err,tempuser){ 48 | var d = {}; 49 | tempuser.joinDate = util.date_format(tempuser.create_at,false,false)+' 加入'; 50 | d.userinfo = tempuser; 51 | d.articlecontent = data; 52 | d.replies = data1; 53 | ep.emit("d",d); 54 | }) 55 | }); 56 | }); 57 | }); 58 | }; -------------------------------------------------------------------------------- /views/login.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 登录 8 |
9 |
10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 |
25 | 28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 | 50 |
51 |
52 |
53 |
54 |
55 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 56 |
" role='alert'> 57 | <%-msg.content %> 58 |
59 | <% } %> 60 |
61 |
62 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/common/404.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= config.site.name + '-' + title %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 50 | 51 | 52 |
53 |
54 |

404. Not Found

55 |

没有找到你要的页面

56 |
          .----.
57 |        _.'__    `.
58 |    .--($)($$)---/#\
59 |  .' @          /###\
60 |  :         ,   #####
61 |   `-..__.-' _.-\###/
62 |         `;_:    `"'
63 |       .'"""""`.
64 |      /,  ya ,\\
65 |     //  404!  \\
66 |     `-._______.-'
67 |     ___`. | .'___
68 |    (______|______)
69 |         
70 | 73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /source/stylesheets/zoom.css: -------------------------------------------------------------------------------- 1 | #zoom { 2 | z-index: 99990; 3 | position: fixed; 4 | top: 0; 5 | left: 0; 6 | display: none; 7 | width: 100%; 8 | height: 100%; 9 | background: rgba(0, 0, 0, 0.8); 10 | filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)"; 11 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)"; 12 | } 13 | #zoom .content { 14 | z-index: 99991; 15 | position: absolute; 16 | top: 50%; 17 | left: 50%; 18 | width: 200px; 19 | height: 200px; 20 | background: #ffffff no-repeat 50% 50%; 21 | padding: 0; 22 | margin: -100px 0 0 -100px; 23 | box-shadow: -20px 20px 20px rgba(0, 0, 0, 0.3); 24 | } 25 | #zoom .content.imgloading { 26 | background-image: url('/images/imgloading.gif'); 27 | } 28 | #zoom .content .overlay { 29 | position: absolute; 30 | border: 1px solid rgba(255, 255, 255, .08); 31 | top: -1px; 32 | left: -1px; 33 | width: 100%; 34 | height: 100%; 35 | -webkit-user-select: none; 36 | } 37 | #zoom img { 38 | display: block; 39 | max-width: none; 40 | background: #ececec; 41 | box-shadow: 0 1px 3px rgba(0,0,0,0.25); 42 | } 43 | #zoom .close { 44 | z-index: 99993; 45 | position: absolute; 46 | top: 0; 47 | right: 0; 48 | width: 49px; 49 | height: 49px; 50 | cursor: pointer; 51 | background: transparent url('/images/close.png') no-repeat 50% 50%; 52 | opacity: 1; 53 | filter: alpha(opacity=100); 54 | } 55 | #zoom .previous, 56 | #zoom .next { 57 | z-index: 99992; 58 | position: absolute; 59 | top: 50%; 60 | overflow: hidden; 61 | display: block; 62 | width: 49px; 63 | height: 49px; 64 | margin-top: -25px; 65 | } 66 | #zoom .previous { 67 | left: 0; 68 | background: url('/images/arrows.png') no-repeat 0 0; 69 | } 70 | #zoom .next { 71 | right: 0; 72 | background: url('/images/arrows.png') no-repeat 100% 0; 73 | } 74 | #zoom .close:hover { 75 | background-color: #da4f49; 76 | } 77 | #zoom .previous:hover, 78 | #zoom .next:hover { 79 | background-color: #0088cc; 80 | } 81 | -------------------------------------------------------------------------------- /views/common/500.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= config.site.name + '-' + title %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 50 | 51 | 52 |
53 |
54 |

500. Server is Sleeping

55 |

服务器开小差了,希望你能把这个BUG报告给我,主页->反馈

56 |
          .----.
57 |        _.'__    `.
58 |    .--($)($$)---/#\
59 |  .' @          /###\
60 |  :         ,   #####
61 |   `-..__.-' _.-\###/
62 |         `;_:    `"'
63 |       .'"""""`.
64 |      /,  ya ,\\
65 |     //  500!  \\
66 |     `-._______.-'
67 |     ___`. | .'___
68 |    (______|______)
69 |         
70 |
71 | 服务器小差了 72 |
73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /source/javascripts/msgbox.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | ! function(W, D) { 4 | 5 | 6 | function msgBox(options) { 7 | this.options = options; 8 | this.gmsgbox = D.createElement("div"); 9 | this.gmsgbox.className = "gmsgbox msgboxout" + (this.options.pop ? ' msgpop' : ''); 10 | this.options.pNode.appendChild(this.gmsgbox); 11 | this.showMsgBox(); 12 | 13 | } 14 | msgBox.prototype.msgOut = function() { 15 | var _this = this; 16 | setTimeout(function() { 17 | _this.gmsgbox.className = _this.gmsgbox.className.replace(/msgboxin/, 'msgboxout'); 18 | }, _this.options.dur); 19 | setTimeout(function() { 20 | _this.options.pNode.removeChild(_this.gmsgbox); 21 | }, _this.options.dur + 2000); 22 | } 23 | msgBox.prototype.msgIn = function() { 24 | var _this = this; 25 | setTimeout(function() { 26 | _this.gmsgbox.className = _this.gmsgbox.className.replace(/msgboxout/, 'msgboxin'); 27 | }, 200); 28 | } 29 | msgBox.prototype.showMsgBox = function() { 30 | this.gmsgbox.className = this.gmsgbox.className + " msgbox_" + this.options.flag; 31 | this.gmsgbox.innerHTML = this.options.text; 32 | this.msgIn(); 33 | this.msgOut(); 34 | } 35 | 36 | //{flag:1,text:'',pNode:,duratoin:4000,pop:true} 37 | function msgbox(options) { 38 | if (!options) return; 39 | var text = options.text === undefined ? ' ' : options.text; 40 | var flag = options.flag === undefined ? 'default' : options.flag; 41 | var dur = options.dur || 2000; 42 | var pop = options.pop === undefined ? false : true; 43 | var pNode = options.pNode === undefined ? D.getElementsByTagName("body")[0] : options.pNode; 44 | return new msgBox({ 45 | text: text, 46 | flag: flag, 47 | pNode: pNode, 48 | dur: dur, 49 | pop:pop 50 | }); 51 | } 52 | if (typeof define === 'function' && define.amd) { 53 | define('msgbox', [], function() { 54 | return msgbox; 55 | }); 56 | } 57 | 58 | 59 | if (typeof module !== 'undefined') { 60 | module.exports = msgbox; 61 | } else if (typeof window !== 'undefined') { 62 | window.msgbox = msgbox; 63 | } 64 | 65 | }(window, document); -------------------------------------------------------------------------------- /views/resetpwd.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 重置密码 8 |
9 |
10 |
11 |
12 |
13 |
14 | ' name="email" readonly placeholder="邮箱"> 15 |
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 |
28 | ' name="token"> 29 |
30 | 31 |
32 |
33 |
34 |
35 | 36 |
37 |
38 | 46 |
47 |
48 |
49 |
50 |
51 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 52 |
" role='alert'> 53 | <%-msg.content %> 54 |
55 | <% } %> 56 |
57 |
58 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/register.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 注册 8 |
9 |
10 |
11 |
12 |
13 |
14 | ' name="email" readonly placeholder="邮箱"> 15 |
16 |
17 |
18 |
19 | ' placeholder="帐号"> 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 | 47 |
48 |
49 |
50 |
51 |
52 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 53 |
" role='alert'> 54 | <%-msg.content %> 55 |
56 | <% } %> 57 |
58 |
59 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/partial/indexsidebar.ejs: -------------------------------------------------------------------------------- 1 |
2 |
38锶
3 |

做一体化的IT社区

4 |
5 | <% if(locals.userinfo){%> 6 |
7 | 发布一个 8 |
9 | <%}%> 10 |
11 |
12 | <%if(typeof(zymryj.cncontent)!== 'undefined'){%> 13 |

<%= zymryj.cncontent %>

14 | <%}%> 15 | <%if(typeof(zymryj.encontent)!== 'undefined'){%> 16 |

<%= zymryj.encontent %>

17 | <%}%> 18 |
19 | 20 |
21 |
22 |
23 |
锶者榜
24 |
25 | <% 26 | var hotuser = d.hotuser; 27 | for(i=0;i 28 | 29 |
>
30 |
<%=hotuser[i].name%>
31 |
33 | class="ordernum firstorder" 34 | <% }else if(i==1){%> 35 | class="ordernum secondorder" 36 | <%}else if(i==2){%> 37 | class="ordernum thirdorder" 38 | <%}else{%> 39 | class="ordernum otherorder" 40 | <%}%> 41 | ><%= i+1 %>
42 |
43 | <%}%> 44 |
45 |
46 |
47 |
48 |
APP下载
49 | 50 |
51 | <% 52 | var siteList = config.site_link; 53 | if(siteList.length > 0){ 54 | %> 55 | 63 | <%}%> 64 | -------------------------------------------------------------------------------- /views/admin/partial/pagination.ejs: -------------------------------------------------------------------------------- 1 | <% 2 | var displaypage = 7; 3 | var items = d.count; 4 | var pagesize = config.index.list_admin_article_size; 5 | var page = Math.ceil(items/pagesize); 6 | var curpage = p; 7 | if(typeof(curpath) === 'undefined'){ 8 | curpath = ''; 9 | } 10 | %> 11 | -------------------------------------------------------------------------------- /views/avatarset.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 |
8 | 14 |
15 |
16 |
17 | <% if(typeof(msg) !== 'undefined' && msg.status !== -1){ %> 18 |
" role='alert'> 19 | <%-msg.content %> 20 |
21 | <% } %> 22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 |
36 |
37 |
38 |
39 |

40 |

41 |
42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 |
50 | 51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | <% include partial/footer %> -------------------------------------------------------------------------------- /routes/mobile/xqjson.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../../dao/userdao'); 2 | var ZymryjDao = require('../../dao/zymryjdao'); 3 | var util = require('../../lib/util'); 4 | var ArticleDao = require('../../dao/articledao'); 5 | var moment = require('moment'); 6 | var config = require('../../config').config; 7 | var EventProxy = require('eventproxy'); 8 | 9 | /** 10 | * [index description] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.index = function (req, res) { 16 | var page = 1; 17 | var pagesize = config.index.list_article_size; 18 | var puretext = true; 19 | var list_hot_user_size = config.index.list_hot_user_size; 20 | var count = 0; 21 | if(req.query.page){ 22 | page=req.query.page; 23 | } 24 | if(req.session.user){ 25 | res.locals.userinfo = req.session.user; 26 | } 27 | var ep = new EventProxy(); 28 | ep.assign("count","articlelist",'zymryj',function (count,articlelist,zymryj) { 29 | var d= {}; 30 | d.count = count; 31 | d.data = articlelist; 32 | var mryj = ' 在人生的漫漫旅途中,有时热烈,有时寂寞,有时高兴,有时忧伤...这里可以记录这一切'; 33 | res.json(d); 34 | }); 35 | 36 | var articleLimit = { 37 | classify: 2, 38 | isdelete: false}; 39 | ArticleDao.getNumberOfArticlesAsObect(articleLimit,function (err,count) { 40 | ep.emit("count",count); 41 | }); 42 | 43 | ArticleDao.getArticleListLimitAsObject(puretext,page,pagesize,articleLimit,function(err,articlelist){ 44 | for(var i =0;i]+src="[^"]+"[^>]*>/g ; 46 | var imglist = articlelist[i].content.match(b) 47 | if(imglist !== null){ 48 | if(imglist.length>0){ 49 | var srcReg = /http:\/\/([^"]+)/i; 50 | var srcStr = imglist[0].match(srcReg); 51 | articlelist[i].pic= srcStr[0];//+"!limitmax"; 52 | } 53 | } 54 | articlelist[i].author = articlelist[i]._creator.name; 55 | articlelist[i].uid = articlelist[i]._creator.uid; 56 | articlelist[i].authorimg = articlelist[i]._creator.photo; 57 | } 58 | ep.emit("articlelist",articlelist); 59 | }) 60 | ZymryjDao.getZymryjOfCurrday(function(err,zymryj){ 61 | ep.emit("zymryj",zymryj); 62 | }); 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /views/partial/pagination.ejs: -------------------------------------------------------------------------------- 1 |
2 | <% 3 | var displaypage = 7; 4 | var items = d.count; 5 | var pagesize = config.index.list_article_size; 6 | var page = Math.ceil(items/pagesize); 7 | var curpage = p; 8 | if(typeof(curpath) === 'undefined'){ 9 | curpath = ''; 10 | } 11 | %> 12 | 69 |
-------------------------------------------------------------------------------- /process/process.js: -------------------------------------------------------------------------------- 1 | var ArticleDao = require('../dao/articledao'); 2 | var Article = require('../models/article'); 3 | var mongoose = require('mongoose'); 4 | var bosonnlp = require('bosonnlp'); 5 | var util = require('../lib/util'); 6 | var boson = new bosonnlp.BosonNLP("yoUTK8dE.3486.jTfMGWlrfZxc"); 7 | mongoose.connect('mongodb://caosl:123456@107.170.206.235:27017/blogdb'); 8 | /* 9 | * GET find password page. 10 | */ 11 | Article.find({ 12 | tid: 3801 13 | }).exec(function(err, articlelist) { 14 | console.log(articlelist.length); 15 | articlelist.forEach(function(article) { 16 | console.log(util.delHtmlTag(article.content)); 17 | boson.extractKeywords(util.delHtmlTag(article.content), function(data) { 18 | 19 | data = JSON.parse(data); 20 | // console.log(labeljson); 21 | var label = ''; 22 | var labeljson = data[0]; 23 | console.log(data); 24 | if (typeof(labeljson) !== 'undefined') { 25 | for (var k = 0; k < (labeljson.length > 5 ? 5 : labeljson.length); k++) { 26 | label += labeljson[k][1] + ',' 27 | }; 28 | 29 | } 30 | label = "默克尔,Merkel,Germany,政治,Mutti,"; 31 | article.label = label; 32 | article.save(); 33 | }); 34 | }); 35 | /* for (var i = 0; i < articlelist.length; i++) { 36 | (function(i) { 37 | if (typeof(article.label) == 'undefined') { 38 | console.log(article.content); 39 | boson.extractKeywords(util.delHtmlTag(article.content), function(data) { 40 | data = JSON.parse(data); 41 | var labeljson = data[0]; 42 | console.log(labeljson); 43 | var label = ''; 44 | for (var k = 0; k < (labeljson.length > 5 ? 5 : labeljson.length); k++) { 45 | label += labeljson[k][1] + ',' 46 | }; 47 | article.label = label; 48 | article.save(); 49 | }); 50 | } 51 | })(i); 52 | };*/ 53 | }) -------------------------------------------------------------------------------- /views/partial/article.js: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | href="/user/<%= article._creator.name %>"><%= article._creator.name %> 6 | <% 7 | if(article.location){ 8 | %> 9 | 在 10 | <%- article.location %> 11 | <%}%> 12 | <% if(article.classify === 0){%> 13 | 14 | <% if(article.title &&article.title.length > 0 ){%> 15 |

<%= article.title %>

16 | <%}%> 17 |
<%- article.newcontent %>
18 | <%}else{%> 19 | 分享来自 20 | <%if(article._sid){%> 21 | <%=article._sid.sname %> 22 | <%}else{%> 23 | net 24 | <%}%> 25 | 26 | 的快链 27 | <%if(article._sid){%> 28 | 29 | <%}%> 30 |

<%= article.content %>

31 | <%}%> 32 |
33 | 41 |
42 |
43 |
-------------------------------------------------------------------------------- /source/javascripts/texiao.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | //触发首页网站信息的提示 3 | $(function() { 4 | $("[data-toggle='tooltip']").tooltip(); 5 | var options = { 6 | animation: true, 7 | trigger: 'focus' //触发tooltip的事件 8 | } 9 | $('.atip').tooltip(options); 10 | }); 11 | 12 | $('.articleitem').hover( 13 | function() { 14 | $(this).find('.otherinfowrap').css("opacity", "1"); 15 | }, 16 | function() { 17 | $(this).find('.otherinfowrap').css("opacity", "0.8"); 18 | } 19 | ); 20 | 21 | //导航栏中搜索的效果 22 | var btnsearch = $(".btn-search"); 23 | var btnclose = $(".btn-close"); 24 | var formsearch = $(".form-search"); 25 | var inputsearch = $("[name=searchstr]"); 26 | btnsearch.click(function() { 27 | formsearch.addClass("active"); 28 | inputsearch.focus(); 29 | }); 30 | btnclose.click(function() { 31 | formsearch.removeClass("active"); 32 | }); 33 | inputsearch.blur(function() { 34 | formsearch.removeClass("active"); 35 | }); 36 | }) 37 | 38 | 39 | // JavaScript Document 40 | function goTopEx() { 41 | var TopObj = document.getElementById("gotopbtn"); 42 | 43 | function getScrollTop() { 44 | return document.documentElement.scrollTop | document.body.scrollTop; 45 | } 46 | 47 | function setScrollTop(value) { 48 | document.documentElement.scrollTop = value; 49 | document.body.scrollTop = value; 50 | } 51 | window.onscroll = function() { 52 | getScrollTop() > 60 ? TopObj.style.bottom = "80px" : TopObj.style.bottom = "-45px"; 53 | } 54 | TopObj.onclick = function() { 55 | var goTop = setInterval(scrollMove, 10); 56 | 57 | function scrollMove() { 58 | setScrollTop(getScrollTop() / 1.1); 59 | if (getScrollTop() < 1) { 60 | clearInterval(goTop); 61 | } 62 | } 63 | } 64 | } 65 | $(window).scroll(function() { 66 | var t = document.documentElement.scrollTop || document.body.scrollTop; 67 | var body = $("body"); 68 | var navigate = document.getElementById("navigate"); 69 | if (t >= 130) { 70 | body.addClass("headon"); 71 | } else { 72 | body.removeClass("headon"); 73 | } 74 | }); -------------------------------------------------------------------------------- /routes/mobile/articlejson.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../../dao/userdao'); 2 | var ArticleDao = require('../../dao/articledao'); 3 | var ReplyDao = require('../../dao/replydao'); 4 | var util = require('../../lib/util'); 5 | var At = require('../../lib/at'); 6 | var relationdao = require('../../dao/relationdao'); 7 | var EventProxy = require('eventproxy'); 8 | 9 | /** 10 | * [getdetail article detail page] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.getdetail = function (req, res) { 16 | var tid = req.query.tid; 17 | var summaryNum = 3; 18 | var msg = {}; 19 | var ep = new EventProxy(); 20 | var proxy = new EventProxy(); 21 | ep.assign("replies",function (replies) { 22 | msg.replies = replies; 23 | ArticleDao.getArticleByTid(tid,function(err,data){ 24 | data.view_count +=1; 25 | data.save(); 26 | data.convertdate = util.date_format(data.post_date,true,true); 27 | msg.post_date = util.date_format(data.post_date,true,true); 28 | msg.view_count = data.view_count; 29 | msg.reply_count = data.reply_count; 30 | msg.like_count = data.like_count; 31 | msg.unlike_count = data.unlike_count; 32 | msg._creator = data._creator; 33 | var b = /]+src="[^"]+"[^>]*>/g ; 34 | var imglist = data.content.match(b) 35 | var newcontent = data.purecontent; 36 | msg.content = data.content; 37 | msg.summarynum = summaryNum; 38 | res.json(msg); 39 | }); 40 | }); 41 | 42 | ReplyDao.getReplyByTidLimit(tid,summaryNum,function(err,data1){ 43 | for(var i = 0 ; i < data1.length ; i++){ 44 | (function (j) { 45 | data1[j].convertdate = util.date_format(data1[j].create_at,true,true); 46 | At.linkUsersWithName(data1[i].content,function(err , str){ 47 | if(err){ 48 | res.redirect('500'); 49 | return ; 50 | } 51 | data1[j].content = str; 52 | data1[j].uid = data1[j]._creator.uid; 53 | data1[j].name = data1[j]._creator.name; 54 | data1[j].avatar = data1[j]._creator.photo; 55 | data1[j].createat = data1[j].create_at; 56 | proxy.emit("reply_find"); 57 | }); 58 | })(i); 59 | } 60 | 61 | proxy.after('reply_find', data1.length, function(){ 62 | ep.emit("replies",data1); 63 | }); 64 | }); 65 | 66 | }; 67 | 68 | 69 | -------------------------------------------------------------------------------- /views/indexlink.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 | <% if(!locals.userinfo){%> 7 |
8 | <%}else{%> 9 |
10 | <%}%> 11 | <% include partial/indexsidebar %> 12 |
13 |
14 |
15 | <% 16 | var result = d.data; 17 | %> 18 | <% for(var i= 0;i 21 |
22 | 27 |
28 | 29 |
30 | <%= result[i].convertdate %> 31 |
32 | <%if(result[i]._sid){%> 33 | <%=result[i]._sid.sname %> 34 | <%}else{%> 35 | net 36 | <%}%> 37 |
38 |
39 |
40 | <%}}%> 41 |
42 | <% include partial/paginationmore%> 43 | 44 | 45 | 49 | 52 |
53 |
54 |
55 |
56 | <%if(d.tags.length > 0){%> 57 |
58 |
    59 |
  • 热门标签:
  • 60 | <% 61 | var tags = d.tags; 62 | for(var i= 0;i 63 |
  • <%- tags[i]%>
  • 64 | <%}%> 65 |
66 |
67 | 68 |
69 |
70 | <%}%> 71 | <% include partial/footer %> -------------------------------------------------------------------------------- /routes/relation.js: -------------------------------------------------------------------------------- 1 | var Relation = require('../models/relation'); 2 | var UserDao = require('../dao/userdao'); 3 | var MessageDao = require('../dao/messagedao'); 4 | var path = require('path'); 5 | var mongoose = require('mongoose'); 6 | var EventProxy = require('eventproxy'); 7 | 8 | /** 9 | * [follow 关注用户动作] 10 | * @param {[type]} req 11 | * @param {[type]} res 12 | * @return {[type]} 13 | */ 14 | exports.follow = function (req, res) { 15 | if(!req.session.user){ 16 | res.json({status:'failed'}); 17 | }else{ 18 | var followUid = req.query.followuid; 19 | var follow = req.query.follow; 20 | var myUid = 0; 21 | var ep = new EventProxy(); 22 | 23 | if(followUid === '' || follow === ''){ 24 | res.json({status:'error'}); 25 | return; 26 | } 27 | 28 | ep.assign("userinfo","userinfoby",function(userinfo,userinfoby){ 29 | myUid = userinfo.uid; 30 | var relation = new Relation({ 31 | uid:myUid, 32 | fuid:followUid, 33 | _uid_info:userinfo._id, 34 | _fuid_info: userinfoby._id 35 | }); 36 | if(follow == "true"){ 37 | Relation.findOne({uid:relation.uid,fuid:relation.fuid},function(err,doc){ 38 | if (err) return handleError(err); 39 | if(doc){ 40 | res.json({status:'failed'}); 41 | return ; 42 | }else{ 43 | relation.save(function(err,relate){ 44 | if (err) return handleError(err); 45 | MessageDao.saveFollowMsg(myUid,followUid,function(err){ 46 | if (err) return handleError(err); 47 | res.json({status:'success'}); 48 | return ; 49 | }); 50 | }); 51 | } 52 | }); 53 | }else{ 54 | Relation.remove({uid:relation.uid,fuid:relation.fuid},function(err,doc){ 55 | if (err) return handleError(err); 56 | res.json({status:'success'}); 57 | return ; 58 | }); 59 | } 60 | }); 61 | 62 | UserDao.getUserInfoByName(req.session.user.name,function(err,userinfo){ 63 | if(err){ 64 | res.redirect('/500'); 65 | return ; 66 | } 67 | if(userinfo){ 68 | ep.emit("userinfo",userinfo); 69 | } 70 | }); 71 | UserDao.getUserInfoByUid(followUid,function(err,userinfoby){ 72 | if(err){ 73 | res.redirect('/500'); 74 | return ; 75 | } 76 | if(userinfoby){ 77 | ep.emit("userinfoby",userinfoby); 78 | } 79 | }); 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /views/admin/partial/catasidebar1.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 38 |
39 |
40 |

公告

41 |

时光静好,与君语;细水流年,与君同。

42 |
43 |
44 |
45 |
46 | 47 | -------------------------------------------------------------------------------- /views/shijian.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | 38SR成长录 8 |
9 |
10 |
11 |
    12 |
  • 13 |
    14 | 2014-7-1 15 |
    16 |
    17 |
    注册38sr域名
    18 |
    注册38sr域名
    19 |
    20 |
  • 21 | 22 |
  • 23 |
    24 | 2014-8-3 25 |
    26 |
    27 |
    程序开发完毕
    28 |
    程序开发完毕,并最终部署在digitalocean的vps上
    29 |
    30 |
  • 31 | 32 |
  • 33 |
    34 | 2014-9-23 35 |
    36 |
    37 |
    新增加栏目
    38 |
    增加笑料,娱乐,囧事等栏目
    39 |
    40 |
  • 41 | 42 |
  • 43 |
    44 | 2014-11-10 45 |
    46 |
    47 |
    网站能支持手机屏幕
    48 |
    网站能支持手机屏幕
    49 |
    50 |
  • 51 | 52 |
  • 53 |
    54 | 2014-11-14 55 |
    56 |
    57 |
    网站使用ssl安全证书
    58 |
    网站使用ssl,成为使用ssl用户数最少的网站
    59 |
    60 |
  • 61 | 62 |
  • 63 |
    64 | 2015-01-10 65 |
    66 |
    67 |
    增加android客户端
    68 |
    增加android客户端,到20150330客户端已经有发表评论点赞功能...
    69 |
    70 |
  • 71 | 72 |
  • 73 |
    74 | 2015-06-01 75 |
    76 |
    77 |
    增加快链功能
    78 |
    增加快链功能,可以发布哪些你喜欢的文章或网站网址...
    79 |
    80 |
  • 81 | 82 |
  • 83 |
    84 | ... 85 |
    86 |
    87 |
    未来 Future
    88 |
    未来可期待...
    89 |
    90 |
  • 91 |
92 |
93 |
94 |
95 |
96 | <% include partial/footer %> -------------------------------------------------------------------------------- /source/stylesheets/loginreg.css: -------------------------------------------------------------------------------- 1 | .leftreg { 2 | float: left; 3 | width: 65%; 4 | } 5 | 6 | .rightreg { 7 | float: right; 8 | width: 35%; 9 | border-left: 1px solid #DAD5D5; 10 | } 11 | 12 | .regpanel { 13 | margin-top: 35px; 14 | margin-left: 20px; 15 | margin-right: 20px; 16 | overflow: hidden 17 | } 18 | .reglogin_head_info{ 19 | color: #383838; 20 | border-left: 4px solid #00a090; 21 | border-bottom: 1px dashed #E0E0E0; 22 | font-size: 20px; 23 | } 24 | .reglogin_formwrap{ 25 | float: right; 26 | width: 75%; 27 | } 28 | .reglogin_mainwrap{ 29 | border-radius: 3px; 30 | background: #fff; 31 | margin: 10px auto 0; 32 | margin-top: 70px; 33 | } 34 | .rightpanelinfo { 35 | margin-left: 50px; 36 | height: 80px 37 | } 38 | 39 | .regpanel input { 40 | border-radius: 4px; 41 | padding-left: 35px; 42 | border: 0px; 43 | background-color: #e4e4e4; 44 | } 45 | 46 | .regpanel button { 47 | border-radius: 0 48 | } 49 | 50 | 51 | .leftreg button{ 52 | width: 100%; 53 | background-color: #598DC5; 54 | height: 40px; 55 | color: #fff; 56 | font-size: 15px; 57 | border: 1px solid #eee; 58 | } 59 | .leftreg button:active,.leftreg button:focus,.leftreg button:hover{ 60 | background-color: #3D72AC; 61 | } 62 | .accountbg { 63 | background: url(../images/y_accountbg.png) 10px 10px no-repeat; 64 | background-size: 16px 17px; 65 | } 66 | 67 | .emailbg { 68 | background: url(../images/y_emailbg.png) 10px 10px no-repeat 69 | } 70 | 71 | .pwdbg { 72 | background: url(../images/y_pwdbg.png) 10px 10px no-repeat 73 | } 74 | 75 | .alertsty { 76 | color: #8a6d3b; 77 | background-color: #fcf8e3; 78 | border-color: #faebcc; 79 | padding: 15px; 80 | margin-bottom: 20px 81 | } 82 | 83 | .sucesssty { 84 | color: #8a6d3b; 85 | background-color: #A3D6AD; 86 | border-color: #faebcc; 87 | padding: 15px; 88 | margin-bottom: 20px 89 | } 90 | .rightreg a{ 91 | color:#07695F; 92 | -webkit-transition: all .3s ease-out; 93 | -moz-transition: all .3s ease-out; 94 | -o-transition: all .3s ease-out; 95 | transition: all .3s ease-out; 96 | -webkit-transition-property: all; 97 | -moz-transition-property: all; 98 | -o-transition-property: all; 99 | transition-property: all; 100 | -webkit-animation-fill-mode: both; 101 | -moz-animation-fill-mode: both; 102 | -o-animation-fill-mode: both; 103 | animation-fill-mode: both; 104 | } 105 | .rightreg a:hover{ 106 | color:#303e48; 107 | text-decoration: underline; 108 | } -------------------------------------------------------------------------------- /views/admin/addarticle1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | 增加文章 / add article 14 |
15 |
16 |
17 |
18 |
19 | 列表 20 | 21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 |
42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |
50 |
51 |
52 |
53 | 54 |
55 |
56 |
57 |
58 |
59 | 60 |
61 |
62 | 63 | -------------------------------------------------------------------------------- /views/message.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 |
8 |
9 |

未读消息

10 |
11 | <% if(not_read_msg.length === 0){%> 12 |
没有未读消息
13 | <%}%> 14 | <% 15 | var message ; 16 | for(i=0;i< not_read_msg.length;i++){ 17 | message = not_read_msg[i]; 18 | %> 19 | <%if(message.type === "follow"){%> 20 |
<%=message.createdate %> >> <%=message.author.name %> 关注你了
21 | <%}%> 22 | <%if(message.type === "at"){%> 23 |
<%=message.createdate %> >> <%=message.author.name %> 在帖子 <%=message.displayinforeply %> 中@你了
24 | <%}%> 25 | <%if(message.type === "reply"){%> 26 |
<%=message.createdate %> >> <%=message.author.name %> 回复了你的帖子 <%=message.displayinforeply %>
27 | <%}%> 28 | <%}%> 29 |
30 |
31 |
32 |

历史消息

33 |
34 | <% if(have_read_msg.length === 0){%> 35 |
没有消息
36 | <%}%> 37 | <% 38 | var message ; 39 | for(i=0;i< have_read_msg.length;i++){ 40 | message = have_read_msg[i]; 41 | %> 42 | <%if(message.type === "follow"){%> 43 |
<%=message.createdate %> >> <%=message.author.name %> 关注你了
44 | <%}%> 45 | <%if(message.type === "at"){%> 46 |
<%=message.createdate %> >> <%=message.author.name %> 在帖子 <%=message.displayinforeply %> 中@你了
47 | <%}%> 48 | <%if(message.type === "reply"){%> 49 |
<%=message.createdate %> >> <%=message.author.name %> 回复了你的帖子 <%=message.displayinforeply %>
50 | <%}%> 51 | <%}%> 52 |
53 |
54 |
55 |
56 | <% include partial/footer %> -------------------------------------------------------------------------------- /routes/mobile/uploadjson.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var config = require('../../config').config; 3 | var UPYun = require('../../lib/upyun').UPYun; 4 | var gm = require('gm') 5 | , fs = require('fs') 6 | , imageMagick = gm.subClass({ imageMagick : true }); 7 | 8 | //图片上传 9 | /** 10 | * [uploadpic description] 11 | * @param {[type]} req 12 | * @param {[type]} res 13 | * @return {[type]} 14 | */ 15 | exports.uploadpic = function(req, res) { 16 | var temp_path = req.files.picture.path; //获取用户上传过来的文件的当前路径 17 | var filename = req.files.picture.name; 18 | var sz = req.files.picture.size; 19 | var maxWidth = 500; 20 | var maxHigh = 500; 21 | if (sz > 2*1024*1024) { 22 | console.log("fffff"); 23 | fs.unlink(temp_path, function() { //fs.unlink 删除用户上传的文件 24 | var msg = {}; 25 | msg.content = "请选择2M以下的图片!!"; 26 | msg.status = 0; 27 | console.log("gggg"); 28 | res.json(msg); 29 | return ; 30 | }); 31 | } 32 | resizeImageByMax(temp_path,temp_path,maxWidth,maxHigh,function(newpath){ 33 | var upyun = new UPYun(config.upyun.bat, config.upyun.opname, config.upyun.oppwd); 34 | var fileContent = fs.readFileSync(temp_path); 35 | var upBase = config.upyun.cimgurl; 36 | var curTime = new Date(); 37 | var newFilename = curTime.getTime()+'_'+filename; 38 | var upAbsolute = '/cimg/'+newFilename; 39 | upyun.writeFile(upAbsolute, fileContent, false, function(err, data){ 40 | if (!err) { 41 | var msg = {}; 42 | console.log(newFilename) 43 | msg.content = upBase+newFilename; 44 | msg.status = 1; 45 | res.json(msg); 46 | console.log(msg); 47 | return ; 48 | } 49 | }); 50 | }) 51 | }; 52 | 53 | /** 54 | * [resizeImageByMax description] 55 | * @param {[type]} temp_path 56 | * @param {[type]} newpath 57 | * @param {[type]} new_width 58 | * @param {[type]} new_high 59 | * @param {Function} callback 60 | * @return {[type]} 61 | */ 62 | function resizeImageByMax(temp_path,newpath,new_width,new_high,callback){ 63 | imageMagick(temp_path).size(function(err,size){ 64 | console.log(size); 65 | var x_w_h = size.width/size.height; 66 | console.log(size) 67 | if(size.width > new_width | size.height > new_high){ 68 | if(x_w_h > 1 || x_w_h === 1){ 69 | new_high = 1/x_w_h*new_high; 70 | }else{ 71 | new_width = x_w_h*new_width; 72 | } 73 | imageMagick(temp_path).resize(new_width, new_high, '!').autoOrient().write(newpath, function(err){ 74 | if (err) { 75 | return; 76 | } 77 | callback(newpath); 78 | return ; 79 | }); 80 | }else{ 81 | callback(newpath); 82 | return ; 83 | } 84 | }) 85 | } -------------------------------------------------------------------------------- /views/tag.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 |
7 | <% include partial/tagssidebar %> 8 |
9 |
10 |
11 | <% 12 | var result = d.data; 13 | %> 14 | <% for(var i= 0;i 17 |
18 |
19 |
20 | <% if(result[i].title &&result[i].title.length > 0 ){%> 21 |

<%= result[i].title %>

22 | <%}%> 23 |
<%- result[i].newcontent %>
24 |
25 |
26 | 29 | 42 | 46 | 52 |
53 |
54 |
55 |
56 | <%}}%> 57 |
58 | <% include partial/pagination%> 59 |
60 |
61 |
62 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/admin/updatearticle1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | 增加文章 / add article 14 |
15 |
16 |
17 |
18 |
19 | 列表 20 | 21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 | 31 | 32 |
33 | 34 |
35 | 36 |
37 |
38 |
39 | 40 |
41 | 42 |
43 |
44 |
45 | 46 |
47 | 48 |
49 |
50 |
51 |
52 |
53 |
54 | 55 | 56 |
57 |
58 |
59 |
60 |
61 |
62 | 63 | 64 | -------------------------------------------------------------------------------- /views/baseset.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% include partial/nav %> 5 |
6 | 72 |
73 | <% include partial/footer %> -------------------------------------------------------------------------------- /lib/at.js: -------------------------------------------------------------------------------- 1 | var User = require('../models/user'); 2 | var Msgdao = require('../dao/msgdao'); 3 | 4 | /** 5 | * [fetchUsers 从文本中提取出@username 标记的用户名数组] 6 | * @param {[type]} text 文本内容 7 | * @return {[type]} 用户名数组 8 | */ 9 | var fetchUsers = function (text) { 10 | var results = text.match(/@[\u4E00-\u9FA5a-zA-Z0-9\-_]+/ig); 11 | var names = []; 12 | if (results) { 13 | for (var i = 0, l = results.length; i < l; i++) { 14 | var s = results[i]; 15 | //remove char @ 16 | s = s.slice(1); 17 | names.push(s); 18 | } 19 | } 20 | return names; 21 | }; 22 | 23 | /** 24 | * [sendMessageToMentionUsers description] 25 | * @param {[type]} text 26 | * @param {[type]} tid 27 | * @param {[type]} refid 28 | * @param {[type]} rid 29 | * @param {Function} callback 30 | * @return {[type]} 31 | */ 32 | exports.sendMessageToMentionUsers = function (text, tid, refid, rid, callback) { 33 | if (typeof rid === 'function') { 34 | callback = rid; 35 | rid = null; 36 | } 37 | callback = callback || function () {}; 38 | User.find({name: { $in: fetchUsers(text)}}, function (err, users) { 39 | if (err || !users) { 40 | return callback(err); 41 | } 42 | var ep = new EventProxy(); 43 | ep.after('sent', users.length, function () { 44 | callback(); 45 | }).fail(callback); 46 | users.forEach(function (user) { 47 | Msgdao.saveAtMsg(user.uid, refid, tid, rid, function(err){ 48 | if(!err){ 49 | ep.emit('sent') 50 | } 51 | }); 52 | }); 53 | }); 54 | }; 55 | 56 | /** 57 | * [linkUsers 根据文本内容,替换为数据库中的数据] 58 | * @param {[type]} text 文本内容 59 | * @param {Function} callback 回调函数 60 | * @return {[type]} 61 | */ 62 | exports.linkUsers = function (text, callback) { 63 | User.find({name: { $in: fetchUsers(text)}}, function (err, users) { 64 | if (err) { 65 | return callback(err); 66 | } 67 | for (var i = 0, l = users.length; i < l; i++) { 68 | var name = users[i].name; 69 | text = text.replace(new RegExp('@' + name + '(?!\s*\\])', 'gmi'), '@' + name + ''); 70 | } 71 | return callback(null, text); 72 | }); 73 | }; 74 | 75 | /** 76 | * [linkUsersWithName description] 77 | * @param {[type]} text 78 | * @param {Function} callback 79 | * @return {[type]} 80 | */ 81 | exports.linkUsersWithName = function (text, callback) { 82 | console.log(text); 83 | User.find({name: { $in: fetchUsers(text)}}, function (err, users) { 84 | if (err) { 85 | return callback(err); 86 | } 87 | console.log(users); 88 | for (var i = 0, l = users.length; i < l; i++) { 89 | var name = users[i].name; 90 | text = text.replace(new RegExp('@' + name + '(?!\s*\\])', 'gmi'), '' ); 91 | // text = text.replace(new RegExp('@' + name + '(?!\s*\\])', 'gmi'), '回复' + name ); 92 | } 93 | return callback(null, text); 94 | }); 95 | }; -------------------------------------------------------------------------------- /views/partial/sidebar.ejs: -------------------------------------------------------------------------------- 1 | <% 2 | var userinfo = d.userinfo; 3 | %> 4 |
<%= userinfo.name %>
5 |
6 |
7 | > 8 |

第<%= userinfo.uid %>位成员

9 |

<%= userinfo.joinDate %>

10 | <% if(typeof(userinfo.intro) !== 'undefined') {%> 11 |
<%= userinfo.intro %>
12 | <% } %> 13 | <% if(typeof(locals.userinfo) !== 'undefined' && locals.userinfo.name === userinfo.name){%> 14 |

个人设置

15 | <%}else{%> 16 |

17 | data_id="<%=userinfo.uid %>"> 18 | <%if(d.isfollow){%> 19 | 取消关注 20 | <%}else{%> 21 | 关注此人 22 | <%}%> 23 | 24 |

25 | <%}%> 26 |
27 |
28 | <% 29 | var followerlist = d.followerlist; 30 | var length1 = followerlist.length; 31 | %> 32 |
拥趸(<%= d.followernum %>) 33 | <% 34 | if(d.followernum > 6){ 35 | %> 36 | ... 37 | <% 38 | } 39 | %> 40 |
41 |
42 | <% 43 | for(i=0;i 46 | 47 |
>
48 |
<%=follower.name%>
49 |
50 | <%}%> 51 |
52 | <% 53 | var hefollowlist = d.hefollowlist; 54 | var length2 = hefollowlist.length; 55 | %> 56 |
关注(<%= d.hefollowernum %>) 57 | <% 58 | if(d.hefollowernum > 6){ 59 | %> 60 | ... 61 | <% 62 | } 63 | %> 64 |
65 |
66 | <% 67 | for(i=0;i 70 | 71 |
72 |
>
73 | <%=hefollow.name%> 74 |
75 |
76 | <%}%> 77 |
78 |
79 |
-------------------------------------------------------------------------------- /routes/other/api.js: -------------------------------------------------------------------------------- 1 | // GET 2 | var UserDao = require('../../dao/userdao'); 3 | var ZymryjDao = require('../../dao/zymryjdao'); 4 | var util = require('../../lib/util'); 5 | var ArticleDao = require('../../dao/articledao'); 6 | var moment = require('moment'); 7 | var config = require('../../config').config; 8 | var cache = require('../../common/cache'); 9 | var EventProxy = require('eventproxy'); 10 | var mongoose = require('mongoose'); 11 | 12 | 13 | /** 14 | * [posts description] 15 | * @param {[type]} req 16 | * @param {[type]} res 17 | * @return {[type]} 18 | */ 19 | exports.posts = function (req, res) { 20 | var pageid = req.query.pageid; 21 | var pagesize = config.index.list_article_size; 22 | var puretext = true; 23 | var flag = 0; 24 | var classify = 1; 25 | var articleLimit = {'$or':[{flag:flag},{classify:classify}],isdelete:false}; 26 | 27 | var ep = new EventProxy(); 28 | 29 | ep.assign("total","articlelist",function (total,articlelist) { 30 | var d= {}; 31 | d.total = total; 32 | d.data = articlelist; 33 | d.pageSize = pagesize; 34 | d.pageIndex = parseInt(pageid); 35 | res.json(d); 36 | }); 37 | 38 | ArticleDao.getNumberOfArticlesAsObect(articleLimit,function (err,total) { 39 | ep.emit("total",total); 40 | }); 41 | 42 | ArticleDao.getArticleListLimitAsObject(puretext,pageid,pagesize,articleLimit,function(err,articlelist){ 43 | for(var i =0;i]+src="[^"]+"[^>]*>/g ; 45 | var imglist = articlelist[i].content.match(b) 46 | var newcontent = articlelist[i].purecontent; 47 | if(articlelist[i].classify != 0){ 48 | articlelist[i].title = encodeURIComponent(articlelist[i].title); 49 | } 50 | if(imglist !== null){ 51 | if(imglist.length>0){ 52 | var srcReg = /http:\/\/([^"]+)/i; 53 | var srcStr = imglist[0].match(srcReg); 54 | if(articlelist[i].type == 1){ 55 | var imgWrap = "" 56 | }else{ 57 | var imgWrap = "" 58 | } 59 | newcontent= imgWrap+newcontent.substring(0,(newcontent.length > 150)?150:newcontent.length).trim(); 60 | } 61 | }else{ 62 | newcontent= newcontent.substring(0,(newcontent.length > 180)?180:newcontent.length).trim(); 63 | } 64 | articlelist[i].newcontent = newcontent; 65 | } 66 | ep.emit("articlelist",articlelist); 67 | }) 68 | }; 69 | 70 | /** 71 | * [partials description] 72 | * @param {[type]} req 73 | * @param {[type]} res 74 | * @return {[type]} 75 | */ 76 | exports.partials = function (req, res) { 77 | var name = req.params.name; 78 | console.log(name); 79 | res.render('_partials/' + name); 80 | }; -------------------------------------------------------------------------------- /views/admin/addarticle.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 | 6 | <% include ./partial/catasidebar%> 7 | 8 | 9 |
10 | <% include ./partial/righttop%> 11 | 12 |
13 |
14 |

主页

15 | 24 |
25 |
26 |
27 |
28 |
29 | 31 | 32 |
33 | 34 |
35 | 36 |
37 |
38 |
39 | 40 |
41 | 42 |
43 |
44 |
45 | 46 |
47 | 48 |
49 |
50 | 51 |
52 |
53 |
54 | 55 | <% include ./partial/footer%> -------------------------------------------------------------------------------- /routes/feedback.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../dao/userdao'); 2 | var ArticleDao = require('../dao/articledao'); 3 | var ReplyDao = require('../dao/replydao'); 4 | var util = require('../lib/util'); 5 | var Article = require('../models/article'); 6 | var Reply = require('../models/reply'); 7 | var at = require('../lib/at'); 8 | var RelationDao = require('../dao/relationdao'); 9 | var EventProxy = require('eventproxy'); 10 | var xssFilters = require('xss-filters'); 11 | 12 | /** 13 | * [index 网站反馈页面] 14 | * @param {[type]} req 15 | * @param {[type]} res 16 | * @return {[type]} 17 | */ 18 | exports.index = function (req, res) { 19 | var proxy = new EventProxy(); 20 | var curpath = '/'; 21 | var title = "网站反馈"; 22 | var tid = 1; 23 | ArticleDao.getArticleByTid(tid,function(err,data){ 24 | var replyLimit = {tid:tid}; 25 | ReplyDao.getReplyByAsObject(replyLimit,function(err,data1){ 26 | for(var i = 0 ; i < data1.length ; i++){ 27 | (function (j) { 28 | data1[j].convertdate = util.date_format(data1[j].create_at,true,true); 29 | at.linkUsers(data1[i].content,function(err , str){ 30 | if(err){ 31 | res.redirect('500'); 32 | return ; 33 | } 34 | data1[j].content = str;//xssFilters.inHTMLData(str); 35 | proxy.emit("reply_find"); 36 | }); 37 | })(i); 38 | } 39 | 40 | proxy.after('reply_find', data1.length, function(){ 41 | var d = []; 42 | d.replies = data1; 43 | d.articlecontent = data; 44 | console.log(d); 45 | res.render('feedback', { title: title,d:d}); 46 | }); 47 | }); 48 | }); 49 | }; 50 | 51 | /** 52 | * [dofb 反馈回复动作] 53 | * @param {[type]} req 54 | * @param {[type]} res 55 | * @return {[type]} 56 | */ 57 | exports.dofb = function (req, res) { 58 | var repstr = req.body.repstr; 59 | var tid = req.body.tid; 60 | var rid = req.body.rid; 61 | var ruid = req.body.ruid; 62 | var runame = req.body.runame; 63 | var username = req.session.user.name; 64 | var cur_rid = 0; 65 | 66 | UserDao.getUserInfoByName(username,function(err,tempuser){ 67 | if(err){ 68 | res.redirect('500'); 69 | return ; 70 | } 71 | if(!tempuser){ 72 | res.redirect('400'); 73 | return ; 74 | } 75 | Reply.findOne().sort({'rid':-1}).exec(function(err1,doc){ 76 | if(doc){ 77 | cur_rid = doc.rid + 1; 78 | } 79 | var reply = new Reply({ 80 | rid:cur_rid, 81 | content: repstr , 82 | tid: tid, 83 | replyid:rid, 84 | uid:tempuser.uid, 85 | ruid:ruid, 86 | _creator:tempuser._id 87 | }); 88 | reply.save(function(){ 89 | Article.update({tid: tid}, {$inc: {reply_count:1}}, { multi: false },function(err,numberAffected, raw){ 90 | if (err){ 91 | res.redirect('/500'); 92 | return ; 93 | } 94 | res.redirect('/feedback'); 95 | }); 96 | }); 97 | }) 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /views/admin/updatesite1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | Site 更新 / Site 更新 14 |
15 |
16 |
17 |
18 |
19 | 新增 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 | 29 |
30 |
31 |
32 | 网站域名 33 |
34 |
35 | 36 |
37 |
38 |
39 |
40 | 网站名字 41 |
42 |
43 | 44 |
45 |
46 |
47 |
48 | 网站简介 49 |
50 |
51 | 52 |
53 |
54 |
55 |
56 | 网站图片 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | 68 |
69 | 70 |
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /views/admin/updatearticle.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 | 6 | <% include ./partial/catasidebar%> 7 | 8 | 9 |
10 | <% include ./partial/righttop%> 11 | 12 |
13 |
14 |

主页

15 | 24 |
25 |
26 |
27 |
28 |
29 | 31 | 32 |
33 | 34 |
35 | 36 |
37 |
38 |
39 | 40 |
41 | 42 |
43 |
44 |
45 | 46 |
47 | 48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 | 56 | <% include ./partial/footer%> -------------------------------------------------------------------------------- /source/stylesheets/pubarticle.css: -------------------------------------------------------------------------------- 1 | .titlewrap{ 2 | margin-top: 15px; 3 | margin-bottom: 20px; 4 | } 5 | .titlewrap #title{ 6 | width: 80%; 7 | border-radius: 0px; 8 | box-shadow: none; 9 | } 10 | .webuploader-element-invisible { 11 | position: absolute!important; 12 | clip: rect(1px 1px 1px 1px); 13 | clip: rect(1px,1px,1px,1px); 14 | } 15 | .uploadname{ 16 | position: relative; 17 | display: inline-block; 18 | cursor: pointer; 19 | background: #00b7ee; 20 | padding: 10px 15px; 21 | color: #fff; 22 | text-align: center; 23 | border-radius: 3px; 24 | overflow: hidden; 25 | } 26 | .uploadwrap{ 27 | position: absolute; 28 | overflow: hidden; 29 | bottom: auto; 30 | right: auto; 31 | width: 86px; 32 | height: 40px; 33 | top: 0px; 34 | left: 0px; 35 | } 36 | #pubstr{ 37 | width: 100%; 38 | } 39 | #pub_link_brief{ 40 | width:100%; 41 | border-radius: 0px; 42 | box-shadow: none; 43 | } 44 | 45 | .btninner { 46 | width: 124px; 47 | overflow: hidden; 48 | position:relative; 49 | margin: 0 auto; 50 | } 51 | .choose-btn{ 52 | display:inline-block; 53 | width: 126px; 54 | color: #fff; 55 | height: 40px; 56 | border: 0; 57 | font-size: 16px; 58 | line-height: 40px; 59 | text-align: center; 60 | cursor: pointer; 61 | background-color: #5993E2; 62 | } 63 | .btninner:hover .choose-btn{ 64 | color:#ccc; 65 | background-color: #568DEF; 66 | } 67 | .btninner input { 68 | position: absolute; 69 | right: 0; 70 | top: 0; 71 | cursor: pointer; 72 | font-size: 100px; 73 | height: 40px; 74 | opacity: 0; 75 | filter: alpha(opacity=0); 76 | overflow: hidden; 77 | } 78 | .writepanel{ 79 | min-height: 600px; 80 | } 81 | .writepanel form{ 82 | margin-right: 0px !important; 83 | } 84 | .writepanel button{ 85 | width:100px; 86 | } 87 | .share_model{ 88 | font-size: 16px; 89 | line-height: 16px; 90 | height: 30px; 91 | border-bottom: 1px solid #ccc; 92 | } 93 | .share_tab_active{ 94 | font-size: 16px; 95 | height: 30px; 96 | float: left; 97 | padding: 7px 12px 0; 98 | cursor: pointer; 99 | border: 1px solid #ccc; 100 | border-bottom: 1px solid #fff; 101 | } 102 | .share_model li { 103 | display: block; 104 | float: left; 105 | height: 30px; 106 | padding-left: 5px; 107 | padding-right: 5px; 108 | padding-bottom: 5px; 109 | } 110 | .share_model li a{ 111 | font-size: 16px; 112 | height: 30px; 113 | float: left; 114 | padding: 7px 12px 0; 115 | cursor:pointer; 116 | } 117 | #link_input{ 118 | margin-bottom: 15px; 119 | } 120 | #url{ 121 | border-radius: 0px; 122 | box-shadow: none; 123 | } 124 | .sublink_wrap{ 125 | float:right; 126 | margin-top: 30px; 127 | } 128 | .subarticle_wrap{ 129 | float:right; 130 | margin-top: 30px; 131 | } 132 | #url{ 133 | width:50%; 134 | display:inline; 135 | float:left; 136 | } 137 | #searchtitle{ 138 | margin-left: 14px; 139 | width: 100px; 140 | } 141 | #tab_link{ 142 | margin-top: 23px; 143 | } 144 | #tab_share{ 145 | margin-top: 15px; 146 | } 147 | .tab_on{ 148 | display:block; 149 | } 150 | .tab_off{ 151 | display:none; 152 | } 153 | .loading{ 154 | display: none; 155 | } -------------------------------------------------------------------------------- /views/admin/updatesite.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 | 6 | <% include ./partial/catasidebar%> 7 | 8 | 9 |
10 | <% include ./partial/righttop%> 11 | 12 |
13 |
14 |

主页

15 | 24 |
25 |
26 |
27 |
28 | 30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 |
42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |
50 | 51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 | 59 | <% include ./partial/footer%> -------------------------------------------------------------------------------- /source/stylesheets/user.css: -------------------------------------------------------------------------------- 1 | .articleitem .reply{ 2 | display: inline-block; 3 | float: right; 4 | } 5 | .fade_trans{ 6 | -webkit-transition: all .3s ease-out; 7 | -moz-transition: all .3s ease-out; 8 | -o-transition: all .3s ease-out; 9 | transition: all .3s ease-out; 10 | -webkit-transition-property: all; 11 | -moz-transition-property: all; 12 | -o-transition-property: all; 13 | transition-property: all; 14 | -webkit-animation-fill-mode: both; 15 | -moz-animation-fill-mode: both; 16 | -o-animation-fill-mode: both; 17 | animation-fill-mode: both 18 | } 19 | .nomore{ 20 | width: 100%; 21 | line-height: 20px; 22 | background-color: #fff; 23 | text-align: center; 24 | } 25 | .get_more{ 26 | margin-top: 10px; 27 | display: block; 28 | } 29 | .get_more{ 30 | color: #808080; 31 | } 32 | .get_more:hover{ 33 | color: #808080 !important; 34 | } 35 | .navigator{ 36 | width: 100%; 37 | display: block; 38 | background-color: #fff; 39 | padding: 15px 10px; 40 | } 41 | .next_page{ 42 | float: right; 43 | width: 120px; 44 | height: 32px; 45 | line-height: 32px; 46 | color: #868686; 47 | background-color: #fff; 48 | text-align: center; 49 | border-radius: 16px; 50 | border: 2px solid #868686; 51 | cursor: pointer; 52 | } 53 | .next_page:hover{ 54 | color: #07695E; 55 | border: 2px solid #07695E; 56 | } 57 | .last_page{ 58 | float: left; 59 | width: 120px; 60 | height: 32px; 61 | line-height: 32px; 62 | color: #868686; 63 | background-color: #fff; 64 | text-align: center; 65 | border-radius: 16px; 66 | border: 2px solid #868686; 67 | } 68 | .last_page:hover{ 69 | color: #07695E; 70 | border: 2px solid #07695E; 71 | } 72 | .page_numwrap{ 73 | height: 32px; 74 | margin: 0 160px; 75 | } 76 | .page_num{ 77 | border-radius: 16px; 78 | line-height: 30px; 79 | font-size: 18px; 80 | height: 32px; 81 | display: block; 82 | color: #A09999; 83 | width: 50px; 84 | margin: 0 auto; 85 | text-align: center; 86 | border: 2px solid #A09999; 87 | } 88 | .user_near_article{ 89 | overflow: hidden; 90 | } 91 | .user_near_article .articleitem{p 92 | margin-top: 1px; 93 | } 94 | 95 | .perfollower img { 96 | vertical-align: middle; 97 | height: 45px; 98 | display: block; 99 | width: 45px; 100 | margin: 0 auto; 101 | } 102 | .page_header_info{ 103 | font-size: 15px; 104 | margin-top: 15px; 105 | height: 40px; 106 | background-color: #f5f5f5; 107 | border-bottom: 2px solid #DCDDD9; 108 | } 109 | .page_header_info .tab-cell{ 110 | border-bottom: 2px solid #DCDDD9; 111 | padding: 5px 10px; 112 | position: relative; 113 | height: 40px; 114 | margin-bottom: -2px; 115 | display: inline-block; 116 | color: #555; 117 | line-height: 30px; 118 | -webkit-transition: all linear .2s; 119 | -moz-transition: all linear .2s; 120 | -ms-transition: all linear .2s; 121 | -o-transition: all linear .2s; 122 | transition: all linear .2s; 123 | } 124 | .page_header_info .active-tab-cell{ 125 | border-bottom: 2px solid #00a090; 126 | padding: 5px 10px; 127 | position: relative; 128 | height: 40px; 129 | margin-bottom: -2px; 130 | display: inline-block; 131 | color: #555; 132 | line-height: 30px; 133 | } 134 | .tab-cell:hover{ 135 | border-bottom: 2px solid #00a090; 136 | } -------------------------------------------------------------------------------- /views/admin/userlist1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | 用户列表 / user list 14 |
15 |
16 |
17 |
18 |
19 | 新增 20 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <% var userlist = d.data %> 40 | <% for(var i=0;i 41 | 42 | 43 | 48 | 49 | 50 | 58 | 59 | <%}%> 60 | 61 |
ID用户名邮箱加入时间
<%=userlist[i].uid%> 44 | 45 | <%=userlist[i].name%> 46 | 47 | <%=userlist[i].email %><%=userlist[i].create_at%> 51 |
52 |
53 | 编辑 54 | 禁言 55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 | <% include partial/pagination%> 67 |
68 |
69 |
70 |
71 | 72 | 73 |
74 |
75 |
功能正在完善
76 |
77 | 78 |
79 | 82 |
83 |
84 | 85 |
86 | 87 | -------------------------------------------------------------------------------- /views/feedback.ejs: -------------------------------------------------------------------------------- 1 | <% include partial/header%> 2 | 3 | 4 | <% 5 | var articlecontent = d.articlecontent; 6 | var replies = d.replies; 7 | %> 8 | <% include partial/nav %> 9 |
10 |
11 |
12 |
13 | <%= title %> 14 | 15 |
16 |
17 |
18 |
19 |
<%- articlecontent.content %> 
20 |
21 | <% 22 | var s_title = ""; 23 | var s_url = ""; 24 | if(articlecontent.title &&articlecontent.title.length > 0 ){ 25 | s_title = articlecontent.title 26 | }else{ 27 | s_title = articlecontent.purecontent 28 | } 29 | s_url = "http://38sr.com/article/" + articlecontent.tid; 30 | %> 31 |
32 | 33 | 34 | 35 |
36 | <% if(replies.length > 0){%> 37 |
回复
38 | <% if(replies){ %> 39 | <% for(i=0;i< replies.length;i++){%> 40 |
41 |
42 | > 43 |
44 | 66 |
67 | <%} 68 | }%> 69 | <%}else{%> 70 |
暂时还没有评论,快来抢沙发呀!
71 | <%}%> 72 |
73 | <%if(locals.userinfo){%> 74 |
75 | 80 |
81 | <%}else{%> 82 |
登录后才能回复, 没有账号?点击这里注册
83 | <%}%> 84 |
85 | 86 | 87 | 88 |
89 |
90 |
91 | <% include partial/footer %> -------------------------------------------------------------------------------- /views/admin/addsite1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | Site 新增 / Site 新增 14 |
15 |
16 |
17 |
18 |
19 | 更新 20 |
21 |
22 |
23 |
24 |
25 |
26 | 28 |
29 |
30 |
31 | 网站域名 32 |
33 |
34 | 35 |
36 |
37 |
38 |
39 | 网站名字 40 |
41 |
42 | 43 |
44 |
45 |
46 |
47 | 网站简介 48 |
49 |
50 | 51 |
52 |
53 |
54 |
55 | 网站图片 56 |
57 |
58 | 59 |
60 |
61 |
62 | 64 | 65 |
66 |
67 |
68 |
69 |
70 | 71 |
72 |
73 | 74 |
75 |
76 |
77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /views/partial/nav.ejs: -------------------------------------------------------------------------------- 1 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /routes/pubarticle.js: -------------------------------------------------------------------------------- 1 | var UserDao = require('../dao/userdao'); 2 | var ArticleDao = require('../dao/articledao'); 3 | var Article = require('../models/article'); 4 | var path = require('path'); 5 | var util = require('../lib/util'); 6 | var mongoose = require('mongoose'); 7 | var EventProxy = require('eventproxy'); 8 | var bosonnlp = require('bosonnlp'); 9 | var marked = require('marked'); 10 | var boson = new bosonnlp.BosonNLP("yoUTK8dE.3486.jTfMGWlrfZxc"); 11 | 12 | 13 | /** 14 | * [save 发表article页面] 15 | * @param {[type]} req 16 | * @param {[type]} res 17 | * @return {[type]} 18 | */ 19 | exports.save = function(req, res) { 20 | var title = req.body.title; 21 | var mcontent = req.body.mcontent; 22 | var label = req.body.label; 23 | var classify = 0; 24 | var name = req.session.user.name; 25 | var uid = 0; 26 | var tid = 0; 27 | var label = ''; 28 | var ep = new EventProxy(); 29 | var content = marked(mcontent); 30 | ep.assign("userinfo", "tid","label", function(userinfo, tid,label) { 31 | uid = userinfo.uid; 32 | var articleItem = new Article({ 33 | tid: tid, 34 | title: title, 35 | content: content, 36 | mcontent:mcontent, 37 | uid: uid, 38 | _creator: userinfo._id, 39 | classify: classify, 40 | label:label, 41 | isdelete: false 42 | }); 43 | ArticleDao.saveNewArticleAsObject(articleItem, function() { 44 | var condition = { 45 | uid: uid 46 | }; 47 | var update = { 48 | $inc: { 49 | score: 1 50 | } 51 | }; 52 | var options = false; 53 | UserDao.updateUserInfoFree(condition, update, options, function(err, num) { 54 | if (err) { 55 | res.redirect('/500') 56 | return; 57 | }; 58 | res.redirect('/'); 59 | }); 60 | }); 61 | }) 62 | 63 | if (title.length > 0) { 64 | classify = 2; 65 | boson.extractKeywords(util.delHtmlTag(content), function(data) { 66 | data = JSON.parse(data); 67 | console.log(data); 68 | var labeljson = data[0]; 69 | console.log(labeljson); 70 | if(typeof(labeljson) !== 'undefined'){ 71 | for (var i = 0; i < (labeljson.length > 5 ? 5 : labeljson.length); i++) { 72 | label +=labeljson[i][1] + ',' 73 | console.log(label); 74 | }; 75 | } 76 | ep.emit("label", label); 77 | }); 78 | } else { 79 | ep.emit("label", label); 80 | } 81 | UserDao.getUserInfoByName(name, function(err, userinfo) { 82 | ep.emit("userinfo", userinfo); 83 | }); 84 | ArticleDao.getMaxTid(function(err, maxtid) { 85 | ep.emit("tid", maxtid); 86 | }) 87 | }; 88 | 89 | /** 90 | * [index description] 91 | * @param {[type]} req 92 | * @param {[type]} res 93 | * @return {[type]} 94 | */ 95 | exports.index = function(req, res) { 96 | if (!req.session.user) { 97 | var prelink = "pub"; 98 | res.locals.error = "请先登录!!"; 99 | res.render('login', { 100 | title: '登录', 101 | prelink: prelink 102 | }); 103 | } else { 104 | res.locals.pageflag = 3; 105 | res.locals.userinfo = req.session.user; 106 | res.render('pubarticle', { 107 | title: '分享一个' 108 | }); 109 | } 110 | }; -------------------------------------------------------------------------------- /views/admin/addsite.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 |
5 | 6 | <% include ./partial/catasidebar%> 7 | 8 | 9 |
10 | <% include ./partial/righttop%> 11 | 12 |
13 |
14 |

主页

15 | 24 |
25 |
26 |
27 |
28 | 30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 |
42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |
50 | 51 |
52 | 53 |
54 |
55 |
56 | 58 | 59 |
60 |
61 | 62 |
63 |
64 | 65 | <% include ./partial/footer%> -------------------------------------------------------------------------------- /views/admin/partial/catasidebar.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /views/admin/articlelist1.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partial/header%> 2 | 3 | 4 | <% include ./partial/nav%> 5 |
6 | 7 | <% include ./partial/catasidebar%> 8 | 9 | 10 |
11 |
12 |
13 | 文章列表 / article list 14 |
15 |
16 |
17 |
18 |
19 | 新增 20 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | <% var articlelist = d.data %> 41 | <% for(var i=0;i 42 | 43 | 44 | 49 | 59 | 60 | 68 | 69 | <%}%> 70 | 71 |
ID标题类型发布时间操作
<%=articlelist[i].tid%> 45 | 46 | <%=articlelist[i].title%> 47 | 48 | 50 | <%=articlelist[i].classify%> 51 | <% if(articlelist[i].classify === 0){%> 52 | 心情 53 | <%}else if(articlelist[i].classify === 2){%> 54 | 文章 55 | <%}else{%> 56 | 快链 57 | <%}%> 58 | <%=articlelist[i].convertdate%> 61 |
62 |
63 | 编辑 64 | 删除 65 |
66 |
67 |
72 |
73 |
74 |
75 |
76 | <% include partial/pagination%> 77 |
78 |
79 |
80 |
81 | 82 | 83 |
84 |
85 |
文章删除
86 |
87 | 你确定要删除这篇文章吗? 88 |
89 | 93 |
94 |
95 |
96 | 97 | -------------------------------------------------------------------------------- /source/stylesheets/jquery.qeditor.css: -------------------------------------------------------------------------------- 1 | .qeditor_border { 2 | background: #FFF; 3 | padding-bottom: 20px; 4 | text-align: center; 5 | position: relative; } 6 | 7 | .qeditor_toolbar { 8 | text-align: left; 9 | background: #FFF; 10 | margin: 0 auto 3px auto; } 11 | .qeditor_toolbar span.vline { 12 | border-left: 1px solid #bbb; 13 | padding-right: 10px; } 14 | .qeditor_toolbar a, .qeditor_toolbar .qe-icon { 15 | color: #666; 16 | text-decoration: none; 17 | font-size: 14px; 18 | margin-right: 8px; } 19 | .qeditor_toolbar a:hover, .qeditor_toolbar .qe-icon:hover { 20 | color: #43be4d; } 21 | .qeditor_toolbar a.qe-state-on { 22 | color: #43be4d; } 23 | .qeditor_toolbar .qe-heading { 24 | position: relative; } 25 | .qeditor_toolbar .qe-heading .qe-menu { 26 | width: 120px; 27 | display: none; 28 | position: absolute; 29 | margin: 0; 30 | padding: 0; 31 | left: -25px; 32 | top: 15px; 33 | border: 1px solid #eee; 34 | border-right: 1px solid #ddd; 35 | border-bottom: 1px solid #ddd; 36 | z-index: 9991; 37 | background: #FFF; 38 | list-style: none; } 39 | .qeditor_toolbar .qe-heading .qe-menu li { 40 | display: inline; 41 | padding: 0; 42 | margin: 0; } 43 | .qeditor_toolbar .qe-heading .qe-menu a { 44 | display: block; 45 | margin: 0; 46 | padding: 2px 10px; } 47 | .qeditor_toolbar .qe-heading .qe-menu a:hover { 48 | background: #f0f0f0; } 49 | .qeditor_toolbar .qe-heading .qe-menu .qe-h1 { 50 | font-size: 17px; 51 | font-weight: bold; } 52 | .qeditor_toolbar .qe-heading .qe-menu .qe-h2 { 53 | font-size: 16px; 54 | font-weight: bold; } 55 | .qeditor_toolbar .qe-heading .qe-menu .qe-h3 { 56 | font-size: 15px; 57 | font-weight: bold; } 58 | .qeditor_toolbar .qe-heading .qe-menu .qe-h4 { 59 | font-size: 14px; 60 | font-weight: bold; } 61 | .qeditor_toolbar .qe-heading .qe-menu .qe-h5 { 62 | font-size: 13px; 63 | font-weight: bold; } 64 | .qeditor_toolbar .qe-heading .qe-menu .qe-h6 { 65 | font-size: 12px; 66 | font-weight: bold; } 67 | .qeditor_toolbar .qe-heading .qe-menu .qe-p { 68 | font-size: 12px; 69 | border-top: 1px solid #eee; } 70 | .qeditor_toolbar .qe-heading.hover { 71 | background: #eee; } 72 | .qeditor_toolbar .qe-heading.hover .qe-menu { 73 | background: #fff; 74 | display: block; } 75 | 76 | .qeditor_preview { 77 | text-align: left; 78 | min-height: 80px; 79 | margin: 0 auto; 80 | overflow-y: scroll; } 81 | 82 | .qeditor_placeholder { 83 | color: #999; } 84 | 85 | .qeditor_fullscreen { 86 | position: fixed; 87 | background: #FFF; 88 | top: 0; 89 | left: 0; 90 | bottom: 0; 91 | right: 0; 92 | z-index: 99990; 93 | padding: 30px 0; 94 | overflow: hidden; } 95 | .qeditor_fullscreen .qeditor_preview { 96 | max-width: 900px; 97 | box-sizing: border-box; 98 | width: 100%; 99 | height: 90%; 100 | margin-top: 20px; 101 | border: 0; 102 | -webkit-box-shadow: none; 103 | -moz-box-shadow: none; 104 | box-shadow: none; 105 | -webkit-transition: none; 106 | -moz-transition: none; 107 | -o-transition: none; 108 | transition: none; 109 | padding: 0; } 110 | .qeditor_fullscreen .qeditor_toolbar { 111 | max-width: 900px; 112 | box-sizing: border-box; 113 | width: 100%; 114 | padding-bottom: 10px; } 115 | .qeditor_fullscreen .qeditor_toolbar a, .qeditor_fullscreen .qeditor_toolbar .qe-icon { 116 | font-size: 18px; 117 | margin-right: 8px; } 118 | --------------------------------------------------------------------------------