PageSourceSearch

https://www.trainspread.com/js/mobile-first/getprice.js

js trainspread.com collected 2026-10-02 21:34:08 UTC 3,960 bytes, 113 lines download raw bytes

1ready(function(){
2    let allDaytripList = document.querySelectorAll(".js_getDayTripPrice"); //取出的是nodelist 用js的node操作方式。
3    let allTourList = document.querySelectorAll(".js_getTourPrice");
4    //let apiweb = "http://202.103.68.104:61/info.php";
5    let apiweb = "https://ct.mycht.cn/info.php";
6    //循环获取
7    for (let i = 0; i < allDaytripList.length; i++) {
8        let param = allDaytripList[i].getAttribute("data");
9        //获取接口价格
10        let apiurl = apiweb+"/thirdparty/ctmobilefirst/api/getDaytripsPrice/?param="+param;;
11        fetch(apiurl)
12        .then(function(res){
13            if (res.ok){
14                return res.json();
15            }else {
16                let message = "fetch error:"+res.statusText;
17                let error = new Error(message);
18                error.res = res;
19                //return Promise.reject(error);
20                throw(error);
21              }
22        }).then(function(data){
23           // console.log(data);
24            allDaytripList[i].textContent=data.price;
25        })
26        
27    }
28
29    for (let i = 0; i < allTourList.length; i++) {
30        let param = allTourList[i].getAttribute("data");
31        //获取接口价格
32        let apiurl = apiweb+"/thirdparty/ctmobilefirst/api/getTourPrice/?param="+param;;
33        fetch(apiurl)
34        .then(function(res){
35            if (res.ok){
36                return res.json();
37            }else {
38                let message = "fetch error:"+res.statusText;
39                let error = new Error(message);
40                error.res = res;
41                //return Promise.reject(error);
42                throw(error);
43              }
44        }).then(function(data){
45           // console.log(data);
46           if (parseInt(data.price)>0){
47                allTourList[i].textContent=data.price;
48           }else{
49                allTourList[i].parentNode.textContent="";
50           }
51            
52        })
53        
54    }
55
56    //一日游价格表
57    let getDaytripPriceList = document.getElementById("getDaytripPriceList");
58    if (getDaytripPriceList){
59        let param = getDaytripPriceList.getAttribute("data");
60        let apiurl = apiweb+"/thirdparty/ctmobilefirst/api/getDaytripPriceList/?param="+param;
61        fetch(apiurl)
62        .then(function(res) {
63            if (res.ok){
64                return res.text();
65            }else{
66                let message = "fetch error:"+res.statusText;
67                let error = new Error(message);
68                error.res = res;
69                //return Promise.reject(error);
70                throw(error);
71            }            
72        }).then(function(data){
73            getDaytripPriceList.innerHTML=data;
74        })
75    }
76
77    //游船价格获取
78    let allCruiseList = document.querySelectorAll(".js_getCruisePrice");
79    if (allCruiseList.length>0){
80        let apiurl = "/js/yangtzecruise/allship.js";
81        fetch(apiurl)
82        .then(function(res){
83            if (res.ok){
84                return res.json();
85            }else {
86                let message = "fetch error:"+res.statusText;
87                let error = new Error(message);
88                error.res = res;
89                //return Promise.reject(error);
90                alert("Data Error!");
91                window.history.back();
92                throw(error);
93                
94            }
95        }).then(function(data){
96            for (let i=0; i < allCruiseList.length; i++){
97                let shipname = allCruiseList[i].getAttribute("data");
98                for (let j=0;j<data.length;j++){
99                    CSI2_CruiseShip = data[j].CSI2_CruiseShip ;
100                    if (CSI2_CruiseShip.toLowerCase() == shipname.toLowerCase()){
101                        allCruiseList[i].textContent=data[j].LowPrice;
102                        //console.log(shipname);
103                        break;
104                    }
105                }
106            }
107
108        });
109
110    }
111
112
113})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.