const AppError = require('../utils/appError')

module.exports = function requireWechatOpenid(req, res, next) {
    const usersWxOpenid = req.headers['users_wx_openid']

    if (!usersWxOpenid) {
        return next(new AppError('请求头缺少 users_wx_openid', 401))
    }

    req.usersWxOpenid = usersWxOpenid
    next()
}
