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