链街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.

66 lines
1.7 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 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. /**
  40. * @param $lng1
  41. * @param $lat1
  42. * @param $lng2
  43. * @param $lat2
  44. * @return mixed
  45. */
  46. public static function getDistance($lng1, $lat1, $lng2, $lat2){
  47. $client = Client::factory(env('RPC_SITE_HOST'));
  48. $request = $client->request(
  49. uniqid(),
  50. self::GET_DISTANCE,
  51. ['lng1' => $lng1,'lat1'=>$lat1,'lng2'=>$lng2,'lat2'=>$lat2]);
  52. $response = $client->send($request);
  53. return json_decode($response->getBody()->getContents(),true);
  54. }
  55. }