Exemplo n.º 1
0
function balance_deal($uid, $type = 1, $money = 0)
{
    global $db, $timestamp;
    $money = intval($money);
    $uid = intval($uid);
    $balance = get_user_can_balance($uid);
    if ($type == 1) {
        $sql = "UPDATE " . table('members_points') . " SET balance= balance+{$money} WHERE uid='{$uid}' LIMIT 1";
        if (!$db->query($sql)) {
            return false;
        }
    }
    if ($type == 2 && $balance >= $money) {
        $sql = "UPDATE " . table('members_points') . " SET balance= balance-{$money} WHERE uid='{$uid}' LIMIT 1";
        if (!$db->query($sql)) {
            return false;
        }
    }
    return true;
}
Exemplo n.º 2
0
        $json["success_num"] = $interview_success_num;
        $json["success_amount"] = $interview_success_money;
        $json["block_balance"] = $block_balance;
        $setsqlarr['cp_json'] = json_encode($json);
        $db->inserttable(table('promotion'), $setsqlarr);
        //        $setsqlarr['addtime'] = time();
        //        $setsqlarr['interview_num'] = $interview_num;
        //        $setsqlarr['interview_money'] = $interview_money;
        //        $setsqlarr['interview_success_money'] = $interview_success_money;
        //
        //        if ($db->inserttable(table('jobs_reward'), $setsqlarr)) {
        //标注简历推广
        set_job_reward($jobid, $setsqlarr['cp_promotionid'], $val_code);
        //锁定金额
        block_balance_reward($uid, $block_balance);
        $can_balance = get_user_can_balance($uid);
        write_memberslog($uid, 1, 9200, $_SESSION['username'], "{$pro_cat['cat_name']}:<strong>{$jobs['jobs_name']}</strong>,悬赏简历冻结 {$block_balance} ,(可用:{$can_balance})", 1, 1018, "{$pro_cat['cat_name']}", "-{$block_balance}", "{$can_balance}");
        exit('推广成功!');
    } else {
        exit("推广失败!");
    }
} elseif ($act == 'img_title') {
    global $_CFG;
    $id = intval($_GET['id']);
    $uid = intval($_SESSION['uid']);
    $img = $db->getone("SELECT * FROM " . table('company_img') . " WHERE uid ='{$uid}' AND id='{$id}' LIMIT 1");
    $tpl = '../../templates/' . $_CFG['template_dir'] . "member_company/ajax_set_img_title.htm";
    $contents = file_get_contents($tpl);
    $contents = str_replace('{#$id#}', $id, $contents);
    $contents = str_replace('{#$title#}', $img['title'], $contents);
    $contents = str_replace('{#$addtime#}', date('Y-m-d', $img['addtime']), $contents);
Exemplo n.º 3
0
function order_paid($v_oid)
{
    global $db, $timestamp, $_CFG;
    $order = $db->getone("select * from " . table('order') . " WHERE oid ='{$v_oid}' AND is_paid= '1' LIMIT 1 ");
    if ($order['pay_type'] == '1' || $order['pay_type'] == '4') {
        $order_name = "套餐积分订单";
        $user = get_user($order['uid']);
        $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 ";
        if (!$db->query($sql)) {
            return false;
        }
        if ($order['amount'] == '0.00') {
            $ismoney = 1;
        } else {
            $ismoney = 2;
        }
        if ($order['points'] > 0) {
            report_deal($order['uid'], 1, $order['points']);
            $user_points = get_user_points($order['uid']);
            $notes = "操作人:{$_SESSION['admin_name']},说明:确认收款。收款金额:{$order['amount']} 。" . date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元,(+{$order['points']}),(剩余:{$user_points}),订单:{$v_oid}";
            write_memberslog($order['uid'], 1, 9001, $user['username'], $notes);
            //会员套餐变更记录。管理员后台设置会员订单购买成功。4表示:管理员后台开通
            write_setmeallog($order['uid'], $user['username'], $notes, 4, $order['amount'], $ismoney, 1, 1);
        }
        if ($order['setmeal'] > 0) {
            set_members_setmeal($order['uid'], $order['setmeal']);
            $setmeal = get_setmeal_one($order['setmeal']);
            $notes = "操作人:{$_SESSION['admin_name']},说明:确认收款,收款金额:{$order['amount']} 。" . date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元并开通{$setmeal['setmeal_name']}";
            write_memberslog($order['uid'], 1, 9002, $user['username'], $notes);
            //会员套餐变更记录。管理员后台设置会员订单购买成功。4表示:管理员后台开通
            write_setmeallog($order['uid'], $user['username'], $notes, 4, $order['amount'], $ismoney, 2, 1);
        }
    } elseif ($order['pay_type'] == '2') {
        $order_name = "广告位订单";
        $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 ";
        //is_paid =2 为确定支付
        if (!$db->query($sql)) {
            return false;
        }
        write_memberslog($_SESSION['uid'], 1, 9001, $_SESSION['username'], "申请广告位:<strong>{$order['description']}</strong>,(花费: {$order['amount']})。", 1, 1020, "申请广告位", "-{$order['amount']}", "{$user_points}");
    } elseif ($order['pay_type'] == '3') {
        $order_name = "短信订单";
        $user = get_user($order['uid']);
        $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 ";
        if (!$db->query($sql)) {
            return false;
        }
        if ($order['setmeal'] > 0) {
            //查看短信套餐
            set_members_sms($order['uid'], intval($order['setmeal']));
            //支付成功,向用户增加短信条数
            $user_points = get_user_setmeal($order['uid']);
            write_memberslog($_SESSION['uid'], 1, 9003, $_SESSION['username'], "短信充值套餐:<strong>{$order['description']}</strong>,(- {$order['amount']}),(剩余:{$user_points['set_sms']})", 1, 1020, "申请广告位", "- {$order['amount']}", "{$user_points['set_sms']}");
        }
    } elseif ($order['pay_type'] == '7') {
        if ($order['amount'] == '0.00') {
            $ismoney = 1;
        } else {
            $ismoney = 2;
        }
        balance_deal($order['uid'], 1, $order['amount']);
        $user_balance = get_user_balance($order['uid']);
        $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 ";
        //is_paid =2 为确定支付
        if (!$db->query($sql)) {
            return false;
        }
        $note = "余额充值:<strong>{$order['description']}</strong>,(: {$order['amount']})。当前余额为:{$user_balance}";
        write_memberslog($_SESSION['uid'], 1, 9101, $_SESSION['username'], $note, 4, $order['amount'], $ismoney, 1, 1);
    } elseif ($order['pay_type'] == '9') {
        if ($order['amount'] == '0.00') {
            $ismoney = 1;
        } else {
            $ismoney = 2;
        }
        if (get_user_can_balance($order['uid']) < $order['amount']) {
            adminmsg('余额不足', 1);
            return false;
        }
        balance_deal($order['uid'], 2, $order['amount']);
        $user_balance = get_user_balance($order['uid']);
        $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 ";
        //is_paid =2 为确定支付
        if (!$db->query($sql)) {
            return false;
        }
        $note = "余额提现:<strong>{$order['description']}</strong>,(: {$order['amount']})。当前余额为:{$user_balance}";
        write_memberslog($_SESSION['uid'], 1, 9101, $_SESSION['username'], $note, 4, $order['amount'], $ismoney, 1, 1);
    }
    //发送邮件
    $mailconfig = get_cache('mailconfig');
    if ($mailconfig['set_payment'] == "1" && $user['email_audit'] == "1") {
        dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment");
    }
    //发送邮件完毕
    //sms
    $sms = get_cache('sms_config');
    if ($sms['open'] == "1" && $sms['set_payment'] == "1" && $user['mobile_audit'] == "1") {
        dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment");
    }
    //微信通知
    set_payment($order['uid'], $order_name, $order['oid'], $order['amount']);
    write_log("将订单号为" . $v_oid . "的订单设置为确认收款", $_SESSION['admin_name'], 3);
    return true;
}
Exemplo n.º 4
0
        $link[0]['href'] = 'company_info.php?act=company_profile';
        showmsg("请先填写您的企业资料!", 1, $link);
    }
    $myorder = get_user_order($_SESSION['uid'], 1);
    $order_num = count($myorder);
    if ($order_num >= 5) {
        $link[0]['text'] = "立即查看";
        $link[0]['href'] = '?act=order_list&is_paid=1';
        showmsg("未处理的订单不能超过 5 条,请先处理后再次申请!", 1, $link, true, 8);
    }
    $amount = trim($_POST['amount']) . intval($_POST['amount']) ? trim($_POST['amount']) : showmsg('请填写充值金额!', 1);
    $description = empty($_POST['description']) ? showmsg("请选择收款信息!", 1) : $_POST['description'];
    $order['oid'] = "TX-" . date('ymd', time()) . "-" . date('His', time());
    //订单号
    $points = 0;
    if ($amount > get_user_can_balance($_SESSION["uid"])) {
        showmsg("提现金额超过可用余额!", 1);
    }
    $order_id = add_order($_SESSION['uid'], 9, $order['oid'], $amount, "moneyreduce", "余额提现:" . $amount . ";" . $description, $timestamp, $points, '', 1);
    if ($order_id) {
        header("location:?act=order_list");
    } else {
        showmsg("添加订单失败!", 0);
    }
} elseif ($act == 'payment') {
    $setmeal = get_user_setmeal($_SESSION['uid']);
    if ($setmeal['endtime'] > 0) {
        $setmeal_endtime = sub_day($setmeal['endtime'], time());
    } else {
        $setmeal_endtime = "无限期";
    }