diff --git a/application/api/controller/Main.php b/application/api/controller/Main.php index 0d6fe55..e41e8c3 100644 --- a/application/api/controller/Main.php +++ b/application/api/controller/Main.php @@ -423,7 +423,8 @@ class Main extends Controller { myPost($push_url,$re); } } - + + /** * 获取图片(cn站点拉取主站img文件) */ @@ -455,6 +456,8 @@ class Main extends Controller { $fileData['mubiao'] = $dir.'/3714895481e8d2338c25c57bbcfba0b7.pdf'; Queue::push( 'app\api\job\imgFile@fire' , $fileData , "file" ); } + + /** * @title 获取首页Highlights diff --git a/application/api/job/imgFile.php b/application/api/job/imgFile.php index e11d7a6..4e8fbcb 100644 --- a/application/api/job/imgFile.php +++ b/application/api/job/imgFile.php @@ -9,20 +9,20 @@ class imgFile { //put your code here public function fire(Job $job, $data) { - $res = $this->send($data); - $job->delete(); - if($res){ - $job->delete(); - }else{ - if($job->attempts()>3){ - // 第1种处理方式:重新发布任务,该任务延迟10秒后再执行 - //$job->release(10); - // 第2种处理方式:原任务的基础上1分钟执行一次并增加尝试次数 - //$job->failed(); - // 第3种处理方式:删除任务 - $job->delete(); - } - } + $this->send($data); + $job->delete(); + // if($res){ + // $job->delete(); + // }else{ + // if($job->attempts()>3){ + // // 第1种处理方式:重新发布任务,该任务延迟10秒后再执行 + // //$job->release(10); + // // 第2种处理方式:原任务的基础上1分钟执行一次并增加尝试次数 + // //$job->failed(); + // // 第3种处理方式:删除任务 + // $job->delete(); + // } + // } } /** diff --git a/application/master/controller/Mytest.php b/application/master/controller/Mytest.php index d89b845..d3f8e83 100644 --- a/application/master/controller/Mytest.php +++ b/application/master/controller/Mytest.php @@ -1,15 +1,9 @@ createSection(); + $section=$PHPWord->addSection(); + + // $section = $PHPWord->createSection(); $PHPWord->addTitleStyle(1, array('bold' => true, 'size' => 18, 'name' => 'Arial', 'Color' => '333'), array('align' => 'center')); - $section->addTitle("疫情防控", 1); + // $section->addTitle("疫情防控", 1); //定义样式数组 @@ -137,7 +133,10 @@ class Mytest extends Controller ); - $cellStyle = array('gridSpan' => 2); + // $cellStyle = array('gridSpan' => 2); + $cellStyle1 = array('gridSpan' => 3,"bgColor"=>"FF0000",'align'=>'center'); + $cellStyle2 = array('gridSpan' => 3,"bgColor"=>"EEEE11",'align'=>'center'); + $cellStyle3 = array('gridSpan' => 3,"bgColor"=>"0099FF",'align'=>'center'); //添加表格样式 @@ -145,53 +144,136 @@ class Mytest extends Controller //添加表格 + $table = $section->addTable('myOwnTableStyle'); - $table->addRow(); + $table->addCell(9000,$cellStyle1)->addText('高风险等级地区'); + $gn = ""; + foreach($fg as $v){ + $table->addRow(); + if($v['p']==$gn){ + $table->addCell(2000,array('vMerge' => 'continue')); + }else{ + $table->addCell(2000, array('vMerge' => 'restart','valign'=>'center'))->addText($v['p']); + } + $table->addCell(2000)->addText($v["city"]); + $table->addCell(5000)->addText($v['area']); + $gn = $v['p']; + } - $table->addCell(3000)->addText('测试1'); - - $table->addCell(3000)->addText('测试2'); - - $table->addCell(3000)->addText('测试3'); - + $table = $section->addTable('myOwnTableStyle'); $table->addRow(); + $table->addCell(9000,$cellStyle2)->addText('中风险等级地区'); + $zn = ""; + foreach($fz as $v){ + $table->addRow(); + if($v['p']==$zn){ + $table->addCell(2000,array('vMerge' => 'continue')); + }else{ + $table->addCell(2000, array('vMerge' => 'restart','valign'=>'center'))->addText($v['p']); + } + $table->addCell(2000)->addText($v["city"]); + $table->addCell(5000)->addText($v['area']); + $zn = $v['p']; + } - $table->addCell(3000)->addText('测试4'); - $table->addCell(6000, $cellStyle)->addText('测试5'); //合并列单元格 + $table1 = $section->addTable('myOwnTableStyle'); + $table1->addRow(); + $table1->addCell(9000,$cellStyle3)->addText('低风险等级地区'); + $dn = ""; + foreach($fd as $v){ + $table1->addRow(); + if($v['p']==$dn){ + $table1->addCell(2000,array('vMerge' => 'continue')); + }else{ + $table1->addCell(2000, array('vMerge' => 'restart','valign'=>'center'))->addText($v['p']); + } + $table1->addCell(2000)->addText($v["city"]); + $table1->addCell(5000)->addText($v['area']); + $dn = $v['p']; + } - $table->addRow(); + + // $table1 = $section->addTable('myOwnTableStyle'); + // $table1->addRow(); + // $table1->addCell(9000,$cellStyle2)->addText('中风险等级地区'); + // $zn = ""; + // foreach($fz as $v){ + // $table1->addRow(); + // if($v['p']==$zn){ + // $table->addCell(2000,array('vMerge' => 'continue')); + // }else{ + // $table->addCell(2000, array('vMerge' => 'restart'))->addText($v['p']); + // } + // $table1->addCell(2000)->addText($v["city"]); + // $table1->addCell(5000)->addText($v['area']); + // $zn = $v['p']; + // } - $table->addCell(3000, array('vMerge' => 'restart'))->addText('合并'); - $table->addCell(3000, array('vMerge' => 'restart'))->addText('测试6'); - $table->addCell(3000)->addText('测试7'); + // $table2 = $section->addTable('myOwnTableStyle'); + // $table2->addRow(); + // $table2->addCell(9000,$cellStyle3)->addText('低风险等级地区'); + // $dn = ""; + // foreach($fd as $v){ + // $table2->addRow(); + // if($v['p']==$dn){ + // $table->addCell(2000,array('vMerge' => 'continue')); + // }else{ + // $table->addCell(2000, array('vMerge' => 'restart'))->addText($v['p']); + // } + // $table2->addCell(2000)->addText($v["city"]); + // $table2->addCell(5000)->addText($v['area']); + // $dn = $v['p']; + // } - $table->addRow(); + // $table->addRow(); - $table->addCell(3000, array('vMerge' => 'continue')); + // $table->addCell(3000)->addText('测试1'); - $table->addCell(3000)->addText('测试8'); + // $table->addCell(3000)->addText('测试2'); - $table->addCell(3000)->addText('测试9'); + // $table->addCell(3000)->addText('测试3'); - $table->addRow(); + // $table->addRow(); - $table->addCell(3000)->addText('测试10'); + // $table->addCell(3000)->addText('测试4'); - $table->addCell(3000)->addText('测试11'); + // $table->addCell(6000, $cellStyle)->addText('测试5'); //合并列单元格 - $table->addCell(3000)->addText('测试12'); + // $table->addRow(); - $file = '测试.docx'; + // $table->addCell(3000, array('vMerge' => 'restart'))->addText('合并'); + + // $table->addCell(3000)->addText('测试6'); + + // $table->addCell(3000)->addText('测试7'); + + // $table->addRow(); + + // $table->addCell(3000, array('vMerge' => 'continue')); + + // $table->addCell(3000)->addText('测试8'); + + // $table->addCell(3000)->addText('测试9'); + + // $table->addRow(); + + // $table->addCell(3000,array('vMerge' => 'continue')); + + // $table->addCell(3000)->addText('测试10'); + + // $table->addCell(3000)->addText('测试11'); + + $file = '风险区域总结.docx'; //文档存在服务器上用此代码 - $objWriter = IOFactory::createWriter($PHPWord, 'Word2007'); + // $objWriter = IOFactory::createWriter($PHPWord, 'Word2007'); - $objWriter->save('存储地址/编程爱好者.docx'); + // $objWriter->save('d:\编程爱好者.docx'); //直接下载不存储在服务器上用此代码