当前位置: 首页>>代码示例>>PHP>>正文


PHP pdo_insertid函数代码示例

本文整理汇总了PHP中pdo_insertid函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_insertid函数的具体用法?PHP pdo_insertid怎么用?PHP pdo_insertid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pdo_insertid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  * 保存一条用户记录至用户表中, 如果OpenID存在, 则更新记录
  * @param array $entity     用户数据
  * @return int|error        成功返回用户编号, 失败返回错误信息
  */
 public function save($entity)
 {
     global $_W;
     $rec = array_elements(array('openid', 'nickname', 'gender', 'state', 'city', 'country', 'avatar'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $sql = 'SELECT * FROM ' . tablename('mbsk_fans') . ' WHERE `uniacid`=:uniacid AND `openid`=:openid';
     $pars = array();
     $pars[':uniacid'] = $rec['uniacid'];
     $pars[':openid'] = $rec['openid'];
     $exists = pdo_fetch($sql, $pars);
     if (!empty($exists)) {
         $filter = array();
         $filter['uniacid'] = $_W['uniacid'];
         $filter['uid'] = $exists['uid'];
         $ret = pdo_update('mbsk_fans', $rec, $filter);
         if ($ret !== false) {
             return $exists['uid'];
         } else {
             return error(-2, '数据更新失败, 请稍后重试');
         }
     }
     $ret = pdo_insert('mbsk_fans', $rec);
     if (!empty($ret)) {
         return pdo_insertid();
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:29,代码来源:Fans.class.php

示例2: doWebAddInfo

 public function doWebAddInfo()
 {
     global $_W, $_GPC;
     load()->func('tpl');
     $infoid = intval($_GPC['infoid']);
     if ($infoid) {
         $info = pdo_fetch("SELECT * FROM " . tablename('water_query_info') . " WHERE id= " . $infoid);
     }
     if ($_GPC['op'] == 'delete') {
         $infoid = intval($_GPC['infoid']);
         $info = pdo_fetch("SELECT id FROM " . tablename('water_query_info') . " WHERE id = " . $infoid);
         if (empty($info)) {
             message('抱歉,信息不存在或是已经被删除!');
         }
         pdo_delete('water_query_info', array('id' => $infoid));
         message('删除成功!', referer(), 'success');
     }
     if (checksubmit()) {
         $data = array('keyword' => $_GPC['keyword'], 'info' => htmlspecialchars_decode($_GPC['info']), 'infophoto' => $_GPC['infophoto']);
         if (!empty($infoid)) {
             pdo_update('water_query_info', $data, array('id' => $infoid));
         } else {
             $data['uniacid'] = $_W['uniacid'];
             pdo_insert('water_query_info', $data);
             $infoid = pdo_insertid();
         }
         message('更新成功!', referer(), 'success');
     }
     include $this->template('addinfo');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:30,代码来源:site.php

示例3: doMobilecomment

 public function doMobilecomment()
 {
     global $_W, $_GPC;
     $id = intval($_GPC['id']);
     if ($_W['ispost']) {
         if (empty($_GPC['count'])) {
             $insert = array('content' => $_GPC['content'], 'from' => $_GPC['from'], 'weid' => $_W['weid'], 'list_id' => $_GPC['id'], 'create_time' => time(), 'from_user' => $_W['fans']['from_user']);
             pdo_insert('izc_lightbox_comment', $insert);
             $id = pdo_insertid();
             $return = array('data' => array('id' => $id, 'date' => date('Y-m-d H:i:s')), 'success' => 1, 'message' => '提交成功');
             if ($_GPC['iscomment'] == 0) {
                 pdo_update('izc_lightbox_list', array('iscomment' => 1), array('id' => $_GPC['id']));
             }
         } else {
             $pindex = intval($_GPC['start']);
             $count = pdo_fetchcolumn('SELECT count(id) FROM' . tablename('izc_lightbox_comment') . ' WHERE `list_id`=:id', array(':id' => $id));
             $list = pdo_fetchall('SELECT * FROM' . tablename('izc_lightbox_comment') . ' WHERE `list_id`=:id  order by create_time desc  LIMIT ' . $pindex * $psize . ',10', array(':id' => $id));
             $return = array('success' => 1, 'data' => array('count' => $count));
             foreach ($list as $v) {
                 $return['data']['data'][] = array('id' => $v['id'], 'from' => $v['from'], 'content' => $v['content'], 'date' => date('Y-m-d H:i:s', $v['create_time']));
             }
         }
     }
     echo json_encode($return);
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:25,代码来源:site.php

示例4: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'notaward' => $_GPC['notaward'], 'notawardtext' => iserializer($notawardtext), 'notawardpic' => $_GPC['notawardpic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], "credit_times" => $_GPC['credit_times'], "credittype" => $_GPC['credittype'], "credit_type" => $_GPC['credit_type'], "credit1" => $_GPC['credit1'], "credit2" => $_GPC['credit2'], 'sn_rename' => $_GPC['sn_rename'], 'awardnum' => $_GPC['awardnum'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'share_acid' => $_GPC['share_acid'], 'copyright' => $_GPC['copyright'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], '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'], 'award_info' => $_GPC['award_info'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt']);
     load()->func('communication');
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         pdo_insert('stonefish_scratch_reply', $insert);
         $id = pdo_insertid();
     } else {
         pdo_update('stonefish_scratch_reply', $insert, array('id' => $id));
     }
     //查询规则
     //查询子公众号信息必保存分享设置
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $_W['uniacid'], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_imgurl' => $_GPC['share_imgurl_' . $acid], 'share_picurl' => $_GPC['share_picurl_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid]);
         if (empty($_GPC['acid_' . $acid])) {
             pdo_insert('stonefish_scratch_share', $insertshare);
         } else {
             pdo_update('stonefish_scratch_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
         }
     }
     //查询子公众号信息必保存分享设置
     //奖品配置
     if (!empty($_GPC['prizetype'])) {
         foreach ($_GPC['prizetype'] as $index => $prizetype) {
             if (empty($prizetype)) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizepro' => $_GPC['prizepro'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'prizepic' => $_GPC['prizepic'][$index], 'prizetxt' => $_GPC['prizetxt'][$index], 'credit' => $_GPC['credit'][$index], 'credit_type' => $_GPC['prize_type'][$index]);
             $updata['total_num'] += $_GPC['prizetotal'][$index];
             pdo_update('stonefish_scratch_prize', $insertprize, array('id' => $index));
         }
     }
     if (!empty($_GPC['prizetype_new']) && count($_GPC['prizetype_new']) > 1) {
         foreach ($_GPC['prizetype_new'] as $index => $credit_type) {
             if (empty($credit_type) || $index == 0) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizepro' => $_GPC['prizepro_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index], 'prizetxt' => $_GPC['prizetxt_new'][$index], 'credit' => $_GPC['credit_new'][$index], 'credit_type' => $_GPC['prize_type_new'][$index]);
             $updata['total_num'] += $_GPC['prizetotal_new'][$index];
             pdo_insert('stonefish_scratch_prize', $insertprize);
         }
     }
     if ($updata['total_num']) {
         pdo_update('stonefish_scratch_reply', $updata, array('id' => $id));
     }
     //奖品配置
     return true;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:60,代码来源:module.php

示例5: user_register

function user_register($user)
{
    if (empty($user) || !is_array($user)) {
        return 0;
    }
    if (isset($user['uid'])) {
        unset($user['uid']);
    }
    $user['salt'] = random(8);
    $user['password'] = user_hash($user['password'], $user['salt']);
    $user['joinip'] = CLIENT_IP;
    $user['joindate'] = TIMESTAMP;
    $user['lastip'] = CLIENT_IP;
    $user['lastvisit'] = TIMESTAMP;
    if (empty($user['status'])) {
        $user['status'] = 2;
    }
    $now = time();
    if (empty($user['endtime'])) {
        $user['endtime'] = $now + 7 * 24 * 3600;
    }
    $result = pdo_insert('users', $user);
    if (!empty($result)) {
        $user['uid'] = pdo_insertid();
    }
    return intval($user['uid']);
}
开发者ID:wisemyth,项目名称:weizan,代码行数:27,代码来源:user.mod.php

示例6: doMobileSaylove

 public function doMobileSaylove()
 {
     global $_W, $_GPC;
     $res_path = $this->res_path;
     $ops = array('submit', 'saylove');
     $op = in_array($_GPC['op'], $ops) ? $_GPC['op'] : 'saylove';
     if ($op == 'saylove') {
         $openid = $_SESSION['openid'];
         $sql = 'SELECT count(openid) FROM ' . tablename('mc_mapping_fans') . ' WHERE openid=:openid AND uniacid=:uniacid AND follow = 1';
         $params = array(':openid' => $openid, ':uniacid' => $_W['uniacid']);
         $isfollow = pdo_fetchcolumn($sql, $params);
         $dayBegin = mktime(0, 0, 0);
         $dayEnd = mktime(23, 59, 59);
         $sql = 'SELECT count(openid) FROM ' . tablename($this->tb_lovehelper_msg) . " WHERE openid=:openid AND uniacid=:uniacid AND createtime<{$dayEnd} AND createtime>{$dayBegin}";
         $params = array(':openid' => $openid, ':uniacid' => $_W['uniacid']);
         $count = pdo_fetchcolumn($sql, $params);
         $sql = 'SELECT * FROM ' . tablename($this->tb_lovehelper_res) . ' WHERE type=:type AND uniacid=:uniacid';
         $params = array(':type' => IMAGE, ':uniacid' => $_W['uniacid']);
         $bgimages = pdo_fetchall($sql, $params);
         include $this->template('saylove');
     }
     if ($op == 'submit') {
         $content = $_GPC["content"];
         $fromuser = $_GPC["fromuser"];
         $bgimage = $_GPC["bgimage"];
         $love = array('content' => $content, 'fromuser' => $fromuser, 'bgimage' => $bgimage, 'uniacid' => $_W['uniacid'], 'openid' => $_SESSION['openid'], 'createtime' => TIMESTAMP);
         pdo_insert($this->tb_lovehelper_msg, $love);
         echo pdo_insertid();
     }
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:30,代码来源:site.php

示例7: site_cover

/**
 * [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;
}
开发者ID:zhang19960118,项目名称:html11,代码行数:39,代码来源:site.mod.php

示例8: receive

 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));
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:60,代码来源:receiver.php

示例9: receive

 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));
             }
         }
     }
 }
开发者ID:wisemyth,项目名称:weizan,代码行数:59,代码来源:receiver.php

示例10: doMobileget

 public function doMobileget()
 {
     global $_GPC, $_W;
     $insert = array('rid' => intval($_GPC['rid']), 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'loops' => intval($_GPC['loop']), 'items' => $_GPC['items'], 'createtime' => time());
     pdo_insert($this->list, $insert);
     $id = pdo_insertid();
     exit(json_encode(array('state' => 'ok', 'mid' => $id)));
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:8,代码来源:site.php

示例11: respond

 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);
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:57,代码来源:processor.php

示例12: doMobileGrabseat

 public function doMobileGrabseat()
 {
     global $_GPC, $_W;
     $rid = $_GPC['rid'];
     $weid = $_W['weid'];
     $sql = "SELECT * FROM " . tablename('grabseat_reply') . " WHERE `rid`=:rid";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     $row['picture'] = $_W['attachurl'] . trim($row['picture'], '/');
     $fromuser = $_W['fans']['from_user'];
     $profile = fans_search($fromuser);
     if (!empty($_GPC['submit'])) {
         if ($_GPC['sel'] == 'grab') {
             if (empty($profile['from_user'])) {
                 message('您还没有关注,请先关注再参与活动~', 'refresh', 'error');
             }
             $graber = pdo_fetch("SELECT * FROM " . tablename('grabseat_record') . " WHERE rid = :rid AND (graberopenid = :graberopenid OR fiteropenid = :fiteropenid) ", array(':rid' => $rid, ':graberopenid' => $fromuser, ':fiteropenid' => $fromuser));
             if (empty($graber)) {
                 $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'gender' => $_GPC['gender']);
                 fans_update($fromuser, $data);
                 $insert = array('weid' => $_GPC['weid'], 'rid' => $rid, 'graberopenid' => $fromuser, 'grabername' => $_GPC['realname'], 'grabermobile' => $_GPC['mobile'], 'grabtime' => time(), 'status' => 0);
                 if (pdo_insert('grabseat_record', $insert)) {
                     $id = pdo_insertid();
                 }
                 die('<script>location.href = "' . $this->createMobileUrl('showseat', array('rid' => $_GPC['rid'], 'id' => $id)) . '";</script>');
             } else {
                 message('不能重复抢座或者您已经就坐~~', 'refresh', 'error');
             }
         } else {
             if (empty($profile['from_user'])) {
                 message('您还没有关注,请先关注再参与活动~', 'refresh', 'error');
             }
             $fiter = pdo_fetch("SELECT * FROM " . tablename('grabseat_record') . " WHERE rid = :rid AND (graberopenid = :graberopenid OR fiteropenid = :fiteropenid) ", array(':rid' => $rid, ':graberopenid' => $fromuser, ':fiteropenid' => $fromuser));
             if (empty($fiter)) {
                 $id = $_GPC['tablenum'];
                 if (empty($id)) {
                     message('座位号忘了填写哟~~', 'refresh', 'error');
                 }
                 $tableid = pdo_fetch("SELECT * FROM " . tablename('grabseat_record') . " WHERE rid = :rid AND id = :id", array(':rid' => $rid, ':id' => $id));
                 if (empty($tableid['id'])) {
                     message('没有这个座位号哦~~', 'refresh', 'error');
                 }
                 if (!empty($tableid['fiteropenid'])) {
                     message('您来晚了,这个座位已经有人做了哟~~', 'refresh', 'error');
                 }
                 $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'gender' => $_GPC['gender']);
                 fans_update($fromuser, $data);
                 $insert = array('fiteropenid' => $fromuser, 'fitername' => $_GPC['realname'], 'fitermobile' => $_GPC['mobile'], 'fittime' => time(), 'status' => 1);
                 pdo_update('grabseat_record', $insert, array('id' => $id));
                 die('<script>location.href = "' . $this->createMobileUrl('fitseat', array('rid' => $_GPC['rid'], 'id' => $id)) . '";</script>');
             } else {
                 message('您已经就坐,不能换座位了哟~~', 'refresh', 'error');
             }
         }
     }
     include $this->template('grabseat');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:56,代码来源:site.php

示例13: doWebList

 public function doWebList()
 {
     global $_GPC, $_W;
     load()->func('tpl');
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'display') {
         if (!empty($_GPC['displayorder'])) {
             foreach ($_GPC['displayorder'] as $id => $displayorder) {
                 pdo_update('meepomailattachment', array('displayorder' => $displayorder), array('id' => $id));
             }
             message('分类排序更新成功!', $this->createWebUrl('List', array('op' => 'display')), 'success');
         }
         $list = pdo_fetchall("SELECT * FROM " . tablename('meepomailattachment') . " WHERE weid = '{$_W['weid']}' ORDER BY id ASC, displayorder DESC");
         include $this->template('list');
     } elseif ($operation == 'post') {
         $id = intval($_GPC['id']);
         if (!empty($id)) {
             $list = pdo_fetch("SELECT * FROM " . tablename('meepomailattachment') . " WHERE id = '{$id}'");
         } else {
             $list = array('displayorder' => 0);
         }
         if (checksubmit('submit')) {
             if (empty($_GPC['attachmentname']) || empty($_GPC['description'])) {
                 message('文件名称以及文件描述是必填项!', $this->createWebUrl('list'), 'error');
             }
             $data = array('weid' => $_W['weid'], 'attachmentname' => $_GPC['attachmentname'], 'isshow' => intval($_GPC['isshow']), 'displayorder' => intval($_GPC['displayorder']), 'description' => $_GPC['description']);
             if (!empty($_FILES['thumb']['tmp_name'])) {
                 load()->func('file');
                 file_delete($_GPC['thumb_old']);
                 $upload = $this->file_upload($data['attachmentname'], $_FILES['thumb']);
                 if (is_error($upload)) {
                     message($upload['message'], '', 'error');
                 }
                 $data['thumb'] = $upload['path'];
             }
             if (!empty($id)) {
                 unset($data['id']);
                 pdo_update('meepomailattachment', $data, array('id' => $id));
             } else {
                 pdo_insert('meepomailattachment', $data);
                 $id = pdo_insertid();
             }
             message('更新附件成功!', $this->createWebUrl('list', array('op' => 'display')), 'success');
         }
         include $this->template('list');
     } elseif ($operation == 'delete') {
         $id = intval($_GPC['id']);
         $category = pdo_fetch("SELECT id FROM " . tablename('meepomailattachment') . " WHERE id = '{$id}'");
         if (empty($category)) {
             message('抱歉,附件不存在或是已经被删除!', $this->createWebUrl('list', array('op' => 'display')), 'error');
         }
         pdo_delete('meepomailattachment', array('id' => $id), 'OR');
         message('附件信息删除成功!', $this->createWebUrl('list', array('op' => 'display')), 'success');
     }
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:55,代码来源:site.php

示例14: fieldsFormSubmit

 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'votetype' => $_GPC['votetype'], 'votelimit' => $_GPC['votelimit'], 'votetimes' => $_GPC['votetimes'], 'votetotal' => $_GPC['votetotal'], 'isimg' => $_GPC['isimg'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']));
     if (!empty($_GPC['thumb'])) {
         $insert['thumb'] = $_GPC['thumb'];
         file_delete($_GPC['thumb-old']);
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     $options = array();
     $option_ids = $_POST['option_id'];
     $option_titles = $_POST['option_title'];
     $option_thumb_olds = $_POST['option_thumb_old'];
     $files = $_FILES;
     $len = count($option_ids);
     $ids = array();
     for ($i = 0; $i < $len; $i++) {
         $item_id = $option_ids[$i];
         $a = array("title" => $option_titles[$i], "rid" => $rid);
         $f = 'option_thumb_' . $item_id;
         $old = $_GPC['option_thumb_' . $item_id];
         if (!empty($files[$f]['tmp_name'])) {
             $upload = file_upload($files[$f]);
             if (is_error($upload)) {
                 message($upload['message'], '', 'error');
             }
             $a['thumb'] = $upload['path'];
         } else {
             if (!empty($old)) {
                 $a['thumb'] = $old;
             }
         }
         if ((int) $item_id == 0) {
             pdo_insert("vote_option", $a);
             $item_id = pdo_insertid();
         } else {
             pdo_update("vote_option", $a, array('id' => $item_id));
         }
         $ids[] = $item_id;
     }
     if (!empty($ids)) {
         pdo_query("delete from " . tablename('vote_option') . " where id not in ( " . implode(',', $ids) . ") and rid = " . $rid);
     }
     return true;
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:55,代码来源:module.php

示例15: fieldsFormSubmit

 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     if (!empty($_GPC['news-title'])) {
         foreach ($_GPC['news-title'] as $groupid => $items) {
             if (empty($items)) {
                 continue;
             }
             foreach ($items as $itemid => $row) {
                 if (empty($row)) {
                     continue;
                 }
                 $update = array('title' => $_GPC['news-title'][$groupid][$itemid], 'description' => $_GPC['news-description'][$groupid][$itemid], 'thumb' => $_GPC['news-picture-old'][$groupid][$itemid], 'content' => htmlspecialchars_decode($_GPC['news-content'][$groupid][$itemid]), 'url' => $_GPC['news-url'][$groupid][$itemid]);
                 if (!empty($_GPC['news-picture'][$groupid][$itemid])) {
                     $update['thumb'] = $_GPC['news-picture'][$groupid][$itemid];
                     file_delete($_GPC['news-picture-old'][$groupid][$itemid]);
                 }
                 pdo_update($this->tablename, $update, array('id' => $itemid));
                 //处理新增子项
                 if (!empty($_GPC['news-title-new'][$groupid])) {
                     foreach ($_GPC['news-title-new'][$groupid] as $index => $title) {
                         if (empty($title)) {
                             continue;
                         }
                         unset($_GPC['news-title-new'][$groupid]);
                         $insert = array('rid' => $rid, 'parentid' => $itemid, 'title' => $title, 'description' => $_GPC['news-description-new'][$groupid][$index], 'thumb' => $_GPC['news-picture-new'][$groupid][$index], 'content' => htmlspecialchars_decode($_GPC['news-content-new'][$groupid][$index]), 'url' => $_GPC['news-url-new'][$groupid][$index]);
                         pdo_insert($this->tablename, $insert);
                     }
                 }
             }
         }
     }
     //处理添加
     if (!empty($_GPC['news-title-new'])) {
         foreach ($_GPC['news-title-new'] as $itemid => $titles) {
             if (!empty($titles)) {
                 $parentid = 0;
                 foreach ($titles as $index => $title) {
                     if (empty($title)) {
                         continue;
                     }
                     $insert = array('rid' => $rid, 'parentid' => $parentid, 'title' => $title, 'description' => $_GPC['news-description-new'][$itemid][$index], 'thumb' => $_GPC['news-picture-new'][$itemid][$index], 'content' => htmlspecialchars_decode($_GPC['news-content-new'][$itemid][$index]), 'url' => $_GPC['news-url-new'][$itemid][$index]);
                     pdo_insert($this->tablename, $insert);
                     if (empty($parentid)) {
                         $parentid = pdo_insertid();
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:yunsite,项目名称:my-we7,代码行数:52,代码来源:module.php


注:本文中的pdo_insertid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。