Merge branch 'develop'
# Conflicts: # app/admin/controller/dashboard/FinStatisticsController.php # app/common/controller/FinPaymentApplyController.php # app/common/controller/FinReceiptController.php # app/common/logic/FinReceiptLogic.php # app/common/model/FinPaymentApply.php # app/common/model/FinReceipt.php # app/common/service/FinPaymentApplyService.php # app/common/service/FinReceiptService.php # app/common/service/StockOrdersService.php # config/route.php
This commit is contained in:
@@ -10,6 +10,7 @@ use app\common\validate\FinReceiptValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\FinReceipt;
|
||||
use support\exception\BusinessException;
|
||||
use support\Redis;
|
||||
use support\Request;
|
||||
|
||||
class FinReceiptService
|
||||
@@ -194,6 +195,10 @@ class FinReceiptService
|
||||
$page = (int)$request->get('current', 1);
|
||||
$param = $request->all();
|
||||
|
||||
if(isset($param['voucher_no_timeout_hour'])){
|
||||
redis::set('voucher_no_timeout_hour', $param['voucher_no_timeout_hour'], 'EX', 30);
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
// 汇款国家
|
||||
@@ -218,7 +223,7 @@ class FinReceiptService
|
||||
// 构建查询
|
||||
$query = $this->modelClass::where($where);
|
||||
|
||||
// 没有付款记录的收款记录
|
||||
// 收款记录绑定情况
|
||||
if (isset($param['payment_apply']) && $param['payment_apply'] == 'not') {
|
||||
$query->where('payment_apply_id', 0);
|
||||
} elseif (isset($param['payment_apply']) && $param['payment_apply'] == 'already') {
|
||||
@@ -228,7 +233,12 @@ class FinReceiptService
|
||||
$query->where('created_at', '<' ,time() - 24*60*60);
|
||||
}
|
||||
|
||||
if (isset($param['scene']) && $param['scene'] == 'list') {
|
||||
if(isset($param['scene']) && $param['scene'] == 'pending'){ //待入账列表
|
||||
$query->where('payment_apply_id', '>' ,'0');
|
||||
$query->where('submit_files','!=','');
|
||||
}
|
||||
|
||||
if (isset($param['scene']) && ($param['scene'] == 'list' ||$param['scene'] == 'pending')) {
|
||||
return $query->paginate($limit, ['*'], 'page', $page);
|
||||
}
|
||||
|
||||
@@ -277,13 +287,20 @@ class FinReceiptService
|
||||
return $query->paginate($limit, ['*'], 'page', $page);
|
||||
}
|
||||
|
||||
public function credit($id)
|
||||
public function credit($id, $exchange_rate)
|
||||
{
|
||||
$finReceipt = FinReceipt::find($id);
|
||||
if(!empty($finReceipt->received_at)){
|
||||
throw new BusinessException('该记录已将确认入账');
|
||||
}
|
||||
$res = $this->logic->credit($id);
|
||||
|
||||
$data = [
|
||||
'received_at' => time(),
|
||||
'exchange_rate' => $exchange_rate,
|
||||
'total_amount_cny' => round($finReceipt['amount']*$exchange_rate,2),
|
||||
];
|
||||
$res = $this->logic->credit($id,$data);
|
||||
FinPaymentApply::where('id', $finReceipt->payment_apply_id)->update(['received_at' => $data['received_at']]);
|
||||
$this->afterServiceUpdate(['id'=>$id]);
|
||||
return $res;
|
||||
}
|
||||
@@ -298,6 +315,7 @@ class FinReceiptService
|
||||
public function serviceUpdatePayment(Request $request, array $data = [], string $scene = 'payment')
|
||||
{
|
||||
$payment_apply_id = $request->input('payment_apply_id');
|
||||
|
||||
$id = $request->input('id');
|
||||
$data = $this->preProcess(ucfirst($scene), $data, $request);
|
||||
$config = $this->buildQueryConfig($request, $scene);
|
||||
@@ -308,8 +326,10 @@ class FinReceiptService
|
||||
$payment = FinPaymentApply::where('id', $payment_apply_id)->first();
|
||||
$receipt = FinReceipt::find($id);
|
||||
$data['discount_amount'] = $payment->amount - $receipt->amount ?? 0;
|
||||
$data['submit_files'] = $payment->submit_files ?? '';
|
||||
|
||||
$updated = $this->logicUpdateBy($config, $data);
|
||||
return $this->postProcess(ucfirst($scene), $data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user