This commit is contained in:
2025-04-25 15:47:08 +08:00
parent 7889883e1c
commit 21a48829c6
2 changed files with 26 additions and 18 deletions

View File

@@ -195,12 +195,16 @@ class LedgerForm extends BaseModel
* 医保支付(走月付)
*/
if ($productOrder['prescription']['category'] == 2) {
$model = new MonthlyPaymentModel();
$model->store_id = $productOrder->store_id;
$model->order_id = $productOrder->id;
$model->amount = $productOrder->market_price;
$model->created_at = $time;
$model->save();
// 查询订单是否已生成月付
$monthInfo = MonthlyPaymentModel::find()->where(['order_id' => $productOrder->id, 'store_id' => $productOrder->store_id])->one();
if (!$monthInfo) {
$model = new MonthlyPaymentModel();
$model->store_id = $productOrder->store_id;
$model->order_id = $productOrder->id;
$model->amount = $productOrder->market_price;
$model->created_at = $time;
$model->save();
}
} else {
$ledger[] = [
'order_id' => $this->order_id,
@@ -247,19 +251,18 @@ class LedgerForm extends BaseModel
foreach($productOrderItems as $v){
$totalPrice = round($v['number'] * $v['price'], 4);
$totalBuyPrice = round($v['number'] * $v['buy_price'], 4);
// 月付
if ($productOrder['prescription']['category'] == 2) {
// (new MonthlyPaymentModel)->save([
// 'store_id' => $productOrder->store_id,
// 'order_id' => $productOrder->id,
// 'amount' => $totalBuyPrice,
// 'created_at' => $time,
// ]);
$model = new MonthlyPaymentModel();
$model->store_id = $productOrder->store_id;
$model->order_id = $productOrder->id;
$model->amount = $totalBuyPrice;
$model->created_at = $time;
$model->save();
// 查询订单是否已生成月付
$monthInfo = MonthlyPaymentModel::find()->where(['order_id' => $productOrder->id, 'store_id' => $productOrder->store_id])->one();
if (!$monthInfo) {
$model = new MonthlyPaymentModel();
$model->store_id = $productOrder->store_id;
$model->order_id = $productOrder->id;
$model->amount = $productOrder->market_price;
$model->created_at = $time;
$model->save();
}
} else {
$ledger[] = [
'order_id' => $this->order_id,

View File

@@ -2,6 +2,7 @@
namespace common\helpers;
use common\services\DataEncryptor;
use Yii;
/**
@@ -116,6 +117,10 @@ class FuncHelper
*/
public static function getAgeFromIdNo($idno = '')
{
// 如果字符串中包含xk_ase_256
if (strpos($idno, 'xk_ase_256') !== false) {
$idno = (new DataEncryptor(Yii::$app->params['ase_key']))->decrypt($idno);
}
$btime = strtotime(substr($idno, 6, 8));//idno是身份证号 截取日期并转为时间戳
$byear = date('Y', $btime);
$bmonth = date('m', $btime);