原后台财务
This commit is contained in:
@@ -156,7 +156,7 @@ $list = [];
|
||||
$list['xingxing'] = $yesterday_data['xingxing'] - no_jike($xingxing) + ($buyi_data['xingxing'] ?? 0);
|
||||
$list['jike'] = $yesterday_data['jike'] - jike($jike) + ($buyi_data['jike'] ?? 0);
|
||||
$list['xigua'] = $yesterday_data['xigua'] - xigua($xigua) + ($buyi_data['xigua'] ?? 0);
|
||||
$list['wujin'] = $yesterday_data['wujin'] - no_jike($wujin) + ($buyi_data['wujin'] ?? 0);
|
||||
$list['wujin'] = $yesterday_data['wujin'] - wujin($wujin) + ($buyi_data['wujin'] ?? 0);
|
||||
$list['wanmei'] = $yesterday_data['wanmei'] - no_jike($wanmei) + ($buyi_data['wanmei'] ?? 0);
|
||||
$list['jinqiao'] = $yesterday_data['jinqiao'] - no_jike($jinqiao) + ($buyi_data['jinqiao'] ?? 0);
|
||||
$list['wuxian'] = $yesterday_data['wuxian'] - no_jike($wuxian) + ($buyi_data['wuxian'] ?? 0);
|
||||
@@ -164,12 +164,12 @@ $list['shihui'] = $yesterday_data['shihui'] - no_jike($shihui) + ($buyi_data['sh
|
||||
$list['gongxiang'] = $yesterday_data['gongxiang'] - no_jike($gongxiang) + ($buyi_data['gongxiang'] ?? 0);
|
||||
|
||||
$qiangzi_rule_result = qx_rule($qiangzi, $qiangzi_refund, false);
|
||||
$xunlian_rule_result = qx_rule($xunlian, $xunlian_refund);
|
||||
$xunlian_rule_result = xunlian($xunlian, $xunlian_refund);
|
||||
$list['qiangzi'] = $yesterday_data['qiangzi'] - $qiangzi_rule_result['cost'] + $qiangzi_rule_result['refund'] + ($buyi_data['qiangzi'] ?? 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);
|
||||
$laoying_rule_result = tl_rule($laoying, $laoying_refund, true);
|
||||
$laoying_rule_result = laoying($laoying, $laoying_refund, true);
|
||||
$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);
|
||||
|
||||
@@ -255,20 +255,46 @@ function no_jike($product)
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 4;
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 3;
|
||||
break;
|
||||
case '周卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 28;
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 18;
|
||||
break;
|
||||
case '月卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 100;
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 50;
|
||||
break;
|
||||
case '双月卡(活动)':
|
||||
case '季卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 300;
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 150;
|
||||
break;
|
||||
case '年卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 1200;
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 500;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
function wujin($product)
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 4;
|
||||
break;
|
||||
case '周卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 25;
|
||||
break;
|
||||
case '月卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 60;
|
||||
break;
|
||||
case '双月卡(活动)':
|
||||
case '季卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 180;
|
||||
break;
|
||||
case '年卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 600;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -278,24 +304,23 @@ function no_jike($product)
|
||||
//强子,讯连规则
|
||||
function qx_rule($product, $refunds, $product_type = true)
|
||||
{
|
||||
$tian = 12;
|
||||
$cost = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * $tian;
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 6.6;
|
||||
|
||||
break;
|
||||
case '周卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 60;
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 34;
|
||||
|
||||
break;
|
||||
case '月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 200;
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 100;
|
||||
|
||||
break;
|
||||
case '季卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 600;
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 270;
|
||||
|
||||
break;
|
||||
case '月卡(活动)':
|
||||
@@ -311,58 +336,58 @@ function qx_rule($product, $refunds, $product_type = true)
|
||||
|
||||
break;
|
||||
case '年卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 2400;
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 900;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$refund = 0;
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
|
||||
$count['cost'] = $cost;
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
}
|
||||
function xunlian($product, $refunds, $product_type = true)
|
||||
{
|
||||
$cost = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
if ((86400 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += $tian;
|
||||
}
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 5.5;
|
||||
|
||||
break;
|
||||
case '周卡':
|
||||
if ((86400*7 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += 60;
|
||||
} else {
|
||||
$refund += round(60/7*intval(handle_time($info['RefundRestTime'])/86400));
|
||||
}
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 28;
|
||||
|
||||
break;
|
||||
case '月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 80;
|
||||
|
||||
break;
|
||||
case '季卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 220;
|
||||
|
||||
break;
|
||||
case '月卡(活动)':
|
||||
case '月卡':
|
||||
if ((86400*30 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += 200;
|
||||
} else {
|
||||
$refund += round(200/30*intval(handle_time($info['RefundRestTime'])/86400));
|
||||
}
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 200;
|
||||
|
||||
break;
|
||||
// case '季卡(活动)':
|
||||
case '季卡':
|
||||
if ((86400*90 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += 600;
|
||||
} else {
|
||||
$refund += round(600/90*intval(handle_time($info['RefundRestTime'])/86400));
|
||||
}
|
||||
case '季卡(活动)':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 600;
|
||||
|
||||
break;
|
||||
case '双月卡(活动)':
|
||||
if ((86400*90 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += 400;
|
||||
} else {
|
||||
$refund += round(600/90*intval(handle_time($info['RefundRestTime'])/86400));
|
||||
}
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 400;
|
||||
|
||||
break;
|
||||
case '年卡':
|
||||
if ((86400*365 - handle_time($info['RefundRestTime'])) < 7200) {
|
||||
$refund += 2400;
|
||||
} else {
|
||||
$refund += round(2400/365*intval(handle_time($info['RefundRestTime'])/86400));
|
||||
}
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 800;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$refund = 0;
|
||||
|
||||
$count['cost'] = $cost;
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
@@ -451,6 +476,90 @@ function tl_rule($product, $refunds, $product_type = false)
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
}
|
||||
//天天,老鹰退款规则
|
||||
function laoying($product, $refunds, $product_type = false)
|
||||
{
|
||||
$month = 30;
|
||||
$cost = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 1.25;
|
||||
|
||||
break;
|
||||
case '周卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 7.5;
|
||||
|
||||
break;
|
||||
case '月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 25;
|
||||
|
||||
break;
|
||||
case '季卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 70;
|
||||
|
||||
break;
|
||||
case '年卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 250;
|
||||
|
||||
break;
|
||||
case '双月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 120;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$refund = 0;
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
case '天卡':
|
||||
if ((86400 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 1.25;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 1.25 - ceil((86400 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
case '周卡':
|
||||
if ((86400 * 7 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 7.5;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 7.5 - ceil((86400 * 7 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
case '月卡':
|
||||
if ((86400 * $month - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 25;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 25 - ceil((86400 * $month - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
case '季卡':
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 70;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 70 - ceil((86400 * 90 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
case '年卡':
|
||||
if ((86400 * 365 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 250;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 250 - ceil((86400 * 365 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
case '双月卡':
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 120;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 120 - ceil((86400 * 90 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 1.25;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$count['cost'] = $cost;
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
}
|
||||
//先锋规则
|
||||
function xianfeng($product, $refunds)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user