コード例 #1
0
ファイル: auto_reply.php プロジェクト: show123456/taiyou
<?php

include_once "../../includes/config.inc.php";
include_once "../../includes/login_check.php";
$customer_id = (int) $_SESSION['customer_id'];
$replyModel = new Model_AutoReply();
if ($_POST['save'] == '1') {
    //params
    $data = array();
    $data['customer_id'] = $customer_id;
    $data['type_id'] = '2';
    $data['is_keyword'] = (int) $_POST['is_keyword'];
    $data['reply_content'] = $data['is_keyword'] ? '' : str_inmysql($_POST['reply_content']);
    $data['reply_keyword'] = $data['is_keyword'] ? str_inmysql($_POST['reply_keyword']) : '';
    $data['create_date'] = date('Y-m-d H:i:s', $_WGT['TIME']);
    $data['state'] = (int) $_POST['state'];
    //save
    if ((int) $_POST['id'] > 0) {
        $gxid = (int) $_POST['id'];
        $replyModel->row_update($data, " id='{$gxid}' and type_id='2' and customer_id='{$customer_id}' ");
    } else {
        $replyModel->insert($data);
    }
    die('success');
}
//find
$replyRow = $replyModel->findByCustomerId($customer_id, '2');
//smarty
$smarty->assign('replyRow', $replyRow);
$smarty->setTpl('info/templates/auto_reply.html')->display();
コード例 #2
0
ファイル: baseapi.php プロジェクト: show123456/taiyou
 public function getInfo()
 {
     $KeywordlistModel = new Model_KeywordList();
     $keyword = $this->post_data['Keyword'];
     $filter['where'] = " customer_id='{$this->customer_id}' and keyword='{$keyword}' ";
     $filter['order'] = " rand() ";
     $sql = $KeywordlistModel->select($filter, 'info_id,info_type');
     $keywordinfo = $KeywordlistModel->fetchRow($sql);
     $base_infoarray = array('text', 'single', 'multi', 'pic', 'music', 'video');
     if ($keywordinfo['info_type']) {
         if (in_array($keywordinfo['info_type'], $base_infoarray)) {
             $class = 'base_info';
         } else {
             $class = $keywordinfo['info_type'] . '_info';
         }
         $classFile = $class . '.php';
         if (file_exists($classFile)) {
             include "{$classFile}";
             $infoobj = new $class();
             $result['info_id'] = $keywordinfo['info_id'];
             $result['info_type'] = $keywordinfo['info_type'];
             $result['customer_id'] = $this->customer_id;
             $result['fromuser'] = $this->post_data['FromUserName'];
             $result['timesign'] = $this->post_data['timesign'];
             $data = $infoobj->getData($result);
             $xmlcontent = $this->create_xmlcontent($data['msgtype'], $data['content'], $data['title'], $data['description'], $data['picurl'], $data['url'], $data['bodystr']);
             return $xmlcontent;
         }
     } else {
         include "special_info.php";
         $infoobj = new special_info();
         $result['info_id'] = $keywordinfo['info_id'];
         $result['info_type'] = $keywordinfo['info_type'];
         $result['customer_id'] = $this->customer_id;
         $result['fromuser'] = $this->post_data['FromUserName'];
         $result['timesign'] = $this->post_data['timesign'];
         $result['keyword'] = $this->post_data['Keyword'];
         $data = $infoobj->getData($result);
         if ($data['msgtype'] != '') {
             return $this->create_xmlcontent($data['msgtype'], $data['content'], $data['title'], $data['description'], $data['picurl'], $data['url'], $data['bodystr']);
         } else {
             //无匹配回复
             $replyModel = new Model_AutoReply();
             $replyRow = $replyModel->findByCustomerId($this->customer_id, '2');
             if (!$replyRow['id'] or $replyRow['state'] != '1') {
                 return false;
             } else {
                 return $this->create_xmlcontent('text', $replyRow['reply_content']);
             }
         }
     }
 }
コード例 #3
0
ファイル: follow.php プロジェクト: show123456/taiyou
<?php

include_once "../../includes/config.inc.php";
include_once "../../includes/login_check.php";
$customer_id = (int) $_SESSION['customer_id'];
$replyModel = new Model_AutoReply();
if ($_POST['save'] == '1') {
    //params
    $data = array();
    $data['customer_id'] = $customer_id;
    $data['type_id'] = 1;
    $data['is_keyword'] = (int) $_POST['is_keyword'];
    $data['reply_content'] = $data['is_keyword'] ? '' : str_inmysql($_POST['reply_content']);
    $data['reply_keyword'] = $data['is_keyword'] ? str_inmysql($_POST['reply_keyword']) : '';
    $data['create_date'] = date('Y-m-d H:i:s', $_WGT['TIME']);
    $data['state'] = (int) $_POST['state'];
    //save
    $replyModel->upsert($data);
    die('success');
}
//find
$replyRow = $replyModel->findByCustomerId($customer_id, '1');
//smarty
$smarty->assign('replyRow', $replyRow);
$smarty->setTpl('info/templates/follow.html')->display();