Пример #1
0
 public function doMobileranking()
 {
     global $_W, $_GPC;
     $uniacid = $_W['uniacid'];
     $userinfo = $this->userinfo;
     $openid = $userinfo['mk_openid'];
     $score = $_GPC['score'];
     $id = $_GPC['id'];
     $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE id = :id", array(':id' => $id));
     $user = pdo_fetch("SELECT * FROM " . tablename($this->table_user) . " where uniacid={$uniacid} and openid='{$openid}' and rid ={$reply['rid']}");
     $userall = pdo_fetchall("SELECT * FROM " . tablename($this->table_user) . " where uniacid={$uniacid} and rid ={$reply['rid']} ORDER BY asnum desc LIMIT 0,10");
     $usernum = pdo_fetchcolumn("SELECT count(*) FROM " . tablename($this->table_user) . " where uniacid={$uniacid} and rid ={$reply['rid']}");
     $maxpage = intval($usernum / 10 + 1);
     $usernuma = pdo_fetchall("SELECT * FROM " . tablename($this->table_user) . " where uniacid={$uniacid} and rid ={$reply['rid']} ORDER BY asnum desc ");
     $i = 0;
     $mingci = 0;
     foreach ($usernuma as $key => $value) {
         $i++;
         if ($openid == $value['openid']) {
             $mingci = $i;
             break;
         }
     }
     include $this->template('ranking');
 }
Пример #2
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('sns') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     if (empty($row['id'])) {
         return array();
     }
     $lastvisit = TIMESTAMP;
     $user = pdo_fetch("SELECT id,nickname FROM " . tablename('fans') . " WHERE from_user ='******'from']}'  LIMIT 1");
     $data = array('uid' => $user['id'], 'lastvisit' => $lastvisit, 'type' => 'sns', 'weid' => $_W['weid']);
     /*
     $zt = pdo_fetch("SELECT lastvisit FROM ".tablename('fans_status')." WHERE uid ={$user['id']}  LIMIT 1");
     if(!$zt){
     pdo_insert('fans_status', $data);
     }
     else
     {
     	unset($data['uid']);
     	pdo_update('fans_status', $data,array('uid'=>$user['id']));
     }
     */
     $title = pdo_fetchcolumn("SELECT name FROM " . tablename('rule') . " WHERE id = :rid LIMIT 1", array(':rid' => $rid));
     $url = create_url('mobile/module/list', array('name' => 'sns', 'type' => $row['type'], 'id' => $rid, 'weid' => $_W['weid']));
     $news = array();
     $news[] = array('title' => $title, 'description' => $row['description'], 'picurl' => $_W['attachurl'] . $row['picture'], 'url' => $url);
     return $this->respNews($news);
     //print_r($user['nickname']);exit;
     //return $this->respText($user['nickname'].'<a href="'.$url.'">点此进入微吧,进行互动交流吧</a>');
 }
Пример #3
0
 public function doMobileMy()
 {
     global $_W, $_GPC;
     checkauth();
     $rid = $_GPC['rid'];
     $from_user = $_W['fans']['from_user'];
     $list = pdo_fetchall("SELECT * FROM " . tablename('weizp_album') . " WHERE rid=:rid AND from_user=:from_user", array('rid' => $rid, 'from_user' => $from_user));
     foreach ($list as $k => $v) {
         foreach ($v as $sk => $sv) {
             if ($sk == 'images') {
                 $tmp = unserialize($sv);
                 $images = array();
                 foreach ($tmp as $ssv) {
                     $images[]['id'] = $ssv;
                     $images[]['file'] = pdo_fetchcolumn("SELECT file FROM " . tablename('weizp_images') . "WHERE id='{$ssv}'");
                 }
                 $sv = $images;
             }
             $v[$sk] = $sv;
         }
         $list[$k] = $v;
     }
     //var_dump($list);
     include $this->template('my');
 }
Пример #4
0
 public function payResult($params)
 {
     load()->model('mc');
     $status = pdo_fetchcolumn("SELECT status FROM " . tablename('mc_credits_recharge') . " WHERE tid = :tid", array(':tid' => $params['tid']));
     if (empty($status)) {
         $fee = $params['fee'];
         $data = array('status' => $params['result'] == 'success' ? 1 : -1);
         if ($params['type'] == 'wechat') {
             $data['transid'] = $params['tag']['transaction_id'];
             $params['user'] = mc_openid2uid($params['user']);
         }
         pdo_update('mc_credits_recharge', $data, array('tid' => $params['tid']));
         if ($params['result'] == 'success' && $params['from'] == 'notify') {
             $setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
             $credit = $setting['creditbehaviors']['currency'];
             if (empty($credit)) {
                 message('站点积分行为参数配置错误,请联系服务商', '', 'error');
             } else {
                 $paydata = array('wechat' => '微信', 'alipay' => '支付宝');
                 $record[] = $params['user'];
                 $record[] = '用户通过' . $paydata[$params['type']] . '充值' . $fee;
                 mc_credit_update($params['user'], $credit, $fee, $record);
             }
         }
     }
     if ($params['from'] == 'return') {
         if ($params['result'] == 'success') {
             message('支付成功!', '../../app/' . url('mc/home'), 'success');
         } else {
             message('支付失败!', '../../app/' . url('mc/home'), 'error');
         }
     }
 }
Пример #5
0
 public function receive()
 {
     global $_W, $_GPC;
     load()->model('mc');
     load()->func('communication');
     $event = $this->message['event'];
     $openid = $this->message['from'];
     $f_log = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE `uniacid` = '{$_W['uniacid']}' AND `openid` = '{$openid}'");
     if ($f_log['uid'] != 0) {
         pdo_update('hx_subscribe_data', array('uid' => $f_log['uid']), array('openid' => $openid));
         $uid = $f_log['uid'];
     } else {
         $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
         $data = array('uniacid' => $_W['uniacid'], 'email' => md5($openid) . '@qdaygroup.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
         $data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']);
         pdo_insert('mc_members', $data);
         $uid = pdo_insertid();
         pdo_update('mc_mapping_fans', array('uid' => $uid), array('openid' => $openid));
         pdo_update('hx_subscribe_data', array('uid' => $uid), array('openid' => $openid));
     }
     $credit_type = isset($this->module['config']['credit_type']) ? $this->module['config']['credit_type'] : 'credit1';
     $credit_subscribe = isset($this->module['config']['credit_subscribe']) ? $this->module['config']['credit_subscribe'] : 5;
     $credit_lever_1 = isset($this->module['config']['credit_lever_1']) ? $this->module['config']['credit_lever_1'] : 2;
     $credit_lever_2 = isset($this->module['config']['credit_lever_2']) ? $this->module['config']['credit_lever_2'] : 1;
     if ($event == 'subscribe') {
         $s_log = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `openid`='{$openid}'");
         if (empty($s_log)) {
             //如果没记录
             $insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'uid' => $uid, 'from_uid' => '0', 'sn' => time(), 'follow' => '1', 'article_id' => '0', 'shouyi' => $credit_subscribe, 'createtime' => TIMESTAMP);
             pdo_insert('hx_subscribe_data', $insert);
             mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
         } else {
             //如果有记录
             if ($s_log['follow'] != 1) {
                 //如果记录未关注
                 $insert = array('follow' => '1');
                 pdo_update('hx_subscribe_data', $insert, array('id' => $s_log['id']));
                 mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
             }
             if (!empty($s_log['from_uid'])) {
                 //如果来源ID不为空
                 $from_user = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$s_log['from_uid']}'");
                 if (!empty($from_user)) {
                     $data = array('shouyi' => $from_user['shouyi'] + $credit_lever_1, 'zjrs' => $from_user['zjrs'] + 1);
                     pdo_update('hx_subscribe_data', $data, array('id' => $from_user['id']));
                     mc_credit_update($s_log['from_uid'], $credit_type, $credit_lever_1, array('1', '推荐一级关注增加积分'));
                     if (!empty($from_user['from_uid'])) {
                         $from_user_2 = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$from_user['from_uid']}'");
                         if (!empty($from_user_2)) {
                             $data2 = array('shouyi' => $from_user_2['shouyi'] + $credit_lever_2, 'jjrs' => $from_user_2['jjrs'] + 1);
                             pdo_update('hx_subscribe_data', $data2, array('id' => $from_user_2['id']));
                             mc_credit_update($from_user['from_uid'], $credit_type, $credit_lever_2, array('1', '推荐二级关注增加积分'));
                         }
                     }
                 }
             }
         }
         //pdo_update('hx_subscribe_data',array('follow'=>1),array('openid'=>$openid));
     }
 }
Пример #6
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_GPC, $_W;
     $currentprompt = trim($_GPC['currentprompt']) ? trim($_GPC['currentprompt']) : '当前数字是 {LUCKYNUM}!';
     $awardprompt = trim($_GPC['awardprompt']) ? trim($_GPC['awardprompt']) : '恭喜您,当前数字是 {LUCKYNUM},获得 {AWARD} 奖品!';
     $data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'luckynumstart' => $_GPC['luckynumstart'], 'luckynumfilter' => $_GPC['luckynumfilter'], 'show_instruction' => $_GPC['show_instruction'], 'time_instruction' => $_GPC['time_instruction'], 'limit_instruction' => $_GPC['limit_instruction'], 'end_instruction' => $_GPC['end_instruction'], 'awardnum_instruction' => $_GPC['awardnum_instruction'], 'award_instruction' => $_GPC['award_instruction'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'limittype' => $_GPC['limittype'], 'awardnum' => $_GPC['awardnum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'currentprompt' => $currentprompt, 'awardprompt' => $awardprompt, 'sponsors1' => $_GPC['sponsors1'], 'sponsors1link' => $_GPC['sponsors1link'], 'sponsors2' => $_GPC['sponsors2'], 'sponsors2link' => $_GPC['sponsors2link'], 'sponsors3' => $_GPC['sponsors3'], 'sponsors3link' => $_GPC['sponsors3link'], 'sponsors4' => $_GPC['sponsors4'], 'sponsors4link' => $_GPC['sponsors4link'], 'sponsors5' => $_GPC['sponsors5'], 'sponsors5link' => $_GPC['sponsors5link'], 'ruletext' => $_GPC['ruletext'], 'title' => $_GPC['title'], 'shareimg' => $_GPC['shareimg'], 'sharetitle' => $_GPC['sharetitle'], 'sharedesc' => $_GPC['sharedesc']);
     $id = pdo_fetchcolumn("SELECT id FROM " . tablename('stonefish_luckynum') . " WHERE rid = :rid", array(':rid' => $rid));
     //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
     if (empty($id)) {
         $data['isshow'] = 1;
         pdo_insert('stonefish_luckynum', $data);
     } else {
         pdo_update('stonefish_luckynum', $data, array('id' => $id));
     }
     //}
     //update
     if (!empty($_GPC['award_number'])) {
         foreach ($_GPC['award_number'] as $key => $val) {
             $update_data = array('numbers' => $_GPC['award_number'][$key], 'title' => $_GPC['award_title'][$key], 'description' => $_GPC['award_desc'][$key]);
             //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
             pdo_update($this->tablename, $update_data, array('id' => $key));
             //}
         }
     }
     //insert
     if (!empty($_GPC['newaward_number'])) {
         foreach ($_GPC['newaward_number'] as $key => $val) {
             $new_data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'numbers' => $_GPC['newaward_number'][$key], 'title' => $_GPC['newaward_title'][$key], 'description' => $_GPC['newaward_desc'][$key], 'dateline' => $_W['timestamp']);
             //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
             pdo_insert($this->tablename, $new_data);
             //}
         }
     }
 }
Пример #7
0
 public function doWebWishlist()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     if (empty($rid)) {
         message('抱歉,传递的参数错误!', '', 'error');
     }
     $where = '';
     $params = array(':rid' => $rid, ':weid' => $_W['uniacid']);
     if (isset($_GPC['status'])) {
         $where .= ' and status=:status';
         $params[':status'] = $_GPC['status'];
     }
     if (!empty($_GPC['keywords'])) {
         $where .= 'AND `dream` LIKE :keywords';
         $params[':keywords'] = "%{$_GPC['keywords']}%";
     }
     $total = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('dream_wish') . " WHERE rid = :rid and weid=:weid " . $where . "", $params);
     $pindex = max(1, intval($_GPC['page']));
     $psize = 5;
     $pager = pagination($total, $pindex, $psize);
     $start = ($pindex - 1) * $psize;
     $limit .= " LIMIT {$start},{$psize}";
     $list = pdo_fetchall("SELECT a.* FROM " . tablename('dream_wish') . " a WHERE a.rid = :rid and a.weid=:weid  " . $where . " ORDER BY a.id DESC " . $limit, $params);
     //一些参数的显示
     $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid", array(':rid' => $rid));
     $viewnum = $reply['viewnum'];
     $dreamnum = $reply['dreamnum'];
     include $this->template('wishlist');
 }
Пример #8
0
 public function doMobiledelcomment()
 {
     global $_W, $_GPC;
     $cid = $_GPC['cid'];
     //$comment=$_GPC['cont'];
     //将ajax写入comment
     $uniacid = $_W['uniacid'];
     // 		$openid=$_W['openid'];
     // 		$ulist=$this->auth($uniacid,$openid);
     //var_dump($ulist);
     // 		$data=array(
     // 			'uniacid'=>$uniacid,
     // 			'tid'=>$tid,
     // 			'comment'=>$comment,
     // 			'nickname'=>$ulist['nickname'],
     // 			'cuid'=>$ulist['uid'],
     // 			'createtime'=>TIMESTAMP
     // 		);
     // 		pdo_insert('enjoy_circle_comment',$data);
     $data['tid'] = pdo_fetchcolumn("select tid from " . tablename('enjoy_circle_comment') . " where cid=" . $cid . "");
     //删除评论
     $res = pdo_delete('enjoy_circle_comment', array('uniacid' => $uniacid, 'cid' => $cid));
     if ($res > 0) {
         echo json_encode($data);
     }
 }
Пример #9
0
function travel_article_search($cid, $type = '', $psize = 20, $orderby = 'id DESC')
{
    global $_GPC, $_W;
    $pindex = max(1, intval($_GPC['page']));
    $result = array();
    $condition = " WHERE weid = '{$_W['weid']}' AND ";
    if (!empty($cid)) {
        $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'");
        if (!empty($category['parentid'])) {
            $condition .= "ccate = '{$cid}'";
        } else {
            $condition .= "pcate = '{$cid}'";
        }
    }
    if (!empty($cid) && !empty($type)) {
        $condition .= " OR ";
    }
    if (!empty($type)) {
        $type = explode(',', $type);
        foreach ($type as $item) {
            $condition .= "type LIKE '%{$item},%'";
        }
    }
    $sql = "SELECT * FROM " . tablename('travel') . $condition . ' ORDER BY ' . $orderby;
    $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('travel') . $condition);
    $result['pager'] = pagination($total, $pindex, $psize);
    return $result;
}
Пример #10
0
 public function doWebList()
 {
     //这个操作被定义用来呈现 管理中心导航菜单
     global $_W, $_GPC;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $condition = '';
     if (!empty($_GPC['keyword'])) {
         $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
     }
     if (!empty($_GPC['createtime'])) {
         $c_s = strtotime($_GPC['createtime']['start']);
         $c_e = strtotime($_GPC['createtime']['end']);
         $condition .= " AND createtime >= '{$c_s}' AND createtime <= '{$c_e}'";
     }
     if (empty($_GPC['createtime'])) {
         $c_s = time() - 86400 * 30;
         $c_e = time() + 84400;
     }
     $list = pdo_fetchall("SELECT * FROM " . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition} ORDER BY displayorder DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
     $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition}");
     $pager = pagination($total, $pindex, $psize);
     if (!empty($list)) {
         foreach ($list as &$row) {
             $row['total'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('hx_pictorial_photo') . " WHERE pictorialid = :pictorialid", array(':pictorialid' => $row['id']));
         }
     }
     load()->func('tpl');
     include $this->template('list');
 }
Пример #11
0
 public function dolist()
 {
     global $_GPC, $_W;
     checklogin();
     $weid = intval($_W['weid']);
     if (checksubmit('verify') && !empty($_GPC['select'])) {
         pdo_update('message_list', array('isshow' => 1, 'create_time' => TIMESTAMP), " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('审核成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     if (checksubmit('delete') && !empty($_GPC['select'])) {
         pdo_delete('message_list', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     $isshow = isset($_GPC['isshow']) ? intval($_GPC['isshow']) : 0;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $message = pdo_fetch("SELECT id, isshow, weid FROM " . tablename('message_reply') . " WHERE weid = '{$weid}' LIMIT 1");
     $list = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}' ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
     if (!empty($list)) {
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}'");
         $pager = pagination($total, $pindex, $psize);
         foreach ($list as &$row) {
             $row['content'] = emotion($row['content']);
             $userids[] = $row['from_user'];
         }
         unset($row);
     }
     include $this->template('list');
 }
Пример #12
0
 public function respond()
 {
     global $_W;
     $content = $this->message['content'];
     $from_user = $this->message['from'];
     $isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('xc_article_article_reply') . " WHERE rid =:rid AND articleid = '0'", array(':rid' => $this->rule));
     $reply = pdo_fetchall("SELECT * FROM " . tablename('xc_article_article_reply') . " WHERE rid = :rid", array(':rid' => $this->rule));
     if (!empty($reply)) {
         foreach ($reply as $row) {
             $ids[$row['articleid']] = $row['articleid'];
         }
         $article = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id');
     }
     if ($isfill && ($count = 8 - count($reply)) > 0) {
         $articlefill = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id');
         if (!empty($articlefill)) {
             foreach ($articlefill as $row) {
                 $article[$row['id']] = $row;
                 $reply[]['articleid'] = $row['id'];
             }
             unset($articlefill);
         }
     }
     if (!empty($reply)) {
         $response = array();
         foreach ($reply as $row) {
             $row = $article[$row['articleid']];
             if (!empty($row)) {
                 $response[] = array('title' => htmlspecialchars_decode($row['title']), 'description' => htmlspecialchars_decode($row['description']), 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id'], 'shareby' => $from_user, 'track_type' => 'click', 'linkurl' => $row['linkurl']))));
             }
         }
     }
     return $this->respNews($response);
 }
Пример #13
0
function site_article($params = array())
{
    global $_GPC, $_W;
    extract($params);
    $pindex = max(1, intval($_GPC['page']));
    $psize = 20;
    $result = array();
    $condition = " WHERE weid = '{$_W['weid']}'";
    if (!empty($cid)) {
        $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'");
        if (!empty($category['parentid'])) {
            $condition .= " AND ccate = '{$cid}'";
        } else {
            $condition .= " AND pcate = '{$cid}'";
        }
    }
    if ($iscommend == 'true') {
        $condition .= " AND iscommend = '1'";
    }
    if ($ishot == 'true') {
        $condition .= " AND ishot = '1'";
    }
    $sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY id DESC';
    $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition);
    $result['pager'] = pagination($total, $pindex, $psize);
    if (!empty($result['list'])) {
        foreach ($result['list'] as &$row) {
            $row['url'] = create_url('mobile/module/detail', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid']));
        }
    }
    return $result;
}
Пример #14
0
/**
 * 取出缓存的单条数据
 * @param 缓存键名,多个层级或分组请使用:隔开
 * @return mixed
 */
function cache_read($key) {
	$sql = 'SELECT `value` FROM ' . tablename('cache') . ' WHERE `key`=:key';
	$params = array();
	$params[':key'] = $key;
	$val = pdo_fetchcolumn($sql, $params);
	return iunserializer($val);
}
Пример #15
0
 public function doWebList()
 {
     global $_GPC, $_W;
     $uniacid = $_W["uniacid"];
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $where = "";
     $mark = $_GPC['mark'];
     $keyword = $_GPC['keyword'];
     if (!empty($mark)) {
         $where .= " AND mark = '{$mark}'";
     }
     if (!empty($keyword)) {
         $where .= " AND title like '%{$keyword}%'";
     }
     if (!empty($_GPC['Deleteall']) && !empty($_GPC['select'])) {
         foreach ($_GPC['select'] as $k => $v) {
             pdo_delete('hx_dialect_questions', array('id' => $v, 'uniacid' => $_W['uniacid']));
         }
         message('成功删除选中的防伪码!', referer(), 'success');
     }
     if (!empty($_GPC['Frozenall']) && !empty($_GPC['select'])) {
         foreach ($_GPC['select'] as $k => $v) {
             pdo_update('securitys_data', array('status' => 0), array('id' => $v, 'uniacid' => $_W['uniacid']));
         }
         message('成功冻结选中的防伪码!', referer(), 'success');
     }
     $list = pdo_fetchall("SELECT *  from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
     $total = pdo_fetchcolumn("SELECT COUNT(*)  from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc");
     $pager = pagination($total, $pindex, $psize);
     load()->func('tpl');
     include $this->template('list');
 }
Пример #16
0
 private function getShowID()
 {
     global $_W;
     $sql = 'select showID from ' . tablename('ice_picWallMain') . ' where uniacid = :uniacid order by showID DESC';
     $result = pdo_fetchcolumn($sql, array('uniacid' => $_W['uniacid']), 0) + 1;
     return $result;
 }
Пример #17
0
 public function doMobileIndex()
 {
     global $_W, $_GPC;
     checkauth();
     $fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
     $rid = $_GPC['rid'];
     $follow = fans_search($_W['fans']['from_user'], array('follow'));
     if ($follow['follow'] == 1) {
         if (intval($_GPC['id'])) {
             $score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
             if ($score < $_GPC['score']) {
                 $update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
                 $score = $_GPC['score'];
                 pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
             }
             message($score, '', 'ajax');
         }
         $from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='******'from_user'] . "'");
         if (empty($from_user['from_user'])) {
             $insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
             pdo_insert('bj_tgame_user', $insert);
         }
         //$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='******'from_user']. "'");
         if ($from_user['rid'] != $rid) {
             $update = array('rid' => $rid);
             pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
         }
         $realname = $fromuser['nickname'];
         $user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
     }
     $set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
     include $this->template('index');
 }
Пример #18
0
 public function doWebDisplay()
 {
     global $_W, $_GPC;
     if (empty($_GPC['do'])) {
         $_GPC['do'] = 'display';
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $condition = '';
     if (!empty($_GPC['keyword'])) {
         $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
     }
     if (is_array($_GPC['industry'])) {
         if (!empty($_GPC['industry']['parent'])) {
             $condition .= " AND industry1 = '{$_GPC['industry']['parent']}'";
         }
         if (!empty($_GPC['industry']['child'])) {
             $condition .= " AND industry2 = '{$_GPC['industry']['child']}'";
         }
     }
     $list = pdo_fetchall("SELECT * FROM " . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
     $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition}");
     $pager = pagination($total, $pindex, $psize);
     include $this->template('display');
 }
Пример #19
0
 public function all_list($params = array())
 {
     global $_GPC, $_W;
     extract($params);
     $result = array();
     $pindex = max(1, intval($_GPC['page']));
     $psize = $psize ? $psize : '20';
     $where = "WHERE `uniacid` = :uniacid AND ischeck=:ischeck";
     $paras = array();
     $paras[':uniacid'] = $_W['uniacid'];
     $paras[':ischeck'] = intval($ischeck);
     $sql = "SELECT * FROM " . tablename('qiyue_canvas') . $where . ' ORDER BY createtime DESC, id DESC';
     $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $paras);
     $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('qiyue_canvas') . $where, $paras);
     if ($_W['isajax']) {
         $context['ajaxcallback'] = 1;
         $result['pager'] = pagination($total, $pindex, $psize, '', $context);
     } else {
         $result['pager'] = pagination($total, $pindex, $psize);
     }
     if (!empty($result['list'])) {
         foreach ($result['list'] as &$row) {
             $row['url'] = url('mobile/module/index', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid']));
         }
     }
     return $result;
 }
Пример #20
0
 public function respond()
 {
     global $_W;
     $content = $this->message['content'];
     //这里定义此模块进行消息处理时的具体过程, 请查看WORMWOOD文档来编写你的代码
     $isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('feng_testingreply') . " WHERE rid =:rid AND testingid = '0'", array(':rid' => $this->rule));
     $reply = pdo_fetchall("SELECT * FROM " . tablename('feng_testingreply') . " WHERE rid = :rid", array(':rid' => $this->rule));
     if (!empty($reply)) {
         foreach ($reply as $row) {
             $ids[$row['testingid']] = $row['testingid'];
         }
         $article = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id');
     }
     if ($isfill && ($count = 8 - count($reply)) > 0) {
         $articlefill = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id');
         if (!empty($articlefill)) {
             foreach ($articlefill as $row) {
                 $article[$row['id']] = $row;
                 $reply[]['testingid'] = $row['id'];
             }
             unset($articlefill);
         }
     }
     if (!empty($reply)) {
         $response = array();
         foreach ($reply as $row) {
             $row = $article[$row['testingid']];
             if (!empty($row)) {
                 $response[] = array('title' => $row['title'], 'description' => $row['description'], 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id']))));
             }
         }
     }
     return $this->respNews($response);
 }
Пример #21
0
 public function receive()
 {
     global $_W, $_GPC;
     $type = $this->message['type'];
     $uniacid = $_W['uniacid'];
     $acid = $_W['acid'];
     $openid = $this->message['from'];
     $event = $this->message['event'];
     $cfg = $this->module['config'];
     file_put_contents(IA_ROOT . '/addons/fm_photosvote/test/fm_test.txt', iserializer($event));
     if ($event == 'unsubscribe') {
         $record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'unfollowtime' => TIMESTAMP);
         pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid));
         if ($cfg['isopenjsps']) {
             $fmvotelog = pdo_fetchall("SELECT tfrom_user FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid));
             foreach ($fmvotelog as $log) {
                 $fmprovevote = pdo_fetch("SELECT photosnum,hits FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid));
                 pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid));
             }
             pdo_delete('fm_photosvote_votelog', array('from_user' => $openid));
             pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid));
         }
     } elseif ($event == 'subscribe') {
         if ($cfg['oauthtype'] == 2) {
             $wechats = pdo_fetch("SELECT * FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid ", array(':uniacid' => $_W['uniacid']));
             $token = iunserializer($wechats['access_token']);
             $arrlog = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND openid = :openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
             $access_token = $token['token'];
             $expire = $token['expire'];
             if (time() >= $expire || empty($access_token)) {
                 $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $wechats['key'] . "&secret=" . $wechats['secret'];
                 $html = file_get_contents($url);
                 $arr = json_decode($html, true);
                 $access_token = $arr['access_token'];
                 $record = array();
                 $record['token'] = $access_token;
                 $record['expire'] = time() + 3600;
                 $row = array();
                 $row['access_token'] = iserializer($record);
                 pdo_update('account_wechats', $row, array('uniacid' => $_W['uniacid']));
             }
             $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN";
             $html = file_get_contents($url);
             $re = @json_decode($html, true);
             if (!empty($arrlog)) {
                 $data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid']);
                 pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
             } else {
                 $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
                 $nickname = $re['nickname'];
                 $data = array('uniacid' => $_W['uniacid'], 'nickname' => $re['nickname'], 'avatar' => $re['headimgurl'], 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
                 pdo_insert('mc_members', $data);
                 $id = pdo_insertid();
                 $data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid'], 'uid' => $id);
                 pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
             }
         }
     }
 }
Пример #22
0
 /**
  * 品牌管理
  */
 public function doWebBrand()
 {
     global $_W, $_GPC;
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'edit') {
         // 添加或编辑
         $id = intval($_GPC['id']);
         if (!empty($id)) {
             $item = pdo_fetch("SELECT * FROM " . tablename($this->table_brand) . " WHERE id = :id", array(':id' => $id));
             if (empty($item)) {
                 message('抱歉,品牌删除或不存在!', '', 'error');
             }
         }
         if (checksubmit('bname')) {
             if (empty($_GPC['bname'])) {
                 message('请输入品牌名称!');
             }
             if (empty($_GPC['btnName'])) {
                 message('请输入自定义按钮名称!');
             }
             if (empty($_GPC['btnUrl'])) {
                 message('请输入自定义 链接地址!');
             }
             if (empty($_GPC['pic'])) {
                 message('请输入品牌背景!');
             }
             if (empty($_GPC['intro'])) {
                 message('请输入品牌介绍');
             }
             if (empty($_GPC['tel'])) {
                 message('请输入联系电话');
             }
             $data = array('weid' => $_W['weid'], 'bname' => $_GPC['bname'], 'intro' => htmlspecialchars_decode($_GPC['intro']), 'video_name' => $_GPC['video_name'], 'video_url' => $_GPC['video_url'], 'createtime' => TIMESTAMP, 'pptname' => $_GPC['pptname'], 'ppt1' => $_GPC['ppt1'], 'ppt2' => $_GPC['ppt2'], 'ppt3' => $_GPC['ppt3'], 'pic' => $_GPC['pic'], 'tel' => $_GPC['tel'], 'btnName' => $_GPC['btnName'], 'btnUrl' => $_GPC['btnUrl'], 'showMsg' => $_GPC['showMsg']);
             if (!empty($id)) {
                 pdo_update($this->table_brand, $data, array('id' => $id));
             } else {
                 pdo_insert($this->table_brand, $data);
             }
             message('更新微品牌成功!', create_url('site/module/brand', array('name' => 'brand', 'op' => 'display')), 'success');
         }
     } elseif ($operation == 'display') {
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $list = pdo_fetchall("SELECT * FROM " . tablename($this->table_brand) . " WHERE weid = '{$_W['weid']}'  ORDER BY createtime DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename($this->table_brand) . " WHERE weid = '{$_W['weid']}'");
         $pager = pagination($total, $pindex, $psize);
     } elseif ($operation == 'delete') {
         $id = intval($_GPC['id']);
         pdo_delete($this->table_brand_image, array('bid' => $id));
         // 删除说明项
         pdo_delete($this->table_brand_note, array('bid' => $id));
         // 删除产品
         pdo_delete($this->table_brand_product, array('bid' => $id));
         // 删除活动
         pdo_delete($this->table_brand, array('id' => $id));
         message('删除成功!', referer(), 'success');
     }
     include $this->template('brand');
 }
Пример #23
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('file');
     $_W['page']['title'] = '签文参数设置';
     if ($_W['isajax'] && $_GPC['op'] == 'delete' && $_GPC['filename']) {
         file_delete($_GPC['filename']);
         exit('ok');
     }
     if (checksubmit()) {
         // 配置
         $dat = $_GPC['add'];
         $dat['imgUrl'] = $_GPC['imgUrl'];
         $this->saveSettings($dat);
         // 签文
         $qian = $_GPC['qian'];
         $f_exp = "::::::";
         $r_exp = PHP_EOL;
         $morepic = "";
         for ($i = 0; $i < count($qian['filename']); $i++) {
             //替换非法字符
             $name = str_replace($f_exp, "", $qian['title'][$i]);
             $name = str_replace($r_exp, "", $name);
             $pic = str_replace($f_exp, "", $qian['filename'][$i]);
             $pic = str_replace($r_exp, "", $pic);
             if ($pic) {
                 $morepic .= $pic . $f_exp . $name . $r_exp;
             }
         }
         // 去掉最后的字符
         // $morepic = substr($morepic,0,strlen($morepic)-2);
         $morepic = trim($morepic);
         $check = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
         if ($check) {
             pdo_update('qiyue_qiuqian', array('morepic' => $morepic), array('uniacid' => $_W['uniacid']));
         } else {
             $add['uniacid'] = $_W['uniacid'];
             $add['morepic'] = $morepic;
             pdo_insert('qiyue_qiuqian', $add);
         }
         message('设置成功', 'referer', 'success');
     }
     if (empty($settings)) {
         $settings = array('title' => '新年祈福签', 'desc' => '我在' . $_W['account']['name'] . '求了一支新年签,你也来吧!', 'imgUrl' => tomedia('./addons/qiuqian/icon.jpg'));
     }
     $qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
     $morepic = array();
     if ($qian_r['morepic']) {
         $f_exp = "::::::";
         $r_exp = PHP_EOL;
         $rr = explode($r_exp, $qian_r['morepic']);
         for ($i = 0; $i < count($rr); $i++) {
             $fr = explode($f_exp, $rr[$i]);
             $morepic[] = array('title' => $fr['1'], 'filename' => $fr['0']);
         }
         unset($qian_r['morepic']);
     }
     include $this->template('setting');
 }
Пример #24
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT `mediaid` FROM " . tablename('images_reply') . " WHERE `rid`=:rid";
     $mediaid = pdo_fetchcolumn($sql, array(':rid' => $rid));
     return $this->respImage($mediaid);
 }
Пример #25
0
 public function get($weid, $modulename)
 {
     $settings = null;
     $result = pdo_fetchcolumn("SELECT settings FROM " . tablename(self::$t_module) . " WHERE uniacid= :weid AND module= :name LIMIT 1", array(':name' => $modulename, ':weid' => $weid));
     if (!empty($result)) {
         $settings = iunserializer($result);
     }
     return $settings;
 }
Пример #26
0
 public function fieldsFormDisplay($rid = 0)
 {
     global $_W, $_GPC;
     if (!empty($rid)) {
         $reid = pdo_fetchcolumn("SELECT reid FROM " . tablename('multisearch_reply') . " WHERE rid = :rid", array(':rid' => $rid));
         $item = pdo_fetch("SELECT * FROM " . tablename('multisearch') . " WHERE id = '{$reid}'");
     }
     include $this->template('rule');
 }
Пример #27
0
 public function fieldsFormDisplay($rid = 0)
 {
     global $_W;
     $uniacid = $_W['uniacid'];
     load()->func('tpl');
     $creditnames = array();
     $unisettings = uni_setting($uniacid, array('creditnames'));
     foreach ($unisettings['creditnames'] as $key => $credit) {
         if (!empty($credit['enabled'])) {
             $creditnames[$key] = $credit['title'];
         }
     }
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_planting_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $share = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_share') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $prize = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_prize') . " WHERE rid = :rid ORDER BY `id` asc", array(':rid' => $rid));
         //查询奖品是否可以删除
         foreach ($prize as $mid => $prizes) {
             $prize[$mid]['fans'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('stonefish_planting_award') . " WHERE prizetype = :prizeid", array(':prizeid' => $prizes['id']));
             $prize[$mid]['delete_url'] = $this->createWebUrl('deleteprize', array('rid' => $rid, 'id' => $prizes['id']));
         }
         //查询奖品是否可以删除
     }
     $seed = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_seed') . " WHERE uniacid = :uniacid Or uniacid = 0 ORDER BY `id` asc", array(':uniacid' => $uniacid));
     if (!$reply) {
         $now = time();
         $reply = array("title" => "种值活动开始了!", "start_picurl" => "../addons/stonefish_planting/template/images/start.jpg", "description" => "欢迎参加种值活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "请用力摇晃你的手机抽奖", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "种值活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_planting/template/images/end.jpg", "homepic" => "../addons/stonefish_planting/template/images/home.jpg", "adpic" => "../addons/stonefish_planting/template/images/banner.png", "award_times" => 1, "credit_times" => 5, "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "homepictime" => 0);
     } else {
         $reply['notawardtext'] = implode("\n", (array) iunserializer($reply['notawardtext']));
     }
     //print_r(uni_modules($enabledOnly = true));
     //exit;
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     //查询子公众号信息
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     $ids_num = count($ids);
     //多少个子公众账号
     $one = current($ids);
     //查询子公众号信息
     if (!$share) {
         $share = array();
         foreach ($ids as $acid => $idlists) {
             $share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加种值活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_planting/template/images/share.png", "share_pic" => "../addons/stonefish_planting/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1);
         }
     }
     include $this->template('form');
 }
Пример #28
0
 public function doWebDisplay()
 {
     global $_W, $_GPC;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 10;
     $condition = '';
     if (!empty($_GPC['keyword'])) {
         $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
     }
     if (is_array($_GPC['industry'])) {
         if (!empty($_GPC['industry']['parent'])) {
             $condition .= " AND industry1 = '{$_GPC['industry']['parent']}'";
         }
         if (!empty($_GPC['industry']['child'])) {
             $condition .= " AND industry2 = '{$_GPC['industry']['child']}'";
         }
     }
     $sql = 'SELECT COUNT(*) FROM ' . tablename('business') . ' WHERE `weid` = :weid ' . $condition;
     $params = array(':weid' => $_W['uniacid']);
     $total = pdo_fetchcolumn($sql, $params);
     if ($total > 0) {
         $sql = 'SELECT * FROM ' . tablename('business') . ' WHERE `weid` = :weid ' . $condition . ' ORDER BY `id`
                 DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize;
         $list = pdo_fetchall($sql, $params);
         $pager = pagination($total, $pindex, $psize);
     }
     if (!empty($_GPC['export'])) {
         /* 输入到CSV文件 */
         $html = "";
         /* 输出表头 */
         $filter = array('title' => '名称', 'phone' => '电话', 'address' => '地址', 'industry1' => '行业');
         foreach ($filter as $key => $value) {
             $html .= $value . "\t,";
         }
         $html .= "\n";
         $key_array = array_keys($filter);
         foreach ($list as $k => $v) {
             foreach ($v as $k1 => $v1) {
                 if (in_array($k1, $key_array)) {
                     if ($k1 == 'createtime' || $k1 == 'dateline') {
                         $html .= date('Y-m-d H:i:s', $v1) . "\t ,";
                     } else {
                         $html .= $v1 . "\t,";
                     }
                 }
             }
             $html .= "\n";
         }
         /* 输出CSV文件 */
         header("Content-type:text/csv");
         header("Content-Disposition:attachment; filename=全部数据.csv");
         echo $html;
         exit;
     }
     load()->func('tpl');
     include $this->template('display');
 }
Пример #29
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     //$content = $this->message['content'];
     $openid = $this->message['from'];
     load()->model('mc');
     $uid = mc_openid2uid($openid);
     $row = pdo_fetch("SELECT awardprompt,currentprompt,floorprompt,setting FROM " . tablename('superman_floor') . " WHERE rid={$rid}");
     $rule_name = pdo_fetchcolumn("SELECT name FROM " . tablename('rule') . " WHERE id={$rid}");
     if ($row) {
         $setting = unserialize($row['setting']);
         if (!$setting['repeat_floor']) {
             $floor = $this->get_floor();
             if ($floor) {
                 $result = str_replace('{RULENAME}', $rule_name, $row['floorprompt']);
                 $result = str_replace('{FLOOR}', $floor['id'], $result);
                 $result = str_replace('{TIME}', date('Y-m-d H:i:s', $floor['dateline']), $result);
                 $winninginfo = $_W['siteroot'] . 'app/' . $this->createMobileUrl('winninginfo', array('rid' => $rid));
                 //return $this->respText($result);
                 $news = array(array('title' => '您已参与过本活动!', 'description' => $result, 'picurl' => '', 'url' => $winninginfo));
                 return $this->respNews($news);
             }
         }
     }
     $new_data = array('dateline' => $_W['timestamp'], 'openid' => $openid);
     pdo_insert("superman_floor_{$rid}", $new_data, false);
     $new_id = pdo_insertid();
     if ($new_id <= 0) {
         return $this->respText('系统异常,请稍后重试!');
     }
     $awards = pdo_fetchall("SELECT * FROM " . tablename('superman_floor_award') . " WHERE rid={$rid}");
     $prompt = pdo_fetch("SELECT awardprompt,currentprompt,floorprompt,setting FROM " . tablename('superman_floor') . " WHERE rid={$rid}");
     if ($awards) {
         foreach ($awards as $item) {
             $floors = explode(',', $item['floors']);
             if (in_array($new_id, $floors)) {
                 $new_data = array('rid' => $rid, 'floor' => $new_id, 'uid' => $uid, 'uniacid' => $_W['uniacid'], 'openid' => $openid, 'award_id' => $item['id'], 'ip' => $_W['clientip'], 'dateline' => $_W['timestamp']);
                 pdo_insert('superman_floor_winner', $new_data);
                 $winner_id = pdo_insertid();
                 $result = str_replace('{RULENAME}', $rule_name, $row['awardprompt']);
                 $result = str_replace('{FLOOR}', $new_id, $result);
                 $result = str_replace('{AWARD}', $item['title'], $result);
                 $result = str_replace('{DESCRIPTION}', $item['description'], $result);
                 $url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('infosubmit', array('_x' => superman_authcode("{$rid}|{$winner_id}|{$openid}", 'ENCODE'), 'rid' => $rid));
                 $winninginfo = $_W['siteroot'] . 'app/' . $this->createMobileUrl('winninginfo', array('rid' => $rid));
                 $news = array(array('title' => '恭喜您,获得' . $item['title'] . '!', 'description' => $result, 'picurl' => '', 'url' => $url));
                 return $this->respNews($news);
             }
         }
     }
     $result = str_replace('{RULENAME}', $rule_name, $row['currentprompt']);
     $result = str_replace('{FLOOR}', $new_id, $result);
     $winninginfo = $_W['siteroot'] . 'app/' . $this->createMobileUrl('winninginfo', array('rid' => $rid));
     $news = array(array('title' => '未中奖,再接再厉!', 'description' => $result, 'picurl' => '', 'url' => $winninginfo));
     return $this->respNews($news);
 }
Пример #30
0
 public function doMobileWish()
 {
     global $_GPC, $_W;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 8;
     $list = pdo_fetchall("SELECT * FROM " . tablename('wish') . "  ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
     $total = pdo_fetchcolumn('SELECT COUNT(1) FROM ' . tablename('wish'));
     $pager = pagination($total, $pindex, $psize);
     include $this->template('wish');
 }