$v['cate_num'] = $infoModel->count($filter); } //echo "<pre>";var_dump($cates);die(); //smarty if ($cate_id) { $smarty->assign("cate_id", $cate_id); } $smarty->assign("type", $type); $smarty->assign("typeyhtml", $type . "_table"); $smarty->assign("cates", $cates); //var_dump($result[data]);die(); foreach ($result['data'] as $key => $value) { //$result['data'][$key]['keyword']=cut_str($value['keyword'],8, $start = 0, $code = 'UTF-8'); $result['data'][$key]['info_intro'] = cut_str($value['info_intro'], 13, $start = 0, $code = 'UTF-8'); $result['data'][$key]['info_title'] = cut_str($value['info_title'], 13, $start = 0, $code = 'UTF-8'); $result['data'][$key]['music_name'] = cut_str($value['music_name'], 9, $start = 0, $code = 'UTF-8'); $result['data'][$key]['music_url'] = cut_str($value['music_url'], 20, $start = 0, $code = 'UTF-8'); $result['data'][$key]['video_name'] = cut_str($value['video_name'], 9, $start = 0, $code = 'UTF-8'); $result['data'][$key]['location_name'] = cut_str($value['location_name'], 9, $start = 0, $code = 'UTF-8'); } if ($type == 'multi') { $Model_InfoCommonDetail = new Model_InfoCommonDetail(); foreach ($result['data'] as &$v) { $filter['where'] = "info_common_id = '{$v['id']}'"; $filter['group'] = 'info_common_id'; $v['multi_num'] = $Model_InfoCommonDetail->count($filter); } } //echo "<pre>";var_dump($result['data']);die(); $smarty->assign("infolist", $result['data']); $smarty->setTpl('info/templates/index.html')->display();
public function getMulti() { $i = 0; $infocommonModel = new Model_InfoCommon(); $filter['where'] = " id='{$this->info_id}' and customer_id='{$this->customer_id}' and state='1' "; $sql = $infocommonModel->select($filter); $inforesult = $infocommonModel->fetchRow($sql); if ($inforesult['id']) { $sql = "update info_common set push_num=push_num+1 where id='" . $inforesult['id'] . "' limit 1"; $infocommonModel->query($sql); $infocommondetailModel = new Model_InfoCommonDetail(); $filter['where'] = " info_common_id='" . $inforesult['id'] . "'"; $filter['order'] = " order_num asc "; $sql = $infocommondetailModel->select($filter); $inforesult2 = $infocommondetailModel->fetchAll($sql); $infocount = count($inforesult2); for ($i = 0; $i < $infocount; $i++) { if (!$inforesult2[$i]['url']) { $url = 'http://' . $_SERVER['HTTP_HOST'] . "/mobile/info.php?t=multi&id=" . $inforesult2[$i]['id']; } else { $url = $inforesult2[$i]['url']; } $itemlist .= "<item>\n\t\t\t <Title><![CDATA[" . $inforesult2[$i]['title'] . "]]></Title>\n\t\t\t <Description><![CDATA[" . $inforesult2[$i]['location_desc'] . "]]></Description>\n\t\t\t <PicUrl><![CDATA[http://" . $_SERVER['HTTP_HOST'] . "/data/image_c/" . $inforesult2[$i]['pic'] . "]]></PicUrl>\n\t\t\t <Url><![CDATA[{$url}]]></Url>\n\t\t\t </item>"; } } if ($i > 0) { $Bodystr = "\n\t\t\t <ArticleCount>{$infocount}</ArticleCount>\n\t\t\t <Articles>\n\t\t\t {$itemlist}\n\t\t\t </Articles>"; $data['msgtype'] = 'news'; $data['bodystr'] = $Bodystr; return $data; } }
if ($act == 'del' && $_POST['child_id']) { $Model_InfoCommonDetail->delete("id='{$_POST[child_id]}'"); //echo $_POST['child_id']; die('success'); } if ($act == 'del' && $id) { Model_Table::get('InfoCommon')->delete("id='{$id}' and customer_id='{$customer_id}'"); Model_Table::get('InfoCommonDetail')->delete("info_common_id='{$id}'"); Model_Table::get('KeywordList')->delete("info_id='{$id}' and customer_id='{$customer_id}' and info_type='{$info_type}'"); header("location:/home/info/index.php?type=multi"); die; } //method:add||modify if ($id) { $music_table = new Model_InfoCommon(); $Model_InfoCommonDetail = new Model_InfoCommonDetail(); $data = $music_table->fetchRow("select * from info_common where id='{$id}' and customer_id='{$customer_id}' and info_type=3"); $datas = $Model_InfoCommonDetail->fetchAll("select * from info_common_detail where info_common_id='{$id}' order by order_num asc"); //echo "<pre>";var_dump($datas); $smarty->assign('infoRow', $data); if ($datas) { foreach ($datas as $key => $value) { $datas[$key]['title'] = cut_str($value['title'], 10, $start = 0, $code = 'UTF-8'); } $smarty->assign('infoAll', $datas); $smarty->assign('json_true', true); } else { $smarty->assign('json_true', false); } //echo "<pre>";var_dump($datas);die(); }
<?php include_once "../includes/config.inc.php"; $customer_id = $_WGT['m_customer_id']; $id = (int) $_REQUEST['id']; $t = $_REQUEST['t']; if ($t == 'single') { $infocommonModel = new Model_InfoCommon(); $filter['where'] = " customer_id='{$customer_id}' and id='{$id}' "; $sql = $infocommonModel->select($filter, '*'); $info = $infocommonModel->fetchRow($sql); $info['info_intro'] = nl2br($info['info_intro']); } elseif ($t == 'multi') { $infocommondetailModel = new Model_InfoCommonDetail(); $filter['where'] = " id='{$id}' "; $sql = $infocommondetailModel->select($filter, '*'); $info = $infocommondetailModel->fetchRow($sql); $info['info_title'] = $info['title']; $info['info_intro'] = nl2br($info['msg_content']); $info['pic_showincontent'] = 1; $info['info_pic'] = $info['pic']; } $customerModel = new Model_Customer(); $filter['where'] = " id='{$customer_id}' "; $sql = $customerModel->select($filter, 'id,weixin_name'); $customerinfo = $customerModel->fetchRow($sql); $smarty->assign("customerinfo", $customerinfo); $smarty->assign("info", $info); $smarty->assign("today", date("Y-m-d")); $smarty->setLayout('')->setTpl('/mobile/templates/info.html')->display();
<?php include_once "../../includes/config.inc.php"; include_once "../../includes/login_check.php"; $customer_id = (int) $_SESSION['customer_id']; $Model_InfoCommonDetail = new Model_InfoCommonDetail(); $Model_InfoCommon = new Model_InfoCommon(); $datatwo['title'] = str_inmysql($_POST['title']); $datatwo['pic'] = str_inmysql($_POST['pic']); /* $msg = str_replace("\n", "<br/>", $_POST['msg_content']); $msg = str_replace("\"", "", $msg); */ //$str = htmlspecialchars($_POST['msg_content']); $datatwo['msg_content'] = str_inmysql($_POST['msg_content']); $datatwo['url'] = str_inmysql($_POST['url']); $datatwo['order_num'] = (int) $_POST['order_num']; if ($_POST['act'] == 'sele' && $_POST['d_id']) { $id = (int) $_POST['d_id']; $p_id = (int) $_POST['id']; $rows = $Model_InfoCommonDetail->fetchRow("select * from info_common_detail where id='{$id}' and info_common_id='{$p_id}'"); //$rowsstr = str_replace("\n", "", $rows['msg_content']); //$rows['msg_content'] = str_replace("\r", "", $rowsstr); $res = json_encode($rows); header('Content-Type: application/json'); echo $res; die; } //The One if ($_POST['info_type_form'] == 'one') { $data['keyword'] = str_inmysql(str_replace(array(';', ','), ',', $_POST['keyword'])); $data['id'] = (int) $_POST['id']; $data['state'] = (int) $_POST['state'];