Authored by ccbikai(👎🏻🍜)

找回丢失的代码

@@ -21,10 +21,16 @@ module.exports = () => { @@ -21,10 +21,16 @@ module.exports = () => {
21 21
22 // 判断请求是否来自app 22 // 判断请求是否来自app
23 yoho.isApp = req.query.app_version || req.query.appVersion; 23 yoho.isApp = req.query.app_version || req.query.appVersion;
  24 + yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
24 25
25 Object.assign(res.locals, yoho); 26 Object.assign(res.locals, yoho);
26 Object.assign(req.yoho, yoho); 27 Object.assign(req.yoho, yoho);
27 28
  29 + // App 内请求支持跨域
  30 + if (yoho.isApp) {
  31 + res.set('Access-Control-Allow-Origin', '*');
  32 + }
  33 +
28 next(); 34 next();
29 }; 35 };
30 }; 36 };
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"> 32 <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)">
33 <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> 33 <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)">
34 </head> 34 </head>
35 - <body class="{{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}"> 35 + <body class="{{#if width750}}width750{{/if}} {{#if isWechat}}wechat-body{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}">
36 <div class="main-wrap"> 36 <div class="main-wrap">
37 {{#if systemUpdate}} 37 {{#if systemUpdate}}
38 {{> updata}} 38 {{> updata}}