优化售后单列表数据结构

wxl
ztt 9 months ago
parent 5e50441f75
commit a1771b455c
  1. 6
      app/common/model/OrderRefund.php
  2. 3
      app/store/model/OrderRefund.php

@ -59,11 +59,11 @@ class OrderRefund extends BaseModel
/** /**
* 关联订单商品表 * 关联订单商品表
* @return BelongsTo * @return HasMany
*/ */
public function goods(): BelongsTo public function goods(): HasMany
{ {
return $this->belongsTo('OrderGoods')->withoutField(['content']); return $this->hasMany('OrderGoods', 'order_id', 'order_id')->withoutField(['content']);
} }
/** /**

@ -88,7 +88,8 @@ class OrderRefund extends OrderRefundModel
} }
// 获取列表数据 // 获取列表数据
$query = $this->alias('refund') $query = $this
->alias('refund')
->field('refund.*, order.order_no') ->field('refund.*, order.order_no')
->join('order', 'order.order_id = refund.order_id') ->join('order', 'order.order_id = refund.order_id')
->join('user', 'user.user_id = order.user_id') ->join('user', 'user.user_id = order.user_id')

Loading…
Cancel
Save