西瓜蘑菇元后台财务员
This commit is contained in:
@@ -13,22 +13,24 @@ class Product
|
||||
{
|
||||
//id=>产品名,每个产品的id不可变动
|
||||
public static $ScoreName = [
|
||||
1 => '强子PPTP',
|
||||
2 => '讯连pptp',
|
||||
1 => '强子IP',
|
||||
2 => '讯连IP',
|
||||
3 => '金桥-仅电脑',
|
||||
4 => '金瑞pptp',
|
||||
5 => '老鹰pptp',
|
||||
6 => '先锋pptp',
|
||||
4 => '金瑞IP',
|
||||
5 => '老鹰IP',
|
||||
6 => '先锋IP',
|
||||
7 => '无尽-仅电脑',
|
||||
8 => '星星pptp',
|
||||
8 => '星星IP',
|
||||
9 => '完美-仅电脑',
|
||||
10 => '无限-单窗口单ip',
|
||||
11 => '先锋SSTP专用',
|
||||
12 => '老鹰测试',
|
||||
13 => '极客pptp',
|
||||
14 => '天天pptp',
|
||||
13 => '极客IP',
|
||||
14 => '天天IP',
|
||||
15 => '共享IP',
|
||||
16 => '实惠IP',
|
||||
17 => '西瓜IP',
|
||||
18 => '蘑菇IP',
|
||||
];
|
||||
|
||||
public static $qiangzi = 1;
|
||||
@@ -47,10 +49,12 @@ class Product
|
||||
public static $tiantian = 14;
|
||||
public static $gongxiang = 15;
|
||||
public static $shihui = 16;
|
||||
public static $xigua = 17;
|
||||
public static $mogu = 18;
|
||||
|
||||
//强子、讯连
|
||||
public static $qx = [1, 2];
|
||||
|
||||
//天天老鹰先锋 金瑞
|
||||
public static $tlxj = [4, 5, 6, 14];
|
||||
//天天老鹰先锋 金瑞 蘑菇
|
||||
public static $tlxj = [4, 5, 6, 14,18];
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ ProductId, PackageName,
|
||||
|
||||
$data = $product_order_model->field($fields)->where(array_merge($where2, ['OrderState' => ['in', $product_order_enum::$PayComplete]]))->where($where1)->group(['ProductId', 'PackageName'])->fetchAll();
|
||||
|
||||
$qiangzi = $xunlian = $jinqiao = $jinrui = $laoying = $xianfeng = $wujin = $xingxing = $wanmei = $wuxian = $jike = $tiantian = $gongxiang = $shihui = [];
|
||||
$qiangzi = $xunlian = $jinqiao = $jinrui = $laoying = $xianfeng = $wujin = $xingxing = $wanmei = $wuxian = $jike = $tiantian = $gongxiang = $shihui = $xigua = $mogu = [];
|
||||
|
||||
foreach ($data as $product) {
|
||||
switch ($product['ProductId']) {
|
||||
@@ -100,6 +100,12 @@ foreach ($data as $product) {
|
||||
case $product_enum::$shihui:
|
||||
$shihui[] = $product;
|
||||
break;
|
||||
case $product_enum::$xigua:
|
||||
$xigua[] = $product;
|
||||
break;
|
||||
case $product_enum::$mogu:
|
||||
$mogu[] = $product;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +125,14 @@ foreach ($refund_qx_info as $info) {
|
||||
}
|
||||
}
|
||||
|
||||
//天天老鹰先锋的退款
|
||||
//天天老鹰先锋的退款 金瑞 蘑菇
|
||||
$tlx_where = array_merge($where2, ['ProductId' => ['in', $product_enum::$tlxj], 'OrderState' => $product_order_enum::$AutoRefundOver]);
|
||||
$refund_tlx_info = $product_order_model->field('ProductId,PackageName,RefundRestTime,ConnectCount')->where($tlx_where)->where($where1)->fetchAll();
|
||||
$tiantian_refund = [];
|
||||
$laoying_refund = [];
|
||||
$xianfeng_refund = [];
|
||||
$jinrui_refund = [];
|
||||
$mogu_refund = [];
|
||||
foreach ($refund_tlx_info as $info) {
|
||||
switch ($info['ProductId']) {
|
||||
case $product_enum::$tiantian:
|
||||
@@ -140,11 +147,15 @@ foreach ($refund_tlx_info as $info) {
|
||||
case $product_enum::$jinrui:
|
||||
$jinrui_refund[] = $info;
|
||||
break;
|
||||
case $product_enum::$mogu:
|
||||
$mogu_refund[] = $info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$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['wanmei'] = $yesterday_data['wanmei'] - no_jike($wanmei) + ($buyi_data['wanmei'] ?? 0);
|
||||
$list['jinqiao'] = $yesterday_data['jinqiao'] - no_jike($jinqiao) + ($buyi_data['jinqiao'] ?? 0);
|
||||
@@ -165,6 +176,9 @@ $list['laoying'] = $yesterday_data['laoying'] - $laoying_rule_result['cost'] + $
|
||||
$xianfeng_rule_result = xianfeng($xianfeng, $xianfeng_refund);
|
||||
$list['xianfeng'] = $yesterday_data['xianfeng'] - $xianfeng_rule_result['cost'] + $xianfeng_rule_result['refund'] + ($buyi_data['xianfeng'] ?? 0);
|
||||
|
||||
$mogu_rule_result = mogu($mogu, $mogu_refund);
|
||||
$list['mogu'] = $yesterday_data['mogu'] - $mogu_rule_result['cost'] + $mogu_rule_result['refund'] + ($buyi_data['mogu'] ?? 0);
|
||||
|
||||
$jinrui_rule_result = jinrui($jinrui, $jinrui_refund);
|
||||
$list['jinrui'] = $yesterday_data['jinrui'] - $jinrui_rule_result['cost'] + $jinrui_rule_result['refund'] + ($buyi_data['jinrui'] ?? 0);
|
||||
|
||||
@@ -202,6 +216,35 @@ function jike($product)
|
||||
return $count;
|
||||
}
|
||||
|
||||
//西瓜每日消费规则
|
||||
function xigua($product)
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 5;
|
||||
break;
|
||||
case '周卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 20;
|
||||
break;
|
||||
case '月卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 60;
|
||||
break;
|
||||
case '季卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 155;
|
||||
break;
|
||||
case '双月卡(送一月)':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 155;
|
||||
break;
|
||||
case '年卡':
|
||||
$count += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 550;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
//星星,无尽,完美,金桥,无限,实惠,共享通用规则
|
||||
function no_jike($product)
|
||||
{
|
||||
@@ -478,6 +521,78 @@ function xianfeng($product, $refunds)
|
||||
return $count;
|
||||
}
|
||||
|
||||
//蘑菇规则
|
||||
function mogu($product, $refunds)
|
||||
{
|
||||
$cost = 0;
|
||||
foreach ($product as $package) {
|
||||
switch ($package['PackageName']) {
|
||||
case '天卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 3;
|
||||
|
||||
break;
|
||||
case '周卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 15;
|
||||
|
||||
break;
|
||||
case '月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 40;
|
||||
|
||||
break;
|
||||
case '月卡(活动)':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 40;
|
||||
|
||||
break;
|
||||
case '季卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 120;
|
||||
|
||||
break;
|
||||
|
||||
case '双月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 80;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$refund = 0;
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
case '天卡':
|
||||
if ((86400 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 3;
|
||||
}
|
||||
break;
|
||||
case '周卡':
|
||||
if ((86400 * 7 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 15;
|
||||
}
|
||||
break;
|
||||
case '月卡':
|
||||
if ((86400 * 30 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 40;
|
||||
}
|
||||
break;
|
||||
case '月卡(活动)':
|
||||
if ((86400 * 30 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 40;
|
||||
}
|
||||
break;
|
||||
case '季卡':
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 120;
|
||||
}
|
||||
break;
|
||||
case '双月卡':
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 80;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$count['cost'] = $cost;
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
}
|
||||
//金瑞规则
|
||||
function jinrui($product, $refunds)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user