lrf 2 년 전
부모
커밋
6e7a921d05
2개의 변경된 파일30개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 3
      app/service/zrOrder.js
  2. 21 1
      config/config.default.js

+ 9 - 3
app/service/zrOrder.js

@@ -19,18 +19,19 @@ class ZrOrderService extends CrudService {
   // 下单,走同样的函数判断.
   // 直接生成订单,扣除积分
 
-
   async toMakeOrder({ key }) {
     key = `${this.redisKey.orderKeyPrefix}${key}`;
     let data = await this.redis.get(key);
     if (!data) throw new BusinessError(ErrorCode.SERVICE_FAULT, '请求超时,请重新进入下单页');
     data = JSON.parse(data);
     const { shop, goods, num: buy_num } = data;
+    // 店铺信息
     const shopInfo = await this.shopModel.findById(shop);
-    // const goodsInfo = await this.
+    // 商品信息
+    const goodsInfo = await this.goodsModel.findById(goods);
+    //
   }
 
-
   /**
    * 检查是否可以购买商品,并生成缓存
    * @param {Object} body 参数体
@@ -117,6 +118,11 @@ class ZrOrderService extends CrudService {
     }, 0);
     return total;
   }
+
+  // 随机字符串产生函数
+  createNonceStr() {
+    return Math.random().toString(36).substr(2, 15);
+  }
 }
 
 module.exports = ZrOrderService;

+ 21 - 1
config/config.default.js

@@ -18,7 +18,7 @@ module.exports = appInfo => {
   config.appName = '天恩活泉商城-服务';
 
   // add your middleware config here
-  config.middleware = [ 'setUserFromToken' ];
+  config.middleware = ['setUserFromToken'];
   config.checkToken = {
     enable: false,
   };
@@ -42,6 +42,26 @@ module.exports = appInfo => {
       allowDiskUse: true,
     },
   };
+  // redis设置
+  config.redis = {
+    client: {
+      port: 6379, // Redis port
+      host: '127.0.0.1', // Redis host
+      password: '123456',
+      db: 1,
+    },
+  };
+  // mq设置
+  config.amqp = {
+    client: {
+      hostname: 'broadcast.waityou24.cn',
+      username: 'tehqDev',
+      password: 'tehqDev',
+      vhost: 'tehqDev',
+    },
+    app: true,
+    agent: true,
+  };
   // jwt设置
   config.jwt = {
     ...jwt,