原后台修改
This commit is contained in:
@@ -21,7 +21,8 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//运行程序
|
//运行程序
|
||||||
public function run(){
|
public function run()
|
||||||
|
{
|
||||||
global $is_script;
|
global $is_script;
|
||||||
spl_autoload_register(array($this, 'loadClass'));
|
spl_autoload_register(array($this, 'loadClass'));
|
||||||
$this->origin();
|
$this->origin();
|
||||||
@@ -30,11 +31,16 @@ class Fastphp
|
|||||||
$this->setDbConfig();
|
$this->setDbConfig();
|
||||||
if (!$is_script) {
|
if (!$is_script) {
|
||||||
$this->route();
|
$this->route();
|
||||||
|
} else {
|
||||||
|
if (isset($_SERVER['SERVER_NAME'])) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//跨域请求处理
|
//跨域请求处理
|
||||||
public function origin(){
|
public function origin()
|
||||||
|
{
|
||||||
$allow_origin = $this->config['origin']; //跨域访问的时候才会存在此字段
|
$allow_origin = $this->config['origin']; //跨域访问的时候才会存在此字段
|
||||||
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
|
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
|
||||||
if (in_array($origin, $allow_origin)) {
|
if (in_array($origin, $allow_origin)) {
|
||||||
@@ -48,7 +54,8 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//路由处理
|
//路由处理
|
||||||
public function route(){
|
public function route()
|
||||||
|
{
|
||||||
$controllerName = $this->config['defaultController'];
|
$controllerName = $this->config['defaultController'];
|
||||||
$actionName = $this->config['defaultAction'];
|
$actionName = $this->config['defaultAction'];
|
||||||
$param = array();
|
$param = array();
|
||||||
@@ -92,7 +99,8 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//检测开发环境
|
//检测开发环境
|
||||||
public function setReporting(){
|
public function setReporting()
|
||||||
|
{
|
||||||
if (APP_DEBUG === true) {
|
if (APP_DEBUG === true) {
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', 'On');
|
ini_set('display_errors', 'On');
|
||||||
@@ -104,13 +112,15 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除敏感字符
|
//删除敏感字符
|
||||||
public function stripSlashesDeep($value){
|
public function stripSlashesDeep($value)
|
||||||
|
{
|
||||||
$value = is_array($value) ? array_map(array($this, 'stripSlashesDeep'), $value) : stripSlashes($value);
|
$value = is_array($value) ? array_map(array($this, 'stripSlashesDeep'), $value) : stripSlashes($value);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测自定义全局变量并移除
|
//检测自定义全局变量并移除
|
||||||
public function unregisterGlobals(){
|
public function unregisterGlobals()
|
||||||
|
{
|
||||||
if (ini_get('register_globals')) {
|
if (ini_get('register_globals')) {
|
||||||
$array = array('_SESSION', '_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');
|
$array = array('_SESSION', '_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');
|
||||||
foreach ($array as $value) {
|
foreach ($array as $value) {
|
||||||
@@ -124,7 +134,8 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//配置数据库信息
|
//配置数据库信息
|
||||||
public function setDbConfig(){
|
public function setDbConfig()
|
||||||
|
{
|
||||||
if (isset($this->config['db'])) {
|
if (isset($this->config['db'])) {
|
||||||
define('DB_HOST', $this->config['db']['host']);
|
define('DB_HOST', $this->config['db']['host']);
|
||||||
define('DB_PORT', $this->config['db']['port']);
|
define('DB_PORT', $this->config['db']['port']);
|
||||||
@@ -135,7 +146,8 @@ class Fastphp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//自动加载类
|
//自动加载类
|
||||||
public function loadClass($className){
|
public function loadClass($className)
|
||||||
|
{
|
||||||
$vendor = substr($className, 0, strpos($className, '\\'));
|
$vendor = substr($className, 0, strpos($className, '\\'));
|
||||||
$vendorDIR = $this->config['namespace'][$vendor];
|
$vendorDIR = $this->config['namespace'][$vendor];
|
||||||
$filePath = substr($className, strlen($vendor)) . '.php';
|
$filePath = substr($className, strlen($vendor)) . '.php';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @Author: kangkang
|
* @Author: kangkang
|
||||||
* @Date: 2020-10-03 18:23:43
|
* @Date: 2020-10-03 18:23:43
|
||||||
* @LastEditors: kangkang
|
* @LastEditors: kangkang
|
||||||
* @LastEditTime: 2020-11-02 15:15:16
|
* @LastEditTime: 2020-11-03 15:05:26
|
||||||
*/
|
*/
|
||||||
$is_script = 1;
|
$is_script = 1;
|
||||||
include __DIR__ . '/../index.php';
|
include __DIR__ . '/../index.php';
|
||||||
@@ -158,7 +158,7 @@ $list['qiangzi'] = $yesterday_data['qiangzi'] - $qiangzi_rule_result['cost'] + $
|
|||||||
$list['xunlian'] = $yesterday_data['xunlian'] - $xunlian_rule_result['cost'] + $xunlian_rule_result['refund'] + ($buyi_data['xunlian'] ?? 0);
|
$list['xunlian'] = $yesterday_data['xunlian'] - $xunlian_rule_result['cost'] + $xunlian_rule_result['refund'] + ($buyi_data['xunlian'] ?? 0);
|
||||||
|
|
||||||
$tiantian_rule_result = tl_rule($tiantian, $tiantian_refund);
|
$tiantian_rule_result = tl_rule($tiantian, $tiantian_refund);
|
||||||
$laoying_rule_result = tl_rule($laoying, $laoying_refund);
|
$laoying_rule_result = tl_rule($laoying, $laoying_refund, true);
|
||||||
$list['tiantian'] = $yesterday_data['tiantian'] - $tiantian_rule_result['cost'] + $tiantian_rule_result['refund'] + ($buyi_data['tiantian'] ?? 0);
|
$list['tiantian'] = $yesterday_data['tiantian'] - $tiantian_rule_result['cost'] + $tiantian_rule_result['refund'] + ($buyi_data['tiantian'] ?? 0);
|
||||||
$list['laoying'] = $yesterday_data['laoying'] - $laoying_rule_result['cost'] + $laoying_rule_result['refund'] + ($buyi_data['laoying'] ?? 0);
|
$list['laoying'] = $yesterday_data['laoying'] - $laoying_rule_result['cost'] + $laoying_rule_result['refund'] + ($buyi_data['laoying'] ?? 0);
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ $xianfeng_rule_result = xianfeng($xianfeng, $xianfeng_refund);
|
|||||||
$list['xianfeng'] = $yesterday_data['xianfeng'] - $xianfeng_rule_result['cost'] + $xianfeng_rule_result['refund'] + ($buyi_data['xianfeng'] ?? 0);
|
$list['xianfeng'] = $yesterday_data['xianfeng'] - $xianfeng_rule_result['cost'] + $xianfeng_rule_result['refund'] + ($buyi_data['xianfeng'] ?? 0);
|
||||||
|
|
||||||
$jinrui_rule_result = jinrui($jinrui, $jinrui_refund);
|
$jinrui_rule_result = jinrui($jinrui, $jinrui_refund);
|
||||||
$list['jinrui'] = $yesterday_data['jinrui'] - $jinrui_rule_result['cost'] + $xianfeng_rule_result['refund'] + ($buyi_data['jinrui'] ?? 0);
|
$list['jinrui'] = $yesterday_data['jinrui'] - $jinrui_rule_result['cost'] + $jinrui_rule_result['refund'] + ($buyi_data['jinrui'] ?? 0);
|
||||||
|
|
||||||
$list['riqi'] = date('Y-m-d H:i:s');
|
$list['riqi'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ function no_jike($product)
|
|||||||
//强子,讯连规则
|
//强子,讯连规则
|
||||||
function qx_rule($product, $refunds, $product_type = true)
|
function qx_rule($product, $refunds, $product_type = true)
|
||||||
{
|
{
|
||||||
$tian = $product_type ? 10 : 12;
|
$tian = 12;
|
||||||
$cost = 0;
|
$cost = 0;
|
||||||
foreach ($product as $package) {
|
foreach ($product as $package) {
|
||||||
switch ($package['PackageName']) {
|
switch ($package['PackageName']) {
|
||||||
@@ -289,8 +289,9 @@ function qx_rule($product, $refunds, $product_type = true)
|
|||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
//天天,老鹰退款规则
|
//天天,老鹰退款规则
|
||||||
function tl_rule($product, $refunds)
|
function tl_rule($product, $refunds, $product_type = false)
|
||||||
{
|
{
|
||||||
|
$month = $product_type ? 40 : 30;
|
||||||
$cost = 0;
|
$cost = 0;
|
||||||
foreach ($product as $package) {
|
foreach ($product as $package) {
|
||||||
switch ($package['PackageName']) {
|
switch ($package['PackageName']) {
|
||||||
@@ -338,10 +339,10 @@ function tl_rule($product, $refunds)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '月卡':
|
case '月卡':
|
||||||
if ((86400 * 30 - handle_time($info['RefundRestTime'])) < 1800) {
|
if ((86400 * $month - handle_time($info['RefundRestTime'])) < 1800) {
|
||||||
$refund += $info['ConnectCount'] * 60;
|
$refund += $info['ConnectCount'] * 60;
|
||||||
} else {
|
} else {
|
||||||
$refund += $info['ConnectCount'] * 60 - ceil((86400 * 30 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4;
|
$refund += $info['ConnectCount'] * 60 - ceil((86400 * $month - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '季卡':
|
case '季卡':
|
||||||
@@ -464,7 +465,7 @@ function jinrui($product, $refunds)
|
|||||||
}
|
}
|
||||||
$refund = 0;
|
$refund = 0;
|
||||||
foreach ($refunds as $info) {
|
foreach ($refunds as $info) {
|
||||||
$refund += handle_time($info['RefundRestTime']) / 86400 * 2 * $info['ConnectCount'];
|
$refund += intval(handle_time($info['RefundRestTime']) / 86400) * 2 * $info['ConnectCount'];
|
||||||
}
|
}
|
||||||
$count['cost'] = $cost;
|
$count['cost'] = $cost;
|
||||||
$count['refund'] = $refund;
|
$count['refund'] = $refund;
|
||||||
|
|||||||
Reference in New Issue
Block a user