|
@@ -67,12 +67,12 @@ class Timedtask extends Controller
|
|
$config = SystemConfig('merchant_config');
|
|
$config = SystemConfig('merchant_config');
|
|
$timeout = $config['refund_time'];
|
|
$timeout = $config['refund_time'];
|
|
$time = date('Y-m-d H:i:s',time()-($timeout*60*60));
|
|
$time = date('Y-m-d H:i:s',time()-($timeout*60*60));
|
|
-
|
|
|
|
|
|
+ $lists = ShopOrder::mk()->where('status',7)->where('refund_time','<',$time)->count();
|
|
ShopOrder::mk()->where('status',7)->where('refund_time','<',$time)->chunk(20,function ($list){
|
|
ShopOrder::mk()->where('status',7)->where('refund_time','<',$time)->chunk(20,function ($list){
|
|
$list = $list->toArray();
|
|
$list = $list->toArray();
|
|
foreach ($list as &$v){
|
|
foreach ($list as &$v){
|
|
//同意退款
|
|
//同意退款
|
|
- $pay_money = ShopOrderPay::mk()->where(['status' => 2, 'pay_no'=>$v['payment_trade']])->value('money');
|
|
|
|
|
|
+ $pay_money = ShopOrderPay::mk()->where(['pay_no'=>$v['payment_trade']])->value('money');
|
|
if($v['payment_type']=='支付宝支付') {
|
|
if($v['payment_type']=='支付宝支付') {
|
|
$result = json_decode(Order::refund_order($v['payment_trade'], $v['refund_money']), true);
|
|
$result = json_decode(Order::refund_order($v['payment_trade'], $v['refund_money']), true);
|
|
}
|
|
}
|
|
@@ -82,7 +82,8 @@ class Timedtask extends Controller
|
|
if($result) {
|
|
if($result) {
|
|
ShopOrder::mk()->where('id',$v['id'])->save(['status' => 8, 'refund_status' => 2, 'dk_time' => date('Y-m-d H:i:s')]);
|
|
ShopOrder::mk()->where('id',$v['id'])->save(['status' => 8, 'refund_status' => 2, 'dk_time' => date('Y-m-d H:i:s')]);
|
|
}else{
|
|
}else{
|
|
-// $this->error('微信账户余额不足');
|
|
|
|
|
|
+
|
|
|
|
+ // $this->error('微信账户余额不足',[$v['payment_trade'],$v['refund_money'],$pay_money]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -116,10 +117,24 @@ class Timedtask extends Controller
|
|
//// $this->error('微信账户余额不足');
|
|
//// $this->error('微信账户余额不足');
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
- $this->success('执行完毕');
|
|
|
|
|
|
+ $this->success('执行完毕',$lists);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function wxt(){
|
|
|
|
+ $data = input();
|
|
|
|
+ $config = SystemConfig('merchant_config');
|
|
|
|
+ $timeout = $config['refund_time'];
|
|
|
|
+ $time = date('Y-m-d H:i:s',time()-($timeout*60*60));
|
|
|
|
+ $find = ShopOrder::mk()->where('status',7)->where('refund_time','<',$time)->where('id',$data['id'])->find();
|
|
|
|
+ if($find['payment_type']=='微信支付') {
|
|
|
|
+ $pay_money = ShopOrderPay::mk()->where(['pay_no'=>$find['payment_trade']])->value('money');
|
|
|
|
+ $result = Order::wxrefund_order($find['payment_trade'], $find['refund_money'],$pay_money);
|
|
|
|
+ //$result = json_decode(Order::wxrefund_order($find['payment_trade'], $find['refund_money'],$pay_money), true);
|
|
|
|
+ dump($result);die;
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 订单自动确认收货
|
|
* 订单自动确认收货
|
|
*/
|
|
*/
|