@tianqing123
2017-06-19T05:48:55.000000Z
字数 1046
阅读 1048
离线大屏
APP通知:资源包更新成功时
定时任务数据提取
创建
根据定时任务数据创建定时任务
APP通知:有任务满足执行条件
// 获取cron// data:[{"id":1,"index":"","cronList":[{"begin":"","end":""}],"startTime":"","endTime":"","createtime":""}]function getCronList(data){result = []; // 处理结果if(data不为空){data.each(d){item = {id:d.id,data:[]};d.cronList.each(dd){item.data.push(dd.begin);item.data.push(dd.end);}result.push(item)}}return result;}// 运行定时任务function runSchedule(updateResult){if(updateResult.type == 'corn'){ // 更新类型是定时任务for(文件名 in updateResult.data){var fileData = readContent(文件名); // 获取文件数据var cronList = getCronList(fileData);// 获取cron 集合cronList.each(d){tsDriver('createSchedule',{ // 创建定时任务type:'cron',biz:updateResult.type,code:d.id,params:d.data,callbackFn:function(result){handleSchedule(result)}});}}}}// 处理定时任务// result:{code:'',biz:'',extend:''}function handleSchedule(result){switch(biz){case 'adv':// 强制刷新指定页面break;case 'sys':break;default:break;}}if(app通知资源包更新结束){获取更新结果 updateResult = {type:'更新类型',data:'更新列表'}runSchedule(updateResult);}