总后台微信退款逻辑
This commit is contained in:
parent
296953484b
commit
3ee83dcc86
@ -8,6 +8,8 @@ use app\admin\lists\store_order\StoreOrderLists;
|
|||||||
use app\admin\lists\store_order\StoreRefundOrderLists;
|
use app\admin\lists\store_order\StoreRefundOrderLists;
|
||||||
use app\admin\logic\store_order\StoreOrderLogic;
|
use app\admin\logic\store_order\StoreOrderLogic;
|
||||||
use app\admin\validate\store_order\StoreOrderValidate;
|
use app\admin\validate\store_order\StoreOrderValidate;
|
||||||
|
use app\common\logic\PayNotifyLogic;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,5 +103,31 @@ class StoreOrderController extends BaseAdminController
|
|||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款逻辑
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function refund()
|
||||||
|
{
|
||||||
|
$params = (new StoreOrderValidate())->goCheck('refund');
|
||||||
|
$detail = StoreOrder::where('order_id',$params['order_id'])->findOrEmpty();
|
||||||
|
if(empty($detail)){
|
||||||
|
return $this->fail('无该订单请检查');
|
||||||
|
}
|
||||||
|
$money = bcmul($detail['pay_price'],100);
|
||||||
|
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
|
||||||
|
->refund($params['order_id'],$money,$money);
|
||||||
|
if($refund){
|
||||||
|
$arr = [
|
||||||
|
'amount'=>[
|
||||||
|
'refund'=>$money
|
||||||
|
]
|
||||||
|
];
|
||||||
|
PayNotifyLogic::refund($params['order_id'],$arr);
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
return $this->fail('退款失败');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -20,6 +20,7 @@ class StoreOrderValidate extends BaseValidate
|
|||||||
*/
|
*/
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'id' => 'require',
|
'id' => 'require',
|
||||||
|
'order_id' => 'require',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -29,8 +30,17 @@ class StoreOrderValidate extends BaseValidate
|
|||||||
*/
|
*/
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
|
'order_id' => '订单编号',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return StoreOrderValidate
|
||||||
|
*/
|
||||||
|
public function sceneRefund()
|
||||||
|
{
|
||||||
|
return $this->only(['order_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 添加场景
|
* @notes 添加场景
|
||||||
|
Loading…
x
Reference in New Issue
Block a user