极客失败
This commit is contained in:
@@ -3,40 +3,134 @@
|
||||
$is_script = 1;
|
||||
include_once __DIR__ . '/../../index.php';
|
||||
|
||||
use app\order\model\CashOut as CashMoedl;
|
||||
use app\order\model\User as UserModel;
|
||||
use app\order\model\UserScore as ScoreModel;
|
||||
// use app\order\model\CashOut as CashMoedl;
|
||||
// use app\order\model\User as UserModel;
|
||||
// use app\order\model\UserScore as ScoreModel;
|
||||
use app\order\model\ProductOrder as OrderModel;
|
||||
|
||||
$file_path = './qzxlrefund.csv';
|
||||
//极客
|
||||
|
||||
$file_path = './jikerefund.csv';
|
||||
$file = fopen($file_path, 'r');
|
||||
|
||||
$order_model = new OrderModel;
|
||||
|
||||
$data = [];
|
||||
while ($info = fgetcsv($file)) {
|
||||
$user_model = new UserModel;
|
||||
$user_info = $user_model->getOne(['LoginCode' => $info['0']]);
|
||||
$time = explode('月',$info[12]);
|
||||
$redund_time = strtotime('2020-'.$time[0].'-'.$time[1])+mt_rand(0,86400);
|
||||
$real_day = 7;
|
||||
if($info[5]==64){
|
||||
$real_day = 30;
|
||||
} elseif($info[5]==65) {
|
||||
$real_day = 90;
|
||||
} elseif($info[5]==67) {
|
||||
$real_day = 90;
|
||||
}
|
||||
$info10 = explode(' ',$info[10]);
|
||||
$info101 = explode('/',$info10[0]);
|
||||
$info[10] = $info101[0].'-'.$info101[1].'-'.$info101[2].' '.$info10[1];
|
||||
// echo $info[10];
|
||||
$end_time = strtotime($info[10])+$real_day*86400;
|
||||
$rest_time = handle_time($end_time-$redund_time);
|
||||
if(($end_time-$redund_time)<0){
|
||||
$rest_time = '0天'.mt_rand(0,23).'时'.mt_rand(0,59).'分';
|
||||
}
|
||||
|
||||
$user_rest = $user_info['RestAmount'];
|
||||
|
||||
$rest = $user_rest + $info['1'];
|
||||
$user_model->where(['Id' => $user_info['Id']])->update(['RestAmount' => $rest]);
|
||||
$score = new ScoreModel;
|
||||
$score_data = [
|
||||
'UserId' => $user_info['Id'],
|
||||
'ScoreType' => 1,
|
||||
'ScoreTypeName' => '强子迅联失败订单补款金额',
|
||||
'ScoreValue' => $info[1],
|
||||
'UserName' => $info[0],
|
||||
'OperateUserName' => 'script',
|
||||
'RestAmount1' => $user_rest,
|
||||
'RestAmount2' => $rest,
|
||||
'CreateTime' => date('Y-m-d H:i:s', time()),
|
||||
'UpdateTime' => date('Y-m-d H:i:s', time()),
|
||||
'TenantId' => 0,
|
||||
'DeleteTag' => 0,
|
||||
$redund_time_real = date('Y-m-d H:i:s',$redund_time);
|
||||
$temp = [
|
||||
'TenantId'=>0,
|
||||
'UserId'=>$info[1],
|
||||
'UserName'=>$info[2],
|
||||
'ProductId'=>$info[3],
|
||||
'ProductName'=>$info[4],
|
||||
'PackageId'=>$info[5],
|
||||
'PackageName'=>$info[6],
|
||||
'CouponId'=>0,
|
||||
'OriginKey'=>null,
|
||||
'OrderName'=>'极客pptp',
|
||||
'OrderNo'=>'tk2020121311111111',
|
||||
'TradeNo'=>null,
|
||||
'OrderState'=>30,
|
||||
'OrderType'=>5,
|
||||
'PayType'=>10,
|
||||
'PayState'=>0,
|
||||
'ConnectCount'=>$info[9],
|
||||
'OrderAmount'=>0,
|
||||
'PaymentAmount'=>0,
|
||||
'OtherPayAmount'=>0,
|
||||
'AccountPayAmount'=>0,
|
||||
'CouponAmount'=>null,
|
||||
'DayPrice'=>5,
|
||||
'DayCount'=>$real_day,
|
||||
'RefundCount'=>1,
|
||||
'RefundAmount'=>0,
|
||||
'RefundRestTime'=>$rest_time,
|
||||
'ClientType'=>0,
|
||||
'Channel'=>null,
|
||||
'ChannelType'=>0,
|
||||
'CreateTime'=> $redund_time_real,
|
||||
'UpdateTime'=> $redund_time_real,
|
||||
'Accounts'=>$info[7],
|
||||
'AccountCount'=>1,
|
||||
'AccountPwd'=>$info[8],
|
||||
'Remark'=>'退款',
|
||||
'DeleteTag'=>0,
|
||||
'StartTime'=>$info[10],
|
||||
'EndTime'=>$info[11],
|
||||
'PayChannel'=>30,
|
||||
'IsAutoRefund'=>0,
|
||||
'BackAmount'=>1001,
|
||||
'RefundReason'=>null,
|
||||
];
|
||||
$score->add($score_data);
|
||||
|
||||
// print_r($info);die;
|
||||
$data[] = $temp;
|
||||
}
|
||||
fclose($file);
|
||||
|
||||
$order_model->addAll($data);
|
||||
|
||||
//将剩余时间进行处理切割转换为秒
|
||||
function handle_time($rest_time)
|
||||
{
|
||||
$time = '';
|
||||
$day = floor($rest_time/86400);
|
||||
$h = floor(($rest_time - $day*86400)/3600);
|
||||
$s = floor(($rest_time - $day*86400 - $h*3600)/60);
|
||||
return $day.'天'.$h.'时'.$s.'分';
|
||||
}
|
||||
|
||||
|
||||
|
||||
//补款
|
||||
// $file_path = './qzxlrefund.csv';
|
||||
// $file = fopen($file_path, 'r');
|
||||
// while ($info = fgetcsv($file)) {
|
||||
// $user_model = new UserModel;
|
||||
// $user_info = $user_model->getOne(['LoginCode' => $info['0']]);
|
||||
|
||||
// $user_rest = $user_info['RestAmount'];
|
||||
|
||||
// $rest = $user_rest + $info['1'];
|
||||
// $user_model->where(['Id' => $user_info['Id']])->update(['RestAmount' => $rest]);
|
||||
// $score = new ScoreModel;
|
||||
// $score_data = [
|
||||
// 'UserId' => $user_info['Id'],
|
||||
// 'ScoreType' => 1,
|
||||
// 'ScoreTypeName' => '强子迅联失败订单补款金额',
|
||||
// 'ScoreValue' => $info[1],
|
||||
// 'UserName' => $info[0],
|
||||
// 'OperateUserName' => 'script',
|
||||
// 'RestAmount1' => $user_rest,
|
||||
// 'RestAmount2' => $rest,
|
||||
// 'CreateTime' => date('Y-m-d H:i:s', time()),
|
||||
// 'UpdateTime' => date('Y-m-d H:i:s', time()),
|
||||
// 'TenantId' => 0,
|
||||
// 'DeleteTag' => 0,
|
||||
// ];
|
||||
// $score->add($score_data);
|
||||
|
||||
// // print_r($info);die;
|
||||
// }
|
||||
// fclose($file);
|
||||
// foreach ($tixian as $info){
|
||||
// $id = $info['id'];
|
||||
// $user_model = new UserModel;
|
||||
@@ -63,4 +157,80 @@ fclose($file);
|
||||
// $data['op_user'] = 'auto';
|
||||
// $data['remark'] = '因我司支付宝账户被公安暂时冻结,故无法资金转出,我司正与公安协调处理此事,你可用余额消费,如需继续提现,您可再次申请,我司将在账户解冻后第一时间处理。';
|
||||
// $cash->where(['id' => $id])->update($data);
|
||||
// }
|
||||
|
||||
//星星服务器
|
||||
// $file_path = './xingxing.csv';
|
||||
// $file = fopen($file_path, 'r');
|
||||
// $data = [];
|
||||
// while ($info = fgetcsv($file)) {
|
||||
// $data[] = $info;
|
||||
// }
|
||||
// fclose($file);
|
||||
|
||||
// $xingxing_f = fopen(__DIR__ . '/xingxingformat.csv', 'w');
|
||||
// //写入星星文件
|
||||
// xingxing_getList($data, $xingxing_f);
|
||||
// fclose($xingxing_f);
|
||||
|
||||
// //星星服务器
|
||||
// //星星服务器解析
|
||||
// function xingxing_getList($data, &$file)
|
||||
// {
|
||||
// $province_record = [];
|
||||
// $key = '';
|
||||
// $list1 = [];
|
||||
// //省会
|
||||
// $province = ['黑龙', '内蒙'];
|
||||
// $citys = ['北京', '上海', '天津', '重庆'];
|
||||
// foreach ($data as $info) {
|
||||
|
||||
// $record = [];
|
||||
// $record['name'] = '星星';
|
||||
// $province_detail = mb_substr($info['1'], 0, 2);
|
||||
// if (in_array($province_detail, $province)) {
|
||||
// $province_detail = mb_substr($info['1'], 0, 3);
|
||||
// $info['1'] = mb_substr($info['1'], 3);
|
||||
// } elseif (!in_array($province_detail, $citys)) {
|
||||
// $info['1'] = mb_substr($info['1'], 2);
|
||||
// }
|
||||
// if (!in_array($province_detail, $province_record)) {
|
||||
// $record['city'] = $province_detail;
|
||||
// $province_record[] = $province_detail;
|
||||
// $key = $province_detail;
|
||||
// $list1[$key][] = $record;
|
||||
// }
|
||||
// $city_ex = explode('电信', $info['1']);
|
||||
// if (strpos($info['1'], '电信') !== false) {
|
||||
// $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
|
||||
// $record['supply'] = '电信';
|
||||
// } elseif (strpos($info['1'], '联通') !== false) {
|
||||
// $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
|
||||
// $record['supply'] = '联通';
|
||||
// } elseif (strpos($info['1'], '移动') !== false) {
|
||||
// $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
|
||||
// $record['supply'] = '移动';
|
||||
// } else {
|
||||
// $record['city'] = $info['1'];
|
||||
// $record['supply'] = '电信/联通';
|
||||
// }
|
||||
|
||||
// $record['ip'] = '';
|
||||
// $record['daikuan'] = '50M';
|
||||
// $record['onlineuser'] = '';
|
||||
// $record['maxuser'] = '';
|
||||
// $record['online'] = '正常';
|
||||
// $record['status'] = '正常';
|
||||
// $record['nasname'] = $info[0];
|
||||
// $key = $province_detail;
|
||||
// $list1[$key][] = $record;
|
||||
// }
|
||||
// // print_r($list1);die;
|
||||
// foreach ($list1 as $val) {
|
||||
// foreach ($val as $net_data) {
|
||||
|
||||
// fputcsv($file, $net_data);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
Reference in New Issue
Block a user