为了账号安全,请及时绑定邮箱和手机立即绑定

errcode: 40125, errmsg: 'invalid appsecret, view more at http://t.cn/RAEkdVq hint: [FVinTA09721501]

/ 猿问

errcode: 40125, errmsg: 'invalid appsecret, view more at http://t.cn/RAEkdVq hint: [FVinTA09721501]

慕仙3125880 2018-04-17 10:07:56

https://img4.mukewang.com/5ad556cd00015b0119160814.jpg

https://img2.mukewang.com/5ad556ce00015a9213880756.jpg

const mongoose = require('mongoose')

const Schema = mongoose.Schema

const TokenSchema = new mongoose.Schema({

     name: String,

     token:String,

     expires_in: Number,

     meta: {

      createdAt: {

      type: Date,

      default: Date.now()

      },

      updatedAt: {

      type: Date,

      default: Date.now()

      }

     }

})

//mongoose保存之前对中间键进行处理

TokenSchema.pre('save', function (next){

if(this.isNew){

      this.meta.createdAt = this.meta.updatedAt = Date.now()

} else{

      this.meta.updatedAt = Date.now()

}

next()

})

//设置静态方法

TokenSchema.statics = {

async getAccessToken() {

const token = await this.findOne({

name: 'access_token'

}).exec()

if (token && token.token) {

            token.access_token = token.token

}

return token

},

  async saveAccessToken(data){

let token = await this.findOne({

name: 'access_token'

}).exec()

if(token) {

token.token = data.access_token,

token.expires_in = data.expires_in

}else{

token = new Token({

name: 'access_token',

token: data.access_token,

expires_in: data.expires_in

})

}

await token.save()

return data

}

}

 

const Token = mongoose.model('Token', TokenSchema)


查看完整描述

1 回答

已采纳
?
pardon110

appsecret错误


查看完整回答
反对 回复 2018-04-17

添加回答

回复

举报

0/150
提交
取消
意见反馈 邀请有奖 帮助中心 APP下载
官方微信