Beispiel #1
0
 public function doWebManage()
 {
     global $_W, $_GPC;
     $data = array();
     if ($_W['ispost']) {
         if (empty($_GPC['items'])) {
             message('创建点内容吧!', referer(), 'error', 1);
         }
         $data['weid'] = $_W['weid'];
         $data['title'] = $_GPC['title'];
         $data['bgimg'] = $_GPC['bgimg'];
         $data['bgcol'] = $_GPC['bgcol'];
         $data['time'] = time();
         foreach ($_GPC['items']['type'] as $k => $val) {
             $data['items'][] = array('type' => $_GPC['items']['type'][$k], 'title' => $_GPC['items']['title'][$k], 'direct' => $_GPC['items']['direct'][$k], 'detail' => $_GPC['items']['detail'][$k]);
         }
         $data['items'] = serialize($data['items']);
         if (empty($_GPC['id'])) {
             pdo_insert('timeaxis', $data);
         } else {
             pdo_update('timeaxis', $data, array('id' => $_GPC['id']));
         }
         //WeUtility::logging('tips','items:'.$data['items']);
         message('活动创建成功', '', 'success', 1);
     }
     $timeinf = array();
     if (!empty($_GPC['id'])) {
         $timeinf = pdo_fetch('SELECT * FROM ' . tablename('timeaxis') . ' WHERE id=:id', array(':id' => $_GPC['id']));
         $timeinf['items'] = unserialize($timeinf['items']);
         $timeinf['url'] = $this->createMobileUrl('index', array('weid' => $_W['weid'], 'tid' => $_GPC['id']));
     }
     include $this->template('manage');
 }
Beispiel #2
0
 public function fieldsFormSubmit($rid)
 {
     global $_W, $_GPC;
     $id = intval($_GPC['replyid']);
     $data = array('rid' => $rid, 'weid' => $_W['weid'], 'sn' => $_GPC['sn'], 'token' => $_GPC['apitoken'], 'maxuse' => intval($_GPC['maxuse']), 'maxtotal' => intval($_GPC['maxtotal']), 'adtype' => intval($_GPC['adtype']), 'adurlv' => $_GPC['adurlv'], 'adurlh' => $_GPC['adurlh'], 'admsg' => $_GPC['admsg'], 'leavemsg' => $_GPC['leavemsg'], 'fontfamily' => $_GPC['fontfamily'], 'fontcolor' => $_GPC['fontcolor'], 'qrcode' => $_GPC['qrcode'], 'mainpic' => $_GPC['mainpic'], 'adpics' => '', 'width' => $_GPC['width'], 'height' => $_GPC['height'], 'size' => intval($_GPC['photosize']), 'status' => intval($_GPC['status']), 'enableauthcode' => intval($_GPC['enableauthcode']), 'enablemsg' => intval($_GPC['enablemsg']), 'content' => $_GPC['content'], 'tipsentry' => $_GPC['tipsentry'], 'tipssuccess' => $_GPC['tipssuccess'], 'tipserror' => $_GPC['tipserror']);
     if (!empty($_GPC['sort'])) {
         asort($_GPC['sort']);
         foreach ($_GPC['sort'] as $key => $value) {
             $data['adpics'][] = $_GPC['adpics'][$key];
         }
         $data['adpics'] = iserializer($data['adpics']);
     } else {
         $data['adpics'] = iserializer($_GPC['adpics']);
     }
     if (empty($id)) {
         pdo_insert('we7_photomaker', $data);
     } else {
         if (!empty($_GPC['qrcode'])) {
             file_delete($_GPC['qrcode-old']);
         }
         if (!empty($_GPC['mainpic'])) {
             file_delete($_GPC['mainpic-old']);
         }
         pdo_update('we7_photomaker', $data, array('id' => $id));
     }
 }
 public function getJsApiTicket()
 {
     if (!empty($_W['account']['jsapi_ticket']) && is_array($_W['account']['jsapi_ticket']) && !empty($_W['account']['jsapi_ticket']['ticket']) && !empty($_W['account']['jsapi_ticket']['expire']) && $_W['account']['jsapi_ticket']['expire'] > TIMESTAMP) {
         return $_W['account']['jsapi_ticket']['ticket'];
     }
     load()->func('communication');
     $access_token = $this->getAccessToken();
     if (is_error($access_token)) {
         return $access_token;
     }
     $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$access_token}&type=jsapi";
     $content = ihttp_get($url);
     if (is_error($content)) {
         return error(-1, '调用接口获取微信公众号 jsapi_ticket 失败, 错误信息: ' . $content['message']);
     }
     $result = @json_decode($content['content'], true);
     if (empty($result) || intval($result['errcode']) != 0 || $result['errmsg'] != 'ok') {
         return error(-1, '获取微信公众号 jsapi_ticket 结果错误, 错误信息: ' . $result['errmsg']);
     }
     $record = array();
     $record['ticket'] = $result['ticket'];
     $record['expire'] = TIMESTAMP + $result['expires_in'] - 200;
     $row = array();
     $row['jsapi_ticket'] = iserializer($record);
     pdo_update('account_wechats', $row, array('acid' => $_W['account']['acid']));
     $_W['account']['jsapi_ticket'] = $record;
     return $record['ticket'];
 }
Beispiel #4
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     if (!empty($_GPC['music-title'])) {
         foreach ($_GPC['music-title'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $update = array('title' => $title, 'description' => $_GPC['music-description'][$index], 'url' => $_GPC['music-url'][$index], 'hqurl' => $_GPC['music-hqurl'][$index]);
             if (!empty($_GPC['music-url-old'][$index]) && $_GPC['music-url'][$index] != $_GPC['music-url-old'][$index]) {
                 file_delete($_GPC['music-url-old'][$index]);
             }
             pdo_update($this->tablename, $update, array('id' => $index));
         }
     }
     //处理添加
     if (!empty($_GPC['music-title-new'])) {
         foreach ($_GPC['music-title-new'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $insert = array('rid' => $rid, 'title' => $title, 'description' => $_GPC['music-description-new'][$index], 'url' => $_GPC['music-url-new'][$index], 'hqurl' => $_GPC['music-hqurl-new'][$index]);
             pdo_insert($this->tablename, $insert);
         }
     }
     return true;
 }
Beispiel #5
0
 public function doWebPost()
 {
     global $_GPC, $_W;
     if (empty($_GPC['do'])) {
         $_GPC['do'] = 'post';
     }
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename('business') . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,商户不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'industry1' => $_GPC['industry']['parent'], 'industry2' => $_GPC['industry']['child'], 'createtime' => TIMESTAMP);
         if (!empty($_GPC['thumb'])) {
             $data['thumb'] = $_GPC['thumb'];
             load()->func('file');
             file_delete($_GPC['thumb-old']);
         }
         if (empty($id)) {
             pdo_insert('business', $data);
         } else {
             unset($data['createtime']);
             pdo_update('business', $data, array('id' => $id));
         }
         message('商户信息更新成功!', $this->createWebUrl('display'), 'success');
     }
     include $this->template('post');
 }
function account_mechat_token($acmechat)
{
    if (is_array($acmechat['access_token']) && !empty($acmechat['access_token']['token']) && !empty($acmechat['access_token']['expire']) && $acmechat['access_token']['expire'] > TIMESTAMP) {
        return $acmechat['access_token']['token'];
    } else {
        if (empty($acmechat['weid'])) {
            message('参数错误.');
        }
        if (empty($acmechat['appid']) || empty($acmechat['appsecret'])) {
            message('请填写开发者的appid及appsecret, (需要你的号码为美洽开发者)!', create_url('index/module/display', array('name' => 'mechat')), 'error');
        }
        $url = "http://open.mobilechat.im/cgi-bin/token?grant_type=client_credential&appid={$acmechat['appid']}&secret={$acmechat['appsecret']}";
        $content = ihttp_get($url);
        if (empty($content)) {
            message('获取美洽开发者授权失败, 请稍后重试!');
        }
        $token = @json_decode($content['content'], true);
        /*$insert = array('cdata' => json_encode($token));
        		pdo_insert('test', $insert);*/
        if (empty($token) || !is_array($token)) {
            message('获取美洽开发者授权失败, 请稍后重试! 公众平台返回原始数据为: <br />' . $token);
        }
        if (empty($token['access_token']) || empty($token['expire_in'])) {
            message("解析美洽开发者授权失败. <br />URL:{$url}<br />错误代码为: {$token['errcode']} <br />错误信息为: {$token['errmsg']}");
        }
        $record = array();
        $record['token'] = $token['access_token'];
        $record['expire'] = TIMESTAMP + $token['expires_in'];
        $row = array();
        $row['access_token'] = iserializer($record);
        pdo_update('mechat', $row, array('weid' => $acmechat['weid']));
        return $record['token'];
    }
}
Beispiel #7
0
 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['uniacid'];
     //drop list
     $seldata = array('api_id' => $this->module['config']['appid'], 'api_key' => $this->module['config']['appkey']);
     $arrdat = $this->jkvisit('QRYL', $seldata);
     $clist = $arrdat['node_list'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $weid, 'appid' => $this->module['config']['authid'], 'appkey' => $this->module['config']['authkey'], 'iurl' => $_GPC['iurl'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     load()->func('tpl');
     include $this->template('routeradd');
 }
Beispiel #8
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');
 }
Beispiel #9
0
 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['weid'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $_W['weid'], 'iurl' => $_GPC['iurl'], 'appid' => $_GPC['appid'], 'appkey' => $_GPC['appkey'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     include $this->template('routeradd');
 }
Beispiel #10
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     load()->func('tpl');
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['uniacid'], 'title' => trim($_GPC['title']), 'content' => trim($_GPC['content']), 'description' => trim($_GPC['description']), 'rule' => trim($_GPC['rule']), 'award' => trim($_GPC['award']), 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'number_times' => intval($_GPC['number_times']), 'most_num_times' => intval($_GPC['most_num_times']), 'daysharenum' => intval($_GPC['daysharenum']), 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'dateline' => TIMESTAMP, 'copyright' => $_GPC['copyright'], 'copyrighturl' => $_GPC['copyrighturl'], "gametime" => intval($_GPC['gametime']), "gamelevel" => intval($_GPC['gamelevel']), "number_times" => intval($_GPC['number_times']), "showusernum" => intval($_GPC['showusernum']), "most_num_times" => intval($_GPC['most_num_times']), "daysharenum" => intval($_GPC['daysharenum']), "mode" => intval($_GPC['mode']), "isneedfollow" => intval($_GPC['isneedfollow']), "sharelotterynum" => intval($_GPC['sharelotterynum']), 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'follow_url' => $_GPC['follow_url']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['start_picurl'] = $_GPC['start_picurl'];
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
     }
     if (!empty($_GPC['share_image'])) {
         $insert['share_image'] = $_GPC['share_image'];
     }
     if (!empty($_GPC['cover'])) {
         $insert['cover'] = $_GPC['cover'];
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         unset($insert['dateline']);
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     return true;
 }
Beispiel #11
0
 public function receive()
 {
     global $_W, $_GPC;
     load()->func('communication');
     $type = $this->message['type'];
     $uniacid = $GLOBALS['_W']['uniacid'];
     $acid = $GLOBALS['_W']['acid'];
     //$uniacid = $_W['acid'];
     $rid = intval($this->params['rule']);
     $rid = $this->rule;
     $openid = $this->message['fromusername'];
     $cfg = $this->module['config'];
     //file_put_contents(IA_ROOT.'/receive.txt', iserializer($cfg));
     if ($this->message['event'] == 'unsubscribe' && $cfg['isopenjsps']) {
         $record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'followtime' => TIMESTAMP);
         pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid));
         $fmvotelog = pdo_fetchall("SELECT * 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 * 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));
     }
 }
Beispiel #12
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'bgimg' => $_GPC['bgimg'], 'shareimg' => $_GPC['shareimg'], 'titleimg' => $_GPC['titleimg'], 'helpimg' => $_GPC['helpimg'], 'cameraimg' => $_GPC['cameraimg'], 'numberimg' => $_GPC['numberimg'], "follow_url" => $_GPC['follow_url'], "share_url" => $_GPC['share_url'], "share_title" => $_GPC['share_title'], "share_icon" => $_GPC['share_icon'], "share_desc" => $_GPC['share_desc']);
     //物品
     $item_ids = $_GPC['item_id'];
     $items = array();
     if (is_array($item_ids)) {
         foreach ($item_ids as $key => $value) {
             $d = array("id" => $value, "score" => $_GPC['item_score_' . $value], "rate" => $_GPC['item_rate_' . $value], "name" => $_GPC['item_name_' . $value], "thumb" => $_GPC['item_thumb_' . $value]);
             $items[] = $d;
         }
     }
     $insert['items'] = serialize($items);
     if (empty($id)) {
         $insert['createtime'] = time();
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert('ewei_takephotoa_reply', $insert);
     } else {
         pdo_update('ewei_takephotoa_reply', $insert, array('id' => $id));
     }
     return true;
 }
Beispiel #13
0
 public function doWebAdd()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,喜帖不存在或是已经删除!', '', 'error');
         }
         $hslists = unserialize($item['hs_pic']);
         if (is_array($hslists)) {
             //兼容0.5数据
             foreach ($hslists as &$h) {
                 if (is_array($h) && isset($h['attachment'])) {
                     $h = $h['attachment'];
                 }
             }
             unset($h);
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入喜帖标题!');
         }
         $data = array('weid' => $_W['uniacid'], 'title' => $_GPC['title'], 'xl_name' => $_GPC['xl_name'], 'xn_name' => $_GPC['xn_name'], 'is_front' => $_GPC['is_front'], 'tel' => $_GPC['tel'], 'hy_time' => $_GPC['hy_time'], 'hy_addr' => $_GPC['hy_addr'], 'jw_addr' => $_GPC['hy_addr'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'video' => $_GPC['video'], 'music' => $_GPC['music'], 'pwd' => $_GPC['pwd'], 'word' => htmlspecialchars_decode($_GPC['word']), 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['dist'], 'createtime' => TIMESTAMP, 'sendtitle' => $_GPC['sendtitle'], 'senddescription' => $_GPC['senddescription'], 'copyright' => htmlspecialchars_decode($_GPC['copyright']));
         load()->func('file');
         //上传图片
         if (!empty($_GPC['art_pic']) && $_GPC['art_pic'] != $_GPC['art_pic_old']) {
             file_delete($_GPC['art_pic_old']);
             $data['art_pic'] = $_GPC['art_pic'];
         }
         if (!empty($_GPC['bg_pic']) && $_GPC['bg_pic'] != $_GPC['bg_pic_old']) {
             file_delete($_GPC['bg_pic_old']);
             $data['bg_pic'] = $_GPC['bg_pic'];
         }
         if (!empty($_GPC['donghua_pic']) && $_GPC['donghua_pic'] != $_GPC['donghua_pic_old']) {
             file_delete($_GPC['donghua_pic_old']);
             $data['donghua_pic'] = $_GPC['donghua_pic'];
         }
         if (!empty($_GPC['suolue_pic']) && $_GPC['suolue_pic'] != $_GPC['suolue_pic_old']) {
             file_delete($_GPC['suolue_pic_old']);
             $data['suolue_pic'] = $_GPC['suolue_pic'];
         }
         if (!empty($_GPC['music']) && $_GPC['music'] != $_GPC['music_old']) {
             file_delete($_GPC['music_old']);
             $data['music'] = $_GPC['music'];
         }
         if (is_array($_GPC['thumbs'])) {
             $data['hs_pic'] = iserializer($_GPC['thumbs']);
         }
         if (empty($id)) {
             pdo_insert($this->headtable, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->headtable, $data, array('id' => $id));
         }
         message('喜帖信息更新成功!', $this->createWebUrl('manager'), 'success');
     }
     include $this->template('add');
 }
Beispiel #14
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'detail' => htmlspecialchars_decode($_GPC['detail']), 'followurl' => $_GPC['followurl'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'start' => $_GPC['start'], 'end' => $_GPC['end'], 'joincount' => intval($_GPC['joincount']), 'points' => intval($_GPC['points']), 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']));
     //规则
     $rule_ids = $_GPC['rule_id'];
     $rule_points = $_GPC['rule_point'];
     $rule_starts = $_GPC['rule_start'];
     $rule_ends = $_GPC['rule_end'];
     $rule_caches = array();
     if (is_array($rule_ids)) {
         foreach ($rule_ids as $key => $value) {
             $value = intval($value);
             $d = array("point" => $rule_points[$key], "start" => $rule_starts[$key], "end" => $rule_ends[$key]);
             $rule_caches[] = $d;
         }
     }
     $insert['rules'] = serialize($rule_caches);
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert('ewei_bonus_reply', $insert);
     } else {
         pdo_update('ewei_bonus_reply', $insert, array('id' => $id));
     }
     //基础数据缓存
     $insert['id'] = $id;
     $d = pdo_fetch("select * from " . tablename('ewei_bonus_reply') . " where rid=:rid limit 1", array(":rid" => $rid));
     $this->write_cache($rid, $d);
     return true;
 }
Beispiel #15
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $this->weid, 'title' => $_GPC['title'], 'kptime' => strtotime($_GPC['kptime']), 'rztime' => strtotime($_GPC['rztime']), 'kfs' => $_GPC['kfs'], 'price' => $_GPC['price'], 'lpaddress' => $_GPC['lpaddress'], 'sltel' => $_GPC['sltel'], 'zxtel' => $_GPC['zxtel'], 'news_title' => $_GPC['news_title'], 'news_icon' => $_GPC['news_icon'], 'news_content' => $_GPC['news_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'order_title' => $_GPC['order_title'], 'order_remark' => $_GPC['order_remark'], 'cover_img' => $_GPC['cover_img'], 'overview_img' => $_GPC['overview_img'], 'intro_img' => $_GPC['intro_img'], 'dt_img' => $_GPC['dt_img'], 'dt_intro' => htmlspecialchars_decode($_GPC['dt_intro']), 'intro' => htmlspecialchars_decode($_GPC['intro']), 'createtime' => TIMESTAMP);
     if (empty($id)) {
         $id = pdo_insert($this->table_hosue, $insert);
     } else {
         pdo_update($this->table_hosue, $insert, array('id' => $id));
     }
     ///说明项处理
     $house_ids = $_GPC['house_ids'];
     $house_names = $_GPC['house_iname'];
     $house_conents = $_GPC['house_icontent'];
     $house_sorts = $_GPC['house_sort'];
     pdo_query("delete from " . tablename($this->table_house_item) . " where hid=:hid", array(":hid" => $id));
     if (is_array($house_ids)) {
         foreach ($house_ids as $key => $value) {
             $value = intval($value);
             $d = array("rid" => $rid, "hid" => $id, "iname" => $house_names[$key], "icontent" => $house_conents[$key], "sort" => $house_sorts[$key]);
             pdo_insert($this->table_house_item, $d);
         }
     }
     return true;
 }
Beispiel #16
0
 public function doWebShare()
 {
     global $_W, $_GPC;
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display-log';
     if ($operation == 'post') {
         $goodsid = $_GPC['goodsid'];
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_event) . " WHERE goodsid=:goodsid", array(":goodsid" => $goodsid));
         $goods = pdo_fetch("SELECT * FROM " . tablename($this->table_goods) . " WHERE id=:goodsid", array(":goodsid" => $goodsid));
         if (checksubmit()) {
             $share_title = $_GPC['share_title'];
             $share_content = $_GPC['share_content'];
             $discount = $_GPC['discount'];
             $discount_limit = $_GPC['discount_limit'];
             if (false == $item) {
                 pdo_insert($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'goodsid' => $goodsid, 'discount' => $discount, 'discount_limit' => $discount_limit));
             } else {
                 pdo_update($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'discount' => $discount, 'discount_limit' => $discount_limit), array('goodsid' => $goodsid));
             }
             message("更新成功", $this->createWebUrl("Share", array("op" => "display-event")), "success");
         }
     }
     if ($operation == 'display-event') {
         $list = pdo_fetchall("SELECT * FROM " . tablename($this->table_goods) . " WHERE weid=:weid AND istime=1", array(":weid" => $_W['weid']));
     }
     if ($operation == 'display-log') {
         $list = pdo_fetchall("SELECT COUNT(goodsid) as click, goodsid, orderid, title  FROM " . tablename($this->table_iptable) . " WHERE weid=:weid GROUP BY orderid", array(":weid" => $_W['weid']));
     }
     include $this->template('share');
 }
Beispiel #17
0
 public function doWebsetting()
 {
     global $_W, $_GPC;
     $weid = $_W['uniacid'];
     load()->func('tpl');
     $subject = pdo_fetch("SELECT * FROM " . tablename(hc_ybdzs_setting) . " WHERE weid = '{$weid}' ORDER BY id DESC LIMIT 1");
     $item['hc_ybdzs_title'] = empty($item['hc_ybdzs_title']) ? '月饼大战' : $item['hc_ybdzs_title'];
     $item['share_desc'] = empty($item['share_desc']) ? '我只用了一层功力,已经无人可及了!' : $item['share_desc'];
     $item['wechat'] = empty($item['wechat']) ? '导流标题' : $item['wechat'];
     $item['hc_ybdzs_url'] = empty($item['hc_ybdzs_url']) ? 'http://52jscn.com' : $item['hc_ybdzs_url'];
     if (checksubmit()) {
         $data = array('hc_ybdzs_title' => $_GPC['hc_ybdzs_title'], 'hc_ybdzs_url' => $_GPC['hc_ybdzs_url'], 'share_desc' => $_GPC['share_desc'], 'wechat' => $_GPC['wechat'], 'counts' => $_GPC['counts'], 'photo' => $_GPC['photo']);
         if (empty($subject)) {
             $data['weid'] = $weid;
             pdo_insert(hc_ybdzs_setting, $data);
         } else {
             pdo_update(hc_ybdzs_setting, $data, array('weid' => $weid));
         }
         message('欧了!欧了!更新完毕!', referer(), 'success');
     }
     if (!$subject['photo']) {
         $subject = array("photo" => "../addons/hc_ybdzs/template/mobile/b.gif");
     }
     include $this->template('setting');
 }
Beispiel #18
0
 public function doWebPost()
 {
     //这个操作被定义用来呈现 管理中心导航菜单
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_stores) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,位置不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入位置名称!');
         }
         $data = array('uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['reside']['province'], 'city' => $_GPC['reside']['city'], 'dist' => $_GPC['reside']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'icon' => $_GPC['icon'], 'industry1' => $_GPC['industry_1'], 'industry2' => $_GPC['industry_2'], 'createtime' => TIMESTAMP);
         if (empty($id)) {
             pdo_insert($this->table_stores, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->table_stores, $data, array('id' => $id));
         }
         message('位置信息更新成功!', $this->createWebUrl('list'), 'success');
     }
     load()->func('tpl');
     include $this->template('post');
 }
Beispiel #19
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);
             //}
         }
     }
 }
Beispiel #20
0
 public function doWebAwardlist()
 {
     global $_GPC, $_W;
     checklogin();
     //$from_user = $_W['fans']['from_user'];
     $id = $_GPC['id'];
     if (checksubmit('delete')) {
         pdo_delete('mgamblemoon_user', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     if (!empty($_GPC['wid'])) {
         $wid = intval($_GPC['wid']);
         pdo_update('mgamblemoon_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
         message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 50;
     $where = '';
     $condition = array('mobile' => " AND b.mobile ='{$_GPC['profilevalue']}'", 'realname' => " AND b.realname ='{$_GPC['profilevalue']}'");
     if (!empty($_GPC['profile'])) {
         $where .= $condition[$_GPC['profile']];
     }
     $sql = "SELECT a.id,  a.award,a.createtime,a.num,a.status, b.nickname, b.mobile FROM " . tablename('mgamblemoon_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = {$id}  {$where} ORDER BY a.huodeid ASC LIMIT " . ($pindex - 1) * $psize . ",{$psize}";
     $list = pdo_fetchall($sql);
     if (!empty($list)) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mgamblemoon_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where}");
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('awardlist');
 }
Beispiel #21
0
 public function doMobileBillboard()
 {
     global $_GPC, $_W;
     $hasExists = pdo_fetch("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid AND `openid`=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $_GPC['openid']));
     if ($hasExists && $hasExists['score'] < $_GPC['score']) {
         pdo_update('cut_zongzi_billboard', array('score' => $_GPC['score']), array('uniacid' => $_W['uniacid'], 'openid' => $_GPC['openid']));
     } else {
         pdo_insert('cut_zongzi_billboard', array('uniacid' => $_W['uniacid'], 'openid' => $_GPC['openid'], 'score' => $_GPC['score']));
     }
     $record = pdo_fetch("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid AND `openid`=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $_GPC['openid']));
     $record['cur_score'] = $_GPC['score'];
     $record['top_score'] = pdo_fetchcolumn("SELECT `score` FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid ORDER BY `score` DESC LIMIT 1", array('uniacid' => $_W['uniacid']));
     $records = pdo_fetchall("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid ORDER BY `score` DESC LIMIT 10", array(':uniacid' => $_W['uniacid']));
     $str = '';
     if ($records) {
         foreach ($records as $key => $item) {
             $userinfo = mc_fansinfo($item['openid']);
             $nickname = empty($userinfo) ? '匿名' : $userinfo['nickname'];
             $str .= '<tr  style="height:30px;"><td>' . $nickname . '</td><td>' . $item['score'] . '</td></tr>';
         }
     }
     $record['billboard'] = $str;
     echo json_encode($record);
     exit;
 }
Beispiel #22
0
function rule_insert_keyword($data) {
	if (!isset($data['rid']) || !isset($data['content'])) {
		return error(1, '参数不完整');
	}
	if (isset($data['id'])) {
		$updateid = $data['id'];
	}
	//正则表达式需要验证其合法性
	if ($data['type'] == 3) {
					
	}
	$insert = array(
		'content' => $data['content'],
		'type' => $data['type'],
		'rid' => $data['rid'],
		'weid' => $data['weid'],
		
	);
	!empty($data['module']) && $insert['module'] = $data['module'];
	if (!empty($updateid) && $updateid > 0) {
		$result = pdo_update('rule_keyword', $insert, array('id' => $updateid));
	} else {
		$result = pdo_insert('rule_keyword', $insert);
	}
	if ($result) {
		return true;	
	} else {
		return error(1, '添加记录失败');
	}
}
Beispiel #23
0
/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
function site_cover($coverparams = array())
{
    $where = '';
    $params = array(':uniacid' => $coverparams['uniacid'], ':module' => $coverparams['module']);
    if (!empty($coverparams['multiid'])) {
        $where .= " AND multiid = :multiid";
        $params[':multiid'] = $coverparams['multiid'];
    }
    $cover = pdo_fetch("SELECT * FROM " . tablename('cover_reply') . " WHERE `module` = :module AND uniacid = :uniacid {$where}", $params);
    if (empty($cover['rid'])) {
        $rule = array('uniacid' => $coverparams['uniacid'], 'name' => $coverparams['title'], 'module' => 'cover', 'status' => 1);
        pdo_insert('rule', $rule);
        $rid = pdo_insertid();
    } else {
        $rule = array('name' => $coverparams['title']);
        pdo_update('rule', $rule, array('id' => $cover['rid']));
        $rid = $cover['rid'];
    }
    if (!empty($rid)) {
        $sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid';
        $pars = array();
        $pars[':rid'] = $rid;
        $pars[':uniacid'] = $coverparams['uniacid'];
        pdo_query($sql, $pars);
        $keywordrow = array('rid' => $rid, 'uniacid' => $coverparams['uniacid'], 'module' => 'cover', 'status' => 1, 'displayorder' => 0, 'type' => 1, 'content' => $coverparams['keyword']);
        pdo_insert('rule_keyword', $keywordrow);
    }
    $entry = array('uniacid' => $coverparams['uniacid'], 'multiid' => $coverparams['multiid'], 'rid' => $rid, 'title' => $coverparams['title'], 'description' => $coverparams['description'], 'thumb' => $coverparams['thumb'], 'url' => $coverparams['url'], 'do' => '', 'module' => $coverparams['module']);
    if (empty($cover['id'])) {
        pdo_insert('cover_reply', $entry);
    } else {
        pdo_update('cover_reply', $entry, array('id' => $cover['id']));
    }
    return true;
}
Beispiel #24
0
 public function doWebCategory()
 {
     global $_GPC, $_W;
     $op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     $id = intval($_GPC['id']);
     if ($op == 'post') {
         if (!empty($id)) {
             $item = pdo_fetch("SELECT * FROM" . tablename('xfmarket_category') . "WHERE id='{$id}'");
         }
         if ($_W['ispost']) {
             $data = array('weid' => $_W['weid'], 'name' => $_GPC['cname'], 'enabled' => $_GPC['enabled']);
             if (empty($id)) {
                 pdo_insert('xfmarket_category', $data);
             } else {
                 pdo_update('xfmarket_category', $data, array('id' => $id));
             }
             message('更新成功', referer(), 'success');
         }
     } elseif ($op == 'display') {
         $row = pdo_fetchall("SELECT * FROM" . tablename('xfmarket_category') . "WHERE weid='{$_W['weid']}'");
     }
     if (checksubmit('delete')) {
         pdo_delete('xfmarket_category', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功', referer(), 'success');
     }
     include $this->template('category');
 }
Beispiel #25
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_W, $_GPC;
     load()->func('file');
     $id = intval($_GPC['reply_id']);
     $insert = array("rid" => $rid, "weid" => $_W['uniacid'], "title" => $_GPC['title'], "description" => $_GPC['description'], "rule" => trim($_GPC['rule']), "end_title" => $_GPC['end_title'], "end_description" => $_GPC['end_description'], "starttime" => strtotime($_GPC['datelimit']['start']), "endtime" => strtotime($_GPC['datelimit']['end']), "total_times" => $_GPC['total_times'], "totaldayplay_times" => $_GPC['totaldayplay_times'], "totaldayshare_times" => $_GPC['totaldayshare_times'], "sharelottery_times" => $_GPC['sharelottery_times'], "gametime" => $_GPC['gametime'], "showusernum" => $_GPC['showusernum'], "share_title" => $_GPC['share_title'], "share_desc" => $_GPC['share_desc'], "share_url" => $_GPC['share_url'], "follow_url" => $_GPC['follow_url'], "gameovertext" => $_GPC['gameovertext'], "tips1text" => $_GPC['tips1text'], "tips2text" => $_GPC['tips2text'], "tips3text" => $_GPC['tips3text'], "signtext" => $_GPC['signtext'], "isneedfollow" => $_GPC['isneedfollow'], "awardtip" => $_GPC['awardtip'], "copyright" => $_GPC['copyright']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['picture'] = $_GPC['start_picurl'];
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
     }
     if (!empty($_GPC['share_image'])) {
         $insert['share_image'] = $_GPC['share_image'];
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         pdo_insert($this->table_reply, $insert);
     } else {
         pdo_update($this->table_reply, $insert, array('id' => $id));
     }
 }
Beispiel #26
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));
     }
 }
Beispiel #27
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');
         }
     }
 }
Beispiel #28
0
 private function getJsApiTicket()
 {
     global $_W;
     $data = array();
     $wechat = pdo_fetch("SELECT access_token FROM " . tablename('wechats') . " WHERE weid = {$_W['weid']}");
     $AccessToken = iunserializer($wechat['access_token']);
     $now = time();
     if ($AccessToken['expire'] < $now || !$AccessToken['ticket']) {
         //失效时,从服务器获取最新的access_token和ticket
         $res = ihttp_get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appId}&secret={$this->appSecret}");
         $content = @json_decode($res['content'], true);
         $access_token = $content['access_token'];
         $res1 = ihttp_get("https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$access_token}");
         $content1 = @json_decode($res1['content'], true);
         $ticket = $content1['ticket'];
         $data['token'] = $access_token;
         $data['expire'] = $now + 7000;
         //是7200秒失效,这里取7000
         $data['ticket'] = $ticket;
         pdo_update("wechats", array('access_token' => serialize($data)), array('weid' => $_W['weid']));
     } else {
         $ticket = $AccessToken['ticket'];
     }
     return $ticket;
 }
Beispiel #29
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $credit = intval($_GPC['credit']);
     $insert = array('rid' => $rid, 'start_time' => strtotime($_GPC['start_time']), 'end_time' => strtotime($_GPC['end_time']), 'awardrules' => $_GPC['awardrules'], 'awardinfo' => $_GPC['awardinfo'], 'days' => $_GPC['days'], 'credit' => $credit);
     if (!empty($_FILES['thumb']['tmp_name'])) {
         file_delete($_GPC['thumb_old']);
         $upload = file_upload($_FILES['thumb']);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     } else {
         $tmp_file = array(name => "registration_top.jpg", tmp_name => "{$_SERVER['DOCUMENT_ROOT']}/source/modules/cgtsignin/template/style/images/registration_top.jpg");
         $upload = file_upload($tmp_file);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     }
     if (empty($id)) {
         pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
 }
Beispiel #30
0
 public function doWebSet()
 {
     global $_W, $_GPC;
     $op = $_GPC['op'];
     $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'frontpic' => $_GPC['frontpic'], 'rightpic' => $_GPC['rightpic'], 'backpic' => $_GPC['backpic'], 'leftpic' => $_GPC['leftpic'], 'toppic' => $_GPC['toppic'], 'bottompic' => $_GPC['bottompic'], 'keyword' => $_GPC['keyword'], 'time' => $_W['timestamp'], 'taxis' => $_GPC['taxis'], 'intro' => $_GPC['intro']);
     if ($op == 'post') {
         if ($_W['ispost']) {
             pdo_insert($this->manage, $data);
             message('添加成功', referer(), 'success');
         } else {
             $set = array();
             $baseUrl = './source/modules/panorama/img/';
             $set['frontpic'] = $baseUrl . '0.jpg';
             $set['rightpic'] = $baseUrl . '1.jpg';
             $set['backpic'] = $baseUrl . '2.jpg';
             $set['leftpic'] = $baseUrl . '3.jpg';
             $set['toppic'] = $baseUrl . '4.jpg';
             $set['bottompic'] = $baseUrl . '5.jpg';
         }
     } elseif ($op == 'update') {
         $id = $_GPC['id'];
         $sql = "select * from" . tablename($this->manage) . "where id=" . $id . " and weid='{$_W['weid']}'";
         //print_r($sql);
         $set = pdo_fetch($sql);
         if ($_W['ispost']) {
             pdo_update($this->manage, $data, array('id' => $id));
             message('修改成功', referer(), 'success');
         }
     }
     include $this->template('set');
 }