This repository was archived by the owner on Jul 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
70 lines (67 loc) · 1.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const xttp = require('xttp');
const ofo = {
lat: '',
lng: '',
source: 2,
post(url, body){
return xttp(url, {
method: 'post',
body
})
.then(res => res.json());
},
set(name, value){
this[name] = value;
return this;
},
location(lat, lng){
return Object.assign(this, { lat, lng });
},
code(tel, ccc = '86'){
const { lat, lng } = this;
return this.post('http://one.ofo.com/verifyCode_v2', {
ccc, tel, type: 1, lat, lng
});
},
login(tel, code, ccc = '86'){
const { lat, lng } = this;
return this.post('http://one.ofo.com/api/login_v2', {
tel, code, ccc, lat, lng
});
},
user(){
const { lat, lng, source, token } = this;
return this.post('http://san.ofo.so/ofo/Api/v4/info/user', {
token, source, lat, lng
});
},
near(){
const { lat, lng, source, token } = this;
return this.post('http://one.ofo.com/nearbyofoCar', {
token, source, lat, lng
});
},
start(carno){
const { lat, lng, token, source } = this;
return this.post('https://san.ofo.so/ofo/Api/v2/carno', {
carno, lat, lng, token, source
});
},
end(orderno){
const { lat, lng, token, source } = this;
return this.post('https://san.ofo.so/ofo/Api/v2/end', {
orderno, token, source, lat, lng
});
},
pay(orderno){
const { lat, lng, token, source } = this;
return this.post('https://san.ofo.so/ofo/Api/v2/pay', {
orderno, token, source, lat, lng
});
}
}
ofo.createServer = () => {
ofo.Server = require('./server');
return new http.Server(ofo.Server);
};
module.exports = ofo;