Accept Merge Request #72: (feature/dgg -> develop)

Merge Request: feat: 【小程序】重复异常上报时,显示出上一次提交的数据

Created By: @大狗哥
Accepted By: @大狗哥
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/72
This commit is contained in:
大狗哥 2025-05-27 16:21:48 +08:00 committed by Coding
commit a4de4d8b61
3 changed files with 33 additions and 9 deletions

View File

@ -19,6 +19,11 @@ class Order extends Model
return $this->belongsTo(\app\admin\model\Area::class,'area_id', 'area_code'); 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) public function getCustomerAttr(string $val)
{ {
return maskExceptFirstChar($val); return maskExceptFirstChar($val);

View File

@ -52,6 +52,7 @@ class OrderAbnormalService extends BaseService
'detail', 'detail',
'create_time', 'create_time',
]) ])
->order('id', 'desc')
->find(); ->find();
} }
} }

View File

@ -14,9 +14,16 @@ class OrderDispatchService extends BaseService
{ {
return $this->getOrderDispatchModel() return $this->getOrderDispatchModel()
->with(['orderInfo' => function ($query) { ->with(['orderInfo' => function ($query) {
$query->with(['area' => function ($query) { $query->with(
$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'); '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('status', OrderDispatch::STATUS_TOGET)
->where('worker_id', $workerId) ->where('worker_id', $workerId)
@ -72,9 +79,14 @@ class OrderDispatchService extends BaseService
{ {
$model = $this->getOrderDispatchModel() $model = $this->getOrderDispatchModel()
->with(['orderInfo' => function ($query) { ->with(['orderInfo' => function ($query) {
$query->with(['area' => function ($query) { $query->with([
$query->field('id,area_code,merge_name'); 'area' => function ($query) {
}])->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->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); ->where('worker_id', $workerId);
@ -213,6 +225,7 @@ class OrderDispatchService extends BaseService
'detail', 'detail',
'images', 'images',
'status', 'status',
'coupon_id',
]; ];
$orderDispatchFields = [ $orderDispatchFields = [
'id', 'id',
@ -235,9 +248,14 @@ class OrderDispatchService extends BaseService
]; ];
$res = $this->getOrderDispatchModel() $res = $this->getOrderDispatchModel()
->with(['orderInfo' => function ($query) use ($orderFields) { ->with(['orderInfo' => function ($query) use ($orderFields) {
$query->with(['area' => function ($query) { $query->with([
$query->field('id,area_code,merge_name'); 'area' => function ($query) {
}])->field($orderFields); $query->field('id,area_code,merge_name');
},
'coupon' => function ($query) {
$query->field('id,threshold,discount_value');
}
])->field($orderFields);
}]) }])
->where('id', $orderDispatchId) ->where('id', $orderDispatchId)
->where('worker_id', $workerId) ->where('worker_id', $workerId)