wangzhibo
5 天以前 50e5cdbaceee71f000341a434620d10a87b582f5
src/modules/order/service/info.ts
@@ -178,20 +178,23 @@
   * @param data
   */
  async create(data: {
    userId: number;
    userId: string;
    goodsList: OrderGoodsEntity[];
    addressId: number;
    remark: string;
    title: string;
    couponId?: number;
    payType?: number;
  }) {
    const address = await this.userAddressService.info(data.addressId);
    const payType = Number(data.payType) || 0;
    const order = {
      userId: data.userId,
      address,
      remark: data.remark,
      title: data.title,
      goodsList: data.goodsList,
      payType,
    } as OrderInfoEntity;
    // 检查库存
    await this.checkStock(data.goodsList);
@@ -211,9 +214,9 @@
    // 生成订单号
    const orderNum = await this.generateOrderNum(order.id);
    // 更新订单
    await this.orderInfoEntity.update(order.id, {
      orderNum,
      payType,
    });
    // 保存订单商品
@@ -375,7 +378,7 @@
   * 物流信息
   * @param orderId
   */
  async logistics(orderId: number, userId?: number) {
  async logistics(orderId: number, userId?: string) {
    const order: OrderInfoEntity = await this.info(orderId);
    if (userId && order.userId != userId) {
      throw new CoolCommException('非法操作');