Merge branch 'feature/fin' into develop

This commit is contained in:
2025-10-29 14:23:53 +08:00
12 changed files with 345 additions and 3 deletions
+26
View File
@@ -3,6 +3,7 @@
namespace app\common\service;
use app\common\logic\FinReceiptLogic;
use app\common\model\FinPaymentApply;
use app\common\model\FinReceiptHis;
use app\common\validate\FinReceiptValidate;
use app\common\traits\crud\CrudServiceTrait;
@@ -89,6 +90,7 @@ class FinReceiptService
$config['where']['id'] = $p['id'];
break;
case 'update':
case 'payment':
case 'destroy':
$config['where']['id'] = $p['id'];
break;
@@ -272,4 +274,28 @@ class FinReceiptService
$this->afterServiceUpdate(['id'=>$id]);
return $res;
}
/**
* 更新计算折让金额
* @param Request $request
* @param array $data
* @param string $scene
* @return mixed
*/
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);
FinPaymentApply::where('id', $payment_apply_id)->update(['receipt_id' => $id, 'claimed_at' => time()]);
//折让金额
$payment = FinPaymentApply::where('id', $payment_apply_id)->first();
$receipt = FinReceipt::find($id);
$data['discount_amount'] = $payment->amount - $payment->amount ?? 0;
$updated = $this->logicUpdateBy($config, $data);
return $this->postProcess(ucfirst($scene), $data);
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace app\common\service;
use app\common\logic\SysConfigLogic;
use app\common\logic\SysCurrencyLogic;
use app\common\logic\SystemsLogic;
use support\Redis;
class SysConfigService
{
protected $logic;
public function __construct()
{
$this->logic = (new SysConfigLogic());
}
/**
* 获取系统list
*/
public static function getConfig(string $config_key)
{
$value = Redis::get($config_key);
if (empty($value)) {
$config = (new SysConfigLogic())->findByKey($config_key);
if (empty($config)) {
return null;
}
$value = $config->config_value;
Redis::set($config->config_key, $value, 'EX', 7200);
}
return $value;
}
}