diff --git a/app/order/controller/CashOutAdmin.php b/app/order/controller/CashOutAdmin.php index 18a1b93..ddbb714 100644 --- a/app/order/controller/CashOutAdmin.php +++ b/app/order/controller/CashOutAdmin.php @@ -5,7 +5,7 @@ * @Author: kangkang * @Date: 2020-10-11 11:22:56 * @LastEditors: kangkang - * @LastEditTime: 2020-10-28 15:53:26 + * @LastEditTime: 2020-11-02 11:04:32 */ namespace app\order\controller; @@ -99,7 +99,7 @@ class CashOutAdmin extends Controller $data['alipay_no'] = $result->alipay_fund_trans_uni_transfer_response->order_id; $data['status'] = 1; } else { - die; + result([],'',30000); } } else if ($data['status'] == '2') { $user_model = new UserModel; diff --git a/app/order/controller/FinanceCheck.php b/app/order/controller/FinanceCheck.php index 797c164..043c5a9 100644 --- a/app/order/controller/FinanceCheck.php +++ b/app/order/controller/FinanceCheck.php @@ -5,7 +5,7 @@ * @Author: kangkang * @Date: 2020-10-13 19:52:37 * @LastEditors: kangkang - * @LastEditTime: 2020-10-30 16:26:53 + * @LastEditTime: 2020-11-02 11:35:58 */ /* * @Descripttion: @@ -74,24 +74,33 @@ class FinanceCheck extends Controller $data = json_decode(file_get_contents("php://input"), true); $userinfo = $this->userinfo; $data['op_person'] = $userinfo['LoginName']; - $data['riqi'] = date('Y-m-d',strtotime($data['riqi'])+86400); + $data['riqi'] = date('Y-m-d', strtotime($data['riqi']) + 86400); $finance_model = new FinanceModel; $finance_operation_model = new FinanceOperationModel; - $finance_data = $finance_model->getOne("date(riqi)='".$data['riqi']."'"); - if(!$finance_data){ + $finance_data = $finance_model->getOne("date(riqi)='" . $data['riqi'] . "'"); + + if (!$finance_data) { $finance_operation_model->add($data); } else { $data['finance_id'] = $finance_data['id']; $finance_buyi = $finance_data[$data['product']] + $data['money']; - $types = ['充值','退款','补差价']; + $types = ['充值', '退款', '补差价']; $finance_update = [ - $data['product']=>$finance_buyi, - 'remark'=>'<'.$finance_data['remark'].$data['product'].'补遗 '.$types[$data['type']-1].$data['money'].'>' + $data['product'] => $finance_buyi, + 'remark' => $finance_data['remark'] .'<'. $data['product'] . '补遗 ' . $types[$data['type'] - 1] . $data['money'] . '>', ]; - if($finance_model->updateOne(['id'=>$finance_data['id']],$finance_update)) + if ($finance_model->updateOne(['id' => $finance_data['id']], $finance_update)) { $finance_operation_model->add($data); - else + + $finance_data_list = $finance_model->getListPage(['id' => ['>', $finance_data['id']]]); + if($finance_data_list) { + foreach($finance_data_list as $info){ + $finance_model->updateOne(['id' => $info['id']], [$data['product'] => $info[$data['product']] + $data['money']]); + } + } + } else { die; + } } \result(); } @@ -105,7 +114,7 @@ class FinanceCheck extends Controller $finance_model = new FinanceOperationModel; $list = $finance_model->getListPage([], '*', 'id desc', "$page,50"); - $types = ['充值','退款','补差价']; + $types = ['充值', '退款', '补差价']; $products = [ 'xingxing' => '星星', 'xianfeng' => '先锋', @@ -123,7 +132,7 @@ class FinanceCheck extends Controller 'gongxiang' => '共享', ]; foreach ($list as $k => &$v) { - $v['type'] = $types[$v['type']-1]; + $v['type'] = $types[$v['type'] - 1]; $v['product'] = $products[$v['product']]; $v['riqi'] = date('Y-m-d', strtotime($v['riqi']) - 86400); } diff --git a/script/finance_check_script.php b/script/finance_check_script.php index 36e07ed..cf907fa 100644 --- a/script/finance_check_script.php +++ b/script/finance_check_script.php @@ -5,7 +5,7 @@ * @Author: kangkang * @Date: 2020-10-03 18:23:43 * @LastEditors: kangkang - * @LastEditTime: 2020-10-30 15:52:27 + * @LastEditTime: 2020-11-02 15:15:16 */ $is_script = 1; include __DIR__ . '/../index.php'; @@ -313,6 +313,10 @@ function tl_rule($product, $refunds) case '年卡': $cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 720; + break; + case '双月卡': + $cost += ($package['NewBuyCount'] + $package['AgainBuyCount']) * 120; + break; } } @@ -323,35 +327,42 @@ function tl_rule($product, $refunds) 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 - ceil((86400 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; } break; case '周卡': 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 - ceil((86400 * 7 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; } break; case '月卡': 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 - ceil((86400 * 30 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; } break; case '季卡': 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 - ceil((86400 * 90 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; } break; case '年卡': 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 - ceil((86400 * 365 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; + } + break; + case '双月卡': + if ((86400 * 90 - handle_time($info['RefundRestTime'])) < 1800) { + $refund += $info['ConnectCount'] * 120; + } else { + $refund += $info['ConnectCount'] * 120 - ceil((86400 * 60 - handle_time($info['RefundRestTime']))/86400) * $info['ConnectCount'] * 4; } break; }