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


PHP mc_openid2uid函数代码示例

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


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

示例1: payResult

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

示例2: 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

示例3: fans_search

 public static function fans_search($from_user, $fields = array())
 {
     //    $uid = pdo_fetchcolumn("SELECT a.uid FROM "
     //      . tablename('mc_mapping_fans') . " a inner join "
     //      . tablename('mc_members') . " b on a.uid=b.uid "
     //      . " WHERE a.openid='{$from_user}' LIMIT 1");
     //    return fans_search($uid, $fields);
     load()->model('mc');
     $uid = mc_openid2uid($from_user);
     return mc_fetch($uid, $fields);
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:11,代码来源:wechatutil.php

示例4: getUserInfo

 private function getUserInfo($uid = null)
 {
     global $_W;
     load()->model('mc');
     if (empty($uid)) {
         $uid = $_W['member']['uid'];
     } else {
         $uid = mc_openid2uid($uid);
     }
     $userInfo = array();
     $filter = array();
     $filter['status'] = 1;
     $userInfo['coupons'] = activity_coupon_owned($uid, $filter);
     $userInfo['tokens'] = activity_token_owned($uid, $filter);
     $userInfo['credits'] = mc_credit_fetch($_W['member']['uid'], '*');
     return $userInfo;
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:17,代码来源:site.php

示例5: receive

 public function receive()
 {
     global $_W;
     load()->model('mc');
     $type = $this->message['type'];
     $event = $this->message['event'];
     $openid = $this->message['from'];
     $config = $this->module['config'];
     $acc = WeAccount::create($_W['acid']);
     if ($event == 'subscribe' && $config['sub_num'] != 0 && !empty($config['sub_type'])) {
         $log = pdo_fetch("SELECT id FROM " . tablename('ju_credit_log') . " WHERE uniacid=:uniacid and openid=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
         if (empty($log)) {
             $uid = mc_openid2uid($openid);
             $result = mc_credit_update($uid, $config['sub_type'], $config['sub_num'], array('0' => '1', '1' => '关注平台奖励'));
             if ($result) {
                 $insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'subscribetime' => time(), 'unsubscribetime' => 0, 'follow' => 1);
                 pdo_insert('ju_credit_log', $insert);
                 $this->sendText($acc, $this->message['from'], '感谢您的关注,赠送您' . $config['sub_num'] . '!');
             }
         } else {
             pdo_update('ju_credit_log', array('follow' => 1, 'subscribetime' => time()), array('id' => $log['id']));
         }
     } elseif ($event == 'unsubscribe' && $config['unsub_num'] != 0) {
         $log = pdo_fetch("SELECT id FROM " . tablename('ju_credit_log') . " WHERE uniacid=:uniacid and openid=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
         $uid = mc_openid2uid($openid);
         if (empty($log)) {
             $result = mc_credit_update($uid, $config['unsub_type'], '-' . $config['unsub_num'], array('0' => '1', '1' => '取消关注平台扣除'));
             if ($result) {
                 $insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'subscribetime' => 0, 'unsubscribetime' => time(), 'follow' => 0);
                 pdo_insert('ju_credit_log', $insert);
             }
         } else {
             $result = mc_credit_update($uid, $config['unsub_type'], '-' . $config['unsub_num'], array('0' => '1', '1' => '取消关注平台扣除'));
             pdo_update('ju_credit_log', array('follow' => 0, 'subscribetime' => 0, 'unsubscribetime' => time()), array('id' => $log['id']));
         }
     }
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:37,代码来源:receiver.php

示例6: payResult

 public function payResult($params)
 {
     global $_W, $_GPC;
     load()->model('mc');
     load()->func('communication');
     //调用http通信文件
     $fee = $params['fee'];
     $data = array('status' => $params['result'] == 'success' ? 1 : -1);
     $paydata = array('wechat' => '微信', 'alipay' => '支付宝', 'credit' => '余额支付');
     $params['user'] = mc_openid2uid($params['user']);
     if ($params['type'] == 'wechat' || $params['type'] == 'alipay') {
         $data['transid'] = $params['tag']['transaction_id'];
     }
     //查询有无充值订单
     $status = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE tid = :tid", array(':tid' => $params['tid']));
     //查询有无商品订单
     $status2 = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_order') . " WHERE id = :tid", array(':tid' => $params['tid']));
     if (empty($status['status']) && !empty($status['id'])) {
         pdo_update('mc_credits_recharge', $data, array('tid' => $params['tid']));
         if ($params['result'] == 'success') {
             $setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
             $credit = $setting['creditbehaviors']['currency'];
             if (empty($credit)) {
                 message('站点积分行为参数配置错误,请联系服务商', '', 'error');
             } else {
                 $record[] = $params['user'];
                 $record[] = '用户通过' . $paydata[$params['type']] . '充值' . $fee;
                 $this->pay_credit_update($params['user'], $credit, $fee, $record);
                 ///47.余额充值微信数据返回调用。
             }
         }
     }
     if (empty($status2['status']) && !empty($status2['id'])) {
         $data['zhifutime'] = time();
         pdo_update('wwx_fxxt_order', $data, array('id' => $params['tid']));
         if ($params['result'] == 'success') {
             $order = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_order') . " WHERE id = '{$params['tid']}'");
             $ordergoods = pdo_fetchall("SELECT * FROM " . tablename('wwx_fxxt_order_goods') . " WHERE orderid = '{$params['tid']}'", array(), 'goodsid');
             $goods = pdo_fetchall("SELECT * FROM " . tablename('wwx_fxxt_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')");
             $address = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_address') . " WHERE id = :id", array(':id' => $order['addressid']));
             if ($goods['totalcnf'] == 1 && empty($goods['total'])) {
                 $this->setOrderStock($params['tid']);
                 ///48.根据订单ID更新信息,false增加库存,无参数为减少库存。
             }
             if (!empty($this->module['config']['noticeemail'])) {
                 $body = "<h3>购买商品清单</h3> <br />";
                 if (!empty($goods)) {
                     foreach ($goods as $row) {
                         $body .= "名称:{$row['title']} ,数量:{$ordergoods[$row['id']]['total']} <br />";
                         $body .= "订单号:{$order['ordersn']}<br />";
                         $body .= "{$paydata[$params['type']]}订单号:{$data['transid']}<br />";
                     }
                 }
             }
             $body .= "总金额:{$order['price']}元 (用户通过{$paydata[$params['type']]}付款)<br />";
             $body .= "<h3>购买用户详情</h3> <br />";
             $body .= "用户标识:{$params['user']} <br />";
             $body .= "真实姓名:{$address['realname']} <br />";
             $body .= "地区:{$address['province']} - {$address['city']} - {$address['area']}<br />";
             $body .= "详细地址:{$address['address']} <br />";
             $body .= "手机:{$address['mobile']} <br /> <br /> <br />";
             ihttp_email($this->module['config']['noticeemail'], "{$_W['account']['name']}商城订单提醒", $body);
         }
     }
     if ($params['from'] == 'return') {
         if ($params['result'] == 'success') {
             $order = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_order') . " WHERE id = '{$params['tid']}'");
             $ordergoods = pdo_fetchall("SELECT goodsid,total,optionid FROM " . tablename('wwx_fxxt_order_goods') . " WHERE orderid = '{$order['id']}'", array(), 'goodsid');
             if (!empty($ordergoods)) {
                 $goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unit, total,credit FROM " . tablename('wwx_fxxt_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')");
             }
             $shopmember = pdo_fetch('SELECT shareid,realname FROM ' . tablename('wwx_fxxt_member') . " WHERE from_user = :from_user", array(':from_user' => $order['from_user']));
             $shareopenid = pdo_fetch('SELECT from_user FROM ' . tablename('wwx_fxxt_member') . " WHERE `uniacid` = :uniacid AND id=:id ", array(':uniacid' => $_W['uniacid'], ':id' => $shopmember['shareid']));
             //查询上级代理的OPENID以及ID
             if (empty($order['ordermessage'])) {
                 $this->sendgmsptz($order['ordersn'], $order['price'], $shopmember['realname'], $shareopenid['from_user']);
                 ///18.提醒:下级购买商品通知
                 $this->sendMobilePayMsg($order, $goods, "在线付款", $ordergoods);
                 ///40.提交订单消息模板。
                 pdo_update('wwx_fxxt_order', array('ordermessage' => 1), array('id' => $params['tid']));
             }
             message('支付成功!', '../../app/' . $this->createMobileUrl('FansIndex'), 'success');
         } else {
             message('支付失败!', '../../app/' . $this->createMobileUrl('FansIndex'), 'error');
         }
     }
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:87,代码来源:site.php

示例7: checkMember

 public function checkMember($openid = '')
 {
     global $_W;
     $acc = WeiXinAccount::create($_W['acid']);
     $userinfo = $acc->fansQueryInfo($openid);
     load()->model('mc');
     $uid = mc_openid2uid($openid);
     pdo_update('mc_members', array('nickname' => $userinfo['nickname'], 'gender' => $userinfo['sex'], 'nationality' => $userinfo['country'], 'resideprovince' => $userinfo['province'], 'residecity' => $userinfo['city'], 'avatar' => $userinfo['headimgurl']), array('uid' => $uid));
     pdo_update('mc_mapping_fans', array('nickname' => $userinfo['nickname']), array('uniacid' => $_W['uniacid'], 'openid' => $openid));
     $model = m('member');
     $member = $model->getMember($openid);
     if (empty($member)) {
         $mc = mc_fetch($uid, array('realname', 'nickname', 'mobile', 'avatar', 'resideprovince', 'residecity', 'residedist'));
         $member = array('uniacid' => $_W['uniacid'], 'uid' => $uid, 'openid' => $openid, 'realname' => $mc['realname'], 'mobile' => $mc['mobile'], 'nickname' => $mc['nickname'], 'avatar' => $mc['avatar'], 'gender' => $mc['gender'], 'province' => $mc['residecity'], 'city' => $mc['residecity'], 'area' => $mc['resizedist'], 'createtime' => time(), 'status' => 0);
         pdo_insert('ewei_shop_member', $member);
         $member['id'] = pdo_insertid();
         $member['isnew'] = true;
     } else {
         $member['nickname'] = $userinfo['nickname'];
         $member['avatar'] = $userinfo['headimgurl'];
         $member['province'] = $userinfo['province'];
         $member['city'] = $userinfo['city'];
         pdo_update('ewei_shop_member', $member, array('id' => $member['id']));
         $member['isnew'] = false;
     }
     return $member;
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:27,代码来源:model.php

示例8: setOrderCredit

 public function setOrderCredit($orderid, $add = true)
 {
     $order = pdo_fetch("SELECT * FROM " . tablename($this->table_order) . " WHERE id=:id LIMIT 1", array(':id' => $orderid));
     if (empty($order)) {
         return false;
     }
     $ordergoods = pdo_fetchall("SELECT goodsid, total FROM " . tablename($this->table_order_goods) . " WHERE orderid = :orderid", array(':orderid' => $orderid));
     if (!empty($ordergoods)) {
         $credit = 0.0;
         $sql = 'SELECT `credit` FROM ' . tablename($this->table_goods) . ' WHERE `id` = :id';
         foreach ($ordergoods as $goods) {
             $goodsCredit = pdo_fetchcolumn($sql, array(':id' => $goods['goodsid']));
             $credit += $goodsCredit * floatval($goods['total']);
         }
     }
     //增加积分
     if (!empty($credit)) {
         load()->model('mc');
         load()->func('compat.biz');
         $uid = mc_openid2uid($order['from_user']);
         $fans = fans_search($uid, array("credit1"));
         if (!empty($fans)) {
             $uid = intval($fans['uid']);
             $remark = $add == true ? '微点餐积分奖励 订单ID:' . $orderid : '微点餐积分扣除 订单ID:' . $orderid;
             $log = array();
             $log[0] = $uid;
             $log[1] = $remark;
             mc_credit_update($uid, 'credit1', $credit, $log);
         }
     }
     return true;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:32,代码来源:site.php

示例9: doMobileSurvey


//.........这里部分代码省略.........
         if ($activity['only_once'] == '1' && $month_total > 0) {
             $pererror = 2;
         }
     }
     $user = mc_fetch($_W['fans']['from_user'], array('realname', 'mobile'));
     if (empty($user['realname']) || empty($user['mobile'])) {
         $userinfo = 0;
     }
     if (checksubmit()) {
         if ($pertotal >= $activity['pertotal']) {
             message('抱歉!每人只能提交' . $activity['pertotal'] . "次!", referer(), 'error');
         }
         //更新粉丝的手机号和姓名
         if ($userinfo == '0') {
             //mc_update($_W['fans']['from_user'], array('realname' => trim($_GPC['username']), 'mobile' => trim($_GPC['telephone'])));
         }
         $row = array();
         $row['sid'] = $sid;
         $row['openid'] = $_W['fans']['from_user'];
         $row['suggest'] = trim($_GPC['suggest']);
         $row['store'] = trim($_GPC['store']);
         $row['createtime'] = TIMESTAMP;
         $datas = array();
         $fields = array();
         foreach ($ds as $r) {
             $fields[$r['sfid']] = $r;
         }
         foreach ($_GPC as $key => $value) {
             if (strexists($key, 'field_')) {
                 $sfid = intval(str_replace('field_', '', $key));
                 $field = $fields[$sfid];
                 if ($sfid && $field) {
                     if (in_array($field['type'], array('textarea', 'radio'))) {
                         $entry = array();
                         $entry['sid'] = $sid;
                         $entry['srid'] = 0;
                         $entry['sfid'] = $sfid;
                         $entry['createtime'] = TIMESTAMP;
                         $entry['data'] = strval($value);
                         $datas[] = $entry;
                     }
                     if (in_array($field['type'], array('checkbox'))) {
                         $value = explode("||", $value);
                         if (!is_array($value)) {
                             continue;
                         }
                         foreach ($value as $k => $v) {
                             $entry['sid'] = $sid;
                             $entry['srid'] = 0;
                             $entry['sfid'] = $sfid;
                             $entry['createtime'] = TIMESTAMP;
                             $entry['data'] = strval($v);
                             $datas[] = $entry;
                         }
                     }
                 }
             }
         }
         if (empty($datas)) {
             message('非法访问.', '', 'error');
         }
         if (pdo_insert('survey_rows', $row) != 1) {
             message('保存失败.');
         }
         $srid = pdo_insertid();
         if (empty($srid)) {
             message('保存失败.');
         } else {
             if ($activity['credit'] > 0) {
                 //if (!$reregister) { //只有领取了会员卡的,才有积分
                 $log = "参加调研问卷,赠送{$activity['credit']}积分";
                 $result = mc_credit_update(mc_openid2uid($row['openid']), 'credit1', $activity['credit'], array(mc_openid2uid($row['openid']), $log, 'ur_survey'));
                 /*   }
                      else    {   //没有注册会员卡的,无积发
                          $log = "参加调研问卷,因未领卡获得0积分";
                          $result = mc_credit_update(mc_openid2uid($row['openid']), 'credit1', 0, array(mc_openid2uid($row['openid']), $log, 'ur_survey'));
                      }*/
             }
         }
         foreach ($datas as &$r) {
             $r['srid'] = $srid;
             pdo_insert('survey_data', $r);
         }
         if (empty($activity['starttime'])) {
             $record = array();
             $record['starttime'] = TIMESTAMP;
             pdo_update('survey', $record, array('sid' => $sid));
         }
         message($log . "</br>" . $activity['information'], url('mc/home'));
         //完成后跳转到会员中
     }
     foreach ($ds as &$r) {
         if ($r['value']) {
             $r['options'] = explode("\r\n", $r['value']);
         }
     }
     load()->func('tpl');
     $stores = pdo_fetchall('SELECT * FROM ' . tablename('activity_stores') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
     include $this->template('survey');
 }
开发者ID:dalinhuang,项目名称:urWq,代码行数:101,代码来源:site.php

示例10: doMobileGetAnswer

 public function doMobileGetAnswer()
 {
     global $_GPC, $_W;
     $fid = intval($_GPC['fid']);
     $weid = $_W['uniacid'];
     $flight_setting = pdo_fetch("SELECT * FROM " . tablename('fighting_setting') . " WHERE id = '{$fid}' LIMIT 1");
     if (empty($flight_setting)) {
         message('非法访问,请重新发送消息进入一战到底页面!');
     }
     load()->model('mc');
     load()->func('compat.biz');
     $fromuser = $_GPC['openid'];
     $uid = mc_openid2uid($fromuser);
     $fans = fans_search($uid, array("credit1"));
     if (!empty($fans)) {
         $credit = $fans['credit1'];
     }
     $qid = intval($_GPC['qestionid']);
     $answer = $_GPC['answer'];
     $answerNum = $_GPC['answerNum'];
     $sql_fighting = pdo_fetch("SELECT * FROM " . tablename('fighting') . " WHERE `from_user`=:from_user AND `fid`=:fid ORDER BY id DESC LIMIT 1", array(':from_user' => $fromuser, ':fid' => $fid));
     $question = pdo_fetch("SELECT * FROM " . tablename('fighting_question_bank') . " WHERE id = '{$qid}'");
     $isupdate = pdo_fetch("SELECT * FROM " . tablename('fighting') . " WHERE fid = " . $fid . " and from_user='" . $fromuser . "'");
     if ($answer == $question['answer']) {
         //正确答案
         $figure = intval($question['figure']);
         //不存在false的情况,如果是false,则表明是非法
         // pdo_update('mc_members', array("credit1" => $credit + $figure), array('uid' => $uid,'uniacid'=>$weid));
         if ($isupdate == false) {
             $insert1 = array('weid' => $_W['uniacid'], 'fid' => $fid, 'answerNum' => $answerNum + 1, 'from_user' => $fromuser, 'nickname' => $member['nickname'], 'lastcredit' => $figure);
             $add = pdo_insert('fighting', $insert1);
             $flightid = pdo_insertid();
             $awn = $insert1['$answerNum'];
             if ($awn >= $flight_setting['qnum']) {
                 $updateData = array('lasttime' => time(), 'answerNum' => 0);
                 pdo_update('fighting', $updateData, array('id' => $flightid));
                 return $this->fightJson(3, '');
                 exit;
             }
         } else {
             $updateData = array('answerNum' => $isupdate['answerNum'] + 1, 'lastcredit' => $isupdate['lastcredit'] + $figure);
             pdo_update('fighting', $updateData, array('id' => $isupdate['id']));
             $awn = $updateData['answerNum'];
             if ($awn >= $flight_setting['qnum']) {
                 $updateData = array('lasttime' => time(), 'lastcredit' => $isupdate['lastcredit'] + $figure, 'answerNum' => 0);
                 pdo_update('fighting', $updateData, array('id' => $isupdate['id']));
                 return $this->fightJson(1, $answerNum);
                 exit;
             }
         }
         pdo_update('mc_members', array("credit1" => $credit + $figure), array('uid' => $uid, 'uniacid' => $weid));
         return $this->fightJson(1, '');
         exit;
     } else {
         if ($isupdate == false) {
             $insert1 = array('weid' => $_W['uniacid'], 'fid' => $fid, 'answerNum' => $answerNum + 1, 'from_user' => $fromuser, 'nickname' => $member['nickname'], 'lastcredit' => 0);
             $addworng = pdo_insert('fighting', $insert1);
             $flightid = pdo_insertid();
             $awn = $insert1['answerNum'];
             if ($awn >= $flight_setting['qnum']) {
                 $updateData = array('lasttime' => time(), 'answerNum' => 0);
                 pdo_update('fighting', $updateData, array('id' => $flightid));
                 return $this->fightJson(3, '答题满了');
                 exit;
             } else {
                 return $this->fightJson(2, $question[answer]);
                 exit;
             }
         } else {
             $updateData = array('answerNum' => $isupdate['answerNum'] + 1);
             pdo_update('fighting', $updateData, array('id' => $isupdate['id']));
             $awn = $updateData['answerNum'];
             if ($awn >= $flight_setting['qnum']) {
                 $updateData2 = array('lasttime' => time(), 'answerNum' => 0);
                 pdo_update('fighting', $updateData2, array('id' => $isupdate['id']));
                 return $this->fightJson(3, '答题满了');
                 exit;
             } else {
                 return $this->fightJson(2, $question[answer]);
                 exit;
             }
         }
         //错误答案 回看答错的题目 $answer fighting_question_worng
         $insertworng = array('weid' => $_W['uniacid'], 'fightingid' => $isupdate['id'], 'wornganswer' => $answer ? $answer : '超时没选择答案', 'qname' => $question['question'], 'answer' => $question['answer'], 'optionA' => $question['optionA'], 'optionB' => $question['optionB'], 'optionC' => $question['optionC'], 'optionD' => $question['optionD'], 'optionE' => $question['optionE'], 'optionF' => $question['optionF']);
         pdo_insert('fighting_question_worng', $insertworng);
         return $this->fightJson(2, '答案错误');
         exit;
     }
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:89,代码来源:site.php

示例11: doMobileDH

 /**
  * author: 微赞科技
  * 兑换
  */
 public function doMobileDH()
 {
     global $_W, $_GPC;
     MonUtil::checkmobile();
     $rid = $_GPC['rid'];
     $egid = $_GPC['egid'];
     $dpassword = $_GPC['dpassword'];
     $record = DBUtil::findById(DBUtil::$TABLE_EGG_RECORD, $rid);
     $res = array();
     if (empty($record)) {
         $res['code'] = 500;
         $res['msg'] = "记录删除或不存在";
         die(json_encode($res));
     }
     $egg = DBUtil::findById(DBUtil::$TABLE_EGG, $egid);
     if ($record['status'] == self::$STATUS_DH) {
         $res['code'] = 500;
         $res['msg'] = "奖品已经兑换过";
         die(json_encode($res));
     }
     if ($egg['dpassword'] == $dpassword) {
         //密码正确
         $prize = DBUtil::findById(DBUtil::$TABLE_EGG_PRIZE, $record['pid']);
         if ($prize['ptype'] == 2) {
             //积分类型
             load()->model('mc');
             $uid = mc_openid2uid($this->getOpenId());
             $result = mc_credit_update($uid, 'credit1', $prize['jf'], array($uid, '砸金蛋手机端兑换积分'));
             if ($result) {
                 DBUtil::updateById(DBUtil::$TABLE_EGG_RECORD, array("status" => self::$STATUS_DH, 'dhtime' => TIMESTAMP), $rid);
                 $res['code'] = 200;
                 die(json_encode($res));
             } else {
                 $res['code'] = 500;
                 $res['msg'] = "兑换失败";
                 die(json_encode($res));
             }
         } else {
             DBUtil::updateById(DBUtil::$TABLE_EGG_RECORD, array("status" => self::$STATUS_DH, 'dhtime' => TIMESTAMP), $rid);
             $res['code'] = 200;
             die(json_encode($res));
         }
     } else {
         $res['code'] = 500;
         $res['msg'] = "密码错误";
         die(json_encode($res));
     }
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:52,代码来源:site.php

示例12: mc_fetch

function mc_fetch($uid, $fields = array())
{
    global $_W;
    $uid = mc_openid2uid($uid);
    if (empty($uid)) {
        return array();
    }
    $struct = (array) cache_load('usersfields');
    if (empty($fields)) {
        $select = '*';
    } else {
        foreach ($fields as $field) {
            if (!in_array($field, $struct)) {
                unset($fields[$field]);
            }
            if ($field == 'birth') {
                $fields[] = 'birthyear';
                $fields[] = 'birthmonth';
                $fields[] = 'birthday';
            }
            if ($field == 'reside') {
                $fields[] = 'resideprovince';
                $fields[] = 'residecity';
                $fields[] = 'residedist';
            }
        }
        unset($fields['birth'], $fields['reside']);
        $select = '`uid`, `' . implode('`,`', $fields) . '`';
    }
    if (is_array($uid)) {
        $result = pdo_fetchall("SELECT {$select} FROM " . tablename('mc_members') . " WHERE uid IN ('" . implode("','", is_array($uid) ? $uid : array($uid)) . "')", array(), 'uid');
        foreach ($result as &$row) {
            if (isset($row['avatar']) && !empty($row['avatar'])) {
                $row['avatar'] = tomedia($row['avatar']);
            }
        }
    } else {
        $result = pdo_fetch("SELECT {$select} FROM " . tablename('mc_members') . " WHERE `uid` = :uid", array(':uid' => $uid));
        if (isset($result['avatar']) && !empty($result['avatar'])) {
            $result['avatar'] = tomedia($result['avatar']);
        }
    }
    return $result;
}
开发者ID:wisemyth,项目名称:weizan,代码行数:44,代码来源:mc.mod.php

示例13: payResult

 public function payResult($params)
 {
     global $_W;
     load()->model('mc');
     $order = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE tid = :tid", array(':tid' => $params['tid']));
     if (empty($order['status'])) {
         $fee = $params['fee'];
         $total_fee = $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') {
             $paydata = array('wechat' => '微信', 'alipay' => '支付宝', 'baifubao' => '百付宝', 'unionpay' => '银联');
             if (empty($order['type']) || $order['type'] == 'credit') {
                 $setting = uni_setting($_W['uniacid'], array('creditbehaviors', 'recharge'));
                 $credit = $setting['creditbehaviors']['currency'];
                 if (empty($credit)) {
                     message('站点积分行为参数配置错误,请联系服务商', '', 'error');
                 } else {
                     $recharge = $setting['recharge'];
                     $add_fee = 0;
                     if (!empty($recharge)) {
                         $back = -1;
                         foreach ($recharge as $k => $li) {
                             if ($li['recharge'] <= $fee) {
                                 $back = $k;
                             }
                         }
                         if (!empty($recharge[$back])) {
                             $add_fee = $recharge[$back]['back'];
                             $total_fee = $add_fee + $fee;
                             $add_str = ",满足 充{$recharge[$back]['recharge']}返{$recharge[$back]['back']},返余额{$recharge[$back]['back']}元,本次操作共增加余额{$total_fee}元";
                         }
                     }
                     $record[] = $params['user'];
                     $record[] = '用户通过' . $paydata[$params['type']] . '充值' . $fee . $add_str;
                     mc_credit_update($order['uid'], $credit, $total_fee, $record);
                     $remark = '用户通过' . $paydata[$params['type']] . '充值' . $fee . $add_str;
                     mc_notice_recharge($order['openid'], $order['uid'], $total_fee, '', $remark);
                 }
             }
             if ($order['type'] == 'card_nums') {
                 $member_card = pdo_get('mc_card_members', array('uniacid' => $order['uniacid'], 'uid' => $order['uid']));
                 $total_num = $member_card['nums'] + $order['tag'];
                 pdo_update('mc_card_members', array('nums' => $total_num), array('uniacid' => $order['uniacid'], 'uid' => $order['uid']));
                 $log = array('uniacid' => $order['uniacid'], 'uid' => $order['uid'], 'type' => 'nums', 'fee' => $params['fee'], 'model' => '1', 'tag' => $order['tag'], 'note' => date('Y-m-d H:i') . "通过{$paydata[$params['type']]}充值{$params['fee']}元,返{$order['tag']}次,总共剩余{$total_num}次", 'addtime' => TIMESTAMP);
                 pdo_insert('mc_card_record', $log);
                 $type = pdo_fetchcolumn('SELECT nums_text FROM ' . tablename('mc_card') . ' WHERE uniacid = :uniacid', array(':uniacid' => $order['uniacid']));
                 $total_num = $member_card['nums'] + $order['tag'];
                 mc_notice_nums_plus($order['openid'], $type, $order['tag'], $total_num);
             }
             if ($order['type'] == 'card_times') {
                 $member_card = pdo_get('mc_card_members', array('uniacid' => $order['uniacid'], 'uid' => $order['uid']));
                 if ($member_card['endtime'] > TIMESTAMP) {
                     $endtime = $member_card['endtime'] + $order['tag'] * 86400;
                 } else {
                     $endtime = strtotime($order['tag'] . 'days');
                 }
                 pdo_update('mc_card_members', array('endtime' => $endtime), array('uniacid' => $order['uniacid'], 'uid' => $order['uid']));
                 $log = array('uniacid' => $order['uniacid'], 'uid' => $order['uid'], 'type' => 'times', 'model' => '1', 'fee' => $params['fee'], 'tag' => $order['tag'], 'note' => date('Y-m-d H:i') . "通过{$paydata[$params['type']]}充值{$params['fee']}元,返{$order['tag']}天,充值后到期时间:" . date('Y-m-d', $endtime), 'addtime' => TIMESTAMP);
                 pdo_insert('mc_card_record', $log);
                 $type = pdo_fetchcolumn('SELECT times_text FROM ' . tablename('mc_card') . ' WHERE uniacid = :uniacid', array(':uniacid' => $order['uniacid']));
                 $endtime = date('Y-m-d', $endtime);
                 mc_notice_times_plus($order['openid'], $member_card['cardsn'], $type, $fee, $order['tag'], $endtime);
             }
         }
     }
     if ($order['type'] == 'credit' || $order['type'] == '') {
         $url = murl('mc/home');
     } else {
         $url = murl('mc/bond/mycard');
     }
     if ($params['from'] == 'return') {
         if ($params['result'] == 'success') {
             message('支付成功!', '../../app/' . $url, 'success');
         } else {
             message('支付失败!', '../../app/' . $url, 'error');
         }
     }
 }
开发者ID:noikiy,项目名称:mygit,代码行数:83,代码来源:site.php

示例14: setOrderCredit

 public function setOrderCredit($orderid, $add = true)
 {
     global $_W;
     $order = pdo_fetch("SELECT * FROM " . tablename('shopping_order') . " WHERE id = :id limit 1", array(':id' => $orderid));
     if (empty($order)) {
         return false;
     }
     $sql = 'SELECT `goodsid`, `total` FROM ' . tablename('shopping_order_goods') . ' WHERE `orderid` = :orderid';
     $orderGoods = pdo_fetchall($sql, array(':orderid' => $orderid));
     if (!empty($orderGoods)) {
         $credit = 0.0;
         $sql = 'SELECT `credit` FROM ' . tablename('shopping_goods') . ' WHERE `id` = :id';
         foreach ($orderGoods as $goods) {
             $goodsCredit = pdo_fetchcolumn($sql, array(':id' => $goods['goodsid']));
             $credit += $goodsCredit * floatval($goods['total']);
         }
     }
     //增加积分
     if (!empty($credit)) {
         load()->model('mc');
         load()->func('compat.biz');
         $uid = mc_openid2uid($order['from_user']);
         $fans = fans_search($uid, array("credit1"));
         if (!empty($fans)) {
             if (!empty($add)) {
                 mc_credit_update($_W['member']['uid'], 'credit1', $credit, array('0' => $_W['member']['uid'], '购买商品赠送'));
             } else {
                 mc_credit_update($_W['member']['uid'], 'credit1', 0 - $credit, array('0' => $_W['member']['uid'], '微商城操作'));
             }
         }
     }
 }
开发者ID:noikiy,项目名称:mygit,代码行数:32,代码来源:site.php

示例15: doMobileGetAward

 public function doMobileGetAward()
 {
     global $_GPC, $_W;
     if (empty($_W['fans']['from_user'])) {
         message('非法访问,请重新发送消息进入砸蛋页面!');
     }
     $fromuser = $_W['fans']['from_user'];
     $id = intval($_GPC['id']);
     $egg = pdo_fetch("SELECT id, periodlottery, maxlottery, default_tips, misscredit, hitcredit FROM " . tablename('egg_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($egg)) {
         message('非法访问,请重新发送消息进入砸蛋页面!');
     }
     $result = array('status' => -1, 'message' => '');
     if (!empty($egg['periodlottery'])) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('egg_winner') . " WHERE createtime > '" . (strtotime(date('Y-m-d')) - 86400 * $egg['periodlottery']) . "' AND from_user = '{$fromuser}' AND status <> 3 AND rid = '{$id}'");
         $lastdate = pdo_fetchcolumn("SELECT createtime FROM " . tablename('egg_winner') . " WHERE from_user = '{$fromuser}' AND status <> 3 ORDER BY createtime DESC");
         if ($total >= intval($egg['maxlottery']) && strtotime(date('Y-m-d')) < strtotime(date('Y-m-d', $lastdate)) + $egg['periodlottery'] * 86400) {
             $result['message'] = '您还未到达可以再次砸蛋的时间。下次可砸时间为' . date('Y-m-d', strtotime(date('Y-m-d', $lastdate)) + $egg['periodlottery'] * 86400);
             message($result, '', 'ajax');
         }
     } else {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('egg_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '{$fromuser}' AND status <> 3");
         if (!empty($egg['maxlottery']) && $total >= $egg['maxlottery']) {
             $result['message'] = $egg['periodlottery'] ? '您已经超过当日砸蛋次数' : '您已经超过最大砸蛋次数';
             message($result, '', 'ajax');
         }
     }
     $gifts = pdo_fetchall("SELECT id, probalilty,inkind,total FROM " . tablename('egg_award') . " WHERE rid = '{$id}' ORDER BY probalilty ASC");
     //计算每个礼物的概率
     $probability = 0;
     $rate = 1;
     $award = array();
     $awardids = array();
     //奖品ID (同时可中多个奖品,然后随机派奖)
     foreach ($gifts as $name => $gift) {
         if (empty($gift['probalilty'])) {
             continue;
         }
         $probability = $gift['probalilty'];
         if ($probability < 1) {
             $temp = explode('.', $probability);
             $temp = pow(10, strlen($temp[1]));
             $rate = $temp < $rate ? $rate : $temp;
             $probability = $probability * $rate;
         }
         $award[] = array('id' => $gift['id'], 'probalilty' => $probability, 'inkind' => $gift['inkind'], 'total' => $gift['total']);
     }
     $all = 100 * $rate;
     mt_srand((double) microtime() * 1000000);
     $rand = mt_rand(1, $all);
     foreach ($award as $gift) {
         if ($rand > 0 && $rand <= $gift['probalilty'] && $gift['total'] > 0) {
             // $awardid = $gift['id'];
             //break;
             //只要符合概率,都算中奖品,然后从奖品中随机
             $awardids[] = $gift['id'];
         }
     }
     if (count($awardids) > 0) {
         mt_srand((double) microtime() * 1000000);
         $randid = mt_rand(0, count($awardids) - 1);
         $awardid = $awardids[$randid];
     }
     $title = '';
     $result['message'] = empty($egg['default_tips']) ? '很遗憾,您没能中奖!' : $egg['default_tips'];
     $data = array('rid' => $id, 'from_user' => $fromuser, 'status' => 0, 'createtime' => TIMESTAMP);
     $credit = array('rid' => $id, 'award' => (empty($awardid) ? '未中' : '中') . '奖奖励积分', 'from_user' => $fromuser, 'status' => 3, 'description' => empty($awardid) ? $egg['misscredit'] : $egg['hitcredit'], 'createtime' => TIMESTAMP);
     if (!empty($awardid)) {
         $gift = pdo_fetch("SELECT * FROM " . tablename('egg_award') . " WHERE rid = '{$id}' AND id = '{$awardid}'");
         if ($gift['total'] > 0) {
             $data['award'] = $gift['title'];
             if (!empty($gift['inkind'])) {
                 $data['description'] = $gift['description'];
                 pdo_query("UPDATE " . tablename('egg_award') . " SET total = total - 1 WHERE rid = '{$id}' AND id = '{$awardid}'");
             } else {
                 $gift['activation_code'] = iunserializer($gift['activation_code']);
                 $code = array_pop($gift['activation_code']);
                 pdo_query("UPDATE " . tablename('egg_award') . " SET total = total - 1, activation_code = '" . iserializer($gift['activation_code']) . "' WHERE rid = '{$id}' AND id = '{$awardid}'");
                 $data['description'] = '兑换码:' . $code . '<br /> 兑换地址:' . $gift['activation_url'];
             }
             $result['message'] = '恭喜您,得到“' . $data['award'] . '”!';
             $result['status'] = 0;
         } else {
             $credit['description'] = $egg['misscredit'];
             $credit['award'] = '未中奖奖励积分';
         }
     }
     !empty($credit['description']) && ($result['message'] .= '<br />' . $credit['award'] . ':' . $credit['description']);
     $data['aid'] = $gift['id'];
     if (empty($awardid)) {
         $value = intval($egg['misscredit']);
         $uid = mc_openid2uid($fromuser);
         mc_credit_update($uid, 'credit1', $value, array(0, '使用砸蛋模块未中奖,赠送' . $value . '积分'));
     } else {
         $value = intval($egg['hitcredit']);
         $uid = mc_openid2uid($fromuser);
         mc_credit_update($uid, 'credit1', $value, array(0, '使用砸蛋模块中奖,赠送' . $value . '积分'));
     }
     if (!empty($credit['description'])) {
         pdo_insert('egg_winner', $credit);
//.........这里部分代码省略.........
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:101,代码来源:site.php


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