feat: 【小程序接口】相关接口增加优惠券信息
This commit is contained in:
parent
0e8c19020c
commit
f77d87e705
|
|
@ -19,6 +19,11 @@ class Order extends Model
|
|||
return $this->belongsTo(\app\admin\model\Area::class,'area_id', 'area_code');
|
||||
}
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\Coupons::class,'coupon_id', 'id');
|
||||
}
|
||||
|
||||
public function getCustomerAttr(string $val)
|
||||
{
|
||||
return maskExceptFirstChar($val);
|
||||
|
|
|
|||
|
|
@ -14,9 +14,16 @@ class OrderDispatchService extends BaseService
|
|||
{
|
||||
return $this->getOrderDispatchModel()
|
||||
->with(['orderInfo' => function ($query) {
|
||||
$query->with(['area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
}])->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount,area_id,status');
|
||||
$query->with(
|
||||
[
|
||||
'area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
},
|
||||
'coupon' => function ($query) {
|
||||
$query->field('id,threshold,discount_value');
|
||||
}
|
||||
]
|
||||
)->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount,area_id,status,coupon_id');
|
||||
}])
|
||||
->where('status', OrderDispatch::STATUS_TOGET)
|
||||
->where('worker_id', $workerId)
|
||||
|
|
@ -72,9 +79,14 @@ class OrderDispatchService extends BaseService
|
|||
{
|
||||
$model = $this->getOrderDispatchModel()
|
||||
->with(['orderInfo' => function ($query) {
|
||||
$query->with(['area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
}])->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount,area_id,customer,tel,status');
|
||||
$query->with([
|
||||
'area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
},
|
||||
'coupon' => function ($query) {
|
||||
$query->field('id,threshold,discount_value');
|
||||
}
|
||||
])->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount,area_id,customer,tel,status,coupon_id');
|
||||
}])
|
||||
->where('worker_id', $workerId);
|
||||
|
||||
|
|
@ -213,6 +225,7 @@ class OrderDispatchService extends BaseService
|
|||
'detail',
|
||||
'images',
|
||||
'status',
|
||||
'coupon_id',
|
||||
];
|
||||
$orderDispatchFields = [
|
||||
'id',
|
||||
|
|
@ -235,9 +248,14 @@ class OrderDispatchService extends BaseService
|
|||
];
|
||||
$res = $this->getOrderDispatchModel()
|
||||
->with(['orderInfo' => function ($query) use ($orderFields) {
|
||||
$query->with(['area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
}])->field($orderFields);
|
||||
$query->with([
|
||||
'area' => function ($query) {
|
||||
$query->field('id,area_code,merge_name');
|
||||
},
|
||||
'coupon' => function ($query) {
|
||||
$query->field('id,threshold,discount_value');
|
||||
}
|
||||
])->field($orderFields);
|
||||
}])
|
||||
->where('id', $orderDispatchId)
|
||||
->where('worker_id', $workerId)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user