Skip to content

Commit 39f6459

Browse files
committed
Python OP
1 parent a903ea7 commit 39f6459

File tree

6 files changed

+710
-1
lines changed

6 files changed

+710
-1
lines changed

taiyangxue/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- [rate](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/rate-of-return) : 做时间的朋友,必须知道收益咋算
2020
- [blockchain](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/blockchain) : 比特币涨疯了,区块链是什么鬼?
2121
- [simple game](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/simple-game) : 与其说教,不如一起写个游戏
22-
22+
- [python-op](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/python-op) : 搞定运营,我用 Python
2323
---
2424

2525
从小白到工程师的学习之路

taiyangxue/python-op/activity.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2021/08/08 4组/张三-123456- 开单
2+
2021/08/08 1组/李四-123457- 开单

taiyangxue/python-op/crawljingdata.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import requests
2+
import json
3+
4+
def get_check_data(date, limit=1, sessionid='4551f206c64'):
5+
headers = {
6+
'authority': 'bushu.jingdaka.com',
7+
'pragma': 'no-cache',
8+
'cache-control': 'no-cache',
9+
'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
10+
'sec-ch-ua-mobile': '?0',
11+
'upgrade-insecure-requests': '1',
12+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
13+
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
14+
'sec-fetch-site': 'none',
15+
'sec-fetch-mode': 'navigate',
16+
'sec-fetch-user': '?1',
17+
'sec-fetch-dest': 'document',
18+
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
19+
'cookie': 'beegosessionID=%s;' % sessionid,
20+
}
21+
22+
params = (
23+
('team_id', '0'),
24+
('search_name', ''),
25+
('course_id', '1099357'),
26+
('record_at', date),
27+
('calendar_id', '0'),
28+
('limit', limit),
29+
('offset', '0'),
30+
)
31+
32+
response = requests.get('https://bushu.jingdaka.com/bg/course/userdatedata', headers=headers, params=params)
33+
data = json.loads(response.text)
34+
rows = []
35+
if data['err_code'] == 0:
36+
for d in data['data']['user_data']:
37+
if d['user_id'] not in [53433468,53433325]:
38+
rows.append((d['user_id'], date, '√'))
39+
else:
40+
print("抓取出错了:", data)
41+
return rows
42+
43+
if __name__ == '__main__':
44+
print(get_check_data('2021-08-04'))

taiyangxue/python-op/dbtables.sql

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
Navicat Premium Data Transfer
3+
4+
Source Server : sale3
5+
Source Server Type : SQLite
6+
Source Server Version : 3030001
7+
Source Schema : main
8+
9+
Target Server Type : SQLite
10+
Target Server Version : 3030001
11+
File Encoding : 65001
12+
13+
Date: 12/08/2021 00:57:47
14+
*/
15+
16+
PRAGMA foreign_keys = false;
17+
18+
-- ----------------------------
19+
-- Table structure for tbas_score
20+
-- ----------------------------
21+
DROP TABLE IF EXISTS "tbas_score";
22+
CREATE TABLE "tbas_score" (
23+
"type" TEXT,
24+
"value" integer,
25+
"title" TEXT
26+
);
27+
28+
-- ----------------------------
29+
-- Table structure for tprj_activity
30+
-- ----------------------------
31+
DROP TABLE IF EXISTS "tprj_activity";
32+
CREATE TABLE "tprj_activity" (
33+
"mixin_id" INTEGER NOT NULL,
34+
"std_id" INTEGER,
35+
"date" TEXT,
36+
"type" text,
37+
"count" INTEGER,
38+
"check_type" TEXT,
39+
"cal_done" real
40+
);
41+
42+
-- ----------------------------
43+
-- Table structure for tprj_leader_score
44+
-- ----------------------------
45+
DROP TABLE IF EXISTS "tprj_leader_score";
46+
CREATE TABLE "tprj_leader_score" (
47+
"mixin_id" INTEGER,
48+
"score" integer
49+
);
50+
51+
-- ----------------------------
52+
-- Table structure for tprj_team_check_rate
53+
-- ----------------------------
54+
DROP TABLE IF EXISTS "tprj_team_check_rate";
55+
CREATE TABLE "tprj_team_check_rate" (
56+
"team" TEXT,
57+
"date" TEXT,
58+
"rate" integer
59+
);
60+
61+
-- ----------------------------
62+
-- Table structure for tprj_team_score
63+
-- ----------------------------
64+
DROP TABLE IF EXISTS "tprj_team_score";
65+
CREATE TABLE "tprj_team_score" (
66+
"team" TEXT,
67+
"score" integer
68+
);
69+
70+
-- ----------------------------
71+
-- Table structure for tprj_team_score_detail
72+
-- ----------------------------
73+
DROP TABLE IF EXISTS "tprj_team_score_detail";
74+
CREATE TABLE "tprj_team_score_detail" (
75+
"team" TEXT,
76+
"score" integer,
77+
"date" TEXT
78+
);
79+
80+
-- ----------------------------
81+
-- Table structure for tprj_user
82+
-- ----------------------------
83+
DROP TABLE IF EXISTS "tprj_user";
84+
CREATE TABLE "tprj_user" (
85+
"mixin_id" INTEGER NOT NULL,
86+
"std_id" INTEGER,
87+
"name" TEXT,
88+
"team" TEXT,
89+
"title" TEXT,
90+
PRIMARY KEY ("mixin_id")
91+
);
92+
93+
-- ----------------------------
94+
-- Table structure for tprj_user_score
95+
-- ----------------------------
96+
DROP TABLE IF EXISTS "tprj_user_score";
97+
CREATE TABLE "tprj_user_score" (
98+
"mixin_id" INTEGER,
99+
"score" integer,
100+
"team" TEXT,
101+
"title" TEXT
102+
);
103+
104+
-- ----------------------------
105+
-- Table structure for tprj_user_score_detail
106+
-- ----------------------------
107+
DROP TABLE IF EXISTS "tprj_user_score_detail";
108+
CREATE TABLE "tprj_user_score_detail" (
109+
"mixin_id" INTEGER,
110+
"score" integer,
111+
"team" TEXT,
112+
"title" TEXT,
113+
"date" TEXT
114+
);
115+
116+
PRAGMA foreign_keys = true;

0 commit comments

Comments
 (0)