Esempio n. 1
0
 protected function focus_autoback()
 {
     global $_SGLOBAL, $_SC, $wx;
     $op_wxid = $wx->weixin['op_wxid'];
     $rand_pic = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28');
     $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin_autoreply') . ' where type="focus" and op_wxid="' . $op_wxid . '" and state=1 order by priority desc');
     if ($msg = $_SGLOBAL['db']->fetch_array($query)) {
         switch ($msg['reply_type']) {
             case "text":
                 $content = db_to_content(htmlspecialchars_decode($msg['content']));
                 $resultStr = $this->resp_text($content);
                 return $resultStr;
                 break;
             case "single_news":
                 $data = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_autoreply_info') . ' where autoreply_id="' . $msg['id'] . '" and state=1');
                 if ($data) {
                     if ($data[0]['url'] == '') {
                         $data[0]['url'] = $_SC['site_host'] . "/appmsg/?id=" . $data[0]['id'] . "&tp=1";
                     }
                     $data[0]['picurl'] = $data[0]['pic'];
                     if ($data[0]['picurl'] == '') {
                         $data[0]['picurl'] = $_SC['img_url'] . '/mpres/wallpaper/' . $rand_pic[array_rand($rand_pic, 1)] . '.jpg';
                     }
                     $data[0]['description'] = htmlspecialchars_decode($data[0]['summary']);
                     $resultStr = $this->resp_news($data);
                     return $resultStr;
                 }
                 break;
             case "multi_news":
                 $data = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_autoreply_info') . ' where autoreply_id="' . $msg['id'] . '" and state=1 order by sort_order limit 0,8');
                 foreach ($data as $k => $v) {
                     if ($data[$k]['url'] == '') {
                         $data[$k]['url'] = $_SC['site_host'] . "/appmsg/?id=" . $data[$k]['id'] . "&tp=1";
                     }
                     $data[$k]['picurl'] = $data[$k]['pic'];
                     $data[$k]['description'] = htmlspecialchars_decode($data[$k]['summary']);
                 }
                 if ($data[0]['picurl'] == '') {
                     $data[0]['picurl'] = $_SC['img_url'] . '/mpres/wallpaper/' . $rand_pic[array_rand($rand_pic, 1)] . '.jpg';
                 }
                 $resultStr = $this->resp_news($data);
                 return $resultStr;
                 break;
         }
     }
     return false;
 }
Esempio n. 2
0
function edit()
{
    global $_SGLOBAL, $smarty, $_SC;
    $id = intval($_GET['id']) ? intval($_GET['id']) : 0;
    $autoreply_id = $id;
    $op_wxid = $_SGLOBAL['db']->getone('select op_wxid from ' . tname('open_member_weixin_autoreply') . ' where id="' . $id . '" and state>-1');
    $op_uid = $_SGLOBAL['uid'];
    check_role($op_wxid);
    $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin') . ' where op_uid="' . $op_uid . '" and id="' . $op_wxid . '"');
    if ($account = $_SGLOBAL['db']->fetch_array($query)) {
        $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin_autoreply') . ' where id="' . $id . '" and state>-1');
        if ($account['autoreply'] = $_SGLOBAL['db']->fetch_array($query)) {
            switch ($account['autoreply']['reply_type']) {
                case "text":
                    $account['autoreply']['content'] = htmlspecialchars_decode($account['autoreply']['content']);
                    $account['autoreply']['content_textarea'] = db_to_content(htmlspecialchars_decode($account['autoreply']['content']));
                    break;
                case "single_news":
                    $account['autoreply']['singlenews'] = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin_autoreply_info') . ' where autoreply_id="' . $autoreply_id . '" and state=1'));
                    if (!$account['autoreply']['singlenews']) {
                        $account['autoreply']['singlenews']['title'] = '标题';
                    } else {
                        $account['autoreply']['singlenews']['content'] = htmlspecialchars_decode($account['autoreply']['singlenews']['content']);
                    }
                    break;
                case "multi_news":
                    $account['autoreply']['multinews_num'] = getcount(tname('open_member_weixin_autoreply_info'), array('autoreply_id' => $autoreply_id));
                    $account['autoreply']['multinews'] = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_autoreply_info') . ' where autoreply_id=' . $autoreply_id . ' and state=1 order by sort_order limit 0,8');
                    foreach ($account['autoreply']['multinews'] as $k => $v) {
                        $account['autoreply']['multinews'][$k]['content'] = htmlspecialchars_decode($v['content']);
                    }
                    break;
            }
        }
        if ($account['headimg'] == '') {
            $account['headimg'] = $_SC['img_url'] . '/weixin_headimg/' . $account['fakeid'] . '.png';
        }
        $smarty->assign('account', $account);
    }
    $smarty->display('wx_account_autoreply_edit.dwt');
}
Esempio n. 3
0
 protected function msg_autoback()
 {
     global $_SGLOBAL, $_SC;
     $resultStr = '';
     $autoreply_type_id = $_SGLOBAL['db']->getone('select aftermsg_autoreply_type_id from ' . tname('open_member_weixin') . ' where id=' . $this->op_wxid);
     if ($autoreply_type_id == 1) {
         $content = htmlspecialchars_decode($_SGLOBAL['db']->getone('select aftermsg from ' . tname('open_member_weixin') . ' where id=' . $this->op_wxid));
         $content = db_to_content(htmlspecialchars_decode($content));
         $resultStr = $this->txt_back($content);
         return $resultStr;
     }
     $rand_pic = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28');
     if ($autoreply_type_id == 2) {
         $data = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_msgreply_info') . ' where wxid=' . $this->op_wxid . ' and autoreply_type_id=2');
         if ($data[0]['pic'] == '') {
             $data[0]['pic'] = $_SC['site_host'] . '/themes/pc/mpres/wallpaper/' . $rand_pic[array_rand($rand_pic, 1)] . '.jpg';
         }
         $data[0]['summary'] = htmlspecialchars_decode($data[0]['summary']);
         $resultStr = $this->tpl($data, 'news', 0, time(), 2);
         return $resultStr;
     }
     if ($autoreply_type_id == 3) {
         $data = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_msgreply_info') . ' where wxid=' . $this->op_wxid . ' and autoreply_type_id=3 order by sort_order');
         if ($data[0]['pic'] == '') {
             $data[0]['pic'] = $_SC['site_host'] . '/themes/pc/mpres/wallpaper/' . $rand_pic[array_rand($rand_pic, 1)] . '.jpg';
         }
         $resultStr = $this->tpl($data, 'news', 0, time(), 2);
         return $resultStr;
     }
 }
Esempio n. 4
0
     $profile['gender_id'] = $profile['gender'];
     $profile['gender'] = $gender[$profile['gender']];
     if ($profile['avator'] == '') {
         $profile['avator'] = 'user1.jpg';
     }
     $profile['avator_file'] = $profile['avator'];
     $profile['avator'] = '/uploads/avators/' . $profile['avator'];
     $profile['country_id'] = $profile['country'];
     $profile['province_id'] = $profile['province'];
     $profile['city_id'] = $profile['city'];
     $profile['district_id'] = $profile['district'];
     $profile['country'] = $_SGLOBAL['db']->getone("SELECT region_name FROM " . tname('region') . " WHERE region_id = " . $profile['country']);
     $profile['province'] = $_SGLOBAL['db']->getone("SELECT region_name FROM " . tname('region') . " WHERE region_id = " . $profile['province']);
     $profile['city'] = $_SGLOBAL['db']->getone("SELECT region_name FROM " . tname('region') . " WHERE region_id = " . $profile['city']);
     $profile['district'] = $_SGLOBAL['db']->getone("SELECT region_name FROM " . tname('region') . " WHERE region_id = " . $profile['district']);
     $profile['intro'] = db_to_content($profile['intro']);
     $smarty->assign('profile', $profile);
     $smarty->display('member_edit.dwt');
     break;
 case "member_list":
     $search_field = getstr($_POST['search_field']);
     $search_keyword = getstr($_POST['search_keyword']);
     $page = empty($_POST["page"]) ? 1 : intval($_POST["page"]);
     $pagesize = empty($_POST["pagesize"]) ? 6 : intval($_POST["pagesize"]);
     $querystr = "";
     $queryarray = array();
     $queryarray[] = 'm.op_uid=' . $_SGLOBAL['uid'];
     if ($search_keyword != "") {
         $queryarray[] = $search_field . " like '%" . $search_keyword . "%'";
     }
     //end if