本文整理汇总了PHP中mc_credit_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP mc_credit_fetch函数的具体用法?PHP mc_credit_fetch怎么用?PHP mc_credit_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mc_credit_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchUserCredit
public function fetchUserCredit($openid)
{
load()->model('mc');
$uid = mc_openid2uid($openid);
$credits = mc_credit_fetch($uid);
return $credits;
}
示例2: 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;
}
示例3: doMobilePay
public function doMobilePay()
{
global $_W, $_GPC;
//验证用户登录状态,此处测试不做验证
checkauth();
$params['tid'] = date('YmdH');
$params['user'] = $_W['member']['uid'];
$params['fee'] = floatval($_GPC['price']);
$params['title'] = '测试支付公众号名称';
$params['ordersn'] = random(5, 1);
$params['virtual'] = false;
if (checksubmit('submit')) {
if ($_GPC['type'] == 'credit') {
$setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
$credtis = mc_credit_fetch($_W['member']['uid']);
//此处需要验证积分数量
if ($credtis[$setting['creditbehaviors']['currency']] < $params['fee']) {
message('抱歉,您帐户的余额不够支付该订单,请充值!', '', 'error');
}
}
} else {
$this->pay($params);
}
}
示例4: pdo_fetchcolumn
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime', array(':uniacid' => $_W['uniacid'], ':type' => 5, ':endtime' => TIMESTAMP));
$pindex = max(1, intval($_GPC['page']));
$psize = 10;
$lists = pdo_fetchall('SELECT id,title,extra,thumb,type,credittype,endtime,description,credit FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, array(':uniacid' => $_W['uniacid'], ':type' => 5, ':endtime' => TIMESTAMP));
foreach ($lists as &$li) {
$li['extra'] = iunserializer($li['extra']);
}
$pager = pagination($total, $pindex, $psize);
}
if ($do == 'post') {
$id = intval($_GPC['id']);
$partime = activity_exchange_info($id, $_W['uniacid']);
if (empty($partime)) {
message('没有指定的礼品兑换.');
}
$credit = mc_credit_fetch($_W['member']['uid'], array($partime['credittype']));
if ($credit[$partime['credittype']] < $partime['credit']) {
message('您的' . $creditnames[$partime['credittype']] . '数量不够,无法兑换.');
}
$ret = activity_module_grant($_W['member']['uid'], $id, 'system', '用户使用' . $partime['credit'] . $creditnames[$partime['credittype']] . '兑换');
if (is_error($ret)) {
message($ret['message']);
}
mc_credit_update($_W['member']['uid'], $partime['credittype'], -1 * $partime['credit'], array($_W['member']['uid'], '礼品兑换:' . $partime['title'] . ' 消耗 ' . $creditnames[$partime['credittype']] . ':' . $partime['credit']));
message("兑换成功,您消费了 {$partime['credit']} {$creditnames[$partime['credittype']]}", url('activity/partimes/mine'));
}
if ($do == 'mine') {
$psize = 10;
$pindex = max(1, intval($_GPC['page']));
$condition = '';
if (empty($_GPC['status']) || $_GPC['status'] == 1) {
示例5: pay
protected function pay($params = array(), $mine = array())
{
global $_W;
if (!$this->inMobile) {
message('支付功能只能在手机上使用');
}
if (empty($_W['member']['uid'])) {
checkauth();
}
$params['module'] = $this->module['name'];
$pars = array();
$pars[':uniacid'] = $_W['uniacid'];
$pars[':module'] = $params['module'];
$pars[':tid'] = $params['tid'];
if ($params['fee'] <= 0) {
$pars['from'] = 'return';
$pars['result'] = 'success';
$pars['type'] = 'alipay';
$pars['tid'] = $params['tid'];
$site = WeUtility::createModuleSite($pars[':module']);
$method = 'payResult';
if (method_exists($site, $method)) {
exit($site->{$method}($pars));
}
}
$sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid';
$log = pdo_fetch($sql, $pars);
if (!empty($log) && $log['status'] == '1') {
message('这个订单已经支付成功, 不需要重复支付.');
}
$setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors'));
if (!is_array($setting['payment'])) {
message('没有有效的支付方式, 请联系网站管理员.');
}
$pay = $setting['payment'];
if (!empty($pay['credit']['switch'])) {
$credtis = mc_credit_fetch($_W['member']['uid']);
}
$you = 0;
if ($pay['card']['switch'] == 2) {
if ($_W['card_permission'] == 1 && !empty($params['module'])) {
$cards = pdo_fetchall('SELECT a.id,a.card_id,a.cid,b.type,b.title,b.extra,b.is_display,b.status,b.date_info FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('coupon') . ' AS b ON a.cid = b.id WHERE a.acid = :acid AND a.module = :modu AND b.is_display = 1 AND b.status = 3 ORDER BY a.id DESC', array(':acid' => $_W['acid'], ':modu' => $params['module']));
$flag = 0;
if (!empty($cards)) {
foreach ($cards as $temp) {
$temp['date_info'] = iunserializer($temp['date_info']);
if ($temp['date_info']['time_type'] == 1) {
$starttime = strtotime($temp['date_info']['time_limit_start']);
$endtime = strtotime($temp['date_info']['time_limit_end']);
if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
continue;
} else {
$param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
$num = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
if ($num <= 0) {
continue;
} else {
$flag = 1;
$card = $temp;
break;
}
}
} else {
$deadline = intval($temp['date_info']['deadline']);
$limit = intval($temp['date_info']['limit']);
$param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
$record = pdo_fetchall('SELECT addtime,id,code FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
if (!empty($record)) {
foreach ($record as $li) {
$time = strtotime(date('Y-m-d', $li['addtime']));
$starttime = $time + $deadline * 86400;
$endtime = $time + $deadline * 86400 + $limit * 86400;
if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
continue;
} else {
$flag = 1;
$card = $temp;
break;
}
}
}
if ($flag) {
break;
}
}
}
}
if ($flag) {
if ($card['type'] == 'discount') {
$you = 1;
$card['fee'] = sprintf("%.2f", $params['fee'] * ($card['extra'] / 100));
} elseif ($card['type'] == 'cash') {
$cash = iunserializer($card['extra']);
if ($params['fee'] >= $cash['least_cost']) {
$you = 1;
$card['fee'] = sprintf("%.2f", $params['fee'] - $cash['reduce_cost']);
}
}
load()->classs('coupon');
$acc = new coupon($_W['acid']);
//.........这里部分代码省略.........
示例6: doMobileRegfans
public function doMobileRegfans()
{
global $_GPC, $_W;
$rid = intval($_GPC['rid']);
$from_user = authcode(base64_decode($_GPC['from_user']), 'DECODE');
$page_from_user = $_GPC['from_user'];
$uniacid = $_W['uniacid'];
//规则判断
$reply = pdo_fetch("select * FROM " . tablename('stonefish_bigwheel_reply') . " where rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
if ($reply == false) {
$this->json_encode(array("success" => 2, "msg" => '规则出错!...'));
}
if ($reply['isshow'] != 1) {
$this->json_encode(array("success" => 2, "msg" => '活动暂停,请稍后...'));
}
if ($reply['starttime'] > time()) {
$this->json_encode(array("success" => 2, "msg" => '活动还没有开始呢,请等待...'));
}
if ($reply['endtime'] < time()) {
$this->json_encode(array("success" => 2, "msg" => '活动已经结束了,下次再来吧!'));
}
if ($reply['power'] == 2 && intval($_W['fans']['follow']) != 0) {
$this->json_encode(array("success" => 2, "msg" => '请先关注公共账号再来参与活动!详情请查看规则!'));
}
//规则判断
//查询是活动定义还是商户赠送
$uid = pdo_fetchcolumn("select uid FROM " . tablename('mc_mapping_fans') . " where openid=:openid and uniacid=:uniacid", array(":openid" => $from_user, ":uniacid" => $uniacid));
$profile = mc_fetch($uid, array('avatar', 'nickname', 'realname', 'mobile', 'qq', 'email', 'address', 'gender', 'telephone', 'idcard', 'company', 'occupation', 'position'));
if ($reply['opportunity'] == 3) {
$doings = pdo_fetch("select * from " . tablename($reply['othermodule'] . '_prizeslist') . " where urlrid = " . $rid . " and prizetype='stonefish_bigwheel' and uniacid='" . $uniacid . "' and from_user='" . $from_user . "'");
if (!empty($doings)) {
if ($doings['usecount'] >= $doings['prizesnum']) {
$this->json_encode(array("success" => 2, "msg" => '抱歉,您的抽奖次数已用完了或没有获得抽奖次数!'));
}
} else {
$this->json_encode(array("success" => 2, "msg" => '抱歉,您的还未获得抽奖资格!'));
}
} elseif ($reply['opportunity'] == 1) {
if (empty($profile['mobile'])) {
$this->json_encode(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->json_encode(array("success" => 2, "msg" => '抱歉,您的资格正在审核中!'));
} else {
if ($doings['awardcount'] == 0) {
$this->json_encode(array("success" => 2, "msg" => '抱歉,您的资格已用完了!'));
}
}
} else {
$this->json_encode(array("success" => 2, "msg" => '抱歉,您还没有获取资格,不能参与!'));
}
} elseif ($reply['opportunity'] == 2) {
$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($uid, array($reply['credit_type']));
$credit_value = intval($credit[$reply['credit_type']] / $reply['credit_value']);
if ($credit_value < 1) {
$this->json_encode(array("success" => 2, "msg" => '抱歉,您没有' . $creditnames . '兑换参与资格了!'));
}
}
//查询是活动定义还是商户赠送
//判断是否参与过
$fans = pdo_fetch("select * from " . tablename('stonefish_bigwheel_fans') . " where rid = :rid and uniacid = :uniacid and from_user= :from_user", array(':rid' => $rid, ':uniacid' => $uniacid, ':from_user' => $from_user));
if (!empty($fans)) {
$this->json_encode(array("success" => 2, "msg" => '已参与过本活动,请勿重复参与!'));
} else {
$fansdata = array('rid' => $rid, 'uniacid' => $uniacid, 'from_user' => $from_user, 'avatar' => $_GPC['avatar'], 'nickname' => $_GPC['nickname'], 'todaynum' => 1, 'totalnum' => 1, 'awardnum' => 0, 'createtime' => time());
pdo_insert('stonefish_bigwheel_fans', $fansdata);
$fans['id'] = pdo_insertid();
//自动读取会员信息存入FANS表中
$ziduan = array('realname', 'mobile', 'qq', 'email', 'address', 'gender', 'telephone', 'idcard', 'company', 'occupation', 'position');
foreach ($ziduan as $ziduans) {
if ($reply['is' . $ziduans]) {
if (!empty($_GPC[$ziduans])) {
pdo_update('stonefish_bigwheel_fans', array($ziduans => $_GPC[$ziduans]), array('id' => $fans['id']));
if ($reply['isfans']) {
if ($ziduans == 'email') {
mc_update($_W['member']['uid'], array('email' => $_GPC['email']));
} else {
mc_update($_W['member']['uid'], array($ziduans => $_GPC[$ziduans], 'email' => $profile['email']));
}
}
}
}
}
//自动读取会员信息存入FANS表中
//增加人数,和浏览次数
pdo_update('stonefish_bigwheel_reply', array('fansnum' => $reply['fansnum'] + 1), array('id' => $reply['id']));
//商家赠送增加使用次数
if ($reply['opportunity'] == 3) {
//pdo_update('stonefish_branch_doings', array('usecount' =>0,'usetime' => time()), array('id' => $doings['id']));
pdo_update($reply['othermodule'] . '_prizeslist', array('usecount' => 0), array('id' => $doings['id']));
} elseif ($reply['opportunity'] == 1) {
//.........这里部分代码省略.........
示例7: pay
protected function pay($params = array())
{
global $_W;
if (!$this->inMobile) {
message('支付功能只能在手机上使用');
}
if (empty($_W['member']['uid'])) {
checkauth();
}
$params['module'] = $this->module['name'];
$pars = array();
$pars[':uniacid'] = $_W['uniacid'];
$pars[':module'] = $params['module'];
$pars[':tid'] = $params['tid'];
if ($params['fee'] <= 0) {
$pars['from'] = 'return';
$pars['result'] = 'success';
$pars['type'] = 'alipay';
$pars['tid'] = $params['tid'];
$site = WeUtility::createModuleSite($pars[':module']);
$method = 'payResult';
if (method_exists($site, $method)) {
exit($site->{$method}($pars));
}
}
$sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid';
$log = pdo_fetch($sql, $pars);
if (!empty($log) && $log['status'] == '1') {
message('这个订单已经支付成功, 不需要重复支付.');
}
$setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors'));
if (!is_array($setting['payment'])) {
message('没有有效的支付方式, 请联系网站管理员.');
}
$pay = $setting['payment'];
if (!empty($pay['credit']['switch'])) {
$credtis = mc_credit_fetch($_W['member']['uid']);
}
include $this->template('common/paycenter');
}
示例8: defined
<?php
/**
* @FreeGo Team 智慧游
* @url http://www.cninone.com/
*/
defined('IN_IA') or exit('Access Denied');
if ($action != 'cash') {
checkauth();
}
load()->model('activity');
$filter = array();
$coupons = activity_coupon_owned($_W['member']['uid'], $filter);
$tokens = activity_token_owned($_W['member']['uid'], $filter);
$setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc', 'payment', 'passport'));
$behavior = $setting['creditbehaviors'];
$creditnames = $setting['creditnames'];
$credits = mc_credit_fetch($_W['member']['uid'], '*');
$sql = 'SELECT `status` FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid";
$cardstatus = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
示例9: activity_module_card_grant
function activity_module_card_grant($uid, $couponid, $module = '', $remark = '')
{
global $_W;
$uid = intval($uid);
$user = mc_fetch($uid, array('groupid'));
$groupid = $user['groupid'];
$couponid = intval($couponid);
$coupon = pdo_fetch("SELECT * FROM " . tablename('activity_coupon') . " WHERE `couponid` = :couponid LIMIT 1", array(':couponid' => $couponid));
$pcount = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('activity_coupon_record') . " WHERE `uid` = :uid AND `couponid` = :couponid", array(':couponid' => $couponid, ':uid' => $uid));
$coupongroup = pdo_fetchall("SELECT groupid FROM " . tablename('activity_coupon_allocation') . " WHERE `couponid` = :couponid", array(':couponid' => $couponid), 'groupid');
$group = array_keys($coupongroup);
$couponmodules = pdo_fetchall("SELECT module FROM " . tablename('activity_coupon_modules') . " WHERE `couponid` = :couponid", array(':couponid' => $couponid), 'module');
$modules = array_keys($couponmodules);
if (empty($coupon)) {
return error(-1, '未找到指定优惠券');
} elseif (!in_array($module, $modules)) {
return error(-1, '该优惠券只能在特定的模块中领取');
} elseif (empty($coupongroup)) {
return error(-1, '该优惠券未指定可使用的会员组');
} elseif (!in_array($groupid, $group)) {
return error(-1, '您所在的用户组没有领取该优惠券的权限');
} elseif ($coupon['starttime'] > TIMESTAMP) {
return error(-1, '优惠券活动尚未开始');
} elseif ($coupon['endtime'] < TIMESTAMP) {
return error(-1, '优惠券活动已经结束');
} elseif ($coupon['dosage'] >= $coupon['amount']) {
return error(-1, '优惠券已经发放完毕');
} elseif ($pcount >= $coupon['limit']) {
return error(-1, '用户领取优惠券数量已经超过限制');
}
$creditnames = array();
$unisettings = uni_setting($_W['uniacid'], array('creditnames'));
if (!empty($unisettings) && !empty($unisettings['creditnames'])) {
foreach ($unisettings['creditnames'] as $key => $credit) {
$creditnames[$key] = $credit['title'];
}
}
$credit = mc_credit_fetch($uid, array($coupon['credittype']));
if ($credit[$coupon['credittype']] < $coupon['credit']) {
return error(-1, '您的' . $creditnames[$coupon['credittype']] . '数量不够,无法兑换.');
}
mc_credit_update($uid, $coupon['credittype'], -1 * $coupon['credit'], array($uid, '优惠券兑换:' . $coupon['title'] . ' 消耗 ' . $creditnames[$coupon['credittype']] . ':' . $coupon['credit']));
$remark = "通过{$module}模块领取优惠券";
$insert = array('couponid' => $couponid, 'uniacid' => $_W['uniacid'], 'uid' => $uid, 'grantmodule' => $module, 'granttime' => TIMESTAMP, 'status' => 1, 'remark' => $remark);
pdo_insert('activity_coupon_record', $insert);
pdo_update('activity_coupon', array('dosage' => $coupon['dosage'] + 1), array('couponid' => $couponid));
return $coupon;
}
示例10: 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));
//.........这里部分代码省略.........
示例11: doMobilePtjpostinfo
public function doMobilePtjpostinfo()
{
//发布信息内容
global $_W, $_GPC;
load()->func('tpl');
load()->model('mc');
load()->func('file');
$uid = mc_openid2uid($_W['openid']);
$creditarray = mc_credit_fetch($uid);
$credit = $creditarray['credit1'];
$ground = $_GPC['ground'];
$type = $_GPC['type'];
$user = $this->DboperateSearchUser($_W['openid']);
if ($_GPC) {
$title = $_GPC['title'];
$content = $_GPC['description'];
$privacy = $_GPC['top'] == 'on' ? 1 : 0;
$c_pay = $_GPC['credit'];
$phone = $_GPC['default_tel'] != '' ? $_GPC['default_tel'] : $_GPC['new_tel'];
if ($_FILES['pic1']['name']) {
$pic1 = file_upload($_FILES['pic1'], 'image');
$path1 = tomedia($pic1['path']);
}
if ($_FILES['pic2']['name']) {
$pic2 = file_upload($_FILES['pic2'], 'image');
$path2 = tomedia($pic2['path']);
}
if ($_FILES['pic3']['name']) {
$pic3 = file_upload($_FILES['pic3'], 'image');
$path3 = tomedia($pic3['path']);
}
//检测状态
if ($title != "" and $content != "" and $phone != "" and $credit >= floatval($c_pay)) {
//判断置顶招聘是否已满
if ($privacy and $this->GetPrivacyNum() > 10) {
message('置顶招聘已满...请稍后重试!', '', 'warning');
exit;
} else {
if ($privacy and $credit >= 100) {
$value = mc_credit_update(mc_openid2uid($_W['openid']), 'credit1', -100);
$this->SendTpl($_W['openid'], $user, 'credit1', $credit - 100);
} else {
if ($privacy) {
message('积分不足,您无权进行此操作,请前往个人中心充值。如有问题,请与管理员联系!');
exit;
}
}
}
$jobid = substr(md5(substr(time(), 4, 8)), 4, 9);
$t = $this->DboperateInsertGroundInfo($_W['openid'], $jobid, $title, $content, $phone, $privacy, $path1, $path2, $path3, intval($c_pay), $type);
if ($t) {
$url = murl('entry//ptjindex', array('m' => $this->modulename));
echo "<script>\r\n \t\t\tlocation.href='{$url}';\r\n \t\t\t</script>";
}
} else {
if ($credit < floatval($c_pay)) {
message('积分不足,请前往个人中心充值。如有问题,请与管理员联系!', 'referer');
}
}
}
include $this->template('postinfo');
}
示例12: mc_credit_update
$log .= "会员消费{$money}元,积分赠送比率为:【1:{$card['grant_rate']}】,共赠送【{$num}】积分";
mc_credit_update($uid, 'credit1', $num, array(0, $log, 'system', $clerk['id'], $clerk['store_id']));
$openid = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $uid));
if (!empty($openid)) {
if ($index == 'credit1') {
mc_notice_credit1($openid, $uid, $num, $log);
}
}
}
exit('success');
}
if ($do == 'credit') {
$type = trim($_GPC['type']);
$num = floatval($_GPC['num']);
$names = array('credit1' => '积分', 'credit2' => '余额');
$credits = mc_credit_fetch($uid);
if ($num < 0 && abs($num) > $credits[$type]) {
exit("会员账户{$names[$type]}不够");
}
$status = mc_credit_update($uid, $type, $num, array(0, trim($_GPC['remark']), 'system', $clerk['id'], $clerk['store_id']));
if (is_error($status)) {
exit($status['message']);
}
if ($type == 'credit1') {
mc_group_update($uid);
}
$openid = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $uid));
if (!empty($openid)) {
if ($type == 'credit1') {
mc_notice_credit1($openid, $uid, $num, '管理员后台操作积分');
}
示例13: doSign
/**
* 签到
*/
function doSign($from, $settings)
{
global $_W;
unset($uid, $today_sign, $insert);
$uid = getUserIdByOpenId($from);
if ($uid <= 0) {
return array(false, 'no_login');
}
$today_sign = getUserTodaySign($uid, $settings['times']);
//今天签到数据
if (!empty($today_sign)) {
return array(false, 'over_number');
}
//超过签到次数
//list($times, $start_time, $end_time, $credit_type, $credit)
$now = time();
if ($now < strtotime($settings['start_time']) || $now > strtotime($settings['end_time'])) {
return array(false, 'over_time');
}
//不在签到时间
$rank = intval(getTodaySignTotal()) + 1;
$times = intval(getUserSignTotal($uid) + 1);
$insert = array('uniacid' => $_W['uniacid'], 'uid' => $uid, 'time' => $now, 'sum_times' => $times, 'rank' => $rank);
pdo_insert('kim_sign_record', $insert);
if (pdo_insertid() > 0) {
load()->model('mc');
$log = array(0, '签到获得');
mc_credit_update($uid, $settings['credit_type'], doubleval($settings['credit']), $log);
$credit = mc_credit_fetch($uid, array($settings['credit_type']));
}
$credits = uni_setting($_W['uniacid'], 'creditnames');
$credit_type = $credits['creditnames'][$settings['credit_type']];
$result = "您今天第 %s 个签到用户\n本次获得 %s 个%s\n您累计拥有 %s 个%s";
$result = sprintf($result, $rank, doubleval($settings['credit']), $credit_type['title'], $credit[$settings['credit_type']], $credit_type['title']);
return array(true, $result);
}
示例14: doMobileApply
public function doMobileApply()
{
//这个操作被定义用来呈现 微站个人中心导航
global $_W, $_GPC;
load()->model('mc');
$openid = $_W['fans']['from_user'];
$fans = pdo_fetch("SELECT fanid,uid FROM " . tablename('mc_mapping_fans') . " WHERE `openid`='{$openid}' LIMIT 1");
$uid = '0';
if ($fans['uid'] != '0') {
$uid = $fans['uid'];
} else {
$uid = mc_update($uid, array('email' => md5($_W['openid']) . '@012wz.com'));
if (!empty($fans['fanid']) && !empty($uid)) {
pdo_update('mc_mapping_fans', array('uid' => $uid), array('fanid' => $fans['fanid']));
}
}
$minnum = isset($this->module['config']['out_limit']) ? $this->module['config']['out_limit'] : '100.00';
$credit_type = isset($this->module['config']['credit_type']) ? $this->module['config']['credit_type'] : 'credit1';
$yue = mc_credit_fetch($uid);
$ff_log = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$uid}'");
$profile = mc_fetch($uid);
if (checksubmit('submit')) {
if ($_GPC['type'] == '1' && empty($_GPC['alipay'])) {
message('参数错误,请返回修改');
}
if ($_GPC['type'] == '2' && empty($_GPC['cardid'])) {
message('参数错误,请返回修改');
}
$remark['1']['user'] = $_GPC['realname'];
$remark['1']['time'] = time();
$remark['1']['reason'] = '';
$data = array('uniacid' => $_W['uniacid'], 'uid' => $uid, 'realname' => $_GPC['realname'], 'qq' => $_GPC['qq'], 'type' => intval($_GPC['type']), 'alipay' => $_GPC['alipay'], 'cardid' => $_GPC['cardid'], 'cardfrom' => $_GPC['cardfrom'], 'cardname' => $_GPC['cardname'], 'credit2' => $_GPC['credit2'], 'mobile' => $_GPC['mobile'], 'createtime' => time(), 'status' => '1', 'remark' => iserializer($remark));
pdo_insert('hx_subscribe_apply', $data);
mc_credit_update($uid, $credit_type, '-' . $_GPC['mobile'], array('1', '申请提现'));
message('提现成功', $this->createMobileUrl('myapply'), 'success');
}
include $this->template('apply');
}
示例15: getUserSystemCredit
function getUserSystemCredit()
{
load()->model('mc');
$uid = mc_openid2uid($this->getOpenId());
$result = mc_credit_fetch($uid);
return $result['credit1'];
}