lrf402788946 4 years ago
parent
commit
26a6a51893
3 changed files with 52 additions and 17 deletions
  1. 42 0
      .github/workflows/nodejs.yml
  2. 0 7
      app/service/weixin.js
  3. 10 10
      config/config.local.js

+ 42 - 0
.github/workflows/nodejs.yml

@@ -0,0 +1,42 @@
+# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+  schedule:
+    - cron: '0 2 * * *'
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        node-version: [10]
+        os: [ubuntu-latest, windows-latest, macos-latest]
+
+    steps:
+    - name: Checkout Git Source
+      uses: actions/checkout@v2
+
+    - name: Use Node.js ${{ matrix.node-version }}
+      uses: actions/setup-node@v1
+      with:
+        node-version: ${{ matrix.node-version }}
+
+    - name: Install Dependencies
+      run: npm i -g npminstall && npminstall
+
+    - name: Continuous Integration
+      run: npm run ci
+
+    - name: Code Coverage
+      uses: codecov/codecov-action@v1
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}

+ 0 - 7
app/service/weixin.js

@@ -33,7 +33,6 @@ class WeixinAuthService extends Service {
         },
         dataType: 'json',
       });
-        console.log(result);
         if (result) {
         // console.log(result);
         const val = JSON.stringify(result.data);
@@ -41,7 +40,6 @@ class WeixinAuthService extends Service {
         data.access_token = result.data.access_token;
       }
     }
-    console.log(`data=>${JSON.stringify(data)}`);
     return data;
   }
 
@@ -50,7 +48,6 @@ class WeixinAuthService extends Service {
     assert(appid, '缺少appid参数项');
     const result = await this.accesstoken({ appid });
     const accesstoken = result.access_token;
-    console.log(`accesstoken=>${accesstoken}`);
     assert(accesstoken, '缺少access_token参数项');
     const key = `visit:auth:jsapiticket:${appid}`;
     const val = await this.app.redis.get(key);
@@ -68,7 +65,6 @@ class WeixinAuthService extends Service {
         dataType: 'json',
       });
       if (result) {
-        // console.log(result);
         if (result.data.errcode === 0) {
           const val = JSON.stringify(result.data);
           await this.app.redis.set(key, val, 'EX', 7200);
@@ -88,7 +84,6 @@ class WeixinAuthService extends Service {
     // const { wxapi } = this.app.config;
     // const appidlist = wxapi;
     // const wxapp = _.find(appidlist, { appid });
-    console.log(`url=>${url}`);
     const noncestr = await this.createNonceStr();
     const timestamp = await this.createTimestamp();
     const ret = {
@@ -97,11 +92,9 @@ class WeixinAuthService extends Service {
       timestamp,
       url,
     };
-    console.log(ret.data);
     const string = await this.raw(ret);
     ret.sign = await this.sha1(string);
     ret.appid = appid;
-    // console.log('ret', ret);
     return ret;
   }
 

+ 10 - 10
config/config.local.js

@@ -15,16 +15,16 @@ module.exports = () => {
   }];
 
   // mq config
-  config.amqp = {
-    client: {
-      hostname: '127.0.0.1',
-      username: 'wy',
-      password: '1',
-      vhost: 'smart',
-    },
-    app: true,
-    agent: true,
-  };
+  // config.amqp = {
+  //   client: {
+  //     hostname: '127.0.0.1',
+  //     username: 'wy',
+  //     password: '1',
+  //     vhost: 'smart',
+  //   },
+  //   app: true,
+  //   agent: true,
+  // };
 
   // redis config
   config.redis = {