修改认领

This commit is contained in:
mzl
2025-10-30 16:42:42 +08:00
parent 5facb1abba
commit 9fbe77a3a9
@@ -120,44 +120,59 @@ class OfficeClerkController extends BaseController
$type = $request->get('type');
if ($type == 'unclaimed') {
$list = Db::table('fin_payment_apply')
->where('doc_user_id', $request->user->uid)
->where('receipt_id', 0)
->select(
'apply_no',
'amount',
'created_at'
)
->get()
->map(function($item) {
return [
'apply_no' => $item->apply_no,
'amount' => $item->amount,
'created_at' => date('Y-m-d H:i:s', $item->created_at)
];
})
->toArray();
->join('sys_currency', 'fin_payment_apply.currency_id', '=', 'sys_currency.id')
->where('fin_payment_apply.doc_user_id', $request->user->uid)
->where('fin_payment_apply.receipt_id', 0)
->get([
'fin_payment_apply.id',
'fin_payment_apply.created_at',
'fin_payment_apply.doc_user_id',
'fin_payment_apply.payment_entity',
'fin_payment_apply.payment_account',
'fin_payment_apply.currency_id',
'sys_currency.currency_name',
'fin_payment_apply.amount',
'fin_payment_apply.apply_no'
]);
foreach ($list as $key => &$val) {
$val->created_at = date('Y-m-d H:i:s', $val->created_at);
}
unset($val);
} else {
$twentyFourHoursAgo = time() - (24 * 3600);
$list = Db::table('fin_payment_apply')
->where('doc_user_id', $request->user->uid)
->whereNotNull('submit_files')
->whereJsonLength('submit_files', '>', 0)
->where('receipt_id', '>', 0)
->where('claimed_at', '<', $twentyFourHoursAgo)
->select(
'apply_no',
'amount',
'created_at'
)
->get()
->map(function($item) {
return [
'apply_no' => $item->apply_no,
'amount' => $item->amount,
'created_at' => date('Y-m-d H:i:s', $item->created_at)
];
})
->toArray();
->join('user', 'fin_payment_apply.doc_user_id', '=', 'user.id')
->join('sys_currency', 'fin_payment_apply.currency_id', '=', 'sys_currency.id')
->where('fin_payment_apply.doc_user_id', $request->user->uid)
->whereNotNull('fin_payment_apply.submit_files')
->whereJsonLength('fin_payment_apply.submit_files', '>', 0)
->where('fin_payment_apply.receipt_id', '>', 0)
->where('fin_payment_apply.claimed_at', '<', $twentyFourHoursAgo)
->get([
'fin_payment_apply.id',
'fin_payment_apply.created_at',
'fin_payment_apply.doc_user_id',
'user.name',
'fin_payment_apply.payment_entity',
'fin_payment_apply.payment_account',
'fin_payment_apply.currency_id',
'sys_currency.currency_name',
'fin_payment_apply.amount',
'fin_payment_apply.apply_no'
]);
foreach ($list as $key => &$val) {
$stockIds = Db::table('fin_payment_stock')
->where('payment_apply_id', $val->id)
->pluck('stock_id')
->toArray();
$val->order_no = Db::table('stock_orders')
->whereIn('id', $stockIds)
->pluck('order_no')
->toArray();
$val->created_at = date('Y-m-d H:i:s', $val->created_at);
}
unset($val);
}
return $this->success($list);
}