需要通过接口查询并保存各个部门下成员的业绩
#根部门:
parentid=parentid:[1]
#子部门:
parentid=parentid:[2,3,4,5,6]
#成员:
{
"errcode": 0,
"errmsg": "ok",
"userlist": [{
"userid": "zhangsan",
"name": "张三",
"department": [1, 2],
"open_userid": "xxxxxx"
},
{
"userid": "lisi",
"name": "李四",
"department": [3],
"open_userid": "xxxxxx"
},
{
"userid": "wangwu",
"name": "王五",
"department": [4],
"open_userid": "xxxxxx"
}
]
}
#业绩统计获取请求JSON:
{
"day_begin_time": 1600272000,#开始时间
"day_end_time": 1600444800,#结束时间
"owner_filter": {
"userid_list": ["zhangsan"] #用户ID
},
"limit" : 1000 #分页
}
#通过跟部门查子部门,子部门查5000用户,使用用户ID查近180天内每天业绩:
#通过API获取数据
def getdata():
for a in range(len[parentid]): #取子部门
for b in range(len[parentid]): #取用户
for c in range(len[datetime]): #取每天时间
for d in range(len[achieve]): #取业绩数据
存入数据库
def adddata():
数据量很大,循环效率很低。如何优化请指教。