├── .idea
├── vcs.xml
└── inspectionProfiles
│ └── Project_Default.xml
├── README.md
├── LICENSE
└── main.py
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NuaaMoneyGone
2 | 通过南航校园卡消费充值查询接口生成个人账单记录与数据分析
3 | ## 【疑似官方停止了本接口,本项目暂时停止,2018年4月29日】
4 | ## Step1:完善核心SDK-查询指定时间段内校园卡的消费情况与充值情况
5 | ### 使用方法:
6 | 1. **Clone代码,或者直接拷贝(反正代码很短)**
7 | 2. **在原来的程序的main函数上修改,或者 import client.py这个文件,这取决于你的使用方式。**
8 |
9 | _提醒:日期格式为 年份-月份-日期 例如:2018-04-03 且查询的间隔需要大于等于一个月_
10 | _需要安装 requests库_
11 |
12 | ```python
13 | test = client(username='你的学号', password='身份证后六位')
14 | print(test.search(begin_data='起始日期', end_data='终止日期'))
15 | ```
16 |
17 | 返回结果包含消费记录和充值距离 形式为JSON数组
18 |
19 |
20 |
21 |
22 | ## Step 2:清洗数据,挖掘有效信息
23 | ## Step 3:搭建Web服务,用Echart做前端对数据进行可视化优化
24 |
25 |
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 GuoBin Wang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | __author__ = 'arcosx'
4 |
5 | import requests
6 |
7 |
8 | class client(object):
9 | username = ""
10 | password = ""
11 | login_url = "https://ucapp.nuaa.edu.cn/wap/login/invalid"
12 | search_url = "https://app.nuaa.edu.cn/cardhis/wap/default/index"
13 | cookie = ""
14 | headers = {
15 | 'X-Requested-With': 'XMLHttpRequest',
16 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
17 | 'Content-Type': 'application/x-www-form-urlencoded',
18 | 'Referer': 'https://app.nuaa.edu.cn/cardhis/wap/default/index',
19 | }
20 |
21 | def __init__(self, username, password):
22 | self.username = username
23 | self.password = password
24 |
25 | def login(self):
26 | post_data = {'username': self.username, 'password': self.password}
27 | login_res = requests.post(self.login_url, data=post_data, headers=self.headers)
28 | cookies = login_res.cookies
29 | UUkey = 'UUkey=' + cookies['UUkey'] + '; '
30 | vjuid = 'vjuid=' + cookies['vjuid'] + '; '
31 | vjvd = 'vjvd=' + cookies['vjvd'] + '; '
32 | vt = 'vt=' + cookies['vt']
33 | header_cookie = UUkey + vjuid + vjvd + vt
34 | self.headers['Cookie'] = header_cookie
35 | return 1
36 |
37 | def search(self, begin_data, end_data):
38 | if self.login() == 0:
39 | return
40 | payload = "sdate=" + begin_data + "&edate=" + end_data
41 | res = requests.post(self.search_url, headers=self.headers, data=payload)
42 | return res.json()
43 |
44 |
45 | if __name__ == '__main__':
46 | test = client(username='', password='')
47 | print(test.search(begin_data='2015-06-06', end_data='2018-04-03'))
48 |
--------------------------------------------------------------------------------