Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jk_interface_test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangqiang
jk_interface_test
Commits
6470c516
Commit
6470c516
authored
Apr 13, 2021
by
小刘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目迁移
parent
db9cc83a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
69 changed files
with
2673 additions
and
5 deletions
+2673
-5
codeStyleConfig.xml
.idea/codeStyles/codeStyleConfig.xml
+6
-0
jk_interface_test.iml
.idea/jk_interface_test.iml
+1
-1
misc.xml
.idea/misc.xml
+2
-1
workspace.xml
.idea/workspace.xml
+0
-0
common_config.py
common/common_config.py
+1
-1
run.py
run.py
+1
-1
conftest.py
script/conftest.py
+1
-1
__init__.py
script/xin_project_patriarch_app/__init__.py
+0
-0
__init__.py
...t/xin_project_patriarch_app/xin_patriarch_app/__init__.py
+0
-0
__init__.py
...h_app/xin_patriarch_app/test_xin_choose_class/__init__.py
+0
-0
test_auth_choose_class.py
...iarch_app/test_xin_choose_class/test_auth_choose_class.py
+0
-0
__init__.py
...app/xin_patriarch_app/test_xin_students_class/__init__.py
+0
-0
test_auth_classes.py
...atriarch_app/test_xin_students_class/test_auth_classes.py
+151
-0
test_auth_students_classes.py
...app/test_xin_students_class/test_auth_students_classes.py
+102
-0
__init__.py
...app/xin_patriarch_app/test_xin_students_login/__init__.py
+0
-0
test_auth_login.py
..._patriarch_app/test_xin_students_login/test_auth_login.py
+51
-0
test_auth_students.py
...triarch_app/test_xin_students_login/test_auth_students.py
+34
-0
__init__.py
...rch_app/xin_patriarch_app/xin_patriach_static/__init__.py
+0
-0
__init__.py
...arch_app/xin_patriach_static/xin_choose_class/__init__.py
+0
-0
xin_choose_classes.py
...in_patriach_static/xin_choose_class/xin_choose_classes.py
+67
-0
__init__.py
...arch_app/xin_patriach_static/xin_public_class/__init__.py
+0
-0
xin_change_list_index.py
...patriach_static/xin_public_class/xin_change_list_index.py
+5
-0
xin_global_static.py
...xin_patriach_static/xin_public_class/xin_global_static.py
+5
-0
__init__.py
...iarch_app/xin_patriach_static/xin_query_class/__init__.py
+0
-0
xin_auth_class.py
...app/xin_patriach_static/xin_query_class/xin_auth_class.py
+45
-0
xin_query_students_class.py
...triach_static/xin_query_class/xin_query_students_class.py
+46
-0
__init__.py
..._app/xin_patriach_static/xin_students_message/__init__.py
+0
-0
xin_query_students_message.py
...static/xin_students_message/xin_query_students_message.py
+26
-0
__init__.py
script/xin_project_patriarch_app/xin_static/__init__.py
+0
-0
start.py
script/xin_project_patriarch_app/xin_static/start.py
+13
-0
__init__.py
.../xin_project_patriarch_app/xin_static/xin_crm/__init__.py
+0
-0
__init__.py
...ct_patriarch_app/xin_static/xin_crm/xin_apply/__init__.py
+0
-0
xin_pay_order.py
...triarch_app/xin_static/xin_crm/xin_apply/xin_pay_order.py
+50
-0
xin_place_order.py
...iarch_app/xin_static/xin_crm/xin_apply/xin_place_order.py
+73
-0
xin_save_order.py
...riarch_app/xin_static/xin_crm/xin_apply/xin_save_order.py
+73
-0
xin_student.py
...n_project_patriarch_app/xin_static/xin_crm/xin_student.py
+187
-0
__init__.py
...ject_patriarch_app/xin_static/xin_educational/__init__.py
+0
-0
__init__.py
...p/xin_static/xin_educational/xin_class_handle/__init__.py
+0
-0
xin_add_class.py
..._static/xin_educational/xin_class_handle/xin_add_class.py
+130
-0
xin_delete_class.py
...atic/xin_educational/xin_class_handle/xin_delete_class.py
+27
-0
xin_update_class.py
...atic/xin_educational/xin_class_handle/xin_update_class.py
+167
-0
__init__.py
.../xin_static/xin_educational/xin_course_handle/__init__.py
+0
-0
xin_course.py
...in_static/xin_educational/xin_course_handle/xin_course.py
+165
-0
xin_update_course.py
...ic/xin_educational/xin_course_handle/xin_update_course.py
+187
-0
xin_network.py
...t_patriarch_app/xin_static/xin_educational/xin_network.py
+66
-0
__init__.py
...n_project_patriarch_app/xin_static/xin_global/__init__.py
+0
-0
global.yaml
...n_project_patriarch_app/xin_static/xin_global/global.yaml
+71
-0
xin_global.py
...project_patriarch_app/xin_static/xin_global/xin_global.py
+24
-0
xin_judge.py
script/xin_project_patriarch_app/xin_static/xin_judge.py
+0
-0
__init__.py
..._project_patriarch_app/xin_static/xin_service/__init__.py
+0
-0
service.yaml
...project_patriarch_app/xin_static/xin_service/service.yaml
+9
-0
xin_service.py
...oject_patriarch_app/xin_static/xin_service/xin_service.py
+17
-0
__init__.py
...ect_patriarch_app/xin_static/xin_service_user/__init__.py
+0
-0
xin_employees.py
...atriarch_app/xin_static/xin_service_user/xin_employees.py
+31
-0
__init__.py
..._project_patriarch_app/xin_static/xin_setting/__init__.py
+4
-0
__init__.py
...arch_app/xin_static/xin_setting/xin_discounts/__init__.py
+3
-0
discounts_global.yaml
...in_static/xin_setting/xin_discounts/discounts_global.yaml
+52
-0
xin_discounts_coupon.py
..._static/xin_setting/xin_discounts/xin_discounts_coupon.py
+153
-0
xin_discounts_event.py
...n_static/xin_setting/xin_discounts/xin_discounts_event.py
+203
-0
xin_school.py
...roject_patriarch_app/xin_static/xin_setting/xin_school.py
+70
-0
xin_time.py
script/xin_project_patriarch_app/xin_static/xin_time.py
+133
-0
__init__.py
...xin_project_patriarch_app/xin_static/xin_user/__init__.py
+0
-0
jky_user.yaml
...n_project_patriarch_app/xin_static/xin_user/jky_user.yaml
+5
-0
patriarch_user
..._project_patriarch_app/xin_static/xin_user/patriarch_user
+0
-0
xin_jky_pc_login.py
...ect_patriarch_app/xin_static/xin_user/xin_jky_pc_login.py
+93
-0
xin_patriarch_login.py
..._patriarch_app/xin_static/xin_user/xin_patriarch_login.py
+75
-0
__init__.py
...xin_project_patriarch_app/xin_static/xin_yaml/__init__.py
+4
-0
xin_read_yaml.py
...roject_patriarch_app/xin_static/xin_yaml/xin_read_yaml.py
+19
-0
xin_write_yaml.py
...oject_patriarch_app/xin_static/xin_yaml/xin_write_yaml.py
+25
-0
No files found.
.idea/codeStyles/codeStyleConfig.xml
0 → 100644
View file @
6470c516
<component
name=
"ProjectCodeStyleConfiguration"
>
<state>
<option
name=
"PREFERRED_PROJECT_CODE_STYLE"
value=
"Default"
/>
</state>
</component>
\ No newline at end of file
.idea/jk_interface_test.iml
View file @
6470c516
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
7 (GeekInterfaceTest)
"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
8
"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
<component
name=
"PyDocumentationSettings"
>
<component
name=
"PyDocumentationSettings"
>
...
...
.idea/misc.xml
View file @
6470c516
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
7 (GeekInterfaceTest)
"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
8
"
project-jdk-type=
"Python SDK"
/>
</project>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
6470c516
This diff is collapsed.
Click to expand it.
common/common_config.py
View file @
6470c516
common_config
=
{
common_config
=
{
"host"
:
"http
s://yf1.jkwljy.com
"
,
"host"
:
"http
://172.10.62.94
"
,
"db_config"
:
{
"db_config"
:
{
'database'
:
'edu-admin'
,
'database'
:
'edu-admin'
,
"user"
:
'read_user'
,
"user"
:
'read_user'
,
...
...
run.py
View file @
6470c516
...
@@ -6,7 +6,7 @@ if __name__ == '__main__':
...
@@ -6,7 +6,7 @@ if __name__ == '__main__':
run_config
=
[
run_config
=
[
"-s"
,
"./script/ji_yun_ying_pc/statistical_report/test_receipt_detail.py"
,
"-s"
,
"./script/ji_yun_ying_pc/statistical_report/test_receipt_detail.py"
,
"--alluredir"
,
"./report/xml"
,
"--alluredir"
,
"./report/xml"
,
"--host"
,
"http://1
92.168.32.36
"
,
"--host"
,
"http://1
72.10.62.94
"
,
"--account"
,
"b"
,
"--account"
,
"b"
,
"--db"
,
"36"
"--db"
,
"36"
]
]
...
...
script/conftest.py
View file @
6470c516
...
@@ -10,7 +10,7 @@ from script.base_api.service_user.departments import departments_schools_get
...
@@ -10,7 +10,7 @@ from script.base_api.service_user.departments import departments_schools_get
def
pytest_addoption
(
parser
):
def
pytest_addoption
(
parser
):
# 注册一个命令行选项host
# 注册一个命令行选项host
parser
.
addoption
(
"--host"
,
default
=
"http
s://yf1.jkwljy.com
"
,
dest
=
"env"
,
help
=
"set test run env"
)
parser
.
addoption
(
"--host"
,
default
=
"http
://172.10.62.94
"
,
dest
=
"env"
,
help
=
"set test run env"
)
# 注册一个命令行选项db
# 注册一个命令行选项db
parser
.
addoption
(
"--db"
,
default
=
"yf1"
,
dest
=
"db"
,
help
=
"set test database"
)
parser
.
addoption
(
"--db"
,
default
=
"yf1"
,
dest
=
"db"
,
help
=
"set test database"
)
# 注册一个命令行选项account
# 注册一个命令行选项account
...
...
script/xin_project_patriarch_app/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_choose_class.py
0 → 100644
View file @
6470c516
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_classes.py
0 → 100644
View file @
6470c516
import
datetime
import
time
import
jsonpath
import
pytest
from
pytest_assume.plugin
import
assume
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_auth_class
import
QueryClass
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_pay_order
import
PayOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_save_order
import
SaveOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
"""
学生没有购买过班级
"""
class
TestAuthNotBuyClasses
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'geek1234'
)
.
get_auth_headers
()
"""
验证没有报班,班级列表为空
"""
def
test_query_new_students
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
"""
学生购买了常规班,副线班,精品班
"""
class
TestAuthHaveClasses
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
self
.
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
self
.
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
create_class_data
=
[[
'主线课程'
,
'极趣班'
,
'常规班课'
,
'数学'
],
[
'主线课程'
,
'极思班'
,
'常规班课'
,
'语文'
],
[
'主线课程'
,
'极智班'
,
'常规班课'
,
'英语'
],
[
'主线课程'
,
'一对一定制班'
,
'精品定制课'
,
'数学'
],
[
'副线课程'
,
'专题'
,
'专题班课'
,
'数学'
],
[
'副线课程'
,
'五四制班'
,
'集训班课'
,
'语文'
],
[
'副线课程'
,
'公开课'
,
'服务班课'
,
'英语'
]]
self
.
details
=
[]
for
class_data
in
self
.
create_class_data
:
self
.
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
class_data
[
0
],
classType
=
class_data
[
1
],
courseType
=
class_data
[
2
],
subject
=
class_data
[
3
],
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
self
.
course_id
)
.
create_class
()[
'classId'
]
self
.
details
.
append
({
"classId"
:
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
})
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
700
,
details
=
self
.
details
)
.
save_order
()[
'data'
]
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
700
}
])
.
pay_order
()
time
.
sleep
(
2
)
def
test_query_all
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classId'
)[
0
]
==
self
.
details
[
0
][
'classId'
]
def
test_query_have_subject
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
==
'数学'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
!=
'语文'
def
test_query_not_subject
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'语文'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
def
test_query_classType
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
==
'常规班课'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
!=
'精品定制课'
def
test_query_not_classType
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'集训班课'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
def
test_query_classTerm
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'春'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
==
'春'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
!=
'秋'
def
test_query_not_classTerm
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'寒'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
def
test_query_all_option
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
],
classTerms
=
[
'春'
],
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
'春'
in
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)
with
assume
:
assert
'秋'
not
in
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)
with
assume
:
assert
'数学'
in
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)
with
assume
:
assert
'英语'
not
in
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
'副线班课'
not
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
def
test_query_graduate
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classStatus
=
1
)
.
query_class_list
()
.
json
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_classes.py -s'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_students_classes.py
0 → 100644
View file @
6470c516
import
datetime
import
time
import
pytest
from
pytest_assume.plugin
import
assume
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_query_students_class
import
QueryStudentsClass
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_pay_order
import
PayOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_save_order
import
SaveOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_update_class
import
UpdateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
"""
学生购买班级详情
"""
class
TestAuthStudentsClassMessage
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'167'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
'主线课程'
,
classType
=
'极趣班'
,
courseType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
self
.
class_id
=
CreateClass
(
server
=
self
.
server
,
className
=
'小黄断言班级名称'
,
courseId
=
self
.
course_id
)
.
create_class
()[
'classId'
]
self
.
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
100
,
details
=
[{
"classId"
:
self
.
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
PayOrder
(
server
=
self
.
server
,
orderId
=
self
.
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
100
}
])
.
pay_order
()
time
.
sleep
(
2
)
# 断言班级名称
def
test_query_students_class
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
f
'小黄断言班级名称极趣班{StaticGlobal.YEAR}{StaticGlobal.TERM}数学'
# 断言修改后班级名称
def
test_query_students_update_className
(
self
):
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_className
(
value
=
'修改后班级名称'
)
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
'修改后班级名称'
# 断言校区
def
test_query_students_school
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'schoolName'
]
==
'测试成都校区'
# 断言没有老师
def
test_query_students_teacher
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'teacherId'
]
is
None
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
is
None
# 断言修改老师后的名字
def
test_query_students_update_teacher
(
self
):
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_teacher
(
value
=
{
"id"
:
9384
,
"name"
:
"刘黄鑫"
})
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
print
(
class_data
)
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'teacherId'
]
==
9384
with
assume
:
assert
class_data
[
'data'
][
'teacherPhone'
]
==
'17623669485'
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
==
'刘黄鑫'
# 断言学科
def
test_query_students_subject
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
print
(
class_data
)
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'subject'
]
==
'数学'
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_students_classes.py -s'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_login.py
0 → 100644
View file @
6470c516
import
allure
import
pytest
from
pytest_assume.plugin
import
assume
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_service_user.xin_employees
import
UpdateEmployees
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
@pytest.mark.run
(
order
=
1
)
class
TestAuthLogin
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
UpdateEmployees
(
server
=
self
.
server
)
.
update_employees
()
self
.
studentPho
=
'13364004418'
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'13364004418'
,
'geek1234'
]])
def
test_login01
(
self
,
username
,
password
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
==
0
with
assume
:
assert
auth_data
[
'msg'
]
==
'成功'
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'13364004418'
,
'123'
]])
def
test_login02
(
self
,
username
,
password
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'msg'
]
==
'用户名或密码错误!'
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'11111111111'
,
'geek1234'
]])
def
test_login03
(
self
,
username
,
password
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
' '
,
' '
]])
def
test_login04
(
self
,
username
,
password
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'这是中文'
,
'geek1234'
]])
def
test_login05
(
self
,
username
,
password
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
if
__name__
==
'__main__'
:
pytest
.
main
([
'xin_patriarch_login.py'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_students.py
0 → 100644
View file @
6470c516
import
jsonpath
import
pytest
import
requests
from
pytest_assume.plugin
import
assume
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
class
TestAuthStudents
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
students_url
=
'/service-profile/app/students/13364004418/mobilePhoneNumberBounding'
self
.
pushRelation_url
=
'/service-profile/app/pushRelationship'
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_headers
()
def
test_students
(
self
):
students_data
=
requests
.
get
(
url
=
self
.
server
+
self
.
students_url
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()
with
assume
:
assert
students_data
[
'code'
]
==
0
with
assume
:
assert
'小黄测试学生三年级'
in
jsonpath
.
jsonpath
(
students_data
,
'$..name'
)
with
assume
:
assert
students_data
[
'data'
][
0
][
'student'
][
'phones'
][
0
]
==
'13364004418'
def
test_push_relation
(
self
):
push_data
=
{
"deviceToken"
:
"ApVZSpXWRryWKlLIbKILYE2C_KFiVLBblNotxrxF8GiT"
,
"studentPhoneNum"
:
"13364004418"
,
"clientIdentify"
:
""
}
push_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
pushRelation_url
,
json
=
push_data
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()
with
assume
:
assert
push_data
[
'code'
]
==
0
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_students.py'
])
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_choose_class/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_choose_class/xin_choose_classes.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
ChooseClasses
:
def
__init__
(
self
,
server
,
studentId
,
schoolAreaId
,
username
=
None
,
password
=
None
):
"""
:param server: 服务
:param studentId: 学生id
:param schoolAreaId: 校区id
:param username: 用户名
:param password: 密码
"""
self
.
server
=
server
self
.
studentId
=
studentId
self
.
schoolAreaId
=
schoolAreaId
self
.
username
=
username
self
.
password
=
password
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
choose_url
=
f
'/service-profile/app/class/{self.studentId}/student/allowable'
self
.
choose_body
=
{
'schoolAreaId'
:
self
.
schoolAreaId
}
def
choose_class
(
self
):
return
requests
.
get
(
url
=
self
.
server
+
self
.
choose_url
,
params
=
self
.
choose_body
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
class
courseDetails
:
def
__init__
(
self
,
server
,
classId
,
studentId
,
username
=
None
,
password
=
None
):
"""
:param server:服务
:param classId:班级id
:param studentId:学生id
:param username:用户名
:param password:密码
"""
self
.
server
=
server
self
.
classId
=
classId
self
.
studentId
=
studentId
self
.
username
=
username
self
.
password
=
password
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
course_details_url
=
f
'/service-profile/app/class/{self.classId}/alternative/{self.studentId}/student'
def
query_course_details
(
self
):
return
requests
.
get
(
url
=
self
.
server
+
self
.
course_details_url
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
courseDetails
(
server
=
server_ip
,
classId
=
100142250
,
studentId
=
10573504
)
.
query_course_details
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_change_list_index.py
0 → 100644
View file @
6470c516
class
ChangeListIndex
:
@classmethod
def
change_list_index
(
cls
,
data
:
list
,
key_name
,
info_name
):
return
dict
((
data_msg
[
key_name
],
dict
(
data_msg
,
index
=
index
))
for
(
index
,
data_msg
)
in
enumerate
(
data
))[
info_name
]
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_global_static.py
0 → 100644
View file @
6470c516
class
StaticGlobal
:
YEAR
=
2021
TERM
=
'春'
SCHOOL
=
3052
SERVER
=
'http://172.10.62.94'
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_query_class/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_query_class/xin_auth_class.py
0 → 100644
View file @
6470c516
"""
家长APP查询学成班级
"""
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
class
QueryClass
:
def
__init__
(
self
,
server
,
studentId
:
str
,
username
:
str
,
password
=
None
,
classStatus
=
None
,
subjects
:
list
=
None
,
courseTypes
:
list
=
None
,
classTerms
:
list
=
None
,
):
self
.
server
=
server
self
.
studentId
=
studentId
self
.
username
=
username
self
.
password
=
password
self
.
classStatus
=
classStatus
or
0
self
.
subjects
=
subjects
or
[]
self
.
courseTypes
=
courseTypes
or
[]
self
.
classTerms
=
classTerms
or
[]
self
.
query_body
=
{
"classStatus"
:
self
.
classStatus
,
"subjects"
:
self
.
subjects
,
"courseTypes"
:
self
.
courseTypes
,
"classTerms"
:
self
.
classTerms
,
"studentId"
:
self
.
studentId
}
self
.
query_url
=
'/service-profile/app/course/newListStudentClasses'
self
.
auth_headers
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
username
)
.
get_auth_headers
()
def
query_class_list
(
self
):
query_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
query_url
,
json
=
self
.
query_body
,
headers
=
self
.
auth_headers
,
verify
=
False
)
return
query_data
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
QueryClass
(
server
=
server_ip
,
username
=
'13364004418'
,
studentId
=
'10573414'
)
.
query_class_list
()
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_query_class/xin_query_students_class.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
"""
家长APP学生购买班级的详细信息
"""
class
QueryStudentsClass
:
def
__init__
(
self
,
server
,
classId
,
studentId
,
username
,
password
=
None
):
"""
:param server: 服务
:param classId: 班级id
:param studentId: 学生id
:param username: 用户名
:param password: 密码
"""
self
.
server
=
server
self
.
classId
=
classId
self
.
studentId
=
studentId
self
.
username
=
username
self
.
password
=
password
self
.
url
=
'/service-profile/app/course/getStudentClassDetail'
self
.
headers
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_headers
()
self
.
body
=
{
"classId"
:
self
.
classId
,
"studentId"
:
self
.
studentId
}
def
query_student_class
(
self
):
class_data
=
requests
.
get
(
url
=
self
.
server
+
self
.
url
,
params
=
self
.
body
,
headers
=
self
.
headers
,
verify
=
False
)
return
class_data
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
query_data
=
QueryStudentsClass
(
server
=
server_ip
,
studentId
=
10573494
,
classId
=
100142234
,
username
=
13312145220
)
.
query_student_class
()
print
(
query_data
)
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_students_message/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_students_message/xin_query_students_message.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
class
QueryStudentsMessage
:
def
__init__
(
self
,
server
,
studentPno
,
password
=
None
):
"""
:param server: 服务
:param studentPno: 手机号
:param password: 密码
"""
self
.
server
=
server
self
.
studentPno
=
studentPno
self
.
password
=
password
self
.
headers
=
AuthHeaders
(
server
=
self
.
server
,
username
=
studentPno
,
password
=
password
)
.
get_auth_headers
()
self
.
query_url
=
f
'/service-profile/app/students/{self.studentPno}/mobilePhoneNumberBounding'
def
query_students_message
(
self
):
return
requests
.
get
(
url
=
self
.
server
+
self
.
query_url
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
print
(
QueryStudentsMessage
(
server
=
'http://172.10.62.94'
,
studentPno
=
13312152205
)
.
query_students_message
())
script/xin_project_patriarch_app/xin_static/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/start.py
0 → 100644
View file @
6470c516
import
jsonpath
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_network
import
NetWork
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
# courseId = CreateCourse(server=Service_get.service_content('94'), classType='新生', term='春').create_course()
# courseId = CreateCourse(server=Service_get.service_content('94'), classType='专题', courseType='专题班课', productType='副线班课', term='春').create_course()
courseId
=
CreateCourse
(
server
=
Service_get
.
service_content
(
'94'
),
classType
=
'新生'
,
courseType
=
'常规班课'
,
productType
=
'主线课程'
,
term
=
'春'
)
.
create_course
()
course_id
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseId'
)[
0
]
class_content
=
CreateClass
(
server
=
Service_get
.
service_content
(
'94'
),
courseId
=
course_id
)
.
create_class
()[
'classId'
]
print
(
NetWork
(
server
=
Service_get
.
service_content
(
'94'
),
resignClassIds
=
[
class_content
])
.
network_set
())
script/xin_project_patriarch_app/xin_static/xin_crm/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_crm/xin_apply/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_crm/xin_apply/xin_pay_order.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
PayOrder
:
def
__init__
(
self
,
server
,
orderId
,
payInfos
:
list
,
username
=
None
,
password
=
None
,
operatorId
=
None
,
operatorType
=
None
,
remark
=
None
):
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
orderId
=
orderId
self
.
operatorId
=
operatorId
or
9384
self
.
operatorType
=
operatorType
or
'STAFF'
self
.
remark
=
remark
or
''
"""
payInfos:支付方式
[
{
"payChannel": "CASH",
"payAmount": 1
},
{
"payChannel": "BOC_POS_OLD",
"payAmount": 197
}
]
"""
self
.
payInfos
=
payInfos
self
.
pay_url
=
'/api-operation-web/pay'
self
.
pay_body
=
{
"orderId"
:
self
.
orderId
,
"operatorId"
:
self
.
operatorId
,
"operatorType"
:
self
.
operatorType
,
"remark"
:
self
.
remark
,
"payInfos"
:
self
.
payInfos
}
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
def
pay_order
(
self
):
pay_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
pay_url
,
json
=
self
.
pay_body
,
headers
=
self
.
headers
,
verify
=
False
)
return
pay_data
script/xin_project_patriarch_app/xin_static/xin_crm/xin_apply/xin_place_order.py
0 → 100644
View file @
6470c516
import
requests
import
datetime
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
PlaceOrder
:
def
__init__
(
self
,
server
,
username
=
None
,
password
=
None
,
studentId
=
None
):
self
.
server
=
server
self
.
sava_order_url
=
'/api-operation-web/order/saveOrder?recommit-ticket=undefined'
self
.
pay_url
=
'/api-operation-web/pay'
self
.
username
=
username
self
.
password
=
password
self
.
studentId
=
studentId
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
sava_body
=
{
"studentId"
:
self
.
studentId
,
"schoolArea"
:
3100
,
"details"
:
[
# {
# "classId": 100141010,
# "num": 10,
# "discountId": "",
# "category": "CLASS"
# },
{
"classId"
:
100141011
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}
],
"discounts"
:
[],
"epayAmount"
:
0
,
"amount"
:
100
,
"remark"
:
""
,
"couponItemIds"
:
[]
}
def
price_order
(
self
):
sava_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
sava_order_url
,
json
=
self
.
sava_body
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()[
'data'
]
pay_body
=
{
"orderId"
:
str
(
sava_data
),
"operatorId"
:
9384
,
"operatorType"
:
"STAFF"
,
"remark"
:
""
,
"payInfos"
:
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
100
}
]
}
pay_data
=
requests
.
post
(
self
.
server
+
self
.
pay_url
,
json
=
pay_body
,
headers
=
self
.
header
,
verify
=
False
)
return
pay_data
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
Service_get
.
service_content
(
'36'
)
for
i
in
range
(
10000
):
studentName
=
'小黄测试学生'
+
str
(
i
)
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
student_id
=
CreateStudent
(
server
=
server_ip
,
studentName
=
studentName
,
publicGrade
=
'五年级'
,
contactInfo
=
studentPho
)
.
create_student
()[
'data'
][
'list'
][
0
][
'studentId'
]
print
(
f
"{studentName}-->学生创建成功!"
)
place_order
=
PlaceOrder
(
server
=
server_ip
,
studentId
=
student_id
)
.
price_order
()
if
place_order
[
'code'
]
==
0
and
place_order
[
'msg'
]
==
'成功'
:
print
(
f
"{studentName}-->购课成功!"
)
else
:
print
(
f
"{studentName}-->购课失败!{place_order}"
)
script/xin_project_patriarch_app/xin_static/xin_crm/xin_apply/xin_save_order.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
SaveOrder
:
def
__init__
(
self
,
server
,
studentId
,
details
,
amount
,
epayAmount
=
None
,
schoolArea
=
None
,
username
=
None
,
password
=
None
,
discounts
=
None
,
remark
=
None
,
couponItemIds
=
None
,
):
self
.
server
=
server
self
.
studentId
=
studentId
self
.
schoolArea
=
schoolArea
or
3052
self
.
username
=
username
self
.
password
=
password
"""
details格式如下
[
{
"classId": 100142081,
"num": 10,
"discountId": "",
"category": "CLASS"
}
]
num:购买数量
discountId:连报或者常规的ID
"""
self
.
details
=
details
"""
自定义优惠
discounts格式如下,
{
"flag": "manualInput",
"discountNum": "12",
"discountMethod": 2,
"remark": "单报转连报(F1)"
}
discountMethod:自定义方式,1是直减,2是折扣
"""
self
.
discounts
=
discounts
or
[]
self
.
epayAmount
=
epayAmount
or
0
self
.
amount
=
amount
self
.
remark
=
remark
or
""
"""
couponItemIds,优惠券的ID
"""
self
.
couponItemIds
=
couponItemIds
or
[]
self
.
save_url
=
'/api-operation-web/order/saveOrder?recommit-ticket=undefined'
self
.
body
=
{
"studentId"
:
self
.
studentId
,
"schoolArea"
:
self
.
schoolArea
,
"details"
:
self
.
details
,
"discounts"
:
self
.
discounts
,
"epayAmount"
:
self
.
epayAmount
,
"amount"
:
self
.
amount
,
"remark"
:
self
.
remark
,
"couponItemIds"
:
self
.
couponItemIds
}
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
def
save_order
(
self
):
order_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
save_url
,
json
=
self
.
body
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
return
order_data
script/xin_project_patriarch_app/xin_static/xin_crm/xin_student.py
0 → 100644
View file @
6470c516
import
requests
import
urllib3
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
CreateStudent
:
def
__init__
(
self
,
server
,
belong
=
None
,
studentName
=
None
,
studentSex
=
None
,
contactType
=
None
,
contactInfo
=
None
,
homeProvinceId
=
None
,
homeProvince
=
None
,
homeCityId
=
None
,
homeCity
=
None
,
homeDistrictId
=
None
,
homeDistrict
=
None
,
homeCountyId
=
None
,
homeCounty
=
None
,
homeAddress
=
None
,
schoolId
=
None
,
schoolName
=
None
,
publicClass
=
None
,
publicTeacher
=
None
,
publicGrade
=
None
,
birthday
=
None
,
testPaperUrls
=
None
,
score
=
None
,
sourceId
=
None
,
intentionLevel
=
None
,
introduceStudentId
=
None
,
introduceStudentName
=
None
,
introduceStudentNo
=
None
,
collectPerson
=
None
,
createSchoolAreaId
=
None
,
otherRemark
=
None
,
remark
=
None
,
classRank
=
None
,
gradeRank
=
None
,
recentScore
=
None
,
parentsHope
=
None
,
studyHabit
=
None
,
city
=
None
,
schoolProvinceName
=
None
,
schoolProvinceId
=
None
,
schoolCityId
=
None
,
schoolCityName
=
None
,
username
=
None
,
password
=
None
,
):
self
.
server
=
server
self
.
belong
=
belong
or
"PUBLIC"
self
.
studentName
=
studentName
or
"小黄测试学生"
self
.
studentSex
=
studentSex
or
"NONE"
self
.
contactType
=
contactType
or
"PHONE"
self
.
contactInfo
=
contactInfo
or
"13364004418"
self
.
homeProvinceId
=
homeProvinceId
or
""
self
.
homeProvince
=
homeProvince
or
""
self
.
homeCityId
=
homeCityId
or
""
self
.
homeCity
=
homeCity
or
""
self
.
homeDistrictId
=
homeDistrictId
or
""
self
.
homeDistrict
=
homeDistrict
or
""
self
.
homeCountyId
=
homeCountyId
or
""
self
.
homeCounty
=
homeCounty
or
""
self
.
homeAddress
=
homeAddress
or
""
self
.
schoolId
=
schoolId
or
13130
self
.
schoolName
=
schoolName
or
"成都市草堂小学子美分校"
self
.
publicClass
=
publicClass
or
""
self
.
publicTeacher
=
publicTeacher
or
""
self
.
publicGrade
=
publicGrade
or
"三年级"
self
.
birthday
=
birthday
or
""
self
.
testPaperUrls
=
testPaperUrls
or
""
self
.
score
=
score
or
""
self
.
sourceId
=
sourceId
or
101
self
.
intentionLevel
=
intentionLevel
or
"S"
self
.
introduceStudentId
=
introduceStudentId
or
""
self
.
introduceStudentName
=
introduceStudentName
or
""
self
.
introduceStudentNo
=
introduceStudentNo
or
""
self
.
collectPerson
=
collectPerson
or
"刘黄鑫"
self
.
createSchoolAreaId
=
createSchoolAreaId
or
3052
self
.
otherRemark
=
otherRemark
or
""
self
.
remark
=
remark
or
""
self
.
classRank
=
classRank
or
""
self
.
gradeRank
=
gradeRank
or
""
self
.
recentScore
=
recentScore
or
""
self
.
parentsHope
=
parentsHope
or
""
self
.
studyHabit
=
studyHabit
or
""
self
.
city
=
city
or
510100
self
.
schoolProvinceName
=
schoolProvinceName
or
"四川省"
self
.
schoolProvinceId
=
schoolProvinceId
or
510100
self
.
schoolCityId
=
schoolCityId
or
510100
self
.
schoolCityName
=
schoolCityName
or
"成都"
self
.
createSchoolAreaId
=
createSchoolAreaId
or
3052
self
.
username
=
username
self
.
password
=
password
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
super
()
.
__init__
()
def
create_student
(
self
):
create_url
=
'/service-crm/clue/manualInputAdd'
create_body
=
{
"belong"
:
self
.
belong
,
"studentName"
:
self
.
studentName
+
self
.
publicGrade
,
"studentSex"
:
self
.
studentSex
,
"contactType"
:
self
.
contactType
,
"contactInfo"
:
self
.
contactInfo
,
"homeProvinceId"
:
self
.
homeProvinceId
,
"homeProvince"
:
self
.
homeProvince
,
"homeCityId"
:
self
.
homeCityId
,
"homeCity"
:
self
.
homeCity
,
"homeDistrictId"
:
self
.
homeDistrictId
,
"homeDistrict"
:
self
.
homeDistrict
,
"homeCountyId"
:
self
.
homeCountyId
,
"homeCounty"
:
self
.
homeCounty
,
"homeAddress"
:
self
.
homeAddress
,
"schoolId"
:
self
.
schoolId
,
"schoolName"
:
self
.
schoolName
,
"publicClass"
:
self
.
publicClass
,
"publicTeacher"
:
self
.
publicTeacher
,
"publicGrade"
:
self
.
publicGrade
,
"birthday"
:
self
.
birthday
,
"testPaperUrls"
:
self
.
testPaperUrls
,
"score"
:
self
.
score
,
"sourceId"
:
self
.
sourceId
,
"intentionLevel"
:
self
.
intentionLevel
,
"introduceStudentId"
:
self
.
introduceStudentId
,
"introduceStudentName"
:
self
.
introduceStudentName
,
"introduceStudentNo"
:
self
.
introduceStudentNo
,
"collectPerson"
:
self
.
collectPerson
,
"createSchoolAreaId"
:
self
.
createSchoolAreaId
,
"otherRemark"
:
self
.
otherRemark
,
"remark"
:
self
.
remark
,
"classRank"
:
self
.
classRank
,
"gradeRank"
:
self
.
gradeRank
,
"recentScore"
:
self
.
recentScore
,
"parentsHope"
:
self
.
parentsHope
,
"studyHabit"
:
self
.
studyHabit
,
"city"
:
self
.
city
,
"schoolProvinceName"
:
self
.
schoolProvinceName
,
"schoolProvinceId"
:
self
.
schoolProvinceId
,
"schoolCityId"
:
self
.
schoolCityId
,
"schoolCityName"
:
self
.
schoolCityName
}
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
json_data
=
requests
.
post
(
url
=
self
.
server
+
create_url
,
json
=
create_body
,
headers
=
self
.
header
,
verify
=
False
)
if
json_data
.
json
()[
'code'
]
==
0
and
json_data
.
json
()[
'msg'
]
==
'成功'
:
query_url
=
'/service-crm/clue/queryAll'
query_body
=
{
"belong"
:
"PUBLIC"
,
"status"
:
"UNASSIGNED"
,
"pageNum"
:
1
,
"pageSize"
:
10
,
"studentName"
:
self
.
contactInfo
,
"intentionLevel"
:
self
.
intentionLevel
,
"publicGrade"
:
self
.
publicGrade
,
"field"
:
"create_time"
,
"orderType"
:
"desc"
,
"orderField"
:
"id"
,
"schoolAreas"
:
[
self
.
createSchoolAreaId
or
3052
]
}
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
student_data
=
requests
.
post
(
url
=
self
.
server
+
query_url
,
json
=
query_body
,
headers
=
self
.
header
,
verify
=
False
)
return
student_data
.
json
()
else
:
return
json_data
.
json
()
class
DeleteStudent
:
def
__init__
(
self
,
server
,
student
:
list
,
username
=
None
,
password
=
None
):
self
.
server
=
server
self
.
student
=
student
self
.
username
=
username
self
.
password
=
password
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
password
)
.
get_headers
()
def
delete_student
(
self
):
delete_url
=
'/service-crm/clue/delete'
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
delete_data
=
requests
.
delete
(
url
=
self
.
server
+
delete_url
,
json
=
self
.
student
,
headers
=
self
.
header
,
verify
=
False
)
return
delete_data
.
json
()
if
__name__
==
'__main__'
:
print
(
CreateStudent
(
server
=
Service_get
.
service_content
(
'94'
),
studentName
=
'阿黄测试11'
)
.
create_student
())
# print(DeleteStudent(server=Service_get.service_content('94'), student=[377963]).delete_student())
script/xin_project_patriarch_app/xin_static/xin_educational/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py
0 → 100644
View file @
6470c516
import
jsonpath
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
CreateClass
:
def
__init__
(
self
,
server
,
courseId
,
phase
=
None
,
classNo
=
None
,
classAbbreviation
=
None
,
classBeginDate
=
None
,
schoolArea
=
None
,
classSchedule
=
None
,
classroomId
=
None
,
teacherId
=
None
,
directorId
=
None
,
classStudentNum
=
None
,
courseNumber
=
None
,
duration
=
None
,
className
=
None
,
username
=
None
,
password
=
None
,
classroomName
=
None
):
self
.
server
=
server
self
.
phase
=
phase
self
.
classNo
=
classNo
self
.
classAbbreviation
=
classAbbreviation
self
.
classBeginDate
=
classBeginDate
self
.
schoolArea
=
schoolArea
self
.
classSchedule
=
classSchedule
self
.
classroomId
=
classroomId
self
.
courseId
=
courseId
self
.
teacherId
=
teacherId
self
.
directorId
=
directorId
self
.
classStudentNum
=
classStudentNum
self
.
courseNumber
=
courseNumber
self
.
duration
=
duration
self
.
className
=
className
or
'小黄测试'
self
.
username
=
username
self
.
password
=
password
self
.
classroomName
=
classroomName
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
def
create_class
(
self
):
class_url
=
'/service-education/education/classes/add?recommit-ticket=temp-ticket'
course_url
=
'/service-education/education/courses/query?pageNum=1&pageSize=10'
course_data
=
{
"courseName"
:
self
.
courseId
,
"type"
:
"click"
,
"schoolAreas"
:
[
self
.
schoolArea
]
}
courseId
=
requests
.
post
(
url
=
self
.
server
+
course_url
,
json
=
course_data
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()
if
courseId
[
'code'
]
!=
0
:
return
courseId
year
=
jsonpath
.
jsonpath
(
courseId
,
'$...year'
)[
0
]
subject
=
jsonpath
.
jsonpath
(
courseId
,
'$...subject'
)[
0
]
term
=
jsonpath
.
jsonpath
(
courseId
,
'$...term'
)[
0
]
registerGrade
=
jsonpath
.
jsonpath
(
courseId
,
'$...registerGrade'
)[
0
]
classType
=
jsonpath
.
jsonpath
(
courseId
,
'$...classType'
)[
0
]
self
.
courseId
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseId'
)[
0
]
courseType
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseType'
)[
0
]
if
courseType
!=
"精品定制课"
:
self
.
courseNumber
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseNumber'
)[
0
]
coursePeriod
=
jsonpath
.
jsonpath
(
courseId
,
'$...coursePeriod'
)[
0
]
self
.
duration
=
float
(
coursePeriod
)
/
int
(
self
.
courseNumber
)
class_data
=
{
"phase"
:
self
.
phase
or
1
,
"classNo"
:
self
.
classNo
or
"测试班级"
,
"classAbbreviation"
:
self
.
classAbbreviation
or
self
.
courseId
,
"classBeginDate"
:
Time_get
()
.
get_before_week_time_start
(),
"schoolArea"
:
self
.
schoolArea
or
3052
,
"classSchedule"
:
[
{
"week"
:
"星期一"
,
"beginTime"
:
"07:15:00"
,
"endTime"
:
"07:20:00"
,
"duration"
:
1
,
"classroomId"
:
self
.
classroomId
,
"classroomName"
:
self
.
classroomName
or
'常规全天'
}
]
if
self
.
classroomId
and
self
.
classSchedule
else
[],
"classroomId"
:
self
.
classroomId
or
10009686
,
"courseId"
:
self
.
courseId
,
"teacherId"
:
self
.
teacherId
or
9384
,
"directorId"
:
self
.
directorId
or
9384
,
"classStudentNum"
:
self
.
classStudentNum
or
"10"
,
"duration"
:
self
.
duration
or
10
,
"courseNumber"
:
self
.
courseNumber
or
10
,
"className"
:
self
.
className
+
classType
+
str
(
year
)
+
term
+
subject
}
if
courseType
!=
"常规班课"
:
class_data
.
pop
(
'phase'
)
if
self
.
classroomId
is
None
:
class_data
.
pop
(
'classroomId'
)
if
self
.
teacherId
is
None
:
class_data
.
pop
(
'teacherId'
)
add_class_data
=
requests
.
post
(
url
=
self
.
server
+
class_url
,
json
=
class_data
,
headers
=
self
.
header
,
verify
=
False
)
if
add_class_data
.
json
()[
'code'
]
==
0
:
query_url
=
'/service-education/education/classes/query'
query_data
=
{
"pageSize"
:
30
,
"pageNum"
:
1
,
'className'
:
self
.
className
,
"courseType"
:
courseType
,
"classType"
:
classType
,
"year"
:
year
,
"term"
:
term
,
"grade"
:
registerGrade
,
"subject"
:
subject
,
"classStatus"
:
"在读"
,
"schoolAreaIds"
:
[
self
.
schoolArea
or
3052
]
}
query_class
=
requests
.
post
(
url
=
self
.
server
+
query_url
,
json
=
query_data
,
headers
=
self
.
header
,
verify
=
False
)
return
query_class
.
json
()[
'data'
][
'list'
][
0
]
else
:
return
add_class_data
.
json
()
if
__name__
==
'__main__'
:
course_id
=
CreateCourse
(
server
=
Service_get
.
service_content
(
'94'
))
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
print
(
CreateClass
(
server
=
Service_get
.
service_content
(
'94'
),
courseId
=
course_id
)
.
create_class
()[
'classId'
])
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
DeleteClass
:
def
__init__
(
self
,
server
,
classes
:
list
,
username
=
None
,
password
=
None
,
):
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
classes
=
classes
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
url
=
'/service-education/education/classes/delete'
def
delete_class
(
self
):
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
classes
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
delete_data
=
DeleteClass
(
server
=
server_ip
,
classes
=
[
100142200
])
.
delete_class
()
print
(
delete_data
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
UpdateClass
:
def
__init__
(
self
,
server
,
classId
,
username
=
None
,
password
=
None
,
):
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
classId
=
classId
self
.
body
=
{
"classId"
:
self
.
classId
}
self
.
update_url
=
'/service-education/education/classes/optionalUpdate'
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
# 修改班级名称
def
update_class_className
(
self
,
value
):
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"className"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改班级简称
def
update_class_abbreviation
(
self
,
value
):
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"classAbbreviation"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改期数
def
update_class_phase
(
self
,
value
):
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"phase"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改老师
def
update_class_teacher
(
self
,
value
:
dict
):
"""
value格式如下,id是老师的id,name是teacher的name
{
"id":9382,
"name":"体验账号-英语"
}
"""
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"teacher"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改教室
def
update_class_classroom
(
self
,
value
:
dict
):
"""
value格式如下,id是classroom的id,name是classroom的name
{
"id":10009903,
"name":"LQ教室1"
}
"""
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"classroom"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改预招收人数
def
update_class_studentNum
(
self
,
value
):
studentNum_url
=
'/service-education/education/classes/update/limit'
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"studentNum"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
studentNum_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改满班目标
def
update_class_targetNum
(
self
,
value
):
targetNum_url
=
'/service-education/education/classes/update/targetNum'
fields
=
{
'fields'
:
[
{
"value"
:
value
,
"name"
:
"targetNum"
}
]}
return
requests
.
post
(
url
=
self
.
server
+
targetNum_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改班主任
def
update_class_employee
(
self
,
value
):
employee_url
=
'/service-education/classDirector/update'
fields
=
{
"employeeId"
:
value
}
return
requests
.
post
(
url
=
self
.
server
+
employee_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改是否属于外地生班
def
update_class_outLandClass
(
self
,
value
:
bool
):
outLandClass_url
=
'/service-education/education/classes/optionalUpdate'
fields
=
{
"fields"
:
[
{
"name"
:
"outlandClass"
,
"value"
:
value
}
]}
return
requests
.
post
(
url
=
self
.
server
+
outLandClass_url
,
json
=
dict
(
fields
,
**
self
.
body
),
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
# 修改排课
def
update_class_schedule
(
self
,
classSchedule
):
"""
classSchedule格式如下
[
{
"classScheduleId": 0,
"date": "2021-04-19 00:00:00",
"week": "星期一",
"beginTime": "11:35:00",
"endTime": "11:40:00",
"duration": 1,
"classScheduleIndex": 1,
"employeeNumber": "TEST007",
"classTeacher": "体验账号-英语",
"classTeacherId": 9382,
"classroomId": 10009903,
"classroomName": "LQ教室1"
}
]
"""
schedule_url
=
'/service-education/education/classes/update'
data
=
{
"classSchedule"
:
classSchedule
}
return
requests
.
post
(
url
=
self
.
server
+
schedule_url
,
json
=
data
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
UpdateClass
(
server
=
server_ip
,
classId
=
100142200
)
.
update_class_schedule
(
'111'
)
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
CreateCourse
:
def
__init__
(
self
,
server
,
username
=
None
,
password
=
None
,
courseName
=
None
,
term
=
None
,
subject
=
None
,
productType
=
None
,
year
=
None
,
classType
=
None
,
grade
=
None
,
coursePeriod
=
None
,
courseType
=
None
,
courseNumber
=
None
,
normalPrice
=
None
,
coursePrice
=
None
,
courseStatus
=
None
,
teachForm
=
None
,
courseDesc
=
None
,
priceType
=
None
,
isTerm
=
None
,
perPeriodDuration
=
None
,
isNormal
=
None
,
sectionSetting
:
int
=
None
,
uphalfCoursePeriod
:
str
=
None
,
downhalfCoursePeriod
:
int
=
None
,
totalPrice
=
None
,
registerGrade
=
None
,
schools
:
list
=
None
,
cContent
=
None
,
):
self
.
courseName
=
courseName
or
"小黄测试课程"
self
.
term
=
term
or
"春"
self
.
subject
=
subject
or
"数学"
self
.
productType
=
productType
or
"主线课程"
self
.
year
=
year
or
2021
self
.
classType
=
classType
or
"极趣班"
self
.
grade
=
grade
or
"三年级"
self
.
coursePeriod
=
coursePeriod
or
"10"
self
.
courseType
=
courseType
or
"常规班课"
self
.
courseNumber
=
courseNumber
or
"10"
self
.
normalPrice
=
normalPrice
or
"10"
self
.
coursePrice
=
coursePrice
or
"10"
self
.
courseStatus
=
courseStatus
or
"1"
self
.
teachForm
=
teachForm
or
"offline"
self
.
courseDesc
=
courseDesc
or
""
"""
priceType,1是按课时收费,2是按期收费,注意按期收费的单价要自己算好再传,我没有验证
"""
self
.
priceType
=
priceType
or
1
self
.
isTerm
=
isTerm
or
False
self
.
perPeriodDuration
=
perPeriodDuration
or
5
self
.
isNormal
=
isNormal
or
1
"""
sectionSetting,是分段支付的标志,1是分段,不传是不分段
"""
self
.
sectionSetting
=
sectionSetting
self
.
uphalfCoursePeriod
=
uphalfCoursePeriod
self
.
downhalfCoursePeriod
=
downhalfCoursePeriod
self
.
totalPrice
=
totalPrice
or
100
self
.
registerGrade
=
registerGrade
or
"三年级"
self
.
schools
=
schools
or
[
{
"area"
:
3013
,
"schoolArea"
:
3052
}
]
self
.
cContent
=
cContent
or
[]
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
"""
新增课程
"""
def
create_course
(
self
):
course_url
=
'/service-education/education/courses/add?recommit-ticket=temp-ticket'
course_body
=
[
{
"courseName"
:
self
.
courseName
+
self
.
classType
+
self
.
courseType
,
"term"
:
self
.
term
,
"subject"
:
self
.
subject
,
"productType"
:
self
.
productType
,
"year"
:
self
.
year
,
"classType"
:
self
.
classType
,
"grade"
:
self
.
grade
,
"coursePeriod"
:
self
.
coursePeriod
,
"courseType"
:
self
.
courseType
,
"courseNumber"
:
self
.
courseNumber
,
"normalPrice"
:
self
.
normalPrice
,
"coursePrice"
:
self
.
coursePrice
,
"courseStatus"
:
self
.
courseStatus
,
"teachForm"
:
self
.
teachForm
,
"courseDesc"
:
self
.
courseDesc
,
"priceType"
:
self
.
priceType
,
"isTerm"
:
self
.
isTerm
,
"perPeriodDuration"
:
self
.
perPeriodDuration
,
"isNormal"
:
self
.
isNormal
,
"totalPrice"
:
self
.
totalPrice
,
"registerGrade"
:
self
.
registerGrade
,
"schools"
:
self
.
schools
,
"cContent"
:
self
.
cContent
}
]
if
self
.
courseType
==
'精品定制课'
:
course_body
[
0
]
.
pop
(
'coursePeriod'
)
course_body
[
0
]
.
pop
(
'courseNumber'
)
course_body
[
0
]
.
pop
(
'isTerm'
)
course_body
[
0
]
.
pop
(
'isNormal'
)
if
self
.
sectionSetting
is
not
None
:
course_body
[
0
][
'sectionSetting'
]
=
self
.
sectionSetting
course_body
[
0
][
'uphalfCoursePeriod'
]
=
self
.
uphalfCoursePeriod
course_body
[
0
][
'downhalfCoursePeriod'
]
=
self
.
downhalfCoursePeriod
course_data
=
requests
.
post
(
url
=
self
.
server
+
course_url
,
json
=
course_body
,
headers
=
self
.
header
,
verify
=
False
)
if
course_data
.
json
()[
'code'
]
==
0
and
course_data
.
json
()[
'msg'
]
==
'成功'
:
query_url
=
'/service-education/education/courses/query?pageNum=1&pageSize=10'
schoolAreas
=
list
()
if
self
.
schools
is
None
:
schoolAreas
.
append
(
3052
)
else
:
for
schools_data
in
self
.
schools
:
schoolAreas
.
append
(
schools_data
[
'schoolArea'
])
query_data
=
{
"classType"
:
self
.
classType
,
"courseName"
:
self
.
courseName
,
"courseType"
:
self
.
courseType
,
"year"
:
self
.
year
,
"term"
:
self
.
term
,
"grade"
:
self
.
grade
,
"subject"
:
self
.
subject
,
"courseStatus"
:
self
.
courseStatus
,
"type"
:
"click"
,
"schoolAreas"
:
schoolAreas
}
query_content
=
requests
.
post
(
url
=
self
.
server
+
query_url
,
json
=
query_data
,
headers
=
self
.
header
,
verify
=
False
)
return
query_content
.
json
()
else
:
return
course_data
.
json
()
class
DeleteCourse
:
def
__init__
(
self
,
server
,
course
:
list
,
username
=
None
,
password
=
None
):
self
.
server
=
server
self
.
course
=
course
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
"""
删除课程
"""
def
delete_course
(
self
):
delete_url
=
'/service-education/education/courses/delete'
delete_data
=
requests
.
delete
(
url
=
self
.
server
+
delete_url
,
json
=
self
.
course
,
headers
=
self
.
header
,
verify
=
False
)
return
delete_data
.
json
()
if
__name__
==
'__main__'
:
print
(
CreateCourse
(
server
=
Service_get
.
service_content
(
'94'
))
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
])
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py
0 → 100644
View file @
6470c516
import
requests
from
script.base_api
import
education_courses_modifyPrice_post
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
def
query_course
(
server
,
courseId
,
headers
):
"""
:param server: 服务
:param headers: 请求头
:param courseId: 课程ID
:return:
"""
query_url
=
'/service-education/education/courses/queryById'
query_data
=
{
"courseId"
:
courseId
,
"judgeUsed"
:
True
,
}
return
requests
.
get
(
url
=
server
+
query_url
,
params
=
query_data
,
headers
=
headers
,
verify
=
False
)
.
json
()
"""
修改课程信息
"""
class
UpdateCourse
:
def
__init__
(
self
,
server
,
courseId
,
username
=
None
,
password
=
None
,
courseName
=
None
,
term
=
None
,
subject
=
None
,
grade
=
None
,
year
=
None
,
classType
=
None
,
teachForm
=
None
,
registerGrade
=
None
,
sectionSetting
=
None
,
uphalfCoursePeriod
=
None
,
downhalfCoursePeriod
=
None
):
"""
:param server: 环境
:param courseId: 课程id
:param username: 用户名
:param password: 密码
:param courseName: 修改的课程名
:param term: 期段
:param subject: 学科
:param grade: 年级
:param year: 年份
:param classType: 公开课,辅导课,讲座
:param teachForm: 线上,online,面授,offline
:param registerGrade: 网报年级
:param sectionSetting: 设置上下分段 0不分段,1分段
:param uphalfCoursePeriod:上的课时,不分段时为null
:param downhalfCoursePeriod: 下的课时,不分段时为null
"""
self
.
server
=
server
self
.
courseId
=
courseId
self
.
username
=
username
self
.
password
=
password
self
.
courseName
=
courseName
self
.
term
=
term
self
.
subject
=
subject
self
.
grade
=
grade
self
.
year
=
year
self
.
classType
=
classType
self
.
teachForm
=
teachForm
self
.
registerGrade
=
registerGrade
self
.
sectionSetting
=
sectionSetting
self
.
uphalfCoursePeriod
=
uphalfCoursePeriod
self
.
downhalfCoursePeriod
=
downhalfCoursePeriod
self
.
update_url
=
'/service-education/education/update/course/class'
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
def
update_course
(
self
):
course_data
=
query_course
(
server
=
self
.
server
,
courseId
=
self
.
courseId
,
headers
=
self
.
headers
)
update_data
=
{
"courseId"
:
self
.
courseId
,
"courseName"
:
self
.
courseName
or
course_data
[
'data'
][
'course'
][
'courseName'
],
"term"
:
self
.
term
or
course_data
[
'data'
][
'course'
][
'term'
],
"subject"
:
self
.
subject
or
course_data
[
'data'
][
'course'
][
'subject'
],
"grade"
:
self
.
grade
or
course_data
[
'data'
][
'course'
][
'grade'
],
"year"
:
self
.
year
or
course_data
[
'data'
][
'course'
][
'year'
],
"classType"
:
self
.
classType
or
course_data
[
'data'
][
'course'
][
'classType'
],
"teachForm"
:
self
.
teachForm
or
course_data
[
'data'
][
'course'
][
'teachForm'
],
"registerGrade"
:
self
.
registerGrade
or
course_data
[
'data'
][
'course'
][
'registerGrade'
],
"sectionSetting"
:
self
.
sectionSetting
or
course_data
[
'data'
][
'course'
][
'sectionSetting'
],
"uphalfCoursePeriod"
:
self
.
uphalfCoursePeriod
or
course_data
[
'data'
][
'course'
][
'uphalfCoursePeriod'
],
"downhalfCoursePeriod"
:
self
.
downhalfCoursePeriod
or
course_data
[
'data'
][
'course'
][
'downhalfCoursePeriod'
]
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_url
,
json
=
update_data
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
"""
修改课程价格
"""
class
UpdateCoursePrice
:
def
__init__
(
self
,
server
,
courseId
,
username
=
None
,
password
=
None
,
normalPrice
=
None
,
isNormal
=
None
,
coursePrice
=
None
):
"""
:param server: 服务
:param courseId: 课程id
:param username: 用户名
:param password: 密码
:param normalPrice: 标准价
:param isNormal: 正价课或低价课,1正价,2低价
:param coursePrice:课程单价
"""
self
.
server
=
server
self
.
courseId
=
courseId
self
.
username
=
username
self
.
password
=
password
self
.
normalPrice
=
normalPrice
self
.
isNormal
=
isNormal
self
.
coursePrice
=
coursePrice
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
update_price_url
=
'/service-education/education/courses/modifyPrice'
def
update_course_price
(
self
):
course_data
=
query_course
(
server
=
self
.
server
,
courseId
=
self
.
courseId
,
headers
=
self
.
headers
)
update_price_data
=
{
"courseId"
:
self
.
courseId
,
"normalPrice"
:
self
.
normalPrice
or
course_data
[
'data'
][
'course'
][
'normalPrice'
],
"isNormal"
:
self
.
isNormal
or
course_data
[
'data'
][
'course'
][
'isNormal'
],
"coursePrice"
:
self
.
coursePrice
or
course_data
[
'data'
][
'course'
][
'coursePrice'
],
"totalPrice"
:
course_data
[
'data'
][
'course'
][
'totalPrice'
]
if
self
.
coursePrice
is
None
or
course_data
[
'data'
][
'course'
][
'courseType'
]
==
'精品定制课'
else
float
(
course_data
[
'data'
][
'course'
][
'courseNumber'
])
*
self
.
coursePrice
}
if
course_data
[
'data'
][
'course'
][
'courseType'
]
==
'精品定制课'
:
update_price_data
.
pop
(
'isNormal'
)
return
education_courses_modifyPrice_post
(
header
=
self
.
headers
,
body
=
update_price_data
,
default_assert
=
False
)
# return requests.post(url=self.server + self.update_price_url, json=update_price_data, headers=self.headers, verify=False).json()
"""
修改课程校区
"""
class
UpdateCourseSchool
:
def
__init__
(
self
,
server
,
courseId
,
schools
:
list
,
username
=
None
,
password
=
None
):
"""
:param server: 服务
:param courseId: 课程id
:param schools:[{"area": 3013,"schoolArea": 3015}]
:param username: 用户名
:param password: 密码
"""
self
.
server
=
server
self
.
courseId
=
courseId
self
.
schools
=
schools
self
.
username
=
username
self
.
password
=
password
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
update_school_url
=
'/service-education/education/courses/courseArea'
self
.
update_body
=
{
"courseId"
:
self
.
courseId
,
"schools"
:
self
.
schools
}
def
update_course_school
(
self
):
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_school_url
,
json
=
self
.
update_body
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
UpdateCoursePrice
(
server
=
server_ip
,
courseId
=
10035293
,
coursePrice
=
100
)
.
update_course_price
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
"""
网报设置,传入班级的ID,类型是list
"""
class
NetWork
:
def
__init__
(
self
,
server
,
resignClassIds
:
list
,
username
=
None
,
password
=
None
,
classSaleBeginDate
=
None
,
classSaleEndDate
=
None
,
classSignBeginDate
=
None
,
classSignEndDate
=
None
,
classResignBeginDate
=
None
,
classResignEndDate
=
None
,
):
"""
:param server: 服务
:param resignClassIds: 班级id
:param username: 用户名
:param password: 密码
:param classSaleBeginDate:上架开始时间
:param classSaleEndDate:上架结束时间
:param classSignBeginDate:报名时间
:param classSignEndDate:报名结束时间
:param classResignBeginDate:原班续报开始时间(已作废)
:param classResignEndDate:原班续报结束时间(已作废)
"""
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
resignClassIds
=
resignClassIds
self
.
classSaleBeginDate
=
classSaleBeginDate
or
Time_get
.
get_before_month_time_end
(
second
=
True
)
self
.
classSaleEndDate
=
classSaleEndDate
or
Time_get
.
get_after_month_time_end
(
second
=
True
)
self
.
classSignBeginDate
=
classSignBeginDate
or
Time_get
.
get_before_month_time_end
(
second
=
True
)
self
.
classSignEndDate
=
classSignEndDate
or
Time_get
.
get_after_month_time_end
(
second
=
True
)
self
.
classResignBeginDate
=
classResignBeginDate
or
""
self
.
classResignEndDate
=
classResignEndDate
or
""
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
def
network_set
(
self
):
data
=
{
"resignClassIds"
:
self
.
resignClassIds
,
"classSaleBeginDate"
:
self
.
classSaleBeginDate
,
"classSaleEndDate"
:
self
.
classSaleEndDate
,
"classSignBeginDate"
:
self
.
classSignBeginDate
,
"classSignEndDate"
:
self
.
classSignEndDate
,
"classResignBeginDate"
:
self
.
classResignBeginDate
,
"classResignEndDate"
:
self
.
classResignEndDate
}
network_url
=
'/service-education/education/classes/update/resignClassInfo'
network_data
=
requests
.
post
(
url
=
self
.
server
+
network_url
,
json
=
data
,
headers
=
self
.
headers
,
verify
=
False
)
return
network_data
.
json
()
if
__name__
==
'__main__'
:
course_id
=
CreateCourse
(
server
=
Service_get
.
service_content
(
'31'
),
classType
=
'新生'
,
courseType
=
'常规班课'
,
productType
=
'主线班课'
,
schools
=
[{
"area"
:
2382
,
"schoolArea"
:
2389
}])
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
Service_get
.
service_content
(
'31'
),
courseId
=
course_id
,
schoolArea
=
2389
)
.
create_class
()[
'classId'
]
print
(
NetWork
(
server
=
Service_get
.
service_content
(
'31'
),
resignClassIds
=
[
class_id
])
.
network_set
())
script/xin_project_patriarch_app/xin_static/xin_global/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_global/global.yaml
0 → 100644
View file @
6470c516
-
global_name
:
"
测试校区ID"
use_name
:
"
$test_schools"
globals_type
:
"
list"
use_type
:
"
使用类型"
argumnets
:
-
3095
-
2383
-
3015
-
3052
-
3074
-
3076
-
3345
-
3047
-
3049
-
global_name
:
"
科目类型"
use_name
:
"
$subjects"
globals_type
:
"
list"
use_type
:
"
使用类型"
argumnets
:
-
"
语文"
-
"
英语"
-
"
物理"
-
"
数学"
-
global_name
:
"
年级"
use_name
:
"
$grades"
globals_type
:
"
list"
use_type
:
"
使用类型"
argumnets
:
-
"
零年级"
-
"
一年级"
-
"
二年级"
-
"
三年级"
-
"
四年级"
-
"
五年级"
-
"
六年级"
-
"
七年级"
-
"
八年级"
-
"
九年级"
-
"
高一"
-
"
高二"
-
"
高三"
-
global_name
:
"
班型"
use_name
:
"
$classTypes"
globals_type
:
"
list"
use_type
:
"
使用类型"
argumnets
:
-
"
极趣班"
-
"
极思班"
-
"
极智班"
-
"
极客班"
-
"
极客A班"
-
"
极客蓝队班"
-
"
五四极趣班"
-
"
五四极思班"
-
"
五四极智班"
-
"
新生"
-
"
人教班"
-
"
八人精品"
-
"
定制班"
-
global_name
:
"
班型"
use_name
:
"
$platform"
globals_type
:
"
list"
use_type
:
"
使用类型"
argumnets
:
-
"
pc"
-
"
app"
-
"
applet"
script/xin_project_patriarch_app/xin_static/xin_global/xin_global.py
0 → 100644
View file @
6470c516
import
os
import
yaml
from
script.xin_project_patriarch_app.xin_static.xin_yaml.xin_read_yaml
import
ReadYaml
class
GlobalData
:
def
__init__
(
self
):
super
()
.
__init__
()
@classmethod
def
global_content
(
cls
):
curPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
print
(
curPath
)
yamlPath
=
os
.
path
.
join
(
curPath
,
"global.yaml"
)
f
=
open
(
yamlPath
,
'r'
,
encoding
=
'utf-8'
)
data
=
f
.
read
()
yaml_reader
=
yaml
.
load
(
data
,
Loader
=
yaml
.
FullLoader
)
f
.
close
()
print
(
yaml_reader
)
if
__name__
==
'__main__'
:
print
(
ReadYaml
.
read_yaml_data
(
path
=
r'\xin_static\xin_global\global.yaml'
))
script/xin_project_patriarch_app/xin_static/xin_judge.py
0 → 100644
View file @
6470c516
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_static/xin_service/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_service/service.yaml
0 → 100644
View file @
6470c516
'
31'
:
"
http://192.168.32.31"
'
36'
:
"
http://192.168.32.36"
'
59'
:
"
http://192.168.32.59"
'
60'
:
"
http://192.168.32.60"
'
93'
:
"
http://172.10.62.93"
'
94'
:
"
http://172.10.62.94"
'
33'
:
"
http://192.168.32.33"
yf1
:
"
https://yf1.jkwljy.com"
\ No newline at end of file
script/xin_project_patriarch_app/xin_static/xin_service/xin_service.py
0 → 100644
View file @
6470c516
import
os
import
yaml
class
Service_get
:
def
__init__
(
self
):
super
()
.
__init__
()
@classmethod
def
service_content
(
cls
,
key
):
curPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
yamlPath
=
os
.
path
.
join
(
curPath
,
"service.yaml"
)
f
=
open
(
yamlPath
,
'r'
,
encoding
=
'utf-8'
)
data
=
f
.
read
()
yaml_reader
=
yaml
.
load
(
data
,
Loader
=
yaml
.
FullLoader
)
f
.
close
()
return
yaml_reader
[
key
]
script/xin_project_patriarch_app/xin_static/xin_service_user/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_service_user/xin_employees.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
data
=
{
"employeeName"
:
"刘黄鑫"
,
"employeeSex"
:
"男"
,
"employmentDate"
:
"2020-08-20"
,
"phoneNumber"
:
"17623669485"
,
"teachSubject"
:
"数学"
,
"teachDegree"
:
"小低,小高,初中,高中"
,
"departmentId"
:
[
"2375"
],
"schoolAreaId"
:
[
2389
,
2398
,
3363
,
3154
,
3352
,
2369
,
3015
,
3348
,
3333
,
3351
,
3095
,
3345
,
3359
,
3365
,
3362
,
3339
,
3353
,
3334
,
2400
,
3360
,
3368
,
3371
,
3361
,
3373
,
3369
,
3366
,
3349
,
3372
,
3340
,
2427
,
3367
,
3335
,
3148
,
3374
,
3377
,
3376
,
3336
,
3357
,
3350
,
3370
,
3001
,
3072
,
3049
,
3342
,
3337
,
2411
,
3344
,
2412
,
3100
,
3146
,
3052
,
3047
,
3157
,
3107
,
3108
,
3076
,
3147
,
3167
,
2383
,
3064
,
3152
,
3063
,
3101
,
3130
,
3170
,
3074
,
3165
,
2413
,
3044
,
3059
,
3038
,
3166
,
3168
,
2385
,
3171
,
2373
,
3137
,
3151
,
2417
,
3041
,
3036
,
3060
,
3125
,
3046
,
3109
,
3110
,
3142
,
3149
,
3037
,
3039
,
3158
,
3104
,
2422
,
2407
,
2386
,
3099
,
2410
,
3067
,
3329
,
2371
,
3330
,
3133
,
3071
,
3070
,
3053
,
3065
,
3150
,
3061
,
3126
,
3062
,
2423
,
2364
,
3043
,
2415
,
3131
,
2388
,
3096
,
2376
,
3042
,
3127
,
3135
,
3136
,
2402
,
2359
,
2365
,
2408
,
2425
,
3002
,
2391
,
3153
,
3138
,
3139
,
3144
,
2419
,
3075
,
2416
,
2421
,
2363
,
2368
,
2403
,
2414
,
2392
,
2406
,
3156
,
3155
,
3097
,
3098
,
3141
,
3069
,
2405
,
2399
,
2397
,
2360
,
3145
,
2420
,
2404
,
2374
,
3124
,
2401
,
3054
],
"roleId"
:
[
10001029
,
10001024
,
10001035
,
10001028
,
10001033
,
10001121
],
"employeeNumber"
:
"JKTR00397"
}
class
UpdateEmployees
:
def
__init__
(
self
,
server
):
self
.
server
=
server
self
.
headers
=
Headers
(
server
=
self
.
server
)
.
get_headers
()
self
.
update_url
=
'/service-user/employees/9384'
def
update_employees
(
self
):
update_data
=
requests
.
patch
(
url
=
self
.
server
+
self
.
update_url
,
json
=
data
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
if
update_data
[
'code'
]
==
0
and
update_data
[
'msg'
]
==
'成功'
:
return
update_data
else
:
return
update_data
if
__name__
==
'__main__'
:
return_data
=
UpdateEmployees
(
'http://172.10.62.94'
)
.
update_employees
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_setting/__init__.py
0 → 100644
View file @
6470c516
from
.xin_discounts
import
DiscountsEvent
,
DiscountsCoupon
from
.xin_school
import
School
__all__
=
[
DiscountsEvent
,
DiscountsCoupon
,
School
]
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/__init__.py
0 → 100644
View file @
6470c516
from
.xin_discounts_coupon
import
DiscountsCoupon
from
.xin_discounts_event
import
DiscountsEvent
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/discounts_global.yaml
0 → 100644
View file @
6470c516
schoolAreaIds
:
-
3095
-
2383
-
3015
-
3052
-
3074
-
3076
-
3345
-
3047
-
3049
subjects
:
-
"
语文"
-
"
英语"
-
"
物理"
-
"
数学"
-
"
化学"
grades
:
-
"
零年级"
-
"
一年级"
-
"
二年级"
-
"
三年级"
-
"
四年级"
-
"
五年级"
-
"
六年级"
-
"
七年级"
-
"
八年级"
-
"
九年级"
-
"
高一"
-
"
高二"
-
"
高三"
classTypes
:
-
"
极趣班"
-
"
极思班"
-
"
极智班"
-
"
极客班"
-
"
极客A班"
-
"
极客蓝队班"
-
"
五四极趣班"
-
"
五四极思班"
-
"
五四极智班"
-
"
新生"
-
"
人教班"
-
"
八人精品"
-
"
定制班"
platform
:
-
"
pc"
-
"
app"
-
"
applet"
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/xin_discounts_coupon.py
0 → 100644
View file @
6470c516
from
urllib
import
request
import
requests
from
xin_project.xin_static.xin_service.xin_service
import
Service_get
from
xin_project.xin_static.xin_time
import
Time_get
from
xin_project.xin_static.xin_user.xin_jky_pc_login
import
Headers
from
xin_project.xin_static.xin_yaml.xin_read_yaml
import
ReadYaml
class
DiscountsCoupon
:
def
__init__
(
self
,
server
,
username
=
None
,
password
=
None
,
name
=
None
,
value
=
None
,
schoolAreaIds
=
None
,
platform
=
None
,
overlay
=
None
,
allSuit
=
None
,
courseIds
=
None
,
classIds
=
None
,
beginDate
=
None
,
endDate
=
None
,
operatorId
=
None
,
operator
=
None
,
issueType
=
None
,
remark
=
None
):
self
.
discounts_global
=
ReadYaml
.
read_yaml_data
(
r'\xin_static\xin_setting\xin_discounts\discounts_global.yaml'
)
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
name
=
name
or
'测试优惠券'
self
.
value
=
value
or
100
self
.
schoolAreaIds
=
schoolAreaIds
or
self
.
discounts_global
[
'schoolAreaIds'
]
self
.
platform
=
platform
or
self
.
discounts_global
[
'platform'
]
self
.
overlay
=
overlay
or
True
self
.
allSuit
=
allSuit
or
True
self
.
courseIds
=
courseIds
if
self
.
allSuit
else
[]
self
.
classIds
=
classIds
or
[]
self
.
beginDate
=
beginDate
or
Time_get
.
get_before_month_time_end
(
second
=
True
)
self
.
endDate
=
endDate
or
Time_get
.
get_after_month_time_start
()
+
' 23:59:59'
self
.
operatorId
=
operatorId
or
9384
self
.
operator
=
operator
or
'刘黄鑫'
self
.
issueType
=
issueType
or
"manual"
self
.
remark
=
remark
or
'测试券'
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
url
=
'/api-operation-web/coupon/add'
self
.
body
=
{
"name"
:
self
.
name
,
"value"
:
self
.
value
,
"schoolAreaIds"
:
self
.
schoolAreaIds
,
"platform"
:
self
.
platform
,
"overlay"
:
self
.
overlay
,
"allSuit"
:
self
.
allSuit
,
"courseIds"
:
self
.
courseIds
,
"classIds"
:
self
.
classIds
,
"beginDate"
:
self
.
beginDate
,
"endDate"
:
self
.
endDate
,
"operatorId"
:
self
.
operatorId
,
"operator"
:
self
.
operator
,
"issueType"
:
self
.
issueType
,
"remark"
:
self
.
remark
,
}
# 现金优惠
def
cash_discounts
(
self
):
cash_data
=
{
"type"
:
"CASH"
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
cash_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 满减优惠
def
full_discounts
(
self
,
full
=
None
,
reduce
=
None
):
full_data
=
{
"type"
:
"FULL_REDUCE"
,
"fullReduceRuleList"
:
[
{
"full"
:
full
or
100
,
"reduce"
:
reduce
or
10
}
]
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
full_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 拓科优惠
def
expand_discounts
(
self
,
year
=
None
,
term
=
None
,
subjects
:
list
=
None
):
expand_data
=
{
"type"
:
"EXPAND"
,
"expandRuleList"
:
[
{
"year"
:
year
or
2021
,
"term"
:
term
or
"春"
,
"subjects"
:
subjects
or
[
"数学"
,
"语文"
]
}
]
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
expand_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 删除优惠券
def
delete_discounts_coupon
(
self
,
coupon_id
):
delete_url
=
'/api-operation-web/coupon'
delete_data
=
{
'id'
:
coupon_id
}
return
requests
.
delete
(
url
=
self
.
server
+
delete_url
,
json
=
dict
(
delete_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 停用优惠券
def
stop_discounts_coupon
(
self
,
coupon_id
,
start
=
True
):
stop_url
=
'/api-operation-web/coupon/updateStatus'
stop_data
=
{
"id"
:
coupon_id
,
"status"
:
2
if
start
else
1
}
return
requests
.
post
(
url
=
self
.
server
+
stop_url
,
json
=
dict
(
stop_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
"""
student:里面的学号是字符串
"""
# 发放学生优惠券券
def
give_student_discounts_coupon
(
self
,
coupon_id
,
student
:
list
):
give_url
=
'/api-operation-web/coupon/addCouponItemByOnline'
give_data
=
{
"couponId"
:
coupon_id
,
"studentNos"
:
student
}
return
requests
.
delete
(
url
=
self
.
server
+
give_url
,
json
=
dict
(
give_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 编辑优惠券
def
edit_discounts_coupon
(
self
,
coupon_id
):
edit_url
=
'/api-operation-web/coupon/edit'
edit_data
=
{
"id"
:
coupon_id
}
self
.
body
.
pop
(
'name'
)
self
.
body
.
pop
(
'value'
)
self
.
body
.
pop
(
'overlay'
)
self
.
body
.
pop
(
'operatorId'
)
self
.
body
.
pop
(
'operator'
)
self
.
body
.
pop
(
'issueType'
)
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
print
(
DiscountsCoupon
(
server
=
Service_get
.
service_content
(
'94'
),
remark
=
'编辑优惠券'
)
.
edit_discounts_coupon
(
coupon_id
=
11577
))
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/xin_discounts_event.py
0 → 100644
View file @
6470c516
import
requests
from
xin_project.xin_static.xin_service.xin_service
import
Service_get
from
xin_project.xin_static.xin_time
import
Time_get
from
xin_project.xin_static.xin_user.xin_jky_pc_login
import
Headers
from
xin_project.xin_static.xin_yaml.xin_read_yaml
import
ReadYaml
class
DiscountsEvent
:
def
__init__
(
self
,
server
,
username
=
None
,
password
=
None
,
discountName
=
None
,
schoolAreaIds
:
list
=
None
,
subjects
:
list
=
None
,
grades
:
list
=
None
,
classTypes
:
list
=
None
,
beginDate
=
None
,
endDate
=
None
,
platform
:
list
=
None
,
remark
=
None
,
terms
=
None
,
overlays
=
None
,
years
=
None
,
):
self
.
discounts_global
=
ReadYaml
.
read_yaml_data
(
r'\xin_static\xin_setting\xin_discounts\discounts_global.yaml'
)
self
.
discountName
=
discountName
or
'优惠测试活动'
self
.
schoolAreaIds
=
schoolAreaIds
or
self
.
discounts_global
[
'schoolAreaIds'
]
self
.
subjects
=
subjects
or
self
.
discounts_global
[
'subjects'
]
self
.
grades
=
grades
or
self
.
discounts_global
[
'grades'
]
self
.
classTypes
=
classTypes
or
self
.
discounts_global
[
'classTypes'
]
self
.
beginDate
=
beginDate
or
Time_get
.
get_before_month_time_end
(
second
=
True
)
self
.
endDate
=
endDate
or
Time_get
.
get_after_month_time_end
()
+
' 23:59:59'
self
.
platform
=
self
.
discounts_global
[
'platform'
]
self
.
platform
=
platform
or
self
.
discounts_global
[
'platform'
]
self
.
remark
=
remark
or
''
self
.
terms
=
terms
or
[
"春"
,
"暑"
,
"秋"
,
"寒"
]
self
.
overlays
=
overlays
or
[
0
,
0
]
self
.
years
=
years
or
[
2020
,
2021
]
self
.
url
=
'/api-operation-web/discount/add'
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
body
=
{
"discountName"
:
self
.
discountName
,
"schoolAreaIds"
:
self
.
schoolAreaIds
,
"subjects"
:
self
.
subjects
,
"grades"
:
self
.
grades
,
"classTypes"
:
self
.
classTypes
,
"beginDate"
:
self
.
beginDate
,
"endDate"
:
self
.
endDate
,
"platform"
:
self
.
platform
,
"remark"
:
self
.
remark
,
"terms"
:
self
.
terms
,
"overlays"
:
self
.
overlays
,
"years"
:
self
.
years
}
"""
continuousRuleList:数据类型如下
[
{
"year": 2021,
"term": "春",
"discountNum": 12
},
{
"year": 2021,
"term": "秋",
"discountNum": 12
}
]
overlays:设置是否与满减和拓科同时使用,第一个是满减,第二个是拓科
[
0,
0
]
"""
# 连报
def
continue_discounts
(
self
,
continuousRuleList
:
list
=
None
):
self
.
body
.
pop
(
'terms'
)
continue_data
=
{
"discountType"
:
1
,
"discountNum"
:
0.1
,
"terms"
:
[
0
],
"continuousRuleList"
:
continuousRuleList
or
[
{
"year"
:
2021
,
"term"
:
"春"
,
"discountNum"
:
12
},
{
"year"
:
2021
,
"term"
:
"暑"
,
"discountNum"
:
12
}
]
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
continue_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 常规
def
routine_discounts
(
self
,
discountNum
=
None
,
years
=
None
,
):
routine_data
=
{
"discountType"
:
2
,
"discountNum"
:
discountNum
or
100
,
"years"
:
years
or
[
2020
,
2021
]
}
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
routine_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
"""
specialRuleList:精品打折
[
{
"coursePeriod": 6,
"discountNum": 90
},
{
"coursePeriod": 7,
"discountNum": 80
},
{
"coursePeriod": 10,
"discountNum": 60
}
]
"""
# 精品
def
boutique_discounts
(
self
,
specialRuleList
:
list
=
None
,
classTypes
:
list
=
None
):
boutique_data
=
{
"discountNum"
:
0.1
,
"discountType"
:
6
,
"specialRuleList"
:
specialRuleList
or
[
{
"coursePeriod"
:
6
,
"discountNum"
:
90
},
{
"coursePeriod"
:
7
,
"discountNum"
:
80
},
{
"coursePeriod"
:
10
,
"discountNum"
:
70
}
],
"classTypes"
:
classTypes
or
[
"一对一定制班"
,
"一对三定制班"
,
"一对八定制班"
,
"一对六定制班"
],
"years"
:
[
0
],
}
self
.
body
.
pop
(
'classTypes'
)
return
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
dict
(
boutique_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 停用或启用优惠券,start=True是停用,False是启用
def
stop_start_discount
(
self
,
event_id
,
start
=
True
):
delete_url
=
'/api-operation-web/discount/updateStatus'
delete_data
=
{
'id'
:
event_id
,
'status'
:
2
if
start
else
1
}
return
requests
.
post
(
url
=
self
.
server
+
delete_url
,
json
=
dict
(
delete_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 编辑优惠
def
edit_discount_event
(
self
,
event_id
):
edit_url
=
'/api-operation-web/discount/edit'
query_edit_url
=
'/api-operation-web/discount/queryById'
query_body
=
{
"discountId"
:
event_id
}
query_data
=
requests
.
get
(
url
=
self
.
server
+
query_edit_url
,
params
=
query_body
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()
discountType
=
query_data
[
'data'
][
'discountType'
]
edit_data
=
{
"discountType"
:
discountType
,
"id"
:
event_id
}
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
"""
requests.post(url=self.server + self.url, json=dict(continue_data, **self.body), headers=self.header, verify=False).json()
"""
print
(
DiscountsEvent
(
server
=
Service_get
.
service_content
(
'94'
))
.
edit_discount_event
(
event_id
=
10001562
))
# print(DiscountsEvent(server=Service_get.service_content('94'), discountName='启用').boutique_discounts())
script/xin_project_patriarch_app/xin_static/xin_setting/xin_school.py
0 → 100644
View file @
6470c516
import
requests
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
School
:
def
__init__
(
self
,
server
,
body
,
username
=
None
,
password
=
None
,
):
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
self
.
body
=
body
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
def
school_update
(
self
):
school_url
=
'/service.yaml-user/departments/school'
school_data
=
requests
.
post
(
url
=
self
.
server
+
school_url
,
json
=
self
.
body
,
headers
=
self
.
headers
,
verify
=
False
)
return
school_data
.
json
()
@classmethod
def
param
(
cls
,
sectionSetting
=
1
):
data
=
{
"id"
:
3052
,
"name"
:
"测试成都校区"
,
"enable"
:
False
,
"workingStartTime"
:
"00:40"
,
"workingEndTime"
:
"04:40"
,
"phone"
:
"15411111111"
,
"province"
:
"510000"
,
"provinceName"
:
"四川省"
,
"city"
:
"510100"
,
"cityName"
:
"成都市"
,
"county"
:
"510104"
,
"countyName"
:
"锦江区"
,
"address"
:
"四川省成都市青羊区东坡街道东坡南一路"
,
"images"
:
[
"https://image.jkwljy.com/gosGoodsImage/image/28529df7-88fc-4d9d-a6a9-7cf61aa59487.jpeg"
],
"longitude"
:
103.994281
,
"latitude"
:
30.654541
,
"seatRule"
:
{
"enable"
:
True
},
"sectionSetting"
:
1
,
"sectionValue"
:
[
{
"term"
:
"秋"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2021/2/28 23:59:59"
},
{
"term"
:
"寒"
,
"upRegisterDeadline"
:
"2020/10/30 23:59:59"
,
"registerDeadline"
:
"2020/10/31 23:59:59"
},
{
"term"
:
"春"
,
"upRegisterDeadline"
:
"2021/03/27 23:59:59"
,
"registerDeadline"
:
"2021/04/30 23:59:59"
},
{
"term"
:
"暑"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2021/01/30 23:59:59"
},
],
}
if
sectionSetting
==
0
:
data
[
'sectionSetting'
]
=
0
data
.
pop
(
'sectionValue'
)
return
data
if
__name__
==
'__main__'
:
print
(
School
(
server
=
Service_get
.
service_content
(
'94'
),
body
=
School
.
param
())
.
school_update
())
print
(
School
.
param
())
"""
这是是否连报设置
"communiqueRule": {
"grade": ["零年级", "一年级"],
"platform": ["app"],
"subject": ["语文", "英语"],
"term": "秋",
"signInTime": ["2021-03-15 00:00:00", "2021-04-14 00:00:00"],
"beginDate": "2021-03-15 00:00:00", "endDate": "2021-04-14 00:00:00"
}
"""
script/xin_project_patriarch_app/xin_static/xin_time.py
0 → 100644
View file @
6470c516
import
datetime
from
datetime
import
timedelta
class
Time_get
:
"""
这里有问题,跨年的前后几个月,可能会出问题
"""
now_day
=
datetime
.
datetime
.
now
()
# 获取当前时间
@classmethod
def
get_today_time
(
cls
,
second
=
False
):
if
second
:
return
Time_get
.
now_day
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
else
:
return
Time_get
.
now_day
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取当前的时间00:00:00
@classmethod
def
get_today_time_start
(
cls
):
time
=
Time_get
.
now_day
.
strftime
(
"
%
Y-
%
m-
%
d"
)
return
time
+
" 00:00:00"
# 获取当前时间23:59:59
@classmethod
def
get_today_time_end
(
cls
):
time
=
Time_get
.
now_day
.
strftime
(
"
%
Y-
%
m-
%
d"
)
return
time
+
' 23:59:59'
# 获取一周开始时间
@classmethod
def
get_week_time_start
(
cls
,
second
=
False
):
time
=
(
Time_get
.
now_day
-
timedelta
(
days
=
Time_get
.
now_day
.
weekday
()))
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
second
:
return
time
+
' 00:00:00'
return
time
# 获取一周结束时间
@classmethod
def
get_week_time_end
(
cls
,
second
=
False
):
time
=
(
Time_get
.
now_day
+
timedelta
(
days
=
6
-
Time_get
.
now_day
.
weekday
()))
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
second
:
return
time
+
' 23:59:59'
return
time
# 获取下周开始时间
@classmethod
def
get_before_week_time_start
(
cls
,
second
=
False
):
time
=
Time_get
.
now_day
+
timedelta
(
days
=
7
-
Time_get
.
now_day
.
weekday
())
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
+
" 23:59:59"
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取前七天的时间
@classmethod
def
get_seven_time
(
cls
):
time
=
'1'
return
time
# 获取本月开始时间
@classmethod
def
get_month_time_start
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
,
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取本月结束时间
@classmethod
def
get_month_time_end
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
+
1
,
1
)
-
timedelta
(
days
=
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取上月开始时间
@classmethod
def
get_before_month_time_start
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
-
1
,
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取上月结束时间
@classmethod
def
get_before_month_time_end
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
,
1
)
-
timedelta
(
days
=
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取下月开始时间
@classmethod
def
get_after_month_time_start
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
+
1
,
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# 获取下月结束时间
@classmethod
def
get_after_month_time_end
(
cls
,
second
=
False
):
time
=
datetime
.
datetime
(
Time_get
.
now_day
.
year
,
Time_get
.
now_day
.
month
+
2
,
1
)
-
timedelta
(
days
=
1
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
"""
获取想要天数之前的开始时间
"""
@classmethod
def
get_before_want_time
(
cls
,
day
:
int
,
second
=
False
):
time
=
Time_get
.
now_day
-
timedelta
(
days
=
day
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
+
" 00:00:00"
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
"""
获取想要天数之后的结束时间
"""
@classmethod
def
get_after_want_time
(
cls
,
day
:
int
,
second
=
False
):
time
=
Time_get
.
now_day
+
timedelta
(
days
=
day
)
if
second
:
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
+
" 23:59:59"
return
time
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
__name__
==
'__main__'
:
print
(
Time_get
()
.
get_after_want_time
(
day
=
1
,
second
=
True
))
script/xin_project_patriarch_app/xin_static/xin_user/__init__.py
0 → 100644
View file @
6470c516
script/xin_project_patriarch_app/xin_static/xin_user/jky_user.yaml
0 → 100644
View file @
6470c516
-
headers
:
Authorization
:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiJlZDNlN2FjMTdiZjA0ZGU3YmQ5MGZjNzE5ZDEzZjdmNCIsInRpbWVzdGFtcCI6MTYxODMxMjQxNzAzMH0.VqAFwmhsxo6aq9_eJ8wc57a5wFV8aDnvruqH-y4Rt1k
Content-Type
:
application/json;charset=UTF-8
server
:
http://172.10.62.94
user
:
13555555555
script/xin_project_patriarch_app/xin_static/xin_user/patriarch_user
0 → 100644
View file @
6470c516
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_static/xin_user/xin_jky_pc_login.py
0 → 100644
View file @
6470c516
import
os
import
requests
import
yaml
from
requests.packages.urllib3.exceptions
import
InsecureRequestWarning
requests
.
packages
.
urllib3
.
disable_warnings
(
InsecureRequestWarning
)
class
Headers
:
def
__init__
(
self
,
server
,
username
=
None
,
password
=
None
):
self
.
server
=
server
self
.
username
=
username
or
13555555555
self
.
password
=
password
or
88888888
self
.
body
=
{
"type"
:
"employee"
,
"identityType"
:
1
,
"ip"
:
"0.0.0.0"
,
"account"
:
self
.
username
,
"password"
:
self
.
password
,
"assistant"
:
False
}
self
.
url
=
'/service-user/auth/employee'
@staticmethod
def
read_headers
(
handle
=
False
,
handle_data
=
None
,
unicode
=
True
):
curPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
yamlPath
=
os
.
path
.
join
(
curPath
,
"jky_user.yaml"
)
if
handle
:
if
unicode
:
with
open
(
yamlPath
,
"w+"
)
as
f
:
yaml
.
dump
(
handle_data
,
f
,
encoding
=
"utf-8"
,
allow_unicode
=
True
)
f
.
close
()
else
:
with
open
(
yamlPath
,
'w+'
)
as
f
:
yaml
.
dump
(
handle_data
,
f
,
encoding
=
'utf-8'
,
default_flow_style
=
False
)
f
.
close
()
else
:
f
=
open
(
yamlPath
,
'r'
,
encoding
=
'utf-8'
)
data
=
f
.
read
()
f
.
close
()
return
yaml
.
load
(
data
,
Loader
=
yaml
.
FullLoader
)
# 获取token函数
def
get_token
(
self
,
AddUser
=
False
):
json_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
verify
=
False
)
if
json_data
.
json
()[
'code'
]
!=
0
:
return
json_data
.
json
()
else
:
token
=
"Bearer "
+
json_data
.
json
()[
'data'
][
'token'
]
content
=
[{
'user'
:
self
.
username
,
'server'
:
self
.
server
,
'headers'
:
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
'Authorization'
:
token
}
}]
if
AddUser
:
yaml_reader
=
self
.
read_headers
()
data
=
content
[
0
]
yaml_reader
.
append
(
data
)
self
.
read_headers
(
handle
=
True
,
handle_data
=
yaml_reader
)
else
:
self
.
read_headers
(
handle
=
True
,
handle_data
=
content
)
return
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
'Authorization'
:
token
}
def
get_headers
(
self
):
yaml_reader
=
self
.
read_headers
()
try
:
for
yaml_data
in
yaml_reader
:
if
yaml_data
[
'server'
]
==
self
.
server
and
yaml_data
[
'user'
]
==
self
.
username
:
test_url
=
'/service-crm/systemMessageItem/get'
test_data
=
requests
.
get
(
url
=
self
.
server
+
test_url
,
headers
=
yaml_data
[
'headers'
],
verify
=
False
)
if
test_data
.
status_code
==
401
:
json_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
verify
=
False
)
if
json_data
.
json
()[
'code'
]
!=
0
:
return
json_data
.
json
()
else
:
token
=
"Bearer "
+
json_data
.
json
()[
'data'
][
'token'
]
content
=
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
'Authorization'
:
token
}
yaml_data
[
'headers'
]
=
content
self
.
read_headers
(
handle
=
True
,
handle_data
=
yaml_reader
,
unicode
=
False
)
return
yaml_data
[
'headers'
]
else
:
return
yaml_data
[
'headers'
]
else
:
continue
return
self
.
get_token
(
AddUser
=
True
)
except
TypeError
:
return
self
.
get_token
()
if
__name__
==
'__main__'
:
print
(
Headers
(
server
=
'http://172.10.62.94'
)
.
get_headers
())
script/xin_project_patriarch_app/xin_static/xin_user/xin_patriarch_login.py
0 → 100644
View file @
6470c516
import
requests
from
requests.packages.urllib3.exceptions
import
InsecureRequestWarning
from
script.xin_project_patriarch_app.xin_static.xin_yaml
import
ReadYaml
,
WriteYaml
requests
.
packages
.
urllib3
.
disable_warnings
(
InsecureRequestWarning
)
class
AuthHeaders
:
def
__init__
(
self
,
server
,
username
,
password
=
None
):
self
.
server
=
server
self
.
username
=
username
self
.
password
=
password
or
'geek1234'
self
.
body
=
{
"account"
:
self
.
username
,
"password"
:
self
.
password
,
"code"
:
""
,
"type"
:
"customer"
}
self
.
url
=
'/service-user/app/auth'
"""
获取家长端APP的登录信息
"""
def
get_auth_token
(
self
):
auth_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
verify
=
False
)
if
auth_data
.
json
()[
'code'
]
!=
0
:
return
auth_data
.
json
()
else
:
# token = "Bearer " + auth_data.json()['data']['token']
return
auth_data
.
json
()
"""
获取登录的请求头,如果没有接写入,如果过期就更新
"""
def
get_auth_headers
(
self
):
auth_yaml
=
ReadYaml
.
read_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
)
try
:
for
auth_data
in
auth_yaml
:
if
auth_data
[
'server'
]
==
self
.
server
and
auth_data
[
'user'
]
==
self
.
username
:
return
auth_data
[
'headers'
]
return
self
.
add_auth_token
(
add
=
True
)
except
TypeError
:
return
self
.
add_auth_token
()
def
add_auth_token
(
self
,
add
=
False
):
auth_json
=
self
.
get_auth_token
()
# print(auth_json)
token
=
"Bearer "
+
auth_json
[
'data'
][
'token'
]
headers
=
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
'Authorization'
:
token
}
content
=
[
{
'user'
:
self
.
username
,
'server'
:
self
.
server
,
'headers'
:
headers
,
'userId'
:
auth_json
[
'data'
][
'userId'
]
}
]
if
add
:
yaml_auth_data
=
ReadYaml
.
read_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
)
data
=
content
[
0
]
yaml_auth_data
.
append
(
data
)
WriteYaml
.
write_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
,
yaml_auth_data
)
else
:
WriteYaml
.
write_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
,
content
)
# print(headers)
return
headers
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
AuthHeaders
(
server
=
server_ip
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_headers
()
script/xin_project_patriarch_app/xin_static/xin_yaml/__init__.py
0 → 100644
View file @
6470c516
from
.xin_write_yaml
import
WriteYaml
from
.xin_read_yaml
import
ReadYaml
__all__
=
[
WriteYaml
,
WriteYaml
]
script/xin_project_patriarch_app/xin_static/xin_yaml/xin_read_yaml.py
0 → 100644
View file @
6470c516
import
os
import
yaml
class
ReadYaml
:
"""
path,为project下的yaml文件路径,返回的是整个yaml文件的数据
"""
@classmethod
def
read_yaml_data
(
cls
,
path
):
try
:
curPath
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))))
f
=
open
(
curPath
+
path
,
'r'
,
encoding
=
'utf-8'
)
data
=
f
.
read
()
yaml_reader
=
yaml
.
load
(
data
,
Loader
=
yaml
.
FullLoader
)
f
.
close
()
return
yaml_reader
except
FileNotFoundError
:
return
FileNotFoundError
script/xin_project_patriarch_app/xin_static/xin_yaml/xin_write_yaml.py
0 → 100644
View file @
6470c516
import
os
import
yaml
class
WriteYaml
:
"""
path:相对project下的yaml文件路径
data:写入的数据
unicode:false为添加,True为修改
注意修改时的传参,这是的修改时清除yaml文件,然后添加
"""
@classmethod
def
write_yaml_data
(
cls
,
path
,
data
,
unicode
=
False
):
try
:
curPath
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))))
if
unicode
:
with
open
(
curPath
+
path
,
"w+"
)
as
f
:
yaml
.
dump
(
data
,
f
,
encoding
=
"utf-8"
,
allow_unicode
=
True
)
f
.
close
()
else
:
with
open
(
curPath
+
path
,
'w+'
)
as
f
:
yaml
.
dump
(
data
,
f
,
encoding
=
'utf-8'
,
default_flow_style
=
False
)
f
.
close
()
except
FileNotFoundError
:
return
str
(
FileNotFoundError
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment