lvhao пре 1 месец
родитељ
комит
e731872b56
1 измењених фајлова са 183 додато и 0 уклоњено
  1. 183 0
      core/CoreApp/controllers/Color.php

+ 183 - 0
core/CoreApp/controllers/Color.php

@@ -42,6 +42,9 @@ class Color extends Start_Controller {
         {
              $this->_ex();
         }
+		else if($arg == 'ex2'){
+			$this->_ex2();
+		}
 		else
 		{
 			$this->_index();
@@ -517,4 +520,184 @@ class Color extends Start_Controller {
 			$tail = "";
             $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
     }
+
+	private function _ex2(){
+		$title = $this->input->get('title',true);
+			$content = $this->input->get('content',true);
+			$warehouse = $this->input->get('warehouse',true);
+			$type = $this->input->get('type',true);
+			$developer = $this->input->post('developer',true);
+			$state = $this->input->get('state',true);
+			$timetk = $this->input->get('timetk',true);
+			$timetj = $this->input->get('timetj',true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			$where = "1=1";
+			if($title)
+            {
+                $where  .= " and title like '%$title%'";
+            }
+			if($content)
+            {
+                $where  .= " and content like '%$content%'";
+            }
+			if($warehouse)
+            {
+                $where  .= " and warehouse = '$warehouse'";
+            }
+			if($type)
+            {
+                $where  .= " and type = '$type'";
+            }
+			if($state)
+            {
+                $where  .= " and state = '$state'";
+            }
+            if($developer)
+            {
+                $where  .= " and developer = '$developer'";
+            }
+			if($timetk && $timetj)
+            {
+                $where  .= " and time > '$timetk' and time < '$timetj'";
+            }
+			//数据排序
+            $order_str = "id desc";
+			$info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,content,img,developer,craft_process,time');
+			foreach ($info_list as $key=>$value) 
+		    {
+		        if(empty($value['developer'])){
+				    $info_list[$key]['developer'] = '';
+				}
+				if(empty($value['craft_process'])){
+				    $info_list[$key]['craft_process'] = '';
+				}
+				
+				if($value['state'] == 1)
+				{
+					$info_list[$key]['state'] = '在售款';
+				}
+				else if($value['state'] == 2)
+				{
+					$info_list[$key]['state'] = '已停售';
+				}
+				else
+				{
+					$info_list[$key]['state'] = '未选择';
+				}
+				
+				if($value['type'] == 1)
+				{
+					$info_list[$key]['type'] = '编号款配图';
+				}
+				else if($value['type'] == 2)
+				{
+					$info_list[$key]['type'] = '颜色配图';
+				}
+				else if($value['type'] == 3)
+				{
+					$info_list[$key]['type'] = '曲度配图';
+				}
+				else if($value['type'] == 4)
+				{
+					$info_list[$key]['type'] = '编号款配图';
+				}
+				else
+				{
+					$info_list[$key]['type'] = '未选择';
+				}
+				
+				$colorimg = explode('|',$value['img']);
+				$v = $colorimg[0];
+				$img_list = [];
+				foreach ($colorimg as $v) 
+				{
+						$lx = explode(".",$v);
+						$lx = strtolower(end($lx));
+						if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
+						{
+							$img_list[] = '<video width="70" src="'.$v.'" controls="controls"';
+						}
+						else if($v != '')
+						{
+							$img_list[] = "<img width='70' src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','/img/thumb?src='),'',$v)."&w=100&h=50' data-src='".$v."'>";
+						}
+						
+				}
+				
+				$info_list[$key]['img'] = '<a href="http://'.$_SERVER['HTTP_HOST'].'/color/see/'.$value['id'].'" target="_blank">点击查看</a>';
+				$info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
+				unset($info_list[$key]['id']);
+			}
+
+			$title = "新品/新色配图"; 
+
+
+		$filename = date("Y-m-d") . $title.".xls";
+		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
+		<head>
+		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+		<!--[if gte mso 9]>
+		<xml>
+			<x:ExcelWorkbook>
+				<x:ExcelWorksheets>
+					<x:ExcelWorksheet>
+						<x:Name>新品/新色配图</x:Name>
+						<x:WorksheetOptions>
+							<x:Print>
+								<x:ValidPrinterInfo />
+							</x:Print>
+						</x:WorksheetOptions>
+					</x:ExcelWorksheet>
+				</x:ExcelWorksheets>
+			</x:ExcelWorkbook>
+		</xml>
+		<![endif]-->
+		<style>
+			tr { mso-height-source: auto; }
+			.fixed-height { 
+				height: 100px; /* 设置固定行高 */
+				mso-height-source: userset; /* 强制Excel使用设定高度 */
+			}
+				
+			
+			
+		</style>
+		</head>
+		<body>";
+		
+		$str .= "<table border='1' cellspacing='0' style='border-collapse: collapse; font-family: Microsoft Yahei; font-size: 13px;'>"; 
+		$str .= "<tr >"; // 应用固定高度类
+		$str .= "<td>标题</td><td>是否在售</td><td>配图类型</td><td>色号</td><td>曲度</td><td>备注</td><td>开发人</td><td>工艺流程</td><td>添加时间</td><td>图片</td>";
+		$str .= "</tr>";
+		foreach($info_list as $key => $value){
+			$str .= "<tr class='fixed-height'>"; // 应用固定高度类
+			$str .= "<td>".$value['title']."</td>";  
+			$str .= "<td>".$value['state']."</td>";   
+			$str .= "<td>".$value['type']."</td>";
+			$str .= "<td>".$value['color']."</td>";
+			$str .= "<td>".$value['lowe']."</td>";
+			$str .= "<td>".$value['content']."</td>";
+			$str .= "<td>".$value['developer']."</td>";
+			$str .= "<td>".$value['craft_process']."</td>";
+			$str .= "<td>".$value['time']."</td>";
+			$str .= "<td ><table border='0'><tr class='fixed-height' >";
+			foreach ($img_list as $img) {
+				$str .= '<td >'.$img.'</td>';
+			  
+			}
+			$str .= "</tr></table></td>";
+			$str .= "</tr>";
+		}
+		
+		
+		$str .= "</table></body></html>"; 
+		
+		header("Content-Type: application/vnd.ms-excel; charset=utf-8"); 
+		header("Content-Disposition: attachment; filename=".$filename); 
+		header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
+		header("Pragma: no-cache"); 
+		header("Expires: 0"); 
+		exit($str); 
+	}
 }