You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
<?php
|
|
|
|
|
|
namespace App\Admin\Common;
|
|
|
|
|
|
use Graze\GuzzleHttp\JsonRpc\Client;
|
|
|
|
class Rpc
|
|
{
|
|
|
|
const SEPARATE_ACCOUNTS = "/order/onlineComplete";
|
|
const ORDER_REFUND = "/order/onlineRefund";
|
|
const GET_DISTANCE = "/location/getDistanceByTencent";
|
|
|
|
|
|
|
|
/**
|
|
* 订单完成时分账流水
|
|
* @param $oid
|
|
* @param $uid
|
|
* @return string
|
|
*/
|
|
public static function separateAccounts($global_order_id,$uid){
|
|
$client = Client::factory(env('RPC_SITE_HOST'));
|
|
$request = $client->request(
|
|
uniqid(),
|
|
self::SEPARATE_ACCOUNTS,
|
|
['global_order_id' => $global_order_id,'user_id'=>$uid]);
|
|
$response = $client->send($request);
|
|
return $response->getBody()->getContents();
|
|
}
|
|
|
|
/**
|
|
* 订单整笔退款
|
|
* @param $global_order_id
|
|
* @param $uid
|
|
* @return string
|
|
*/
|
|
public static function orderRefund($global_order_id,$uid){
|
|
$client = Client::factory(env('RPC_SITE_HOST'));
|
|
$request = $client->request(
|
|
uniqid(),
|
|
self::ORDER_REFUND,
|
|
['global_order_id' => $global_order_id,'user_id'=>$uid]);
|
|
$response = $client->send($request);
|
|
return $response->getBody()->getContents();
|
|
}
|
|
|
|
public static function getDistance($lng1, $lat1, $lng2, $lat2){
|
|
$client = Client::factory(env('RPC_SITE_HOST'));
|
|
$request = $client->request(
|
|
uniqid(),
|
|
self::GET_DISTANCE,
|
|
['lng1' => $lng1,'lat1'=>$lat1,'lng2'=>$lng2,'lat2'=>$lat2]);
|
|
$response = $client->send($request);
|
|
return json_decode($response->getBody()->getContents(),true);
|
|
}
|
|
}
|