号源显示的bug,修改按钮路径

wenjuan
yanzai 1 year ago
parent 6a2db40e55
commit dcc66adb07

@ -124,15 +124,15 @@ class HomeController extends Controller
'logo' => '/assets/h5/zhuyishixiang.png' 'logo' => '/assets/h5/zhuyishixiang.png'
], ],
[ [
'message' => '暂未开放', 'message' => '',
'name' => '套餐预约', 'name' => '套餐预约',
'url' => '/pages/main/combo/combo', 'url' => '/pages/main/combo/combo',
'logo' => '/assets/h5/zhuyishixiang.png' 'logo' => '/assets/h5/zhuyishixiang.png'
], ],
[ [
'message' => '暂未开放', 'message' => '',
'name' => '项目自选', 'name' => '项目自选',
'url' => '/pages/main/optionalProject/optionalProject', 'url' => '/pages/main/tj/tjzx',
'logo' => '/assets/h5/zhuyishixiang.png' 'logo' => '/assets/h5/zhuyishixiang.png'
] ]
]; ];

@ -39,92 +39,94 @@ class PayController extends Controller
if ($orderInfo->status !== 1) return \Yz::echoError1("订单不是待支付状态不能支付。当前状态:" . $orderInfo->status); if ($orderInfo->status !== 1) return \Yz::echoError1("订单不是待支付状态不能支付。当前状态:" . $orderInfo->status);
$personInfo = DB::table('web_user_person')->where(['id' => $orderInfo->person_id, 'is_del' => 0])->first(); $personInfo = DB::table('web_user_person')->where(['id' => $orderInfo->person_id, 'is_del' => 0])->first();
if (!$personInfo) return \Yz::echoError1("就诊人异常"); if (!$personInfo) return \Yz::echoError1("就诊人异常");
$sub_org_code=0; //小程序端医院代码 $sub_org_code = 0; //小程序端医院代码
if($orderInfo->hospital_id==1){ if ($orderInfo->hospital_id == 1) {
$sub_org_code=6; $sub_org_code = 6;
} }
if($orderInfo->hospital_id==2){ if ($orderInfo->hospital_id == 2) {
$sub_org_code=2; $sub_org_code = 2;
} }
if($sub_org_code==0) return \Yz::echoError1("医院id异常"); if ($sub_org_code == 0) return \Yz::echoError1("医院id异常");
$XCXApi=new XCXApiController(); $XCXApi = new XCXApiController();
$params = [ $params = [
'appid' =>$XCXApi::$appid, 'appid' => $XCXApi::$appid,
'sub_org_code'=>$sub_org_code, 'sub_org_code' => $sub_org_code,
'ghzid' => $personInfo->ghzid, 'ghzid' => $personInfo->ghzid,
'orderid' => $orderInfo->order_number, 'orderid' => $orderInfo->order_number,
'order_desc' => $orderInfo->title, 'order_desc' => $orderInfo->title,
'amount' => (int)($orderInfo->true_price * 100), 'amount' => (int)($orderInfo->true_price * 100),
'notify_url'=> config('app.globals.PayNotifyUrl') 'notify_url' => config('app.globals.PayNotifyUrl')
]; ];
$nonce=self::nonce(); $nonce = self::nonce();
$timestamp=(string)time(); $timestamp = (string)time();
//签名 //签名
$pay_path="/jeecg-boot/hospital/openapi/order/create"; $pay_path = "/jeecg-boot/hospital/openapi/order/create";
$base64Signature=$XCXApi::Sign($pay_path,$params,$nonce,$timestamp,true); $base64Signature = $XCXApi::Sign($pay_path, $params, $nonce, $timestamp, true);
$params['timestamp']=$timestamp; $params['timestamp'] = $timestamp;
$params['nonce']=$nonce; $params['nonce'] = $nonce;
$params['signature']=$base64Signature; $params['signature'] = $base64Signature;
return \Yz::Return(true,"操作完成",['info'=>$params]); return \Yz::Return(true, "操作完成", ['info' => $params]);
} }
//订单支付查询 //订单支付查询
public function CheckPay() public function CheckPay()
{ {
$openid = request('openid'); $openid = request('openid');
$order_number= request('order_number'); $order_number = request('order_number');
$XCX = new XCXApiController(); $XCX = new XCXApiController();
$res = $XCX::Post('订单查询', ['orderid'=>$order_number]); $res = $XCX::Post('订单查询', ['orderid' => $order_number]);
//判断如果支付成功,更改订单状态 //判断如果支付成功,更改订单状态
if($res['data']['trade_state']==='SUCCESS'){ if ($res['data']['trade_state'] === 'SUCCESS') {
$order=DB::table('orders')->where(['order_number'=>$order_number])->first(); $order = DB::table('orders')->where(['order_number' => $order_number])->first();
DB::table('orders')->where(['id'=>$order->id])->update([ DB::table('orders')->where(['id' => $order->id])->update([
'status'=>2, 'status' => 2,
'pay_time' => date('Y-m-d H:i:s'), 'pay_time' => date('Y-m-d H:i:s'),
]); ]);
$Finish=new OrderController();//预约体检 $Finish = new OrderController();//预约体检
$Finish->Finish($order_number); $Finish->Finish($order_number);
return \Yz::Return(true,"支付成功",['id'=>$order->id]); return \Yz::Return(true, "支付成功", ['id' => $order->id]);
}else{ } else {
return \Yz::echoError1("支付失败".$res['data']['trade_state']); return \Yz::echoError1("支付失败" . $res['data']['trade_state']);
} }
} }
//退款 //退款
public function Refund() public function Refund()
{ {
//先调用思信取消,恢复号源,然后再退款 //先调用思信取消,恢复号源,然后再退款
//判断订单状态是否是已经支付,判断是否到检, //判断订单状态是否是已经支付,判断是否到检,
$openid = request('openid'); $openid = request('openid');
$id= request('id'); $id = request('id');
$orderInfo = DB::table('orders')->where(['id' => $id])->first(); $orderInfo = DB::table('orders')->where(['id' => $id])->first();
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("已登记体检,禁止退款");
//调用思信取消,恢复号源 //调用思信取消,恢复号源
$ap=new OrderController(); $ap = new OrderController();
$cancel= $ap->cancel_appointment($orderInfo->hospital_id,[ $cancel = $ap->cancel_appointment($orderInfo->hospital_id, [
'type' => $orderInfo->type, 'type' => $orderInfo->type,
'预约Id' => $orderInfo->appointment_number '预约Id' => $orderInfo->appointment_number
]); ]);
if($cancel['code']!=0) return \Yz::echoError1("取消预约失败,".$cancel['message']); if ($cancel['code'] != 0) return \Yz::echoError1("取消预约失败," . $cancel['message']);
//退款 //如果真实支付大于0 则调用小程序退款
$data=[ if ($orderInfo->true_price > 0) {
'orderid'=>$orderInfo->order_number, $data = [
'refund_order_id'=>'T'.$orderInfo->order_number, 'orderid' => $orderInfo->order_number,
'refund_amount'=>(int)($orderInfo->true_price * 100), 'refund_order_id' => 'T' . $orderInfo->order_number,
'refund_reason'=>"体检H5订单退款", 'refund_amount' => (int)($orderInfo->true_price * 100),
'refund_reason' => "体检H5订单退款",
]; ];
$XCX = new XCXApiController(); $XCX = new XCXApiController();
$res = $XCX::Post('订单退款', $data); $res = $XCX::Post('订单退款', $data);
if($res['data']['refund_state']==='SUCCESS'){ if ($res['data']['refund_state'] != 'SUCCESS') {
DB::table('orders')->where(['id'=>$id])->update([ return \Yz::echoError1("退款失败" . $res['data']['refund_state']);
'status'=>5 }
]);
return \Yz::Return(true,"退款成功",[]);
}else{
return \Yz::echoError1("退款失败".$res['data']['refund_state']);
} }
DB::table('orders')->where(['id' => $id])->update([
'status' => 5
]);
return \Yz::Return(true, "退款成功", []);
} }

@ -29,11 +29,22 @@ class PlanController extends Controller
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id]) ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where(['hospital_id'=>$hospital_id,'type'=>1])
->whereIn('use_type',[0,$use_type]); ->whereIn('use_type',[0,$use_type]);
if($use_type==1){ // if($use_type==1){
$list=$list->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount); // $list=$list->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount);
} // }
if($use_type==2){ // if($use_type==2){
$list=$list->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount); // $list=$list->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount);
// }
if ($use_type == 1) {
$list = $list->where(function ($query) use ($amount) {
$query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount);
});
}
if ($use_type == 2) {
$list = $list->where(function ($query) use ($amount) {
$query->where('amount_limit2', 0)->orWhere('amount_limit2', '>=', $amount);
});
} }
$list=$list->select('date', DB::raw('COUNT(*) as count')); $list=$list->select('date', DB::raw('COUNT(*) as count'));
$list=$list->groupBy('date')->get(); $list=$list->groupBy('date')->get();
@ -84,11 +95,16 @@ class PlanController extends Controller
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id]) ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where(['hospital_id'=>$hospital_id,'type'=>1])
->whereIn('use_type',[0,$use_type]); ->whereIn('use_type',[0,$use_type]);
if($use_type==1){ if ($use_type == 1) {
$list=$list->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount); $list = $list->where(function ($query) use ($amount) {
$query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount);
});
} }
if($use_type==2){
$list=$list->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount); if ($use_type == 2) {
$list = $list->where(function ($query) use ($amount) {
$query->where('amount_limit2', 0)->orWhere('amount_limit2', '>=', $amount);
});
} }
$list=$list->get(); $list=$list->get();
@ -107,11 +123,22 @@ class PlanController extends Controller
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id]) ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where(['hospital_id'=>$hospital_id,'type'=>1])
->whereIn('use_type',[0,$use_type]); ->whereIn('use_type',[0,$use_type]);
if($use_type==1){ // if($use_type==1){
$weeklist=$weeklist->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount); // $weeklist=$weeklist->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount);
} // }
if($use_type==2){ // if($use_type==2){
$weeklist=$weeklist->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount); // $weeklist=$weeklist->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount);
// }
if ($use_type == 1) {
$weeklist = $weeklist->where(function ($query) use ($amount) {
$query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount);
});
}
if ($use_type == 2) {
$weeklist = $weeklist->where(function ($query) use ($amount) {
$query->where('amount_limit2', 0)->orWhere('amount_limit2', '>=', $amount);
});
} }
$weeklist=$weeklist->select('date', DB::raw('COUNT(*) as count')); $weeklist=$weeklist->select('date', DB::raw('COUNT(*) as count'));
$weeklist=$weeklist->groupBy('date')->get(); $weeklist=$weeklist->groupBy('date')->get();

Loading…
Cancel
Save