<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Facades\JWTAuth;
use App\Http\model\Sms;
use App\Http\Controllers\AlipayController;
class SetorderController extends Controller
{
public function busrider(Request $request)
{
$uid = $request->get('id');
$users = DB::table('order')->where('user_id',$uid)->select('peer')->get();
$users = json_decode(json_encode($users),true);
foreach ($users as $key => &$value) {
$value['peer'] = json_decode($value['peer'],true);
}
$arr = [
'code'=>'1000',
'data'=>$users
];
echo json_encode($arr);
}
public function chosecity(Request $request)
{
$server = Db :: table('server_item')->where('name','即时用车')->first();
$serid = $server -> id;
$area = Db :: table('company_server_car')
->leftJoin('region','company_server_car.area_id','=','region.code')
->where('company_server_car.item_id',$serid)
->select('region.name','region.code')
->get();
$area = json_decode(json_encode($area),true);
$arr = [];
$i = 0;
foreach ($area as $key => $value) {
$arr[$i]['name'] = $value['name'];
$arr[$i]['code'] = $value['code'];
$i++;
}
$returnArr = [
'code'=>'1000',
'data'=>$arr
];
echo json_encode($returnArr);
}
public function carserver(Request $request)
{
$fullName = $request -> input('fullname');
$type = $request -> input('type');
$server = Db :: table('server_item')->where('name',$type)->first();
$serid = $server -> id;
$area = Db :: table('region')->where('fullName',$fullName)->first();
$code = $area -> code;
$car = Db :: table('company_server_car')->where('item_id',$serid)->where('area_id',$code)->first();
if(!empty($car)){
$car = $car -> series_id;
$car = explode(',', $car);
$cararr = Db :: table('car_series')
->whereIn('id',$car)->where('status',1)->select('id','series_name','image','people')->get();
$cararr = json_decode(json_encode($cararr),true);
$arr = [
'code'=>'1000',
'data'=>$cararr
];
}else{
$arr = [
'code'=>'1001',
'data'=>'暂无数据'
];
}
echo json_encode($arr);
}
public function order(Request $request)
{
$data = $request -> all();
$uid = $request->get('id'); if(!empty($data['perOrCom'])){
if($data['perOrCom'] == 1) $statusArr = [9,10,11];
$clearing_type = Db :: table('order')
->where('user_id',$uid)
->where('judgment',5)->whereIn('status',$statusArr)->where('wystatus',1)->first();
$clearing_type = json_decode(json_encode($clearing_type),true);
}else{
$company_id = Db :: table('social_user')->where('id',$uid)->select('company_id')->first();
$statusArr = [9,10,11];
$clearing_type = Db :: table('order')
->where('companyId',$company_id -> company_id)
->where('judgment',5)->whereIn('status',$statusArr)->where('wystatus',1)->first();
$clearing_type = json_decode(json_encode($clearing_type),true);
}
}else{
$statusArr = [9,10,11];
$clearing_type = Db :: table('order')
->where('user_id',$uid)
->where('judgment',5)->whereIn('status',$statusArr)->where('wystatus',1)->first();
$clearing_type = json_decode(json_encode($clearing_type),true);
}
if($clearing_type){
$return['code'] = '1001';
$return['msg'] = '有订单尚未结算';
echo json_encode($return);
die;
}
$type = $data['type'] if($type == '接机'){
$cip = 1;
}else{
$cip = 2;
}
$server = Db :: table('server_item')->where('name',$type)->first();
$serid = $server -> id;
$num = date('ymds') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 7);
$user = Db :: table('social_user')->where('id',$uid)->first();
$nickname = $user -> nickname;
$phone = $user -> phone;
$isself = $data['isself'];
if($isself == 1){
$carpeople = $nickname;
$carphone = $phone;
}else{
if($data['carpeople'] == '本人乘车'){
$carpeople = '乘客' . rand(111,999);
}else{
$carpeople = $data['carpeople'];
}
$carphone = $data['carphone'];
}
if($data['passenger_people'] > 1){
$peer = json_encode($data['peer']) }else{
$peer = '';
}
if(!empty($data['cip_number'])){
$cip_number = $data['cip_number'];
}else{
$cip_number = '';
}
$pay_from = $data['pay_from'];
$remarks = $data['remarks'];
if(!empty($data['flight_number'])){
$flight_number = $data['flight_number'];
}else{
$flight_number = '';
}
if(!empty($data['terminal'])){
$terminal = $data['terminal'];
}else{
$terminal = '';
}
if(!empty($data['car_trips'])){
$car_trips = $data['car_trips'];
}else{
$car_trips = '';
}
if(!empty($data['station'])){
$station = $data['station'];
}else{
$station = '';
}
if(!empty($data['jsjcs'])){
$jsjcs = 2;
}else{
$jsjcs = 1;
}
if(!empty($data['cippeople'])){
$cippeople = json_encode($data['cippeople']);
}else{
$cippeople = '';
}
$area = Db :: table('region')->where('code',$data['area_code'])->first();
$areaid = $area -> parentCode;
if(!empty($data['perOrCom'])){
if($data['perOrCom'] == 1) $companyId = '';
}else{
$company_id = Db :: table('social_user')->where('id',$uid)->select('company_id')->first();
$companyId = $company_id -> company_id;
}
}else{
$companyId = '';
}
if(!empty($data['usejsj'])){
if($data['usejsj'] == 0) $jsjcs_type = 0;
}elseif ($data['usejsj'] == 1) $jsjcs_type = 1;
}
}else{
$jsjcs_type = 2;
}
$insertArr = [
'user_id'=>$uid 'car_id'=>$data['car_id'] 'order_number'=>$num, 'end'=>$data['end'] 'origin'=>$data['origin'] 'price'=>$data['price'] 'type'=>$serid 'orders_name'=>$nickname 'orders_phone'=>$phone 'appointment'=>strtotime($data['appointment']) 'passenger_name'=>$carpeople 'passenger_phone'=>$carphone 'passenger_people'=>$data['passenger_people'] 'cip'=>$cip 'created_at'=>time() 'status'=>1 'wystatus'=>1 'remarks'=>$remarks 'origin_position'=>$data['origin_position'] 'end_position'=>$data['end_position'] 'judgment'=>5 'cip_number'=>$cip_number 'pay_from'=>$pay_from 'flight_number'=>$flight_number 'terminal'=>$terminal 'car_trips'=>$car_trips 'station'=>$station 'jsjcs'=>$jsjcs 'peer'=>$peer 'cippeople'=>$cippeople 'companyId'=>$companyId 'jsjcs_type'=>$jsjcs_type 'area_code'=>$areaid ];
if(!empty($data['usejsj'])){
if($data['usejsj'] == 0) $price = $data['fuwurice'];
}elseif ($data['usejsj'] == 1) $price = $data['fuwurice'];
}
}else{
$price = $data['price'];
}
DB::beginTransaction();
try {
$id = Db :: table('order')->insertGetId($insertArr);
if(!empty($data['perOrCom'])){
if($data['perOrCom'] == 1) if(!empty($data['payType'])){
if(!empty($data['usejsj'])){
if($data['usejsj'] == 0) Db :: table('social_user')->where('id',$uid)->decrement('plane_left_num');
Db :: table('social_user')->where('id',$uid)->increment('plane_used_num');
}elseif ($data['usejsj'] == 1) Db :: table('social_user')->where('id',$uid)->decrement('p_plane_left_num');
Db :: table('social_user')->where('id',$uid)->increment('p_plane_used_num');
}
}
if($data['payType'] == 1){
$card = Db :: table('wakeup_card')
->where('uid',$uid)
->where('from',2)
->where('lost_price','>',$price)
->order('type desc')
->get();
$card = json_decode(json_encode($card),true);
if(!empty($card)){
Db :: table('order')->where('id',$id)->update(['cardnum'=>$card[0]['id']]);
Db :: table('wakeup_card')
->where('id',$card[0]['id'])
->decrement('lost_price',$price);
}else{
Db :: table('social_user')
->where('id',$uid)
->decrement('sum_money',$price);
}
}elseif($data['payType'] == 2) Db :: table('social_user')->where('id',$uid)->decrement('left_price',$price);
Db :: table('social_user')->where('id',$uid)->increment('used_price',$price);
}
}
}else if(!empty($data['usejsj'])){
Db :: table('social_company')->where('id',$companyId)->decrement('plane_left_num');
Db :: table('social_company')->where('id',$companyId)->increment('plane_used_num');
}
$card = Db:: table('wakeup_card')
->where('uid', $companyId)
->where('from', 1)
->where('lost_price', '>', $price)
->order('type desc')
->get();
$card = json_decode(json_encode($card),true);
if(!empty($card)){
Db :: table('order')->where('id',$id)->update(['cardnum'=>$card[0]['id']]);
Db:: table('wakeup_card')
->where('id', $card[0]['id'])
->decrement('lost_price',$price);
}else{
Db:: table('social_company')
->where('id',$companyId)
->decrement('account_money',$price);
}
}
}else{
Db :: table('social_user')->where('id',$uid)->decrement('sum_money',$price);
}
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$arr= [
'id'=>'',
'code'=>'1001',
'msg'=>'failed',
];
echo json_encode($arr);
die;
}
if($data['sendsms'] == 2) $msg = '您预订'.$data['appointment'].'的'.$type.'订单下单成功,稍后将有专属司机为您服务。【时代出行】';
$code = new Sms();
$re = $code -> sendSMS($phone,$msg);
}
$arr= [
'id'=>$id,
'code'=>'1000',
'msg'=>'success',
];
echo json_encode($arr);
}
public function test(Request $request)
{
}
public function fee2($origins, $destinations, $usetime, $carid, $serid, $areaid)
{
$ori = implode(',', $origins);
$des = implode(',', $destinations);
$url = 'http://api.map.baidu.com/routematrix/v2/driving?output=json&origins=' . $ori . '&destinations=' . $des . '&ak=RGwhFRkSZfva32BN96csoObm4FIfiCAY';
$result = $this->get_curl_json($url);
$time = round($result['result'][0]['duration']['value'] / 60) $dis = round($result['result'][0]['distance']['value']/1000, 1) $return = [];
$price = 0;
$re = Db:: table('company_charges_rule')->where('series_id', $carid)->where('server_id', $serid)->where('area_id', $areaid)->first();
$re = json_decode(json_encode($re),true);
if (!empty($re)) {
$difdis = $dis - $re['basis_km'] if ($difdis > 0) $difdis2 = $dis - $re['super_km_km'] if ($difdis2 < $re['super_km_shortage_km']) $price = $re['price'];
} else $usetime1 = explode(' ', $usetime);
$usetime2 = strtotime($usetime);
$day_start_time = strtotime($usetime1[0] . $re['day_start_time']);
$day_end_time = strtotime($usetime1[0] . $re['day_end_time']);
$avgdis = $difdis2 / $re['super_km_per_km'];
if ($day_start_time < $usetime2 && $usetime2 < $day_end_time) {
$price = $re['price'] + $avgdis * $re['day_commission'];
} else {
$price = $re['price'] + $avgdis * $re['night_commission'];
}
}
} else $price = $re['price'];
}
$diftime = $time - $re['basis_time'];
if ($diftime > 0) $diftime2 = $time - $re['starting_starting_time'] if ($diftime2 < 0) {
$price = $price;
} else {
$diftime3 = $diftime2 - $re['starting_shortage_time'];
if ($diftime3 < 0) {
$price = $price;
} else {
if($re['starting_exceed_time'] > 0){
$avgtime = $diftime3 / $re['starting_exceed_time'];
}else{
$avgtime = $diftime3;
}
$price = $price + $avgtime * $re['starting_add_money'];
}
}
} else $price = $price;
}
$return['price'] = sprintf("%.2f",$price);
$return['msg'] = 'success';
} else {
$return['price'] = 0;
$return['msg'] = '没有该服务';
}
return $return;
}
function price(Request $request)
{
$data = $request -> all();
$server = Db :: table('server_item')->where('name',$data['type'])->first();
$serid = $server -> id;
$origins = [$data['latshang'], $data['lngshang']];
$destinations = [$data['lat'], $data['lng']];
$usetime = $data['usetime'];
$carid = $data['carid'];
$areaid = $data['areaid'];
$area = Db :: table('region')->where('code',$areaid)->first();
$areaid = $area -> parentCode;
$re = $this->fee2($origins, $destinations, $usetime, $carid, $serid, $areaid);
echo json_encode($re);
}
public function zhifubao(Request $request)
{
$data = $request -> all();
$uid = $request->get('id');
$orderId = $uid.date("YmdHis",time()).rand(1111,9999);
$subject = '时代出行支付';
$body = '时代出行支付';
$pre_price = $data['price'];
$expire = date('Y-m-d H:i:s',time());
$pay = new AlipayController();
$re = $pay->unifiedorder($orderId, $subject,$body,$pre_price,$expire);
dump($re);
$a = json_decode($re,true);
dump($a);
return $re;
}
public function notify()
{
include_once ('../../alipay/AopSdk.php');
include_once ('../../alipay/aop/AopClient.php');
$aop = new \AopClient();
$aop->alipayrsaPublicKey = \Comm\Pay\Alipay::ALIPAY_RSA_PUBLIC_KEY;
$flag = $aop->rsaCheckV1($_POST, NULL, "RSA2");
if($flag){
if($_POST['trade_status'] == 'TRADE_SUCCESS'
|| $_POST['trade_status'] == 'TRADE_FINISHED') $orderId = $_POST['out_trade_no'];
$trade_no = $_POST['trade_no'];
$gmt_payment = $_POST['gmt_payment'];
$gtime = strtotime($gmt_payment);
}
}
}
public function get_curl_json($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
if(curl_errno($ch)){
print_r(curl_error($ch));
}
curl_close($ch);
return json_decode($result,TRUE);
}
function pay($openid,$money,$payNum,$url,$uid){
$arr = [];
$openid = $openid include_once '../app/wxpay/lib2/WxPay.JsApiPay.php';
include_once '../app/wxpay/lib/WxPay.Api.php';
$money = $money $money = (float)substr(sprintf("%.3f",$money),0,-1);
$order_no = $payNum $input = new \WxPayUnifiedOrder();
$input->SetBody("支付");
$input->SetAttach("支付");
$input->SetOut_trade_no($order_no) $mymoney = $money*100 $input->SetTotal_fee($mymoney) $input->SetGoods_tag("微信支付");
$url = $url $input->SetNotify_url($url);
$input->SetTrade_type("JSAPI");
$input->SetOpenid($openid);
$order = \WxPayApi::unifiedOrder($input);
$tools = new \JsApiPay();
$jsApiParameters = $tools->GetJsApiParameters($order);
$list = $input->GetValues();
$list['timeStamp'] = time();
$data['money'] = $money;
$data['source_id'] = $uid;
$data['source'] = 0;
$data['pay_way'] = 1;
$data['status'] = 1;
$data['out_trade_no'] = $list['out_trade_no'];
$add = Db::table('social_recharge_log')->insertGetId($data);
$data = json_decode($jsApiParameters,true);
$data['out_trade_no'] = $list['out_trade_no'];
return $data;
}
public function paywx(Request $request)
{
$openid = $request->input('openid');
if($openid){
$money = $request->input('money') ? $request->input('money') : 1;
$payNum = date('YmdHis') . rand(1111,9999);
$url = 'https://b.shidaichuxing.com/api/setorder/returnurl' if(!empty($request->get('id'))){
$uid = $request->get('id');
}
$result = $this -> pay($openid,$money,$payNum,$url,$uid);
$arr['data'] = $result;
$arr['err_code'] = '1000';
$arr['err_msg'] = '生成订单成功';
}else{
$arr['err_code'] = '1001';
$arr['err_msg'] = '生成订单失败,没有收到openid';
}
echo json_encode($arr);
}
public function getOpenid(Request $request)
{
$arr = [];
$code = $request->input('code');
$SECRET = 'd85ce9c54a6b0d0636c11f8c7a8014f4';
$APPID = 'wxe5b2b29d2bd6a56c';
$url = 'https://api.weixin.qq.com/sns/jscode2session?appid='.$APPID.'&secret='.$SECRET.'&js_code='.$code.'&grant_type=authorization_code';
$res=$this->curlGet($url);
$reqData = json_decode($res, true);
$key = $reqData['session_key'];
$openid = $reqData['openid'];
$arr['openid'] = $openid;
$arr['err_code'] = '1000';
$arr['err_msg'] = '请求成功';
echo json_encode($arr);
}
function curlGet($url,$data=""){
$ch=curl_init();
$header[]="Accept-Charset: utf-8";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"GET");
curl_setopt($ch,CURLOPT_TIMEOUT,500);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; MSIE 5.01;Window NT 5.0)');
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_AUTOREFERER,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER,0);
$temp=curl_exec($ch);
curl_close($ch);
return $temp;
}
public function returnurl(Request $Request) {
ini_set('date.timezone', 'Asia/Shanghai');
include_once '../app/wxpay/lib2/WxPay.JsApiPay.php';
include_once '../app/wxpay/lib/WxPay.Api.php';
error_reporting(E_ERROR);
$logHandler = new \CLogFileHandler("../logs/" . date('Y-m-d') . '.log');
Log::Init($logHandler, 15);
Log::DEBUG("begin notify");
$notify = new \WxPayNotify();
$notify = new \PayNotifyCallBack();
$list = file_get_contents("php://input");
$result = $notify->GetValues();
$mes = [];
if ($result['trade_state'] == 'SUCCESS') {
$num = $request['out_trade_no'] ? $request['out_trade_no'] : '';
$data['status'] = 0;
$data['created_at'] = date("Y-m-d H:i:s",time());
$res = Db::table('social_recharge_log')->where('out_trade_no',$num)->update($data);
$list = Db::table('social_recharge_log')->select('money','source_id')->where('out_trade_no',$num)->first();
$list = json_decode(json_encode($list),true);
$money = $list['money'];
$uid = $list['source_id'];
$user = Db::table('social_user')->where('id',$list['source_id'])->increment('sum_money',$money);
if($res && $user){
return ['code'=>1000,'message'=>'充值成功!'];
}else{
return ['code'=>1001,'message'=>'充值失败!'];
}
}else{
$mes = [
'message'=> '参数错误',
'code'=>'1003',
];
}
return json_encode($mes);
Log::DEBUG("end notify");
Log::INFO(str_repeat("=", 20));
}
public function upload(Request $request)
{
if(!$request->hasFile('source')){
return '没有文件';
}
$file = $request->file('source');
if(!$file->isValid()){
return '文件上传出错';
}
$source = $this->makePhoto($request);
$strs=stripslashes($source);
return $strs;
}
private static function makePhoto(Request $request )
{
$file = $request->file('source');
if ($file) {
$file_path = 'uploads/' . date("Ymd") . "/";
$extension = $file->getClientOriginalExtension();
$file_name = md5(time() . mt_rand(10, 99)) . '.' . $extension;
$info = $file->move($file_path, $file_name);
if (!$info) {
return 'failed';
}
return $file_path . $file_name;
}
}
public function orderlist(Request $request )
{
$uid = $request->get('id'); $re = Db :: table('order')
->leftJoin('server_item','order.type','=','server_item.id')
->where('user_id',$uid)
->orderBy('created_at','desc')
->select('order.appointment','order.origin','order.end','order.status','server_item.name')
->get();
$re = json_decode(json_encode($re),true);
$arr = [];
if(!empty($re)){
foreach ($re as $key => &$value) {
$value['appointment'] = date('Y-m-d H:i',$value['appointment']);
if($value['status'] == 0){
$value['statusName'] = '已取消';
$arr['已取消订单'][] = $value }elseif($value['status'] == 1){
$value['statusName'] = '未开始';
$arr['未开始订单'][] = $value }elseif($value['status'] >= 9){
$value['statusName'] = '已完成';
$arr['已完成订单'][] = $value }else{
$value['statusName'] = '进行中';
$arr['进行中订单'][] = $value }
}
}else{
$arr = [];
}
$retuen['data'] = $arr;
$retuen['msg'] = '请求成功';
echo json_encode($retuen);
}
public function cipPrice(Request $request)
{
$area = Db :: table('region')->where('code',$request['area_code'])->first();
$areaid = $area -> parentCode;
$cips = Db :: table('company_fee')->where('area_id',$areaid)->first();
$cips = $cips->cip_fee;
$cip= (float)$cips;
return $cip;
}
public function canUseMoney(Request $request)
{
$uid = $request->get('id'); if($request['types'] == 1) $re = Db :: table('social_user')->where('id',$uid)->select('left_price','plane_left_num','p_plane_left_num','sum_money')->first();
$re = json_decode(json_encode($re),true);
}
if ($request['types'] == 2) $com = Db :: table('social_user')->where('id',$uid)->select('company_id')->first();
$company_id = $com -> company_id;
$re = Db :: table('social_company')->where('id',$company_id)->select('account_money','plane_left_num')->first();
$re = json_decode(json_encode($re),true);
}
$arr['code'] = '200';
$arr['msg'] = '请求成功';
$arr['data'] = $re;
echo json_encode($arr);
}
public function teseRout(Request $request)
{
$area = Db :: table('region')->where('code',$request['area_code'])->first();
$areaid = $area -> parentCode;
$parent_id = Db :: table('server_item')->where('name','特殊路线')->select('id')->first();
$re = Db :: table('company_server_car')
->leftJoin('server_item','company_server_car.id','=','server_item.id')
->where('company_server_car',$areaid)
->where('server_item.parent_id',$parent_id -> id)
->select('id','name','picture')
->get();
$re = json_decode(json_encode($re),true);
$arr['code'] = '200';
$arr['msg'] = '请求成功';
$arr['data'] = $re;
echo json_encode($arr);
}
public function dingzhiRout(Request $request)
{
$area = Db :: table('region')->where('code',$request['area_code'])->first();
$areaid = $area -> parentCode;
$parent_id = Db :: table('server_item')->where('name','定制用车')->select('id')->first();
$re = Db :: table('company_server_car')
->leftJoin('server_item','company_server_car.id','=','server_item.id')
->where('company_server_car',$areaid)
->where('server_item.parent_id',$parent_id -> id)
->select('id','name','picture')
->get();
$re = json_decode(json_encode($re),true);
$arr['code'] = '200';
$arr['msg'] = '请求成功';
$arr['data'] = $re;
echo json_encode($arr);
}
function ali_pay(Request $request)
{
require_once '../app/alipay/aop/AopClient.php';
$notify_url = "";
$c = new \AopClient;
$c->signType = "RSA2";
$c->appId = "2018052860271109";
$c->alipayrsaPublicKey ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhiBZEEqftuHPn86HdbhcoPmrjHErcoqHfhB25vk1kjmPlA5ovytISqsJZnV9JKSY+vQ53ITL/RpQjLKFmqjqZGm5GzOD2Q1Yfzacfptm8vFA2cZcjJ5sr4CXcYf56yq7YXX3JoGwSPlMzs9LJYXd5N/GRpwLHXNx+9eMCX31N+emCGwItJTIWjRk7F7Oq5YT2O/4nSw1XLce4GBKAkK/iDk0bBE6BHdAVLMnfOs26f/0hNCNkqiTSBekCIvKoy1PuXgEoxRVec7gVc+9IGZgGcROX6RN1qsOLIfsU74/6Sl7CTcn6Y4cjBerfskVDqCFDsoB3yUfU0KXhBhdd4+MDwIDAQAB";
$c->rsaPrivateKey ="MIIEogIBAAKCAQEApv0/3UzexQ6b827W/zYYeAAqiXAO/KHrJfdIZbazHshOpLdIIrk9XFZXGI+bZlgPFaTZsiyOidhjUj2NIx/uz3IW2d128e2EbUz5qs7DlhkZ3KvBcRRDGTgxUUaJHrail866VXZEyDPihmApz6lV2Tsyx712FroDfxnE1OB4rSOby/1BWuHTRrE5Zsv+2K8QfRDUOaiM5dcKjYe5CIJJbnXUYf5QoKdwEGd37Ao3be04+sQnRUsS7qh/egJRLQgOgbXGwZBaq7PRzarg3zsfdxsw5wfZbLerfwYsnEGdVR5GOBnRIPqNFnOWyZok+coJ3PD21v9UrKIss5XxStyrYwIDAQABAoIBAHuuPssN0EFrnJ4kjiDgVCctGFRLJw5+bsfj6z9KnkhCW90r0sXFJWlqmX+bfaHDvwhs3MBWuAvotUeIRyyozhvfiIU8vohZPyglRxX3pm1ZkgobPF8gfsIDGKP19kFFTA/cEa6StkcCBtk4CD/CT89hRS8jaH9UrppI37w7taWl85gBEmiQSjRYVZg1YjxIj6RY/ucbvwIlOzhQMvo/3kUJQ4vep16e/vbuFCi5boMGt/PXlWUh+HDqmYqnrE1WpCITHRL+jmYgK2li/oj985
$content['subject'] = '时代出行支付' $uid = $uid = $request->get('id'); ;
$trade_no = $request['num'];
$money = $request['money'];
$content['out_trade_no'] = $trade_no $content['total_amount'] =$money $content['product_code'] = "QUICK_MSECURITY_PAY" $con = json_encode($content) $param = array();
$param['app_id'] = $c->appId $param['method'] = 'alipay.trade.app.pay' $param['charset'] = 'utf-8' $param['sign_type'] = 'RSA2' $param['timestamp'] = date("Y-m-d H:i:s") $param['version'] = '1.0' $param['notify_url'] = $notify_url $param['biz_content'] = $con $paramStr = $c->getSignContent($param);
$sign = $c->alonersaSign($paramStr,$c->rsaPrivateKey,'RSA2');
$param['sign'] = $sign;
$result = $c->getSignContentUrlencode($param) $arr = ['key'=>$result];
$a = json_encode($result);
return json_encode($arr) ;
}
}