修改科学计算字符类型

This commit is contained in:
wucongxing8150 2024-05-08 11:59:47 +08:00
parent 39a71a53e4
commit 3c22c9444b
6 changed files with 55 additions and 48 deletions

View File

@ -128,7 +128,7 @@ class AutoCompleteServicePackageDelayDirectConsumer extends ConsumerMessage
(string)$order_service_package_detail['service_count'], (string)$order_service_package_detail['service_count'],
bcmul( bcmul(
(string)$order_service_package_detail['single_inquiry_price'], (string)$order_service_package_detail['single_inquiry_price'],
0.75, "0.75",
3), 3),
3 3
); );

View File

@ -17,6 +17,7 @@ class AddServicePackageCompleteQueueCommand extends HyperfCommand
{ {
public function __construct(protected ContainerInterface $container) public function __construct(protected ContainerInterface $container)
{ {
date_default_timezone_set('Asia/Shanghai');
parent::__construct('addServicePackageFinishQueue'); parent::__construct('addServicePackageFinishQueue');
} }
@ -50,9 +51,12 @@ class AddServicePackageCompleteQueueCommand extends HyperfCommand
// 添加服务包订单完成延迟队列 // 添加服务包订单完成延迟队列
$finish_time = strtotime($order_service_package['finish_time']); $finish_time = strtotime($order_service_package['finish_time']);
$time = $finish_time - time(); $time = $finish_time - time();
if (\Hyperf\Config\config('app_env') == "dev"){
$time = 5;
}
$queue_data = array(); $queue_data = array();
$queue_data['order_no'] = $order_service_package['order_service_no']; $queue_data['order_no'] = $order_service_package['order_service_no'];
@ -84,8 +88,9 @@ class AddServicePackageCompleteQueueCommand extends HyperfCommand
public function getExecOrder(): array public function getExecOrder(): array
{ {
// 获取三天后结束时间 // 获取三天后结束时间
$three_day_finish_time = date('Y-m-d H:i:s',strtotime('+3 days', time())); $three_day_start_time = date('Y-m-d 00:00:00',strtotime('+3 days', strtotime(date('Y-m-d',time()))));
$finish_time_params = [date('Y-m-d H:i:s',time()),$three_day_finish_time]; $three_day_finish_time = date('Y-m-d 23:59:59',strtotime('+3 days', strtotime(date('Y-m-d',time()))));
$finish_time_params = [$three_day_start_time,$three_day_finish_time];
$params = array(); $params = array();
$params['order_service_status'] = 3; // 订单状态1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消) $params['order_service_status'] = 3; // 订单状态1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)

View File

@ -225,13 +225,13 @@ class DoctorAccountService extends BaseService
(string)$order_service_package_detail['service_count'], (string)$order_service_package_detail['service_count'],
2 2
), ),
0.75, "0.75",
2 2
); );
}else{ }else{
$result['estimate_income'] = bcmul( $result['estimate_income'] = bcmul(
(string)$order_service_package_detail['service_price'], (string)$order_service_package_detail['service_price'],
0.75, "0.75",
2 2
); );
} }
@ -344,9 +344,9 @@ class DoctorAccountService extends BaseService
// 计算医生个人所得税 // 计算医生个人所得税
$income_tax = $this->computeIndividualIncomeTax($amount_total); $income_tax = $this->computeIndividualIncomeTax($amount_total);
$withdrawal_amount = bcsub($amount_total, $income_tax, 2); $withdrawal_amount = bcsub((string)$amount_total, (string)$income_tax, 2);
$income_tax = bcmul($income_tax, 1, 2); $income_tax = bcmul((string)$income_tax, 1, 2);
$result = array(); $result = array();
$result['bank'] = $bank; //银行数据 $result['bank'] = $bank; //银行数据
@ -673,7 +673,7 @@ class DoctorAccountService extends BaseService
} }
// 提现金额 // 提现金额
$amount_total = bcmul((string)$amount_total,0.75,2); $amount_total = bcmul((string)$amount_total,"0.75",2);
// 计算医生个人所得税 // 计算医生个人所得税
$income_tax = $this->computeIndividualIncomeTax($amount_total); $income_tax = $this->computeIndividualIncomeTax($amount_total);

View File

@ -1098,11 +1098,11 @@ class OrderService extends BaseService
if ($order['order_type'] == 1){ if ($order['order_type'] == 1){
$expected_amount_total = bcmul( $expected_amount_total = bcmul(
bcsub( bcsub(
$order['amount_total'], (string)$order['amount_total'],
$refund_total, (string)$refund_total,
3 3
), ),
0.75, "0.75",
2 2
); );
} }
@ -1120,10 +1120,10 @@ class OrderService extends BaseService
(string)$order_service_package_detail['single_inquiry_price'], (string)$order_service_package_detail['single_inquiry_price'],
3 3
), ),
$refund_total, (string)$refund_total,
3 3
), ),
0.75, "0.75",
2 2
); );
} }

View File

@ -1593,12 +1593,12 @@ class PatientOrderService extends BaseService
$actual_product_price = bcadd( $actual_product_price = bcadd(
bcmul( bcmul(
35, 35,
$product_datas[$key]['used_quantity'], (string)$product_datas[$key]['used_quantity'],
2 2
), ),
bcmul( bcmul(
$product_datas[$key]['product_price'], (string)$product_datas[$key]['product_price'],
$product_datas[$key]['actual_quantity'], (string)$product_datas[$key]['actual_quantity'],
2 2
), ),
2 2
@ -1608,8 +1608,8 @@ class PatientOrderService extends BaseService
$payment_amount_total = bcadd( $payment_amount_total = bcadd(
$payment_amount_total, $payment_amount_total,
bcmul( bcmul(
$product_datas[$key]['product_price'], (string)$product_datas[$key]['product_price'],
$product_datas[$key]['actual_quantity'], (string)$product_datas[$key]['actual_quantity'],
2 2
), ),
2 2
@ -1618,8 +1618,8 @@ class PatientOrderService extends BaseService
// 此处重新计算药品总金额 // 此处重新计算药品总金额
$amount_total = bcadd( $amount_total = bcadd(
$amount_total, (string)$amount_total,
$actual_product_price, (string)$actual_product_price,
2 2
); );
@ -1627,8 +1627,8 @@ class PatientOrderService extends BaseService
$discount_amount = bcadd( $discount_amount = bcadd(
$discount_amount, $discount_amount,
bcmul( bcmul(
$product_datas[$key]['discount_amount'], (string)$product_datas[$key]['discount_amount'],
$product_datas[$key]['used_quantity'], (string)$product_datas[$key]['used_quantity'],
2 2
), ),
2 2
@ -1638,8 +1638,8 @@ class PatientOrderService extends BaseService
$freight_calculation_amount = bcadd( $freight_calculation_amount = bcadd(
$freight_calculation_amount, $freight_calculation_amount,
bcmul( bcmul(
$product_datas[$key]['product_price'], (string)$product_datas[$key]['product_price'],
$product_datas[$key]['product_num'], (string)$product_datas[$key]['product_num'],
2 2
), ),
2 2
@ -1673,8 +1673,8 @@ class PatientOrderService extends BaseService
// 实际支付金额=商品总金额-优惠卷金额+运费金额 // 实际支付金额=商品总金额-优惠卷金额+运费金额
$payment_amount_total = bcadd( $payment_amount_total = bcadd(
bcsub( bcsub(
$payment_amount_total, (string)$payment_amount_total,
$coupon_amount_total, (string)$coupon_amount_total,
2 2
), ),
$logistics_fee, $logistics_fee,
@ -1773,7 +1773,7 @@ class PatientOrderService extends BaseService
$data['order_prescription_id'] = $order_prescription['order_prescription_id']; $data['order_prescription_id'] = $order_prescription['order_prescription_id'];
$data['product_id'] = $product_data['product_id']; $data['product_id'] = $product_data['product_id'];
$data['product_name'] = $product_data['product_name']; $data['product_name'] = $product_data['product_name'];
$data['product_price'] = bcmul($product_data['product_price'], $product_data['actual_quantity'], 3); $data['product_price'] = bcmul((string)$product_data['product_price'], (string)$product_data['actual_quantity'], 3);
$data['product_platform_code'] = $product_data['product_platform_code']; $data['product_platform_code'] = $product_data['product_platform_code'];
$data['amount'] = $product_data['product_num']; $data['amount'] = $product_data['product_num'];
$data['manufacturer'] = $product_data['manufacturer']; $data['manufacturer'] = $product_data['manufacturer'];
@ -2206,12 +2206,12 @@ class PatientOrderService extends BaseService
$actual_product_price = bcadd( $actual_product_price = bcadd(
bcmul( bcmul(
35, 35,
$product_data['used_quantity'], (string)$product_data['used_quantity'],
2 2
), ),
bcmul( bcmul(
$product_data['product_price'], (string)$product_data['product_price'],
$product_data['actual_quantity'], (string)$product_data['actual_quantity'],
2 2
), ),
2 2
@ -2219,10 +2219,10 @@ class PatientOrderService extends BaseService
// 此处重新计算药品支付金额 // 此处重新计算药品支付金额
$payment_amount_total = bcadd( $payment_amount_total = bcadd(
$payment_amount_total, (string)$payment_amount_total,
bcmul( bcmul(
$product_data['product_price'], (string)$product_data['product_price'],
$product_data['actual_quantity'], (string)$product_data['actual_quantity'],
2 2
), ),
2 2
@ -2231,24 +2231,24 @@ class PatientOrderService extends BaseService
// 此处重新计算药品总金额 // 此处重新计算药品总金额
$amount_total = bcadd( $amount_total = bcadd(
$amount_total, (string)$amount_total,
$actual_product_price, (string)$actual_product_price,
2 2
); );
// 此处重新计算药品优惠金额 // 此处重新计算药品优惠金额
$discount_amount = bcadd( $discount_amount = bcadd(
$discount_amount, (string)$discount_amount,
$product_data['discount_amount'], (string)$product_data['discount_amount'],
2 2
); );
// 此处计算药品总金额-计算运费使用 // 此处计算药品总金额-计算运费使用
$freight_calculation_amount = bcadd( $freight_calculation_amount = bcadd(
$freight_calculation_amount, (string)$freight_calculation_amount,
bcmul( bcmul(
$product_data['product_price'], (string)$product_data['product_price'],
$product_data['product_num'], (string)$product_data['product_num'],
2 2
), ),
2 2
@ -2274,7 +2274,7 @@ class PatientOrderService extends BaseService
} }
// 实际支付金额=商品总金额-优惠卷金额+运费金额 // 实际支付金额=商品总金额-优惠卷金额+运费金额
$payment_amount_total = bcadd(bcsub($payment_amount_total, $coupon_amount_total, 2), $logistics_fee, 2); $payment_amount_total = bcadd(bcsub((string)$payment_amount_total, (string)$coupon_amount_total, 2), (string)$logistics_fee, 2);
// 药品优惠金额 // 药品优惠金额
$discount_amount = $discount_amount + $coupon_amount_total; $discount_amount = $discount_amount + $coupon_amount_total;

View File

@ -388,10 +388,11 @@ class UserCouponService extends BaseService
continue; continue;
} }
$product_price = bcadd($product_price, $product_price = bcadd(
(string)$product_price,
bcmul( // 商品价格*实际数量数量 bcmul( // 商品价格*实际数量数量
$coupon_product_data['product_price'], (string)$coupon_product_data['product_price'],
$coupon_product_data['actual_quantity'], (string)$coupon_product_data['actual_quantity'],
2 2
), ),
2 2
@ -403,10 +404,11 @@ class UserCouponService extends BaseService
if ($coupon['application_scope'] == 1 || $coupon['application_scope'] == 6){ if ($coupon['application_scope'] == 1 || $coupon['application_scope'] == 6){
foreach ($coupon_product_datas as $coupon_product_data){ foreach ($coupon_product_datas as $coupon_product_data){
// 计算商品总金额 // 计算商品总金额
$product_price = bcadd($product_price, $product_price = bcadd(
(string)$product_price,
bcmul( // 商品价格*数量 bcmul( // 商品价格*数量
$coupon_product_data['product_price'], (string)$coupon_product_data['product_price'],
$coupon_product_data['actual_quantity'], (string)$coupon_product_data['actual_quantity'],
2 2
), ),
2 2