码迷,mamicode.com
首页 > 其他好文 > 详细

tocken和ticket的数据模型;

时间:2016-01-06 19:59:25      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

 1 /* jshint -W079 */
 2 /* jshint -W020 */
 3 
 4 "use strict";
 5 var _ = require("lodash");
 6 
 7 module.exports = function(utils, db) {
 8 
 9   // Model WeChatAccessTokenSchema
10   var WeChatAccessTokenSchema = new db.Schema({
11     appid:  {type: String, required: true },
12     access_token: String,
13     expires_in: Number,
14     at: {type: Number, default: parseInt(new Date().getTime() / 1000)},
15     create_at: {type: Date, default: Date.now}
16   }, db.schema_options);
17 
18   WeChatAccessTokenSchema.index({ appid: 1 });
19   WeChatAccessTokenSchema.index({ access_token: 1 });
20 
21   global.WeChatAccessToken = db.mongoose.model(‘WeChatAccessToken‘, WeChatAccessTokenSchema);
22 
23   // Model WeChatTicketSchema
24   var WeChatTicketSchema = new db.Schema({
25     appid: {type: String, required: true},
26     ticket: String,
27     noncestr: String,
28     expires_in: Number,
29     at: {type: Number, default: parseInt(new Date().getTime() / 1000)},
30     create_at: {type: Date, default: Date.now}
31   }, db.schema_options);
32 
33   WeChatTicketSchema.index({ appid: 1 });
34   WeChatTicketSchema.index({ ticket: 1 });
35 
36   global.WeChatTicket = db.mongoose.model(‘WeChatTicket‘, WeChatTicketSchema);
37 };

 

tocken和ticket的数据模型;

标签:

原文地址:http://www.cnblogs.com/suoking/p/5106443.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!