123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- /* eslint valid-jsdoc: "off" */
- 'use strict';
- /**
- * @param {Egg.EggAppInfo} appInfo app info
- */
- module.exports = appInfo => {
- const config = exports = {};
- // use for cookie sign key, should change to your own and keep security
- config.keys = appInfo.name + '_1560223608734_7978';
- // post form请求 关闭csrf安全插件
- config.security = {
- csrf: {
- enable: false,
- ignoreJSON: true,
- },
- // domainWhiteList: [ 'http://www.baidu.com' ], // 配置白名单
- };
- // 配置上传
- config.multipart = {
- fileSize: '50mb',
- mode: 'stream',
- fileExtensions: [ '.jpg', '.img', '.png', '.docx' ], // 扩展几种上传的文件格式
- };
- // add your middleware config here
- config.middleware = [ 'common', 'interceptor', 'xml2js' ];
- config.interceptor = {
- ignore(ctx) {
- // 所有微信的接口 和 登录接口不需要带用户
- const ignoreUrl = [
- '/sys/upload/uploadImageXy', // 上传图片到Xy
- '/visit/pcVisitCommit', // 视频巡访提交
- '/index',
- '/sys/login/in',
- '/sys/login/connection',
- '/wx/wxMessage',
- '/wx/getSign',
- '/wx/getOpenId',
- '/wx/getAppId',
- '/wxinfo/isExist',
- '/wxinfo/bing',
- '/wxinfo/visitIsExist',
- '/wxinfo/visitBing',
- '/wxinfo/visitUnbind',
- '/wxinfo/visitByFid',
- '/wxinfo/visitByNumber',
- '/visit/one',
- '/applet/isExist',
- '/applet/bing',
- '/applet/homeStatistics',
- '/welcomeMessage/list',
- '/banner/list',
- '/wx/getAppletOpenId',
- '/applet/appletVisitIsExist',
- '/applet/appletVisitBing',
- '/applet/appletVisitUnbind',
- '/oss/getALiOssToken',
- '/wxinfo/ownerAdd', // 未登录的用户也可以自主上报信息
- '/wxinfo/ownerUpdate', // 自主填报修改采集记录
- '/wxinfo/ownerStatistics', // 自主填报查询吉林省统计
- // '/info/createOldInfoOwnerUser', // 将以前的第五级地区自主上报员 生成一次(且只可执行一次)
- // '/info/createYlxtSelectUser', // 生成前三级 养老系统 信息查询管理员 生成一次(且只可执行一次) // CH 2022-11-15 16:17:03
- '/sys/user/selectOne', // 修改默认密码
- '/sys/user/updatePwdBeforeLogin', // 修改默认密码
- ];
- const url = ctx.request.url;
- for (const item of ignoreUrl) {
- if (url.indexOf(item) >= 0) {
- return true;
- }
- }
- return false;
- },
- };
- config.xml2js = {
- match(ctx) {
- const matchUrl = [ '/wx/wxMessage' ];
- const url = ctx.request.url;
- for (const item of matchUrl) {
- if (url.indexOf(item) >= 0) {
- return true;
- }
- }
- return false;
- },
- };
- config.common = {
- match() {
- return true;
- },
- };
- config.wechat_config = {
- // 这边使用的是故事机的appId 后期无解
- appId: 'wx22055631b887c2ab',
- appSecret: '328614e5d0d0b5f90c8480a6a9f81b00',
- getAccessToken: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET',
- createMenu: 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN',
- getUserInfo: 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN',
- getJsApiTicket: 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi',
- // 公众号获取openid
- oauthAccessToken: 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code',
- // 小程序获取openid
- getAppletAccessToken: 'https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=CODE&grant_type=authorization_code',
- oauthUserinfo: 'https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN',
- };
- // 加密
- config.dump = { ignore: new Set([
- 'pass', 'pwd', 'passd', 'passwd', 'password', 'keys', 'masterKey', 'accessKey',
- // ignore any key contains "secret" keyword
- /secret/i, 'wechat_config', 'userConfig',
- ]) };
- // add your user config here
- const userConfig = {
- // myAppName: 'egg',
- cors: {
- origin: '*', // 注释掉就是上面的white生效
- allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
- },
- sessionTimeOut: 86400, // 24H
- defaultPassword: '123456',
- defaultYlxtSelectPassword: 'sckj@2022',
- defaultPageSize: 10,
- defaultUploadPath: './app/public/',
- defaultWritePathPre: '/public/uploads/',
- defaultWriteAliOSSPath: 'public/uploads/',
- scanPathPre: '/public/uploads/scan/',
- scanAliOSSPath: 'public/uploads/scan/',
- defaultWriteFilePathPre: '/public/file/',
- uploadDir: './app/public/avatar/upload/',
- defaultAdminId: '5d0070438217f92210e6f972',
- defaultAdminRoleId: '5d030a91ebd90c299489c121',
- defaultManagerRoleId: '5d036441464ced1f1840204a',
- defaultUserRoleId: '5d0c41046a0a730a44fe06b5',
- defaultOwnerManagerRoleId: '617f4b42e134000015002d42', // 自主上报员ObjectId
- defaultYLXTSelectRoleId: '617f4b42e134000015002a11', // 养老系统信息查看角色ObjectId-2022-11-15-CH
- fileType: {
- AUTH: '/public/uploads/auth/', // 采集员认证文件照片
- INFO: '/public/uploads/info/', // 采集老人的照片
- VISIT: '/public/uploads/visit/', // 巡防照片
- SCAN: '/public/uploads/scan/', // 二维码生成路径
- CARD: '/public/uploads/card/', // 身份卡图片
- },
- roleArn: 'acs:ram::35026409:role/aliyunststokenverify', // 阿里云RAM受信账号
- tokenExpireTime: 3600, // OssToken 过期时间(900-3600秒)
- sessionName: 'SCKJALiOssToken', // 用户自定义参数。此参数用来区分不同的令牌,可用于用户级别的访问审计。
- logger: {
- consoleLevel: 'DEBUG', // NONE
- allowDebugAtProd: true,
- level: 'DEBUG', // NONE
- },
- };
- return {
- ...config,
- ...userConfig,
- };
- };
|