|
@@ -61,25 +61,25 @@ class Order extends SubCommon
|
|
|
}
|
|
|
#退款
|
|
|
public function refund(){
|
|
|
+ $id=input('id',0);
|
|
|
+ $data=input();
|
|
|
if($this->request->isGet()){
|
|
|
- $id=input('id',0);
|
|
|
$model=MobileOrder::where('s_id',$this->auth->id)->find($id);
|
|
|
$this->assign('row',$model);
|
|
|
return view();
|
|
|
}else{
|
|
|
- $data=input('row/a');
|
|
|
$this->validate($data,[
|
|
|
'amount|金额'=>'require|number|egt:0',
|
|
|
]);
|
|
|
Db::startTrans();
|
|
|
- $model=$this->model->where('id',$ids)->lock(true)->findOrFail();
|
|
|
+ $model=MobileOrder::where('s_id',$this->auth->id)->where('id',$id)->lock(true)->findOrFail();
|
|
|
if($data['amount']>$model['amount']){
|
|
|
$this->error('退款金额不能大于付款金额');
|
|
|
}
|
|
|
$model['amount_refund']=$data['amount'];
|
|
|
$model['refund_no']=session_create_id();
|
|
|
Refund::setType($model)->refund();
|
|
|
- $model['status']=\app\common\model\MobileOrder::STATUS_REFUNDED;
|
|
|
+ $model['status']= MobileOrder::STATUS_REFUNDED;
|
|
|
$model->save();
|
|
|
SmsSend::orderRefund($model['phone']);
|
|
|
Db::commit();
|