代码拉取完成,页面将自动刷新
同步操作将从 goodfeng/xgc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- coding: utf-8 -
from db.models import Department
from logic.department import DepartmentLG
from logic.covip import ClistLG
from util.time import getToday
from datasource.eggs.covip.locationInfo import LocationInfo
def creatDepartmentID(c):
alpha = [str(i) for i in range(0,10)] + [chr(i) for i in range(65,91)]
w1 = c//len(alpha)
w2 = c%len(alpha)
return alpha[w1]+alpha[w2]
def creatPasw(i):
return 'hnjm'+str(i)[-8:]
if __name__ == '__main__':
sdate = getToday()
t = LocationInfo(sdate)
did = DepartmentLG().getDepartmentByName('国际教育学院').id
DepartmentLG().clear(did)
ClistLG().clear(did)
departlen = Department.objects.filter(id__lte='0Y').count()
dicts =[]
depts = []
admins ={}
dclasses ={}
for rec in t.getRecs():
name = rec['name'].strip().replace('\n','').replace('\t','')
dname = rec['department'].strip().replace('\n','').replace('\t','')
try:
department = DepartmentLG().getDepartmentByName(dname).id
except Exception as e:
print('-3')
dclass = rec['dclass']
if dclass not in depts:
depts.append(dclass)
i = depts.index(dclass)
dclass = creatDepartmentID(departlen+i)
dclasses[dclass]=department
eid = rec['eid']
pasw = creatPasw(eid)
mobile = str(rec['mobile']).strip()
isadmin = rec['isadmin']
if isadmin=='是':
role = '1'
admins[dclass]=name
else:
role = '0'
acovip = ClistLG().create(name,department,dclass, name, mobile, pasw, role)
dicts.append(acovip)
tdicts=[]
c=0
for t in depts:
c+=1
dname = t
dtype = '2'
dorder =c
dclass = creatDepartmentID(c+departlen-1)
print(dname,dclass)
try:
DepartmentLG().getDepartmentByName(dname)
print('-3')
except Exception as e:
print(dname,e)
adept = DepartmentLG().create(dclass,dname, dtype, dorder, dclasses[dclass])
tdicts.append(adept)
for t in tdicts:
print(t.__dict__)
DepartmentLG().bulk_create(tdicts)
ndicts=[]
for acovip in dicts:
if acovip.dclass in admins:
acovip.admin = admins[acovip.dclass]
else:
acovip.admin = acovip.name
ndicts.append(acovip)
ClistLG().bulk_create(ndicts)
print('1')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。