Browse Source

线下酒店等订单增加back_amount

Panda 2 weeks ago
parent
commit
4fb6cab427

+ 10 - 10
application/common/business/PaymentBusiness.php

@@ -126,7 +126,7 @@ class PaymentBusiness extends BusinessResult
         // 主表校验
         $model = new HotelOrderModel();
         $order = $model->getDetail(
-            params: ['order_no', $this->orderNo],
+            params: ['order_no' => $this->orderNo],
             with  : [
                 'hotel', 'room'
             ]
@@ -163,7 +163,7 @@ class PaymentBusiness extends BusinessResult
                 'shop_name'    => $order['hotel']['name'],
                 'shop_logo'    => $order['hotel']['image'],
                 'back_rate'    => $order['hotel']['back_rate'],
-                'back_amount'  => bcmul($order['pay_amount'],$order['hotel']['back_rate'],2),
+                'back_amount'  => bcmul($order['pay_amount'],bcdiv($order['hotel']['back_rate'],100,2),2),
                 'args'         => json_encode([
                     [
                         'image'      => $order['room']['image'],// 图片
@@ -191,7 +191,7 @@ class PaymentBusiness extends BusinessResult
         // 主表校验
         $model = new HotelCanteenOrderModel();
         $order = $model->getDetail(
-            params: ['order_no', $this->orderNo],
+            params: ['order_no' => $this->orderNo],
             with  : [
                 'canteen', 'room'
             ]
@@ -228,7 +228,7 @@ class PaymentBusiness extends BusinessResult
                 'shop_name'    => $order['canteen']['name'],
                 'shop_logo'    => $order['canteen']['image'],
                 'back_rate'    => $order['canteen']['back_rate'],
-                'back_amount'  => bcmul($order['pay_amount'],$order['canteen']['back_rate'],2),
+                'back_amount'  => bcmul($order['pay_amount'],bcdiv($order['canteen']['back_rate'],100,2),2),
                 'args'         => json_encode([
                     [
                         'image'       => $order['room']['image'],// 图片
@@ -254,7 +254,7 @@ class PaymentBusiness extends BusinessResult
         // 主表校验
         $model = new UniversityEventApplyModel();
         $order = $model->getDetail(
-            params: ['order_no', $this->orderNo],
+            params: ['order_no' => $this->orderNo],
             with  : [
                 'events'
             ]
@@ -291,7 +291,7 @@ class PaymentBusiness extends BusinessResult
                 'shop_name'    => $order['events']['name'],
                 'shop_logo'    => $order['events']['image'],
                 'back_rate'    => $order['events']['back_rate'],
-                'back_amount'  => bcmul($order['pay_amount'],$order['events']['back_rate'],2),
+                'back_amount'  => bcmul($order['pay_amount'],bcdiv($order['events']['back_rate'],100,2),2),
                 'args'         => json_encode([
                     [
                         'image'      => $order['events']['image'],// 图片
@@ -317,7 +317,7 @@ class PaymentBusiness extends BusinessResult
         // 主表校验
         $model = new OfflineShopOrderModel();
         $order = $model->getDetail(
-            params: ['order_no', $this->orderNo],
+            params: ['order_no' => $this->orderNo],
             with  : [
                 'shop'
             ]
@@ -354,7 +354,7 @@ class PaymentBusiness extends BusinessResult
                 'shop_name'    => $order['shop']['name'],
                 'shop_logo'    => $order['shop']['image'],
                 'back_rate'    => $order['shop']['back_rate'],
-                'back_amount'  => bcmul($order['pay_amount'],$order['shop']['back_rate'],2),
+                'back_amount'  => bcmul($order['pay_amount'],bcdiv($order['shop']['back_rate'],100,2),2),
                 'args'         => json_encode([
                     [
                         'image' => $order['shop']['image'],// 图片
@@ -378,7 +378,7 @@ class PaymentBusiness extends BusinessResult
         // 主表校验
         $model = new TravelOrderModel();
         $order = $model->getDetail(
-            params: ['order_no', $this->orderNo],
+            params: ['order_no' => $this->orderNo],
             with  : [
                 'travel'
             ]
@@ -415,7 +415,7 @@ class PaymentBusiness extends BusinessResult
                 'shop_name'    => $order['travel']['name'],
                 'shop_logo'    => $order['travel']['image'],
                 'back_rate'    => $order['travel']['back_rate'],
-                'back_amount'  => bcmul($order['pay_amount'],$order['travel']['back_rate'],2),
+                'back_amount'  => bcmul($order['pay_amount'],bcdiv($order['travel']['back_rate'],100,2),2),
                 'args'         => json_encode([
                     [
                         'image'      => $order['travel']['image'],// 图片

+ 3 - 0
application/common/model/BaseModel.php

@@ -147,6 +147,9 @@ class BaseModel extends Model
         }
 
         foreach ($params as $field => $value) {
+            if (empty($field)){
+                continue;
+            }
             $method = 'search' . Str::studly($field) . 'Attribute';
             if ($value !== null && $value !== '' && method_exists($this, $method)) {
                 $this->query = $this->$method($this->query,$value,$params);

+ 2 - 0
application/common/model/OfflineShopOrderModel.php

@@ -18,6 +18,8 @@ class OfflineShopOrderModel extends BaseModel
     protected $createTime = false;
     protected $updateTime = false;
     protected $deleteTime = false;
+    protected int $is_status_search = 0;// 默认使用 status = 1 筛选
+    protected int $is_delete_search = 0;// 默认使用 is_delete = 0 筛选
 
     public function searchUserIdAttribute($query, $value, array $params)
     {