美文网首页
小程序后台登录

小程序后台登录

作者: 9b559869875b | 来源:发表于2018-12-02 22:46 被阅读20次

    // 登录接口

    router.get('/login', authorizationMiddleware, controllers.login)

    //访问前缀

    const router = require('koa-router')({

    prefix: '/weapp'

    })

    登录地址就是:https://xxx.qcloud.la/weapp/login

    // 登录授权接口

    module.exports = async (ctx, next) => {

    // 通过 Koa 中间件进行登录之后

    // 登录信息会被存储到 ctx.state.$wxInfo

    // 具体查看:

    if (ctx.state.$wxInfo.loginState) {

    ctx.state.data = ctx.state.$wxInfo.userinfo

    ctx.state.data['time'] = Math.floor(Date.now() / 1000)

    }

    }

    相关文章

      网友评论

          本文标题:小程序后台登录

          本文链接:https://www.haomeiwen.com/subject/mdbnmxtx.html