/** * [topic 专题/活动] * @Author Ethan * @DateTime 2015-08-12T17:08:15+0800 * @return [type] [description] */ public function topic() { //流量统计 $this->flowModel->addHits(array("title" => "topic", "type" => 2)); $id = I("get.id"); if (!$id) { $this->error("数据错误!", "/home/mobile/topicList.html"); } $info = $this->topicModel->where("id='{$id}' and mark=1")->find(); if (!$info) { $this->error("数据错误!", "/home/mobile/topicList.html"); } if ($info["end_time"] > time()) { $info["is_finish"] = 0; $time = getFormatDate(date("Y-m-d H:i:s"), date("Y-m-d H:i:s", $info['end_time'])); if ((int) $time["day"] > 0) { $info['time'] .= "<em>" . $time["day"] . "</em>天"; } if ((int) $time["hour"] > 0) { $info['time'] .= "<em>" . $time["hour"] . "</em>时"; } else { $info['time'] .= "00h : "; } if ((int) $time["minute"] > 0) { $info['time'] .= "<em>" . $time["minute"] . "</em>分"; } else { $info['time'] .= "00m : "; } if ((int) $time["second"] > 0) { $info['time'] .= "<em>" . $time["second"] . "</em>秒"; } else { $info['time'] .= "00s"; } } else { $info['is_finish'] = 1; //已结束 $info['time'] = "<em>00</em>时<em>00</em>分<em>00</em>秒"; } $info['content'] = html_entity_decode($info['content']); $info['image'] = unserialize($info['image']); $this->assign("info", $info); $this->display(); }
/** * [topic 专题/活动] * @Author Ethan * @DateTime 2015-08-12T17:08:15+0800 * @return [type] [description] */ public function topicList() { //流量统计 $this->flowModel->addHits(array("title" => "topicList", "type" => 1)); $bannel = $this->bannelModel->where("type=1")->find(); $bannel['url'] = unserialize($bannel['url']); $top = $this->topicModel->where("mark=1 and type=2")->order("end_time asc ,sort asc ")->select(); //没有结束时间的活动,即积分活动 foreach ($top as &$row) { //$val['describe'] = mb_substr($val['describe'],0,60,'utf-8'); $row['image'] = unserialize($row['image']); } $list = $this->topicModel->where("mark=1 and type=1")->order("end_time asc ,sort asc ")->select(); foreach ($list as $key => &$val) { $val['image'] = unserialize($val['image']); //$val['content'] = html_entity_decode($val['content']); //$val['describe'] = mb_substr($val['describe'],0,60,'utf-8'); if ($val["end_time"] > time()) { $val["is_finish"] = 0; $time = getFormatDate(date("Y-m-d H:i:s"), date("Y-m-d H:i:s", $val['end_time'])); if ((int) $time["day"] > 0) { $val['time'] .= $time["day"] . "d : "; } if ((int) $time["hour"] > 0) { $val['time'] .= $time["hour"] . "h : "; } else { $val['time'] .= "00h : "; } if ((int) $time["minute"] > 0) { $val['time'] .= $time["minute"] . "m : "; } else { $val['time'] .= "00m : "; } if ((int) $time["second"] > 0) { $val['time'] .= $time["second"] . "s"; } else { $val['time'] .= "00s"; } } else { $val['is_finish'] = 1; //已结束 $val['time'] = "00h : 00m : 00s"; } //针对排序问题 if ($val['is_finish'] == 0) { $arr[$key] = $val; } else { $new[$key] = $val; } } if ($new && $arr) { $result = array_merge($arr, $new); } elseif (!$new && $arr) { $result = $arr; } elseif ($new && !$arr) { $result = $new; } if ($result && $top) { $result = array_merge($top, $result); } elseif ($result && $top) { $result = $result; } elseif (!$result && $top) { $result = $top; } foreach ($result as $key => $val) { if ($key !== 0) { $html .= "<div class='active_con'>"; $html .= "<div class='active_pic_wrap'><a href='/home/login/topic/id/{$val['id']}.html'><img data-src='" . $val['image'][0] . "'></a></div>"; $html .= "<dl class='active_info'>"; $html .= "<dt>{$val['title']}<a class='more' href='/home/login/topic/id/{$val['id']}.html'>活动规则>></a></dt>"; $html .= "<dd><em>活动介绍:</em>{$val['describe']}</dd>"; if ($val['type'] == 2) { $html .= "<dd><em></em></dd>"; $html .= "<dd><a class='btn_blue' href='/home/login/topic/id/{$val['id']}.html'>立即参与</a></dd>"; } elseif ($val['type'] == 1) { $html .= "<dd><em>距活动结束:</em>{$val['time']}</dd>"; if ($val['is_finish'] == 1) { $html .= "<dd><a class='btn_grey' href='javascript:void(0)'>活动已结束</a></dd>"; } else { $html .= "<dd><a class='btn_blue' href='/home/login/topic/id/{$val['id']}.html'>立即参与</a></dd>"; } } $html .= "</dl>"; $html .= "</div>"; } } $this->assign("html", $html); $this->assign("image", $bannel['url']); $this->assign("list", $result); $this->display(); }
?> <tr > <td><?php echo '<a href="workOrder.php?action&id=' . $id . '">' . $row['Work_Order_Number'] . '</a>'; ?> </td> <td><?php echo $row['Property']; ?> </td> <td><?php echo $row['City']; ?> </td> <td><?php echo getFormatDate($row['Dispatched_On_Date']); ?> </td> <td><?php echo $row['Work_Order_Number']; ?> </td> </tr> <?php } ?> </tbody> </table> </div>