56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
/*
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Author: kangkang
|
|
* @Date: 2020-10-03 18:23:43
|
|
* @LastEditors: Please set LastEditors
|
|
* @LastEditTime: 2020-12-05 19:52:44
|
|
*/
|
|
$is_script = 1;
|
|
include_once __DIR__ . '/../../index.php';
|
|
|
|
use app\api\model\ProductOrder as ProductOrderModel;
|
|
use enum\order\ProductOrder as ProductOrderEnum;
|
|
use app\manager\model\ProductAccount;
|
|
|
|
$product_order_model = new ProductOrderModel;
|
|
$product_order_enum = new ProductOrderEnum;
|
|
$product_account_model = new ProductAccount;
|
|
|
|
// SELECT * FROM `product_order` WHERE OrderType=5 AND UpdateTime<'2020-12-06' AND UpdateTime>'2020-12-03' AND ProductId IN(3,7,9,10,15,16)
|
|
$list = $product_order_model->getList("OrderType=5 AND UpdateTime<'2020-12-06' AND UpdateTime>'2020-12-03' AND ProductId IN(3,7,9,10,15,16)");
|
|
|
|
$account_list = [];
|
|
|
|
$order_list = [];
|
|
|
|
foreach ($list as $info){
|
|
$account_list[] = $info['Accounts'];
|
|
$order_list[$info['Accounts']] = $info;
|
|
}
|
|
|
|
$account_model_list = $product_account_model->getList(['Account'=>['in',$account_list]]);
|
|
foreach ($account_model_list as $account) {
|
|
$endtime = strtotime($account['EndTime']) + handle_time($order_list[$account['Account']]['RefundRestTime']);
|
|
$data['EndTime'] = date('Y-m-d H:i:s', $endtime);
|
|
$product_account_model->updateOne(['Account'=>$account['Account']], $data);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将剩余时间进行处理切割转换为秒
|
|
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[0] * 60;
|
|
return $time;
|
|
} |