$order['oid'] = "KK-" . date('ymd', time()) . "-" . date('His', time()); //订单号 $order_id = admin_add_order($_SESSION['uid'], 7, $order['oid'], $amount, "余额增加", $notes, $timestamp, 0, '', 1); $setsqlarr["cid"] = $clue_id; $setsqlarr["notes"] = "用户id:" . $member_uid . ";" . $notes; $setsqlarr['addtime'] = time(); $setsqlarr['admin_name'] = $_SESSION["admin_name"]; $setsqlarr['nexttime'] = ""; $db->inserttable(table('jobs_reward_clue_log'), $setsqlarr); !$order_id ? adminmsg("奖励失败!", 0) : adminmsg("奖励成功!", 2); } } elseif ($act == 'company_points') { //审核列表审核 get_token(); check_permissions($_SESSION['admin_purview'], "company_points"); $list = get_points_plan(); $smarty->assign('pageheader', "积分增送方案"); $smarty->assign('list', $list); $smarty->display('company/admin_company_points.htm'); } elseif ($act == 'points_plan_save') { //审核列表审核 get_token(); check_permissions($_SESSION['admin_purview'], "company_points"); $setsqlarr['name'] = !empty($_POST['name']) ? trim($_POST['name']) : adminmsg('请填写名称!', 1); $setsqlarr['money'] = !empty($_POST['money']) ? trim($_POST['money']) : adminmsg('金额不能为空!', 1); $setsqlarr['free_points'] = !empty($_POST['free_points']) ? trim($_POST['free_points']) : adminmsg('赠送积分不能为空!', 1); $insert_id = $db->inserttable(table('company_points'), $setsqlarr, true); write_log("添加积分赠送方案" . $setsqlarr['name'], $_SESSION['admin_name'], 3); $link[0]['text'] = "返回列表"; $link[0]['href'] = "?act=company_points"; adminmsg('添加成功!', 2, $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 = trim($_POST['description']); $points = 0; if ($amount > get_user_can_balance($_SESSION["uid"])) { showmsg("超过可用余额!", 1); } $points = $amount * $_CFG['payment_rate']; $plants = get_points_plan("money desc"); $free_points = 0; if ($plants) { foreach ($plants as $key => $v) { if ($amount >= $v["money"]) { $free_points = $v["free_points"]; break; } } } $points = $points + $free_points; balance_deal($_SESSION["uid"], 2, $amount); $order_id = add_order($_SESSION['uid'], 4, $order['oid'], $amount, $payment_name, "余额购买积分:" . $points, $timestamp, $points, '', 1); if ($order_id) { $sql = "UPDATE " . table('order') . " SET is_paid=2,payment_time='{$timestamp}' WHERE id='{$order_id}' LIMIT 1"; $db->query($sql);