自制简历优化
This commit is contained in:
parent
80f215c80f
commit
2c5009f3c9
@ -110,13 +110,16 @@ def chkData(data):
|
||||
bast_index = 0
|
||||
bast_time = 0
|
||||
for index, i in enumerate(work_list):
|
||||
time = i.get('time' '')
|
||||
time = i.get('time' '').replace('.', '/')
|
||||
if time:
|
||||
if time.split('-')[-1].split('/')[0].strip().isdigit():
|
||||
chk_time = int(time.split('-')[-1].split('/')[0])
|
||||
else:
|
||||
chk_time = int(datetime.now().year)
|
||||
if chk_time > bast_time:
|
||||
bast_time = chk_time
|
||||
bast_index = index
|
||||
data['firm'] = work_list[bast_index]['company_name']
|
||||
res1['firm'] = work_list[bast_index]['company_name']
|
||||
else:
|
||||
work_list = []
|
||||
res1['work_list'] = work_list
|
||||
@ -1540,7 +1543,7 @@ async def login(
|
||||
'user_id': user.user_id, # 钉钉id
|
||||
'id': user.id, # 账号的唯一标识
|
||||
'rank': user.rank, # 区分hr和面试官
|
||||
'nickname':user.nickname, # 显示名
|
||||
'nickname': user.nickname, # 显示名
|
||||
'token': security.create_access_token(
|
||||
expires_delta=access_token_expires, user_id=user.user_id, email=user.email,
|
||||
tel=user.tel, name=user.name, rank=user.rank),
|
||||
@ -1582,7 +1585,8 @@ async def reset_my_password(request: Request,
|
||||
"""
|
||||
await crud.user.reset_password(db,
|
||||
schemas.UserRestPassword(user_id=current_user.user_id, password=data_in.password,
|
||||
nickname=data_in.nickname,tel=data_in.tel,email=data_in.email))
|
||||
nickname=data_in.nickname, tel=data_in.tel,
|
||||
email=data_in.email))
|
||||
return schemas.Msg(code=200, msg='ok')
|
||||
|
||||
|
||||
|
@ -1,18 +1,23 @@
|
||||
import json
|
||||
import pprint
|
||||
from copy import deepcopy
|
||||
|
||||
import pymongo
|
||||
import redis
|
||||
import requests
|
||||
|
||||
from core.config import Settings
|
||||
from core.config import Settings, Debug
|
||||
|
||||
Settings = Settings()
|
||||
Mongo = Debug()
|
||||
host = Settings.REDIS_CONF.get('host')
|
||||
port = Settings.REDIS_CONF.get('port')
|
||||
db = Settings.REDIS_CONF.get('db')
|
||||
clientMongo = Mongo.DATABASE_URI
|
||||
password = Settings.REDIS_CONF.get('password')
|
||||
# redisdb = redis.Redis(host=host, port=port, db=db,password=password)
|
||||
redisdb = redis.Redis(host=host, port=port, db=db)
|
||||
myClient = pymongo.MongoClient(clientMongo)
|
||||
|
||||
|
||||
def get_token():
|
||||
@ -159,7 +164,7 @@ def get_all_uid():
|
||||
获取所有部门的钉钉用户id
|
||||
:return: list
|
||||
"""
|
||||
date_s,depid = get_section()
|
||||
date_s, depid = get_section()
|
||||
res_c = []
|
||||
for k, v in date_s.items():
|
||||
res = {}
|
||||
@ -233,6 +238,7 @@ def Unionid(unionid):
|
||||
datas = r.json()
|
||||
return datas.get('result').get('userid')
|
||||
|
||||
|
||||
def user_details(userid):
|
||||
"""
|
||||
根据userid获取用户详情
|
||||
@ -247,17 +253,20 @@ def user_details(userid):
|
||||
r = requests.post(url=url, params=query, data=data)
|
||||
datas = r.json()
|
||||
return datas
|
||||
|
||||
|
||||
def get_user_list():
|
||||
"""
|
||||
获取所有部门钉钉用户id,list返回
|
||||
"""
|
||||
user=get_redis_alluid()
|
||||
user = get_redis_alluid()
|
||||
user_list = []
|
||||
for i in user:
|
||||
for ii in i.get('user_id'):
|
||||
user_list.append(ii.get('userid'))
|
||||
return user_list
|
||||
|
||||
|
||||
def get_alluid_list():
|
||||
"""
|
||||
获取redis中存的所有部门钉钉用户id,如没有重新获取再存数据库中,再获取
|
||||
@ -272,8 +281,35 @@ def get_alluid_list():
|
||||
user = redisuid.decode()
|
||||
return json.loads(user)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#a = user_details('16371426094531014')
|
||||
#a=get_redis_alluid()
|
||||
a=get_zi()
|
||||
import time
|
||||
|
||||
mongo_db = myClient['hr_system']
|
||||
true_db = mongo_db['worker_info']
|
||||
a = user_details('102253692821037562')
|
||||
user_info = a.get('result', {})
|
||||
user_info['extension'] = eval(user_info['extension'])
|
||||
time_stamp = user_info['hired_date']
|
||||
local_time = time.localtime(time_stamp / 1000)
|
||||
true_time = time.strftime("%Y-%m-%d", local_time)
|
||||
user_info['work_in'] = true_time
|
||||
true_db.insert_one(user_info)
|
||||
# a = get_redis_alluid()
|
||||
# insert_many = []
|
||||
# for i in a:
|
||||
# if not i['user_id']:
|
||||
# continue
|
||||
# for user in i['user_id']:
|
||||
# user_id = user['userid']
|
||||
# user_info = user_details(user_id).get('result', {})
|
||||
# user_info['extension'] = eval(user_info['extension'])
|
||||
# time_stamp = user_info['hired_date']
|
||||
# local_time = time.localtime(time_stamp / 1000)
|
||||
# true_time = time.strftime("%Y-%m-%d", local_time)
|
||||
# user_info['work_in'] = true_time
|
||||
# inset_data = deepcopy(user_info)
|
||||
# insert_many.append(inset_data)
|
||||
# true_db.insert_many(insert_many)
|
||||
# a=get_zi()
|
||||
pprint.pprint(a)
|
||||
|
Loading…
Reference in New Issue
Block a user