This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-10-28 17:56:50
|
||||
* @LastEditors: kangkang
|
||||
* @LastEditTime: 2020-10-28 20:39:18
|
||||
* @LastEditTime: 2020-10-29 12:02:16
|
||||
*/
|
||||
namespace enum\product;
|
||||
|
||||
@@ -49,8 +49,8 @@ class Product
|
||||
public static $shihui = 16;
|
||||
|
||||
//强子、讯连
|
||||
public static $qx = [1,2];
|
||||
public static $qx = [1, 2];
|
||||
|
||||
//天天老鹰先锋
|
||||
public static $tlx = [5,6,14];
|
||||
//天天老鹰先锋 金瑞
|
||||
public static $tlxj = [4, 5, 6, 14];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-10-03 18:23:43
|
||||
* @LastEditors: kangkang
|
||||
* @LastEditTime: 2020-10-29 10:46:48
|
||||
* @LastEditTime: 2020-10-29 12:08:30
|
||||
*/
|
||||
$is_script = 1;
|
||||
include __DIR__ . '/../index.php';
|
||||
@@ -40,7 +40,7 @@ ProductId, PackageName,
|
||||
CASE OrderType
|
||||
WHEN 3 THEN ConnectCount
|
||||
WHEN 4 THEN ConnectCount
|
||||
ELSE 0 END) 'AgainBuyCount',
|
||||
ELSE 0 END) 'AgainBuyCount'
|
||||
|
||||
";
|
||||
|
||||
@@ -96,7 +96,7 @@ foreach ($data as $product) {
|
||||
}
|
||||
|
||||
//强子讯连专门处理退款
|
||||
$qx_where = array_merge($where2, ['ProductId' => ['in', $product_enum::$qx], 'OrderState' => ['in', $product_order_enum::$Refunds], 'ConnectCount' => 1, 'OrderType' => $product_order_enum::$New]);
|
||||
$qx_where = array_merge($where2, ['ProductId' => ['in', $product_enum::$qx], 'OrderState' => ['in', $product_order_enum::$Refunds], 'ConnectCount' => 1, 'OrderType' => $product_order_enum::$Refund]);
|
||||
$refund_qx_info = $product_order_model->field('ProductId,PackageName,RefundRestTime')->where($qx_where)->where($where1)->fetchAll();
|
||||
$qiangzi_refund = [];
|
||||
$xunlian_refund = [];
|
||||
@@ -110,12 +110,14 @@ foreach ($refund_qx_info as $info) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//天天老鹰先锋的退款
|
||||
$tlx_where = array_merge($where2, ['ProductId' => ['in', $product_enum::$tlx], 'OrderState' => ['in', $product_order_enum::$Refunds]]);
|
||||
$refund_tlx_info = $product_order_model->field('ProductId,PackageName,RefundRestTime,ConnectCount')->where($qx_where)->where($where1)->fetchAll();
|
||||
$tlx_where = array_merge($where2, ['ProductId' => ['in', $product_enum::$tlxj], 'OrderState' => ['in', $product_order_enum::$Refunds]]);
|
||||
$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 = [];
|
||||
foreach ($refund_tlx_info as $info) {
|
||||
switch ($info['ProductId']) {
|
||||
case $product_enum::$tiantian:
|
||||
@@ -127,34 +129,39 @@ foreach ($refund_tlx_info as $info) {
|
||||
case $product_enum::$xianfengpptp:
|
||||
$xianfeng_refund[] = $info;
|
||||
break;
|
||||
case $product_enum::$jinrui:
|
||||
$jinrui_refund[] = $info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$list = [];
|
||||
$list['xingxing'] = $yesterday_data['xingxing']-no_jike($xingxing);
|
||||
$list['jike'] = $yesterday_data['jike']-jike($jike);
|
||||
$list['wujin'] = $yesterday_data['wujin']-no_jike($wujin);
|
||||
$list['wanmei'] = $yesterday_data['wanmei']-no_jike($wanmei);
|
||||
$list['jinqiao'] = $yesterday_data['jinqiao']-no_jike($jinqiao);
|
||||
$list['wuxian'] = $yesterday_data['wuxian']-no_jike($wuxian);
|
||||
$list['shihui'] = $yesterday_data['shihui']-no_jike($shihui);
|
||||
$list['gongxiang'] = $yesterday_data['gongxiang']-no_jike($gongxiang);
|
||||
$list['xingxing'] = $yesterday_data['xingxing'] - no_jike($xingxing);
|
||||
$list['jike'] = $yesterday_data['jike'] - jike($jike);
|
||||
$list['wujin'] = $yesterday_data['wujin'] - no_jike($wujin);
|
||||
$list['wanmei'] = $yesterday_data['wanmei'] - no_jike($wanmei);
|
||||
$list['jinqiao'] = $yesterday_data['jinqiao'] - no_jike($jinqiao);
|
||||
$list['wuxian'] = $yesterday_data['wuxian'] - no_jike($wuxian);
|
||||
$list['shihui'] = $yesterday_data['shihui'] - no_jike($shihui);
|
||||
$list['gongxiang'] = $yesterday_data['gongxiang'] - no_jike($gongxiang);
|
||||
|
||||
$qiangzi_rule_result = qx_rule($qiangzi,$qiangzi_refund);
|
||||
$xunlian_rule_result = qx_rule($xunlian,$xunlian_refund);
|
||||
$list['qiangzi'] = $yesterday_data['qiangzi']-$qiangzi_rule_result['cost']+$qiangzi_rule_result['refund'];
|
||||
$list['xunlian'] = $yesterday_data['xunlian']-$xunlian_rule_result['cost']+$xunlian_rule_result['refund'];
|
||||
$qiangzi_rule_result = qx_rule($qiangzi, $qiangzi_refund);
|
||||
$xunlian_rule_result = qx_rule($xunlian, $xunlian_refund);
|
||||
$list['qiangzi'] = $yesterday_data['qiangzi'] - $qiangzi_rule_result['cost'] + $qiangzi_rule_result['refund'];
|
||||
$list['xunlian'] = $yesterday_data['xunlian'] - $xunlian_rule_result['cost'] + $xunlian_rule_result['refund'];
|
||||
|
||||
$tiantian_rule_result = tl_rule($tiantian,$tiantian_refund);
|
||||
$laoying_rule_result = tl_rule($laoying,$laoying_refund);
|
||||
$list['tiantian'] = $yesterday_data['tiantian']-$tiantian_rule_result['cost']+$tiantian_rule_result['refund'];
|
||||
$list['laoying'] = $yesterday_data['laoying']-$laoying_rule_result['cost']+$laoying_rule_result['refund'];
|
||||
$tiantian_rule_result = tl_rule($tiantian, $tiantian_refund);
|
||||
$laoying_rule_result = tl_rule($laoying, $laoying_refund);
|
||||
$list['tiantian'] = $yesterday_data['tiantian'] - $tiantian_rule_result['cost'] + $tiantian_rule_result['refund'];
|
||||
$list['laoying'] = $yesterday_data['laoying'] - $laoying_rule_result['cost'] + $laoying_rule_result['refund'];
|
||||
|
||||
$xianfeng_rule_result = xianfeng($xianfeng,$xianfeng_refund);
|
||||
$list['xianfeng'] = $yesterday_data['xianfeng']-$xianfeng_rule_result['cost']+$xianfeng_rule_result['refund'];
|
||||
$xianfeng_rule_result = xianfeng($xianfeng, $xianfeng_refund);
|
||||
$list['xianfeng'] = $yesterday_data['xianfeng'] - $xianfeng_rule_result['cost'] + $xianfeng_rule_result['refund'];
|
||||
|
||||
dump($list);
|
||||
$jinrui_rule_result = xianfeng($jinrui, $jinrui_refund);
|
||||
$list['jinrui'] = $yesterday_data['jinrui'] - $jinrui_rule_result['cost'] + $xianfeng_rule_result['refund'];
|
||||
|
||||
$list['riqi'] = date('Y-m-d H:i:s');
|
||||
dump($finance->add($list));
|
||||
|
||||
//极客每日消费规则
|
||||
function jike($product)
|
||||
@@ -240,19 +247,19 @@ function qx_rule($product, $refunds)
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
case '天卡':
|
||||
$refund += handle_time($info['RefundRestTime'])/86400 * 10;
|
||||
$refund += handle_time($info['RefundRestTime']) / 86400 * 10;
|
||||
break;
|
||||
case '周卡':
|
||||
$refund += handle_time($info['RefundRestTime'])/86400 * (60 / 7);
|
||||
$refund += handle_time($info['RefundRestTime']) / 86400 * (60 / 7);
|
||||
break;
|
||||
case '月卡':
|
||||
$refund += handle_time($info['RefundRestTime'])/86400 * (200 / 30);
|
||||
$refund += handle_time($info['RefundRestTime']) / 86400 * (200 / 30);
|
||||
break;
|
||||
case '季卡':
|
||||
$refund += handle_time($info['RefundRestTime'])/86400 * (600 / 90);
|
||||
$refund += handle_time($info['RefundRestTime']) / 86400 * (600 / 90);
|
||||
break;
|
||||
case '年卡':
|
||||
$refund += handle_time($info['RefundRestTime'])/86400 * (2400 / 365);
|
||||
$refund += handle_time($info['RefundRestTime']) / 86400 * (2400 / 365);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -292,38 +299,38 @@ function tl_rule($product, $refunds)
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
case '天卡':
|
||||
if ((86400-handle_time( $info['RefundRestTime'])) <1800) {
|
||||
if ((86400 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 4;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 4 - (86400-handle_time( $info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
$refund += $info['ConnectCount'] * 4 - (86400 - handle_time($info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
}
|
||||
break;
|
||||
case '周卡':
|
||||
if ((86400*7-handle_time( $info['RefundRestTime'])) <1800) {
|
||||
if ((86400 * 7 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 20;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 20 -(86400*7-handle_time( $info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
$refund += $info['ConnectCount'] * 20 - (86400 * 7 - handle_time($info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
}
|
||||
break;
|
||||
case '月卡':
|
||||
if ((86400*30-handle_time( $info['RefundRestTime'])) <1800) {
|
||||
if ((86400 * 30 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 60;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 60 -(86400*30-handle_time( $info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
$refund += $info['ConnectCount'] * 60 - (86400 * 30 - handle_time($info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
}
|
||||
break;
|
||||
case '季卡':
|
||||
if ((86400*90-handle_time( $info['RefundRestTime'])) <1800) {
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 180;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 180 -(86400*90-handle_time( $info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
$refund += $info['ConnectCount'] * 180 - (86400 * 90 - handle_time($info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
}
|
||||
break;
|
||||
case '年卡':
|
||||
if ((86400*365-handle_time( $info['RefundRestTime'])) <1800) {
|
||||
if ((86400 * 365 - handle_time($info['RefundRestTime'])) < 1800) {
|
||||
$refund += $info['ConnectCount'] * 7200;
|
||||
} else {
|
||||
$refund += $info['ConnectCount'] * 720 -(86400*365-handle_time( $info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
$refund += $info['ConnectCount'] * 720 - (86400 * 365 - handle_time($info['RefundRestTime'])) * $info['ConnectCount'] * 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -333,7 +340,7 @@ function tl_rule($product, $refunds)
|
||||
return $count;
|
||||
}
|
||||
//先锋规则
|
||||
function xianfeng($product,$refunds)
|
||||
function xianfeng($product, $refunds)
|
||||
{
|
||||
$cost = 0;
|
||||
foreach ($product as $package) {
|
||||
@@ -364,27 +371,27 @@ function xianfeng($product,$refunds)
|
||||
foreach ($refunds as $info) {
|
||||
switch ($info['PackageName']) {
|
||||
case '天卡':
|
||||
if ((86400-handle_time( $info['RefundRestTime'])) <10800) {
|
||||
if ((86400 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 3;
|
||||
}
|
||||
break;
|
||||
case '周卡':
|
||||
if ((86400*7-handle_time( $info['RefundRestTime'])) <10800) {
|
||||
if ((86400 * 7 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 18;
|
||||
}
|
||||
break;
|
||||
case '月卡':
|
||||
if ((86400*30-handle_time( $info['RefundRestTime'])) <10800) {
|
||||
if ((86400 * 30 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 60;
|
||||
}
|
||||
break;
|
||||
case '季卡':
|
||||
if ((86400*90-handle_time( $info['RefundRestTime'])) <10800) {
|
||||
if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 168;
|
||||
}
|
||||
break;
|
||||
case '年卡':
|
||||
if ((86400*365-handle_time( $info['RefundRestTime'])) <10800) {
|
||||
if ((86400 * 365 - handle_time($info['RefundRestTime'])) < 10800) {
|
||||
$refund += $info['ConnectCount'] * 636;
|
||||
}
|
||||
break;
|
||||
@@ -395,12 +402,50 @@ function xianfeng($product,$refunds)
|
||||
return $count;
|
||||
}
|
||||
|
||||
//金瑞规则
|
||||
function jinrui($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']) * 20;
|
||||
|
||||
break;
|
||||
case '月卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 60;
|
||||
|
||||
break;
|
||||
case '季卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 180;
|
||||
|
||||
break;
|
||||
case '年卡':
|
||||
$cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 720;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$refund = 0;
|
||||
foreach ($refunds as $info) {
|
||||
$refund += handle_time($info['RefundRestTime'])/86400*2*$info['ConnectCount'];
|
||||
}
|
||||
$count['cost'] = $cost;
|
||||
$count['refund'] = $refund;
|
||||
return $count;
|
||||
}
|
||||
|
||||
//将剩余时间进行处理切割转换为秒
|
||||
function handle_time($rest_time)
|
||||
{
|
||||
$time1 = explode('天', $rest_time);
|
||||
$time2 = explode('时', $time1[1]);
|
||||
$time3 = explode('分', $time2[1]);
|
||||
$time = $time1[0] * 86400 + $time2[0] * 3600 + $time3 * 60;
|
||||
|
||||
$time = $time1[0] * 86400 + $time2[0] * 3600 + $time3[0] * 60;
|
||||
return $time;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user