From 38f768d39ba27d303147c59a222655b7c6cdfb25 Mon Sep 17 00:00:00 2001
From: younger_times <841720330@qq.com>
Date: 星期二, 04 七月 2023 14:45:02 +0800
Subject: [PATCH] 修改BUG

---
 OKProject/Class/Home/View/TripAddressCell.swift |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/OKProject/Class/Home/View/TripAddressCell.swift b/OKProject/Class/Home/View/TripAddressCell.swift
index 75198b2..2001e01 100644
--- a/OKProject/Class/Home/View/TripAddressCell.swift
+++ b/OKProject/Class/Home/View/TripAddressCell.swift
@@ -174,6 +174,11 @@
     //MARK: - Rx
     func bindRx() {
 
+        NotificationCenter.default.rx.notification(Notification.Name("cartype_Noti")).subscribe(onNext: {noti in
+            YYMapViewManager.share.calType.accept(2)
+            self.queryServerCarOfficalModel()
+        }).disposed(by: rx.disposeBag)
+
         onUserNumPressed.subscribe(onNext: {num in
             var notOneAmount:Double = 0
             var oneAmount:Double = 0
@@ -419,6 +424,7 @@
         YYMapViewManager.share.calType.subscribe { (state) in
             if state == 1{
                 self.button_tip.setTitle("单程计费", for: .normal)
+                self.queryServerCarOfficalModel()
             }else if state == 2{
                 self.button_tip.setTitle("包车计费", for: .normal)
             }
@@ -593,7 +599,21 @@
     
     func queryServerCarOfficalModel(){
         view_carType.style = .refreshing
-        APIManager.shared.provider.rx.request(.queryOfficalCarModel(calType: 1, startLonLat: "\(YYMapViewManager.share.originInfo.value?.lon ?? 0),\(YYMapViewManager.share.originInfo.value?.lat ?? 0)", endLonLat: "\(YYMapViewManager.share.destination.value?.lon ?? 0),\(YYMapViewManager.share.destination.value?.lat ?? 0)",startTime: "", endTime: "")).map(YYModel<[YYCarTypeModel]>.self)
+
+
+        var startTime:String?
+        var endTime:String?
+
+        if YYMapViewManager.share.timeStamp.value != nil{
+            startTime = DateClass.timeStampToString("\(YYMapViewManager.share.timeStamp.value)", dateFormat: "yyyy-MM-dd 00:00:00")
+        }
+
+        if YYMapViewManager.share.timeEndStamp.value != nil{
+            endTime = DateClass.timeStampToString("\(YYMapViewManager.share.timeEndStamp.value)", dateFormat: "yyyy-MM-dd 00:00:00")
+        }
+
+
+        APIManager.shared.provider.rx.request(.queryOfficalCarModel(calType: YYMapViewManager.share.calType.value ?? 1, startLonLat: "\(YYMapViewManager.share.originInfo.value?.lon ?? 0),\(YYMapViewManager.share.originInfo.value?.lat ?? 0)", endLonLat: "\(YYMapViewManager.share.destination.value?.lon ?? 0),\(YYMapViewManager.share.destination.value?.lat ?? 0)",startTime:startTime, endTime: endTime)).map(YYModel<[YYCarTypeModel]>.self)
             .validate()
             .subscribe(onSuccess: { [unowned self] (model) in
                 self.view_carType.style = .none

--
Gitblit v1.7.1