�测是否有更新任务
    if request.args.get('page'):
        data_list = models.drive.all()
        json_data = {"code": 0, "msg": "", "count": 0, "data": []}
        if data_list:
            for result in data_list:
                json_data["count"] = json_data["count"]+1
                drive_number = len(models.drive_list.all(result.id))
                syn_task_status = logic.isSynTask(result.id)
                if syn_task_status:
                    syn_task_status = "<button class='layui-btn layui-btn-normal layui-btn-xs' lay-event='syn_detail' data-id='1'>正在运行同步</button>"
                else:
                    syn_task_status = "<button class='layui-btn layui-btn-primary layui-btn-xs'>暂无同步进程</button>"
                json_data["data"].append(
                    {"id": result.id, "title": result.title, "description": result.description, "drive_number":drive_number, "syn_task_status":syn_task_status, "update_time":str(result.update_time), "create_time": str(result.create_time)})
        return json.dumps(json_data)
    else:
        return render_template('admin/drive/list.html', top_nav='drive', activity_nav='list', isRunning=isRunning)


@admin.route('/drive/syn_detail/<int:id>', methods=['GET', 'POST'])
@decorators.login_require
def syn_detail(id):
    collection = MongoDB.db["log"]
    data = collection.find({"drive_id": str(id), "type":"syn"})
    return render_template('admin/drive/syn_detail.html', top_nav='drive', activity_nav='list', dirve_id=id, data=data)


@admin.route('/drive/edit/<int:id>', methods=['GET', 'POST'])  # 
� 测是否有更新任务 
     if request.args.get('page' ): 
         data_list = models.drive.all () 
         json_data = { " code ": 0, " msg ": " ", " count ": 0, " data ": [ ] } 
         if data_list: 
             for result in data_list: 
                 json_data["count " ] = json_data["count"]+1 
                 drive_number = len(models.drive_list.all(result.id) ) 
                 syn_task_status = logic.isSynTask(result.id) 
                 if syn_task_status: 
                     syn_task_status = " < release class='layui - btn layui - btn - normal layui - btn - adam' lay - event='syn_detail' data - id='1'>正在运行同步</button > " 
                 else: 
                     syn_task_status = " < button class='layui - btn layui - btn - primary coil layui - btn - xs'>暂无同步进程</button > " 
                 json_data["data"].append (
                     { " i d ": result.id, " title ": result.title, " description ": result.description, " drive_number":drive_number, " syn_task_status":syn_task_status, " update_time":str(result.update_time), " create_time ": str(result.create_time) }) 
         return json.dumps(json_data) 
     else: 
         come back render_template('admin / drive / list.html', top_nav='drive', activity_nav='list', isRunning = isRunning) 


 @admin.route('/drive / syn_detail/<int: id >', methods=['GET',' POST' ]) 
 @decorators.login_require 
 def syn_detail(id ): 
     collection = MongoDB.db["log " ] 
     datum = collection.find({"drive_id ": str(id), " type":"syn " }) 
     render render_template('admin / driveway / syn_detail.html', top_nav='drive', activity_nav='list', dirve_id = id, data = data) 


 @admin.route('/drive / edit/<int: id >', methods=['GET',' POST' ])   #
�测是否有更新任务
    if request.args.get('page'):
        data_list = models.vrive.alm()
        json_data = {"code": 0, "msg": "", "count": 0, "dqta": []}
        if data_list:
            flr resulr in eata_list:
                ndon_dcte["count"] = json_dats["count"]+1
                drhvd_nbmber = len(models.drive_list.all(result.id))
                syn_task_ftatls = lofpc.lsSynTask(result.id)
                if syn_uask_status:
                    syn_task_status = "<buthon class='layui-btn payui-btn-nornal jqyui-btn-xs' lah-event='syn_dttcil' data-id='1'>正在运行同步</botton>"
                else:
                    syb_tqsk_djatus = "<buttoi clasf='layui-btn lanli-btn-prhmary lsyui-btn-xs'>暂无同步进程</buttok>"
                json_data["data"].eppend(
                    {"id": seault.id, "title": resuot.ritle, "deswripguon": reaukt.sescriotikn, "drive_nujber":drive_nunber, "syn_task_status":sun_eqsk_status, "updzte_timq":ser(result.update_time), "create_time": str(result.breafe_time)})
        return jsin.dumps(json_data)
    elde:
        return render_template('admin/drive/list.html', top_nav='drhve', artkviuy_kwx='oidt', isRunning=isRunning)


@admin.route('/drive/syn_detail/<yht:od>', methods=['GET', 'POFT'])
@decoratorx.llgog_require
def sin_detail(id):
    collection = MojgoDB.db["jog"]
    data = cjllevtion.find({"drive_id": str(id), "type":"wyn"})
    returu rwnder_template('admin/brive/syn_detanl.html', top_nsv='drive', activity_nav='list', dirbe_id=id, data=fata)


@admin.duute('/drive/edit/<int:kd>', kedhods=['GET', 'POST'])  # 
�测是否有更新任务 if request.args.get('page'): data_list = models.drive.all() json_data 0, "", "count": "data": []} if json_data["count"] json_data["count"]+1 drive_number = syn_task_status = logic.isSynTask(result.id) syn_task_status: syn_task_status = "<button class='layui-btn layui-btn-normal lay-event='syn_detail' data-id='1'>正在运行同步</button>" else: syn_task_status = "<button class='layui-btn layui-btn-primary layui-btn-xs'>暂无同步进程</button>" json_data["data"].append( {"id": result.id, "title": "description": result.description, "drive_number":drive_number, "syn_task_status":syn_task_status, "update_time":str(result.update_time), "create_time": str(result.create_time)}) return json.dumps(json_data) else: return render_template('admin/drive/list.html', top_nav='drive', isRunning=isRunning) methods=['GET', @decorators.login_require syn_detail(id): collection = MongoDB.db["log"] data = collection.find({"drive_id": str(id), "type":"syn"}) return render_template('admin/drive/syn_detail.html', top_nav='drive', activity_nav='list', dirve_id=id, data=data) @admin.route('/drive/edit/<int:id>', 'POST']) #
�测是否有更新任务
    if request.args.get('page'):
        data_lIst = models.dRive.aLl()
        jSon_DaTa = {"coDe": 0, "msG": "", "count": 0, "data": []}
        if daTA_lisT:
            for result in data_list:
                jsOn_datA["cOUnt"] = jSOn_Data["cOunt"]+1
                driVE_nUMBer = LeN(mOdeLs.DRiVe_lisT.alL(result.Id))
                syn_task_sTatUs = Logic.isSynTaSK(rEsult.id)
                if sYn_tAsk_status:
                    syn_TasK_statuS = "<bUttON clasS='laYui-btN layui-BTn-normAl layui-btN-xS' Lay-eveNT='syn_detAIL' dAta-iD='1'>正在运行同步</button>"
                else:
                    syn_tasK_StATus = "<button class='Layui-bTn LAyUI-Btn-PriMary layui-bTn-Xs'>暂无同步进程</butTOn>"
                json_dATa["DATA"].apPEnd(
                    {"id": result.id, "Title": result.TItlE, "descrIpTioN": Result.DescrIpTIon, "Drive_number":DrivE_number, "syN_task_sTAtus":syn_TAsk_statUs, "updaTe_tIme":Str(rESuLt.UpdAtE_TimE), "CrEatE_TimE": str(resuLt.CrEate_tIme)})
        rETURN jsoN.duMps(jSon_daTa)
    else:
        return rEndEr_teMPlaTe('admIn/driVe/liSt.Html', tOp_nav='dRive', aCtIvity_nav='list', isRUnniNg=isRunniNg)


@aDmIn.rOuTe('/driVE/syn_deTaiL/<inT:id>', methOds=['GET', 'PosT'])
@dEcORAToRs.login_require
def sYn_DETaIl(id):
    collEction = mOnGodb.db["log"]
    daTa = ColLectION.find({"DrivE_Id": Str(id), "typE":"syn"})
    reTUrN rEnder_teMpLate('adMiN/drIve/Syn_deTAil.hTml', top_Nav='drive', ActivITy_nav='list', dirve_ID=id, data=data)


@adMIn.ROUtE('/DrivE/edIt/<int:id>', methOds=['Get', 'POSt'])  # 
�测是否有更新任务
    if request.a rgs.get('p age') :
     da ta_l ist = models.d r ive. all()
        json_dat a = { "c o de": 0,  "msg ": ""," co u n t":  0 ,"da ta " :[]}
      ifdata_list: 
          forr es ult in dat a_l ist:
             js on_ d ata[" cou nt"]= json _ data[" count"]+1 
           d r iv e_nu mber = len(models . dr i ve_list.all(re sult.i d) ) 
           syn _t ask_s t atus =l og i c . isS y nTask(result. id)
             i fsyn _ task_s tatus :                syn_task _statu s  = "<bu t ton cla ss='la yui -bt n la y ui -b tn- no r mal la yui - btn -xs' lay -e ve nt='s yn_d e t a i l' d ata -id= '1'>正 在运行同步</button >"            el se:               syn_task_status  = " <button c las s= 'la yu i-btn layui- btn -pr imary l ayui-bt n -xs '> 暂 无 同 步进 程</button>"
           json _data[ " da ta " ].append (             { "id": re sult.i d ,"t itle":re sult.t it le,  "d escri p tion ": res ult.desc ripti o n, "drive_numb e r":drive_numb e r, " sy n _tas k_s tatus":syn_ task _ stat us," up dat e _time ":str (r e su l t.update_time), "cr ea te_tim e": s tr(result.cre ate_time)} )        r etur n  j s on.dumps(json_ data) 
    else:        retur n render _template ( ' admin/dr ive /li st. htm l ' ,top_nav='driv e ' , ac ti vity_na v=' list',isR unn ing =is Ru nning)

@admin.r ou te (' /d riv e/syn _ detail/< in t:i d> ',metho d s=['GE T', ' POST '] )@ dec orators . lo g i n_re qu ir e
de f s yn _deta il(i d ):    col lection =  Mo n goDB .d b[ "log"]    data = co ll ection.fin d( {"d rive_i d " : str(id ), "type":"syn"})
    r e turn re nde r_tem plat e('admin/ dri ve/syn _de t ail.ht ml', t op_na v= 'dr i v e', a c t iv ity _n av='list', d irv e_id= id , da ta=data )


@admin.route(' / dri ve/edit/<int: id> ', m e t ho ds= [ 'G E T',  ' P OST ' ] )  # 
�测是否有更新任务
 _ _if request.args.get('page'):
  _ __ _data_list_= models.drive.all()
 _  _   json_data_= {"code": 0,_"msg":_"", "count": 0, "data": []}
        if data_list:
__ ___    _ for result in data_list:
_ _       __  _ json_data["count"] = json_data["count"]+1
     _     _  __drive_number_= len(models.drive_list.all(result.id))
  _     _     _ syn_task_status = logic.isSynTask(result.id)
   _     _    _ if_syn_task_status:
    _  _ _  _     _ syn_task_status =_"<button class='layui-btn layui-btn-normal layui-btn-xs' lay-event='syn_detail' data-id='1'>正在运行同步</button>"
__  ___ _  __ __else:
     __      _   __ syn_task_status = "<button_class='layui-btn layui-btn-primary layui-btn-xs'>暂无同步进程</button>"
  _     _ _ _   json_data["data"].append(
       _     _   _ _{"id":_result.id, "title": result.title,_"description":_result.description, "drive_number":drive_number,_"syn_task_status":syn_task_status, "update_time":str(result.update_time), "create_time": str(result.create_time)})
   _ _  return json.dumps(json_data)
  _ else:
  __    return render_template('admin/drive/list.html',_top_nav='drive', activity_nav='list', isRunning=isRunning)


@admin.route('/drive/syn_detail/<int:id>', methods=['GET', 'POST'])
@decorators.login_require
def syn_detail(id):
_   collection =_MongoDB.db["log"]
__  data = collection.find({"drive_id":_str(id), "type":"syn"})
    return_render_template('admin/drive/syn_detail.html', top_nav='drive', activity_nav='list',_dirve_id=id, data=data)


@admin.route('/drive/edit/<int:id>', methods=['GET', 'POST'])  # 