自制简历优化
This commit is contained in:
parent
80f215c80f
commit
2c5009f3c9
@ -110,13 +110,16 @@ def chkData(data):
|
|||||||
bast_index = 0
|
bast_index = 0
|
||||||
bast_time = 0
|
bast_time = 0
|
||||||
for index, i in enumerate(work_list):
|
for index, i in enumerate(work_list):
|
||||||
time = i.get('time' '')
|
time = i.get('time' '').replace('.', '/')
|
||||||
if time:
|
if time:
|
||||||
|
if time.split('-')[-1].split('/')[0].strip().isdigit():
|
||||||
chk_time = int(time.split('-')[-1].split('/')[0])
|
chk_time = int(time.split('-')[-1].split('/')[0])
|
||||||
|
else:
|
||||||
|
chk_time = int(datetime.now().year)
|
||||||
if chk_time > bast_time:
|
if chk_time > bast_time:
|
||||||
bast_time = chk_time
|
bast_time = chk_time
|
||||||
bast_index = index
|
bast_index = index
|
||||||
data['firm'] = work_list[bast_index]['company_name']
|
res1['firm'] = work_list[bast_index]['company_name']
|
||||||
else:
|
else:
|
||||||
work_list = []
|
work_list = []
|
||||||
res1['work_list'] = work_list
|
res1['work_list'] = work_list
|
||||||
@ -1582,7 +1585,8 @@ async def reset_my_password(request: Request,
|
|||||||
"""
|
"""
|
||||||
await crud.user.reset_password(db,
|
await crud.user.reset_password(db,
|
||||||
schemas.UserRestPassword(user_id=current_user.user_id, password=data_in.password,
|
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')
|
return schemas.Msg(code=200, msg='ok')
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
import json
|
import json
|
||||||
import pprint
|
import pprint
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
|
import pymongo
|
||||||
import redis
|
import redis
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from core.config import Settings
|
from core.config import Settings, Debug
|
||||||
|
|
||||||
Settings = Settings()
|
Settings = Settings()
|
||||||
|
Mongo = Debug()
|
||||||
host = Settings.REDIS_CONF.get('host')
|
host = Settings.REDIS_CONF.get('host')
|
||||||
port = Settings.REDIS_CONF.get('port')
|
port = Settings.REDIS_CONF.get('port')
|
||||||
db = Settings.REDIS_CONF.get('db')
|
db = Settings.REDIS_CONF.get('db')
|
||||||
|
clientMongo = Mongo.DATABASE_URI
|
||||||
password = Settings.REDIS_CONF.get('password')
|
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,password=password)
|
||||||
redisdb = redis.Redis(host=host, port=port, db=db)
|
redisdb = redis.Redis(host=host, port=port, db=db)
|
||||||
|
myClient = pymongo.MongoClient(clientMongo)
|
||||||
|
|
||||||
|
|
||||||
def get_token():
|
def get_token():
|
||||||
@ -233,6 +238,7 @@ def Unionid(unionid):
|
|||||||
datas = r.json()
|
datas = r.json()
|
||||||
return datas.get('result').get('userid')
|
return datas.get('result').get('userid')
|
||||||
|
|
||||||
|
|
||||||
def user_details(userid):
|
def user_details(userid):
|
||||||
"""
|
"""
|
||||||
根据userid获取用户详情
|
根据userid获取用户详情
|
||||||
@ -247,6 +253,8 @@ def user_details(userid):
|
|||||||
r = requests.post(url=url, params=query, data=data)
|
r = requests.post(url=url, params=query, data=data)
|
||||||
datas = r.json()
|
datas = r.json()
|
||||||
return datas
|
return datas
|
||||||
|
|
||||||
|
|
||||||
def get_user_list():
|
def get_user_list():
|
||||||
"""
|
"""
|
||||||
获取所有部门钉钉用户id,list返回
|
获取所有部门钉钉用户id,list返回
|
||||||
@ -258,6 +266,7 @@ def get_user_list():
|
|||||||
user_list.append(ii.get('userid'))
|
user_list.append(ii.get('userid'))
|
||||||
return user_list
|
return user_list
|
||||||
|
|
||||||
|
|
||||||
def get_alluid_list():
|
def get_alluid_list():
|
||||||
"""
|
"""
|
||||||
获取redis中存的所有部门钉钉用户id,如没有重新获取再存数据库中,再获取
|
获取redis中存的所有部门钉钉用户id,如没有重新获取再存数据库中,再获取
|
||||||
@ -272,8 +281,35 @@ def get_alluid_list():
|
|||||||
user = redisuid.decode()
|
user = redisuid.decode()
|
||||||
return json.loads(user)
|
return json.loads(user)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#a = user_details('16371426094531014')
|
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()
|
# a = get_redis_alluid()
|
||||||
a=get_zi()
|
# 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)
|
pprint.pprint(a)
|
||||||
|
Loading…
Reference in New Issue
Block a user