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


PHP mc_credit_update函数代码示例

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


在下文中一共展示了mc_credit_update函数的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: 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

示例3: updateUserScore

 public function updateUserScore($score, $openid, $log = '')
 {
     load()->model('mc');
     $uid = mc_openid2uid($openid);
     $log_arr = array();
     $log_arr[0] = $uid;
     $log_arr[1] = $log == '' ? '未记录' : $log;
     mc_credit_update($uid, 'credit1', $score, $log_arr);
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:9,代码来源:FlashUserService.php

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

示例5: doMobileShow

 public function doMobileShow()
 {
     global $_W, $_GPC;
     $rid = trim($_GPC['rid']);
     $reply = pdo_fetch("SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     if (time() > strtotime($reply['endtime'])) {
         if (empty($reply['memo2'])) {
             $msg = '对不起,活动已经于' . $reply['endtime'] . '结束,感谢您的参与!!!';
         } else {
             $msg = $reply['memo2'];
         }
         message($msg, $reply['url2'], 'success');
     }
     if (time() < strtotime($reply['starttime'])) {
         if (empty($reply['memo1'])) {
             $msg = '对不起,活动将于' . $reply['starttime'] . '开始,敬请期待!!!';
         } else {
             $msg = $reply['memo1'];
         }
         message($msg, $reply['url1'], 'success');
     }
     if (empty($_W['fans']['nickname'])) {
         mc_oauth_userinfo();
     }
     if ($reply['pictype'] == 1) {
         if (empty($_W['fans']['follow']) || $_W['fans']['follow'] == 0) {
             header("Location: " . $reply['urlx']);
             exit;
         }
     }
     $op = trim($_GPC['op']);
     $qrmoney = $_GPC['qrmoney'];
     $from_user = $_W['fans']['openid'];
     $qrpicurl = $_W['attachurl'] . $reply['qrcode'];
     if ($op == 'post') {
         if ($qrmoney < 0.01) {
             message('支付金额错误,请重新录入!', $this->createMobileUrl('show', array('rid' => $rid, 'from_user' => $from_user)), 'error');
         }
         $data = array('rid' => $rid, 'dateline' => TIMESTAMP, 'clientOrderId' => TIMESTAMP, 'qrmoney' => $qrmoney, 'status' => 0, 'fromuser' => $from_user, 'username' => $_W['fans']['nickname'], 'avatar' => $_W['fans']['tag']['avatar'], 'credit' => $reply['n']);
         pdo_insert('bm_qrsign_payed', $data);
         $params = array('tid' => $data['clientOrderId'], 'ordersn' => $data['clientOrderId'], 'title' => '扫码支付', 'fee' => $data['qrmoney'], 'user' => $from_user);
         $this->pay($params);
         exit;
     } else {
         if ($op == 'sign') {
             $rec = pdo_fetch("select * from " . tablename('bm_qrsign_record') . " where rid= " . $rid . " and fromuser= '{$from_user}' order by sign_time desc");
             if (!empty($rec)) {
                 $Date_1 = date("Y-m-d", time());
                 $Date_2 = date("Y-m-d", $rec['sign_time']);
                 $Date_List_a1 = explode("-", $Date_1);
                 $Date_List_a2 = explode("-", $Date_2);
                 $d1 = mktime(0, 0, 0, $Date_List_a1[1], $Date_List_a1[2], $Date_List_a1[0]);
                 $d2 = mktime(0, 0, 0, $Date_List_a2[1], $Date_List_a2[2], $Date_List_a2[0]);
                 $Days = round(($d1 - $d2) / 3600 / 24);
                 if ($Days == 0) {
                     $msg = '感谢您的参与,每个人每天只可以签到一次哦!!!';
                     message($msg, $reply['urly'], 'success');
                 }
             }
             $insert = array('rid' => $rid, 'fromuser' => $from_user, 'username' => $_W['fans']['nickname'], 'avatar' => $_W['fans']['tag']['avatar'], 'sign_time' => $_W['timestamp'], 'credit' => $reply['n']);
             pdo_insert('bm_qrsign_record', $insert);
             $user = fans_search($from_user);
             $sql_member = "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}'";
             $uid = pdo_fetchcolumn($sql_member);
             mc_credit_update($uid, 'credit1', intval($reply['n']), array(0 => 'system', 1 => '扫码签到送积分'));
             $user = fans_search($from_user);
             $msg = '恭喜签到成功,您已获得奖励积分' . $reply['n'] . '分,您目前的总积分为' . $user['credit1'] . '分!';
             message($msg, $reply['urly'], 'success');
         }
     }
     include $this->template('show');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:72,代码来源:site.php

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

示例7: sysAddCredit

 private function sysAddCredit($from_user, $credit_value, $credittype, $tag)
 {
     global $_GPC;
     load()->model('mc');
     $uid = mc_openid2uid($from_user);
     mc_credit_update($uid, 'credit' . $credittype, $credit_value, array($uid, $tag));
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:7,代码来源:fans.class.inc.php

示例8: pdo_fetchcolumn

        $is_add = pdo_fetchcolumn($sql, $parm);
        if (empty($is_add)) {
            $creditbehaviors = pdo_fetchcolumn('SELECT creditbehaviors FROM ' . tablename('uni_settings') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid']));
            $creditbehaviors = iunserializer($creditbehaviors) ? iunserializer($creditbehaviors) : array();
            if (empty($creditbehaviors['activity'])) {
                $ret['result'] = 'creditset-miss';
                moduleInit($_GPC['module'], $ret);
            } else {
                $credittype = $creditbehaviors['activity'];
            }
            $data = array('uniacid' => $_W['uniacid'], 'touid' => $uid, 'fromuid' => 0, 'module' => $_GPC['module'], 'sign' => $_GPC['sign'], 'action' => $_GPC['action'], 'credit_value' => intval($return['credit_value']), 'createtime' => TIMESTAMP);
            pdo_insert('mc_handsel', $data);
            $note = empty($_GPC['note']) ? '系统赠送积分' : $_GPC['note'];
            $log = array('uid' => $uid, 'credittype' => $credittype, 'uniacid' => $_W['uniacid'], 'num' => intval($return['credit_value']), 'createtime' => TIMESTAMP, 'operator' => 0, 'remark' => $note);
            $credit_value = intval($return['credit_value']);
            mc_credit_update($uid, $credittype, $credit_value, $log);
            $ret['result'] = 'success';
            moduleInit($_GPC['module'], $ret);
        } else {
            $ret['result'] = 'repeat';
            moduleInit($_GPC['module'], $ret);
        }
    } else {
        $ret['result'] = 'action-miss';
        moduleInit($_GPC['module'], $ret);
    }
} else {
    $ret['result'] = 'uid-miss';
    moduleInit($_GPC['module'], $ret);
}
function moduleInit($name, $params = array())
开发者ID:6662680,项目名称:qday_wx,代码行数:31,代码来源:share.ctrl.php

示例9: doMobileGetAward

    public function doMobileGetAward()
    {
        global $_GPC, $_W;
        if (empty($_W['fans']['from_user']) || empty($_W['member']['uid'])) {
            message('非法访问,请重新发送消息进入砸蛋页面!');
        }
        checkauth();
        $fromuser = $_W['fans']['from_user'];
        $uid = intval($_W['member']['uid']);
        $id = intval($_GPC['id']);
        $sql = 'SELECT `id`, `periodlottery`, `maxlottery`, `default_tips`, `misscredit`, `hitcredit` FROM ' . tablename('egg_reply') . ' WHERE `rid` = :rid';
        $params = array(':rid' => $id);
        $egg = pdo_fetch($sql, $params);
        if (empty($egg)) {
            message('非法访问,请重新发送消息进入砸蛋页面!');
        }
        $result = array('status' => -1, 'message' => '');
        $sql = 'SELECT COUNT(*) FROM ' . tablename('egg_winner') . ' WHERE `rid` = :rid AND `uid` = :uid';
        $params[':uid'] = $uid;
        if (empty($egg['periodlottery'])) {
            $total = pdo_fetchcolumn($sql, $params);
            if ($total >= $egg['maxlottery']) {
                $result['message'] = '您已经超过最大砸蛋次数';
                message($result, '', 'ajax');
            }
        } else {
            $sql .= ' AND `createtime` > :createtime';
            $params[':createtime'] = strtotime(date('Y-m-d')) - 86400 * $egg['periodlottery'];
            $total = pdo_fetchcolumn($sql, $params);
            if ($total >= $egg['maxlottery']) {
                $sql = 'SELECT `createtime` FROM ' . tablename('egg_winner') . ' WHERE `rid` = :rid AND `uid` = :uid
						ORDER BY `createtime` DESC';
                $lastdate = pdo_fetchcolumn($sql, array(':rid' => $id, ':uid' => $uid));
                $result['message'] = '您还未到达可以再次砸蛋的时间。下次可砸时间为' . date('Y-m-d', strtotime(date('Y-m-d', $lastdate)) + $egg['periodlottery'] * 86400);
                message($result, '', 'ajax');
            }
        }
        $sql = 'SELECT * FROM ' . tablename('egg_award') . ' WHERE `rid` = :rid ORDER BY `probalilty`';
        $gifts = pdo_fetchall($sql, array(':rid' => $id));
        $awards = array();
        foreach ($gifts as $key => $gift) {
            if (empty($gift['total']) || empty($gift['probalilty'])) {
                unset($gifts[$key]);
                continue;
            }
            $gifts[$key]['random'] = mt_rand(1, 100 / $gift['probalilty']);
            if (mt_rand(1, 100 / $gift['probalilty']) == mt_rand(1, 100 / $gift['probalilty'])) {
                $awards[] = $gift;
            }
        }
        if (count($awards) > 0) {
            $randid = mt_rand(0, count($awards) - 1);
            $awardid = $awards[$randid];
        }
        $result['message'] = empty($egg['default_tips']) ? '很遗憾,您没能中奖!' : $egg['default_tips'];
        $credit = array('rid' => $id, 'uniacid' => $_W['uniacid'], 'uid' => $uid, 'from_user' => $fromuser, 'isaward' => empty($awardid) ? 0 : 1, 'award' => (empty($awardid) ? '未中' : '中') . '奖奖励积分', 'description' => empty($awardid) ? $egg['misscredit'] : $egg['hitcredit'], 'credit' => empty($awardid) ? $egg['misscredit'] : $egg['hitcredit'], 'createtime' => strtotime(date('Y-m-d H:i:s')), 'status' => 2);
        if (!empty($awardid)) {
            $sql = 'SELECT * FROM ' . tablename('egg_award') . ' WHERE `rid` = :rid AND `id` = :id';
            $params = array(':rid' => $id, ':id' => $awardid['id']);
            $gift = pdo_fetch($sql, $params);
            if ($gift['total'] > 0) {
                $credit['status'] = 0;
                $credit['award'] = $gift['title'];
                if (!empty($gift['inkind'])) {
                    $credit['description'] = $gift['description'];
                    $sql = 'UPDATE ' . tablename('egg_award') . ' SET `total` = `total` - 1 WHERE `rid` = :rid AND `id` = :id';
                    pdo_query($sql, $params);
                } else {
                    $gift['activation_code'] = (array) iunserializer($gift['activation_code']);
                    $code = array_pop($gift['activation_code']);
                    $activation_code = iserializer($gift['activation_code']);
                    $sql = 'UPDATE ' . tablename('egg_award') . " SET `total` = `total` - 1, `activation_code` = '" . $activation_code . "' WHERE `rid` = :rid AND `id` = :id";
                    pdo_query($sql, $params);
                    $credit['description'] = '兑换码:' . $code . '<br /> 兑换地址:' . $gift['activation_url'];
                }
                $result['message'] = '恭喜您,得到“' . $gift['title'] . '”!';
                $result['status'] = 0;
            } else {
                $credit['description'] = $egg['misscredit'];
                $credit['award'] = '未中奖奖励积分';
            }
        }
        !empty($credit['description']) && ($result['message'] .= '<br />' . $credit['award'] . ':' . $credit['description']);
        $credit['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 . '积分'));
        }
        pdo_insert('egg_winner', $credit);
        $result['myaward'] = pdo_fetchall("SELECT award, description FROM " . tablename('egg_winner') . " WHERE uid = '{$uid}' AND award <> '' AND rid = '{$id}' ORDER BY createtime DESC");
        message($result, '', 'ajax');
    }
开发者ID:aspnmy,项目名称:weizan,代码行数:97,代码来源:site.php

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

示例11: doMobileget_award

 public function doMobileget_award()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     $fansID = $_W['member']['uid'];
     $from_user = $_W['fans']['from_user'];
     $uniacid = $_W['uniacid'];
     $profile = mc_fetch($fansID, array('avatar', 'nickname', 'realname', 'mobile', 'qq', 'email', 'address', 'gender', 'telephone', 'idcard', 'company', 'occupation', 'position'));
     if (empty($profile['avatar'])) {
         $profile['avatar'] = '../addons/stonefish_redenvelope/template/images/avatar.jpg';
     }
     if (empty($profile['nickname'])) {
         $profile['nickname'] = $_GPC['realname'];
     }
     $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_redenvelope_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     if ($reply == false) {
         $this->message(array("success" => 2, "msg" => '规则出错!...'), "");
     }
     if ($reply['isshow'] != 1) {
         //活动已经暂停,请稍后...
         $this->message(array("success" => 2, "msg" => '活动暂停,请稍后...'), "");
     }
     if ($reply['starttime'] > time()) {
         $this->message(array("success" => 2, "msg" => '活动还没有开始呢,请等待...'), "");
     }
     if ($reply['endtime'] < time()) {
         $this->message(array("success" => 2, "msg" => '活动已经结束了,下次再来吧!'), "");
     }
     if (empty($_W['fans'])) {
         $this->message(array("success" => 2, "msg" => '请先关注公共账号再来参与活动!详情请查看规则!'), "");
     }
     //先判断有没有资格领取
     //判断是否为关注用户
     $follow = pdo_fetchcolumn("SELECT follow FROM " . tablename('mc_mapping_fans') . " Where openid=:openid and uniacid=:uniacid ORDER BY `fanid` DESC", array(":openid" => $from_user, ":uniacid" => $uniacid));
     if ($follow == 0) {
         $this->message(array("success" => 2, "msg" => '请先关注公共账号再来参与活动!详情请查看规则!'), "");
     }
     //判断是否为关注用户
     //查询是活动定义还是商户赠送
     if ($reply['opportunity'] == 1) {
         if (empty($profile['mobile'])) {
             $this->message(array("success" => 2, "msg" => '您没有注册成为会员,不能刮奖!'), "");
         }
         $doings = pdo_fetch("SELECT * FROM " . tablename('stonefish_branch_doings') . " WHERE rid = " . $rid . " and mobile='" . $profile['mobile'] . "' and uniacid='" . $uniacid . "'");
         if (!empty($doings)) {
             if ($doings['status'] < 2) {
                 $this->message(array("success" => 2, "msg" => '抱歉,您的领取红包资格正在审核中!'), "");
             } else {
                 if ($doings['awardcount'] == 0) {
                     $this->message(array("success" => 2, "msg" => '抱歉,您的领取红包资格已用完了!'), "");
                 }
             }
         } else {
             $this->message(array("success" => 2, "msg" => '抱歉,您还没有获取领取红包资格,不能领取!'), "");
         }
     } elseif ($reply['opportunity'] == 2) {
         load()->model('account');
         $unisettings = uni_setting($uniacid, array('creditnames'));
         foreach ($unisettings['creditnames'] as $key => $credits) {
             if ($reply['credit_type'] == $key) {
                 $creditnames = $credits['title'];
                 break;
             }
         }
         $credit = mc_credit_fetch($fansID, array($reply['credit_type']));
         $credit_times = intval($credit[$reply['credit_type']] / $reply['credit_times']);
         if ($credit_times < 1) {
             $this->message(array("success" => 2, "msg" => '抱歉,您没有' . $creditnames . '兑换红包了!'), "");
         }
     }
     //查询是活动定义还是商户赠送
     //是否已关联用户,如果中能中奖一次,判断是否已中奖
     $fans = pdo_fetch("SELECT * FROM " . tablename('stonefish_redenvelope_fans') . " WHERE rid = " . $rid . " and fansID=" . $fansID . " and from_user='" . $from_user . "'");
     if ($fans == false) {
         $inpoint = mt_rand($reply['inpointstart'] * 100, $reply['inpointend'] * 100) / 100;
         $inpoint = sprintf("%.2f", $inpoint);
         $fans = array('rid' => $rid, 'uniacid' => $uniacid, 'fansID' => $fansID, 'from_user' => $from_user, 'inpoint' => $inpoint, 'avatar' => $profile['avatar'], 'nickname' => $profile['nickname'], 'createtime' => time());
         pdo_insert('stonefish_redenvelope_fans', $fans);
         $fans['id'] = pdo_insertid();
         //自动读取会员信息存入FANS表中
         $ziduan = array('realname', 'mobile', 'qq', 'email', 'address', 'gender', 'telephone', 'idcard', 'company', 'occupation', 'position');
         load()->model('mc');
         foreach ($ziduan as $ziduans) {
             if ($reply['is' . $ziduans]) {
                 if (!empty($_GPC[$ziduans])) {
                     pdo_update('stonefish_redenvelope_fans', array($ziduans => $_GPC[$ziduans]), array('id' => $fans['id']));
                     if ($reply['isfans']) {
                         mc_update($fansID, array($ziduans => $_GPC[$ziduans]));
                     }
                 }
             }
         }
         //自动读取会员信息存入FANS表中
         //增加人数,和浏览次数
         pdo_update('stonefish_redenvelope_reply', array('fansnum' => $reply['fansnum'] + 1, 'viewnum' => $reply['viewnum'] + 1), array('id' => $reply['id']));
         //商家赠送增加使用次数
         if ($reply['opportunity'] == 1) {
             pdo_update('stonefish_branch_doings', array('usecount' => 0, 'usetime' => time()), array('id' => $doings['id']));
         } elseif ($reply['opportunity'] == 2) {
             mc_credit_update($fansID, $reply['credit_type'], -$reply['credit_times'], array($fansID, '兑换幸运抢红包活动消耗:' . $reply['credit_times'] . '个' . $creditnames));
//.........这里部分代码省略.........
开发者ID:6662680,项目名称:qday_wx,代码行数:101,代码来源:site.php

示例12: activity_shipping_grant

    $ret = activity_shipping_grant($uid, $exid);
    if (is_error($ret)) {
        message($ret['message']);
    }
    $member = mc_fetch($uid, array('uid', 'realname', $exchange['credittype'], 'resideprovince', 'residecity', 'residedist', 'address', 'zipcode', 'mobile'));
    if ($member[$exchange['credittype']] < $exchange['credit']) {
        message($creditnames[$exchange['credittype']] . '数量不够,无法兑换.');
    }
    $shipping = array('exid' => $exid, 'uniacid' => $uniacid, 'uid' => $uid, 'realname' => $member['realname'], 'mobile' => $member['mobile'], 'province' => $member['resideprovince'], 'city' => $member['residecity'], 'district' => $member['residedist'], 'address' => $member['address'], 'zipcode' => $member['zipcode']);
    if (checksubmit('submit')) {
        $data = array('uniacid' => $_W['uniacid'], 'exid' => $exid, 'uid' => $uid, 'status' => 0, 'createtime' => time(), 'name' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'province' => $_GPC['reside']['province'], 'city' => $_GPC['reside']['city'], 'district' => $_GPC['reside']['district'], 'address' => $_GPC['address'], 'zipcode' => $_GPC['zipcode']);
        $trade_log = array('uniacid' => $_W['uniacid'], 'uid' => $uid, 'exid' => $exid, 'type' => 3, 'createtime' => time(), 'extra' => iserializer($exchange));
        pdo_insert('activity_exchange_trades', $trade_log);
        pdo_insert('activity_exchange_trades_shipping', $data);
        pdo_update('activity_exchange', array('num' => $exchange['num'] + 1), array('id' => $exchange['id'], 'uniacid' => $_W['uniacid']));
        mc_credit_update($uid, $exchange['credittype'], -1 * $exchange['credit'], array($uid, '礼品兑换:' . $exchange['title'] . ' 消耗 ' . $creditnames[$exchange['credittype']] . ':' . $exchange['credit']));
        message("兑换成功,您消费了 {$exchange['credit']} {$creditnames[$exchange['credittype']]}", url('activity/exchange/mine', array('type' => 3)));
    }
    template('activity/shipping');
} elseif ($do == 'mine') {
    $type = intval($_GPC['type']);
    $type = empty($type) ? 1 : $type;
    $type = in_array($type, array(1, 2, 3, 4, 5)) ? $type : 1;
    $page = intval($_GPC['__input']['page']);
    switch ($type) {
        case 1:
        case 2:
            break;
        case 3:
            $pindex = max(1, $page);
            $psize = 10;
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:31,代码来源:exchange.ctrl.php

示例13: doMobileCredit

 public function doMobileCredit()
 {
     global $_W, $_GPC;
     if (!$this->check_mc_follow()) {
         if (empty($_W['account']['subscribeurl'])) {
             $this->msg('error', '请关注本公众平台后再参与活动!');
         }
         $this->msg('redirect', $_W['account']['subscribeurl']);
     }
     checkauth();
     if (empty($_W['member']['mobile'])) {
         //如果未填写手机号码,跳转到会员中心
         $this->msg('uc', '<P>请先完善您的个人资料!</p><P><font color="red">注意</font>:姓名和手机号码必填。</p><P>个人资料是将来兑奖的依据。</p>');
     }
     //用户信息
     $member_info = pdo_fetch("SELECT * FROM " . tablename('mc_members') . " WHERE uid=" . $_W['member']['uid']);
     //活动信息
     $info = pdo_fetch("SELECT l.title as goods_title,l.info,l.price,l.thumb,d.*,r.title as rule_title,r.rule FROM " . tablename('zerobuy_detail') . " d left join " . tablename('zerobuy_list') . " l on d.lid=l.id left join " . tablename('zerobuy_rule') . " r on d.rid=r.id WHERE d.id=" . $_GPC['id']);
     if ($info['status'] == 1) {
         $this->msg('error', '活动还未开始,请耐心等待!');
     }
     if ($info['status'] == 3 || $info['status'] == 4) {
         $this->msg('error', '活动已经结束!');
     }
     $num = floor($member_info['credit1'] / $info['exchange']);
     if ($_GPC['act'] == 'exchange') {
         if ($num < 1) {
             $this->msg('error', '积分不足');
         }
         $msg = $this->make_code($_GPC['id']);
         //更行用户表
         load()->model('mc');
         mc_credit_update($_W['member']['uid'], 'credit1', -$info['exchange'], array($_W['member']['uid'], "参与零元购活动:" . $info['title']));
         $this->msg('success', $msg);
     }
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:36,代码来源:site.php

示例14: doMobileGetAward

 public function doMobileGetAward()
 {
     global $_GPC, $_W;
     checkauth();
     $fromuser = $_W['fans']['from_user'];
     $id = intval($_GPC['id']);
     $dqq = pdo_fetch("SELECT id, periodlottery, maxlottery, default_tips, misscredit, hitcredit FROM " . tablename('dqq_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($dqq)) {
         message('非法访问,请重新发送消息进入打气球页面!4');
     }
     $result = array('status' => -1, 'message' => '');
     if (!empty($dqq['periodlottery'])) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('dqq_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '{$fromuser}'  AND rid = '{$id}'");
         $lastdate = pdo_fetchcolumn("SELECT createtime FROM " . tablename('dqq_winner') . " WHERE from_user = '{$fromuser}'  ORDER BY createtime DESC");
         if ($total >= intval($dqq['maxlottery']) && strtotime(date('Y-m-d')) < strtotime(date('Y-m-d', $lastdate)) + $dqq['periodlottery'] * 86400) {
             $result['message'] = '没箭啦';
             message($result, '', 'ajax');
         }
     } else {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('dqq_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '{$fromuser}' ");
         if (!empty($dqq['maxlottery']) && $total >= $dqq['maxlottery']) {
             $result['message'] = '今天没箭了';
             message($result, '', 'ajax');
         }
     }
     $gifts = pdo_fetchall("SELECT id, probalilty FROM " . tablename('dqq_award') . " WHERE rid = '{$id}' ORDER BY probalilty ASC");
     //计算每个礼物的概率
     $probability = 0;
     $rate = 1;
     $award = array();
     foreach ($gifts as $name => $gift) {
         if (empty($gift['probalilty'])) {
             continue;
         }
         if ($gift['probalilty'] < 1) {
             $temp = explode('.', $gift['probalilty']);
             $temp = pow(10, strlen($temp[1]));
             $rate = $temp < $rate ? $rate : $temp;
         }
         $probability = $probability + $gift['probalilty'] * $rate;
         $award[] = array('id' => $gift['id'], 'probalilty' => $probability);
     }
     $all = 100 * $rate;
     if ($probability < $all) {
         $award[] = array('title' => '', 'probalilty' => $all);
     }
     mt_srand((double) microtime() * 1000000);
     $rand = mt_rand(1, $all);
     foreach ($award as $key => $gift) {
         if (isset($award[$key - 1])) {
             if ($rand > $award[$key - 1]['probalilty'] && $rand <= $gift['probalilty']) {
                 $awardid = $gift['id'];
                 break;
             }
         } else {
             if ($rand > 0 && $rand <= $gift['probalilty']) {
                 $awardid = $gift['id'];
                 break;
             }
         }
     }
     $result['message'] = '唉,没中';
     $data = array('rid' => $id, 'from_user' => $fromuser, 'status' => empty($gift['inkind']) ? 1 : 0, 'createtime' => TIMESTAMP);
     $credit = array('rid' => $id, 'award' => (empty($awardid) ? '未中' : '中') . '奖励积分', 'from_user' => $fromuser, 'status' => 3, 'description' => empty($awardid) ? $dqq['misscredit'] : $dqq['hitcredit'], 'createtime' => TIMESTAMP);
     if (!empty($awardid)) {
         $sql = 'SELECT * FROM ' . tablename('dqq_award') . ' WHERE `rid` = :rid AND `id` = :id';
         $params = array(':rid' => $id, ':id' => $awardid);
         $gift = pdo_fetch($sql, $params);
         if ($gift['total'] > 0) {
             $data['award'] = $gift['title'];
             $credit1 = intval($gift['get_jf']);
             load()->model('mc');
             mc_credit_update($_W['member']['uid'], "credit1", $credit1, null);
             $data['description'] = $gift['title'];
             $result['message'] = '' . $data['award'] . '!';
             $result['status'] = 0;
             pdo_update('dqq_award', array('total' => --$gift['total']), array('id' => $gift['id']));
         } else {
             $credit['description'] = $dqq['misscredit'];
             $credit['award'] = '未中奖励积分';
         }
     }
     !empty($credit['description']) && ($result['message'] .= '<br />' . $credit['award'] . ':' . $credit['description']);
     $data['aid'] = $gift['id'];
     if (!empty($credit['description'])) {
         pdo_insert('dqq_winner', $credit);
     }
     pdo_insert('dqq_winner', $data);
     message($result, '', 'ajax');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:90,代码来源:site.php

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


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