链街Dcat后台
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

6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
  1. <?php
  2. namespace App\Admin\Common;
  3. use Graze\GuzzleHttp\JsonRpc\Client;
  4. class Rpc
  5. {
  6. const SEPARATE_ACCOUNTS = "/order/onlineComplete";
  7. const ORDER_REFUND = "/order/onlineRefund";
  8. const GET_DISTANCE = "/location/getDistanceByTencent";
  9. /**
  10. * 订单完成时分账流水
  11. * @param $oid
  12. * @param $uid
  13. * @return string
  14. */
  15. public static function separateAccounts($global_order_id,$uid){
  16. $client = Client::factory(env('RPC_SITE_HOST'));
  17. $request = $client->request(
  18. uniqid(),
  19. self::SEPARATE_ACCOUNTS,
  20. ['global_order_id' => $global_order_id,'user_id'=>$uid]);
  21. $response = $client->send($request);
  22. return $response->getBody()->getContents();
  23. }
  24. /**
  25. * 订单整笔退款
  26. * @param $global_order_id
  27. * @param $uid
  28. * @return string
  29. */
  30. public static function orderRefund($global_order_id,$uid){
  31. $client = Client::factory(env('RPC_SITE_HOST'));
  32. $request = $client->request(
  33. uniqid(),
  34. self::ORDER_REFUND,
  35. ['global_order_id' => $global_order_id,'user_id'=>$uid]);
  36. $response = $client->send($request);
  37. return $response->getBody()->getContents();
  38. }
  39. public static function getDistance($lng1, $lat1, $lng2, $lat2){
  40. $client = Client::factory(env('RPC_SITE_HOST'));
  41. $request = $client->request(
  42. uniqid(),
  43. self::GET_DISTANCE,
  44. ['lng1' => $lng1,'lat1'=>$lat1,'lng2'=>$lng2,'lat2'=>$lat2]);
  45. $response = $client->send($request);
  46. return json_decode($response->getBody()->getContents(),true);
  47. }
  48. }