Example #1
0
//delete
if ($act == 'del' && $id) {
    Model_Table::get('InfoCommon')->delete("id='{$id}' and customer_id='{$customer_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=single");
    die;
}
//method:add||modify
if ($id) {
    $data = Model_Table::get('InfoCommon')->findByWhere("id='{$id}' and customer_id='{$customer_id}' and info_type='" . Model_InfoCommon::get_type($info_type) . "'");
    $smarty->assign('infoRow', $data);
}
//submit
if (method_is('post')) {
    $data['customer_id'] = $customer_id;
    $data['info_type'] = Model_InfoCommon::get_type($info_type);
    $data['keyword'] = isset($_POST['keyword']) ? str_inmysql(str_replace(array(';', ','), ',', $_POST['keyword'])) : '';
    $data['state'] = isset($_POST['state']) ? (int) $_POST['state'] : '';
    $data['cate_id'] = isset($_POST['cate_id']) ? (int) $_POST['cate_id'] : '';
    $data['info_title'] = isset($_POST['info_title']) ? str_inmysql($_POST['info_title']) : '';
    $data['pic_showincontent'] = isset($_POST['show']) ? (int) $_POST['show'] : '';
    $data['info_pic'] = isset($_POST['info_pic']) ? str_inmysql($_POST['info_pic']) : '';
    $data['info_desc'] = isset($_POST['info_desc']) ? str_inmysql($_POST['info_desc']) : '';
    $data['info_intro'] = isset($_POST['info_intro']) ? str_inmysql($_POST['info_intro']) : '';
    $data['info_url'] = isset($_POST['info_url']) ? str_inmysql($_POST['info_url']) : '';
    $data['create_date'] = date('Y-m-d H:i:s', $_WGT['TIME']);
    if (!$data['keyword']) {
        ajax_feedback(0, '1201');
    }
    if (!$data['info_intro']) {
        ajax_feedback(0, '1202');
Example #2
0
//var
$customer_id = (int) $_SESSION['customer_id'];
$type = Model_InfoCate::exist_type($_REQUEST['type']) ? $_REQUEST['type'] : 'text';
$cate_id = (int) $_REQUEST["cate_id"];
$page = (int) $_REQUEST["p"] > 0 ? (int) $_REQUEST["p"] : 1;
//sql
$filter = array();
$filter['where'] = "customer_id = {$customer_id}";
if ($cate_id) {
    $filter['where'] .= " and cate_id='{$cate_id}'";
}
if ($type == 'multi') {
    $filter['where'] .= " and info_type='3'";
} else {
    if (Model_InfoCate::getTypeName($type) == 'common') {
        $filter['where'] .= " and info_type='" . Model_InfoCommon::get_type($type) . "'";
    }
}
$filter['order'] = "id desc";
//result
$table = 'Model_Info' . ucfirst(Model_InfoCate::getTypeName($type));
$infoModel = new $table();
//echo "<pre>";var_dump($filter);die();
$result = $infoModel->paginate($filter, '*', $page, $size = '20');
$pager = $result['pager'];
//pager
if ($pager['pagenum'] > $pager['size']) {
    $pagerhtml = new SubPages($pager['size'], $pager['count'], $pager['current'], $pager['range'], 2);
    $smarty->assign("pagerhtml", $pagerhtml);
}
//category
Example #3
0
 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;
     }
 }
Example #4
0
<?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();
Example #5
0
    $days_value_str .= $count_value . ',';
    $days_valueb_str .= $count_valueb . ',';
    $days_valuec_str .= $count_valuec . ',';
}
$filter['where'] = "customer_id = '{$customer_id}' and msg_content!='subscribe' and msg_content!='unsubscribe' and msg_content!='' and create_date >= '{$start_date}'";
$filter['group'] = "msg_content";
$filter['order'] = "count_num desc";
$filter['limit'] = "0,100";
$sql = $messageModel->select($filter, 'count(id) as count_num,msg_content');
$topmessage = $messageModel->fetchAll($sql);
foreach ($topmessage as $key => $value) {
    $topmessage[$key]['msg_content'] = cut_str($value['msg_content'], 6, $start = 0, $code = 'UTF-8');
}
$topmessage = array_slice($topmessage, 0, 10, true);
//互动内容统计
$infocommonModel = new Model_InfoCommon();
$filter = array();
$filter['where'] = "customer_id = '{$customer_id}' and state='1' ";
$filter['group'] = "info_type";
$sql = $infocommonModel->select($filter, 'count(id) as count_num,info_type');
$infocommonarray = $infocommonModel->fetchAll($sql);
foreach ($infocommonarray as $key => $value) {
    $infocount[$value['info_type']] = $value['count_num'];
}
//图片统计
$infopicModel = new Model_InfoPic();
$filter = array();
$filter['where'] = "customer_id = '{$customer_id}'";
$infocount['pic'] = $infopicModel->count($filter);
//音乐统计
$infomusicModel = new Model_InfoMusic();
Example #6
0
$Model_InfoCommonDetail = new Model_InfoCommonDetail();
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();
Example #7
0
<?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'];