积分预存款完成

main
yanzai 1 year ago
parent 8f31c52451
commit 3304bb8630

@ -32,9 +32,9 @@ class AspNetZhuanController extends Controller
return true; return true;
} }
//使用预存款 //使用预存款
public static function UseYuCunKuan($hzid,$yucunkuan,$yyid,$yucunkuanleixing,$caozuorenid,$caozuorenmigncheng,$beizhu,$dingdanshijian) public static function UseYuCunKuan($ghzid,$yucunkuan,$yyid,$yucunkuanleixing,$caozuorenid,$caozuorenmigncheng,$beizhu,$dingdanshijian)
{ {
$res = self::Get(self::$JF_BaseUrl . '?type=5' . '&hzid=' . $hzid. '&yucunkuan=' . $yucunkuan.'&yyid='.$yyid.'&yucunkuanleixing='.$yucunkuanleixing.'&caozuorenid='.$caozuorenid.'&caozuorenmigncheng='.urlencode($caozuorenmigncheng).'&beizhu='.urlencode($beizhu).'&dingdanshijian='.urlencode($dingdanshijian)); $res = self::Get(self::$JF_BaseUrl . '?type=5' . '&ghzid=' . $ghzid. '&yucunkuan=' . $yucunkuan.'&yyid='.$yyid.'&yucunkuanleixing='.$yucunkuanleixing.'&caozuorenid='.$caozuorenid.'&caozuorenmigncheng='.urlencode($caozuorenmigncheng).'&beizhu='.urlencode($beizhu).'&dingdanshijian='.urlencode($dingdanshijian));
return true; return true;
} }

@ -309,7 +309,7 @@ class OrderController extends Controller
if($jifen>$all_jifen) return \Yz::echoError1("用户剩余积分不足"); if($jifen>$all_jifen) return \Yz::echoError1("用户剩余积分不足");
} }
if($yucunkuan>0) { if($yucunkuan>0) {
return \Yz::echoError1("暂不支持预存款"); // return \Yz::echoError1("暂不支持预存款");
$all_yucunkuan= $AspNet::GetJiFen_YuCunKuan(2,$person->ghzid); $all_yucunkuan= $AspNet::GetJiFen_YuCunKuan(2,$person->ghzid);
if($yucunkuan>$all_yucunkuan) return \Yz::echoError1("用户剩余预存款不足"); if($yucunkuan>$all_yucunkuan) return \Yz::echoError1("用户剩余预存款不足");
} }
@ -371,7 +371,7 @@ class OrderController extends Controller
} }
if($yucunkuan>0) { if($yucunkuan>0) {
$yucunkuan_dikou_status=false; $yucunkuan_dikou_status=false;
// $yucunkuan_dikou_status= $AspNet::UseYuCunKuan(); $yucunkuan_dikou_status= $AspNet::UseYuCunKuan($person->ghzid,-$yucunkuan,$yyid,0,$insert,'tj_h5','抵扣体检H5订单',$now_datetime);
} }
} }

@ -2,6 +2,7 @@
namespace App\Http\Controllers\API\H5; namespace App\Http\Controllers\API\H5;
use App\Http\Controllers\API\AspNetZhuanController;
use App\Http\Controllers\API\XCXApiController; use App\Http\Controllers\API\XCXApiController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -109,6 +110,8 @@ class PayController extends Controller
if (!$orderInfo) return \Yz::echoError1("未找到有效订单"); if (!$orderInfo) return \Yz::echoError1("未找到有效订单");
if ($orderInfo->status !== 2) return \Yz::echoError1("订单状态异常。当前状态:" . $orderInfo->status); if ($orderInfo->status !== 2) return \Yz::echoError1("订单状态异常。当前状态:" . $orderInfo->status);
if ($orderInfo->check_status == 2) return \Yz::echoError1("已登记体检,禁止退款"); if ($orderInfo->check_status == 2) return \Yz::echoError1("已登记体检,禁止退款");
$person=DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first();
if(!$person) return \Yz::echoError1("用户不存在");
//调用思信取消,恢复号源 //调用思信取消,恢复号源
$ap = new OrderController(); $ap = new OrderController();
$cancel = $ap->cancel_appointment($orderInfo->hospital_id, [ $cancel = $ap->cancel_appointment($orderInfo->hospital_id, [
@ -130,6 +133,27 @@ class PayController extends Controller
return \Yz::echoError1("退款失败" . $res['data']['refund_state']); return \Yz::echoError1("退款失败" . $res['data']['refund_state']);
} }
} }
$now_datetime=date('Y-m-d H:i:s');
//调用接口恢复积分和预存款
$env=config('app.globals.Env');
$AspNet=new AspNetZhuanController();
$jifen_huifu_status=true;
$yucunkuan_huifu_status=true;
$yyid=$orderInfo->hospital_id;
if($yyid==1) $yyid=6;
if($env=='pro') { //如果是正式环境
if($orderInfo->jifen>0) {
$jifen_huifu_status=false;
$jifen_huifu_status= $AspNet::UseJiFen($person->ghzid,$orderInfo->jifen,$yyid,$orderInfo->id,'tj_h5','抵扣体检H5订单',$now_datetime);
}
if($orderInfo->yucunkuan>0) {
$yucunkuan_huifu_status=false;
$yucunkuan_huifu_status= $AspNet::UseYuCunKuan($person->ghzid,$orderInfo->yucunkuan,$yyid,0,$orderInfo->id,'tj_h5','抵扣体检H5订单',$now_datetime);
}
}
DB::table('orders')->where(['id' => $id])->update([ DB::table('orders')->where(['id' => $id])->update([
'status' => 5 'status' => 5
]); ]);

Loading…
Cancel
Save