<?php /** * 会员财务中心 * * 作者:Kim * 模块定制QQ: 800083075 * 后台体验地址: http://www.012wz.com */ defined('IN_IA') or exit('Access Denied'); global $_W, $_GPC; checklogin(); if ($_W['ispost'] && $_W['isajax']) { $user = pdo_fetch("SELECT U.* FROM " . tablename("uni_account_users") . " AS A LEFT JOIN " . tablename("users") . " AS U ON A.uid=U.uid WHERE A.uniacid=:uniacid AND A.role='manager'", array(":uniacid" => $_W['uniacid'])); if (empty($user)) { die(json_encode(array("code" => 1, "message" => "扣费帐号不存在."))); } $res = buy_package($user, $_GPC['pid'], $_GPC['total']); if (!is_error($res)) { die(json_encode(array("code" => 1, "message" => "购买成功."))); } die(json_encode(array("code" => 0, "message" => $res["message"]))); } $idList = pdo_fetchall("SELECT id FROM " . tablename("uni_group")); $_items = array(); foreach ($idList as $item) { $_items[] = $item["id"]; } $list = uni_groups($_items); $curr_count = count($list[$_W["user"]["account"]["groupid"]]['modules']); include $this->template('financial_buypackage');
function common_group_check() { global $_W; $uniacid = $_W['uniacid']; $settings = uni_setting($uniacid, array('groupdata')); $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array(); if ($groupdata['isexpire'] == 1) { $settings = get_settings(); $account = uni_fetch(); $group = kim_get_uni_group($account['groupid']); $user = pdo_fetch("SELECT U.* FROM " . tablename("uni_account_users") . " AS A LEFT JOIN " . tablename("users") . " AS U ON A.uid=U.uid WHERE A.uniacid=:uniacid AND A.role='manager'", array(":uniacid" => $uniacid)); if ($groupdata['endtime'] < TIMESTAMP) { if ($user["credit2"] >= $group["price"] && $settings["is_auto"] == 1) { $result = buy_package($user, $group["id"]); if (is_error($result)) { return $result; } return error(0, "自动续费成功."); } else { $over_group = !empty($settings["over_group"]) ? intval($settings["over_group"]) : 0; pdo_update('uni_account', array('groupid' => $over_group), array('uniacid' => $uniacid)); pdo_update('uni_settings', array('groupdata' => iserializer(array('isexpire' => 0, 'endtime' => 0, 'oldgroupid' => $group['id'], 'is_auto' => 1))), array('uniacid' => $uniacid)); $_W['account']['groupid'] = $over_group; load()->model('module'); module_build_privileges(); return error(0, "自动续费失败,变成配置过期套餐."); } } $overTime = intval($groupdata['endtime']) - TIMESTAMP; if (!empty($settings["tx_date"]) && intval($settings["tx_date"]) > 0 && is_email_tx($overTime, intval($settings["tx_date"]))) { $email = pdo_fetchcolumn("SELECT P.email FROM " . tablename("uni_account_users") . " AS A LEFT JOIN " . tablename("users_profile") . " AS P ON A.uid=P.uid WHERE A.uniacid=:uniacid AND A.role='manager'", array(":uniacid" => $uniacid)); if (!empty($email)) { $email_body = str_replace('<', "<", $settings["tx_email"]); $email_body = str_replace('>', ">", $email_body); $email_body = str_replace('#package#', $group['name'], $email_body); $email_body = str_replace('#day#', $groupdata['endtime'], $email_body); load()->func('communication'); $send = ihttp_email($email, "套餐到期提醒-系统邮件,请勿回复.", $email_body, true); if (is_error($send)) { return $send; } cache_write('kim_financial_email_tx' . $_W["uniacid"], array("time" => date("Y-m-d", TIMESTAMP))); return error(0, "套餐到期提醒,成功"); } return error(0, "提醒邮箱未设定"); } return error(0, "检查成功"); } return error(-1, "操作失败"); }