McDonaldsUtil.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Http\Utils\McDonalds;
  3. use App\Exceptions\CommonException;
  4. use App\Http\Bean\Util\KenDeJi\GetKfcOrdersParamBean;
  5. use App\Http\Bean\Util\McDonalds\GetMdlOrdersParamsBean;
  6. use App\Http\Enum\AccountTypeEnum;
  7. use App\Http\Enum\ErrorEnum;
  8. use App\Http\Utils\BaseUtil;
  9. use App\Models\UserSpreadModel;
  10. use Tool\ShanTaoTool\HttpCurl;
  11. class McDonaldsUtil extends BaseUtil
  12. {
  13. /**
  14. * 获取活动转链
  15. * @param $sid string 推广位ID
  16. * @param string $phone 手机号码
  17. */
  18. public static function getMdlActUrl($sid, $phone = "")
  19. {
  20. $url = "http://api.jutuike.com/mcdonald/act";
  21. $params = [
  22. "apikey"=>env("JU_TUI_KE_API_KEY"),
  23. "sid"=>$sid
  24. ];
  25. if($phone){
  26. $params["mobile"] = $phone;
  27. }
  28. $res = HttpCurl::getCurl($url,$params);
  29. if($res["code"]!= 1){
  30. throw new CommonException(ErrorEnum::ERROR_KFC_URL);
  31. }
  32. return $res["data"];
  33. }
  34. /**
  35. * 获取mdl订单
  36. * @param GetKfcOrdersParamBean $getKfcOrdersParamBean
  37. */
  38. public static function getMdlOrders(GetMdlOrdersParamsBean $getKfcOrdersParamBean)
  39. {
  40. $url = "http://api.jutuike.com/mcdonald/orders";
  41. $params = [
  42. "apikey"=>env("JU_TUI_KE_API_KEY"),
  43. "start_time"=>$getKfcOrdersParamBean->getStartTime(),
  44. "end_time"=>$getKfcOrdersParamBean->getEndTime(),
  45. "query_type"=>$getKfcOrdersParamBean->getQueryType(),
  46. "status"=>$getKfcOrdersParamBean->getStatus(),
  47. "page"=>$getKfcOrdersParamBean->getPage(),
  48. "pageSize"=>$getKfcOrdersParamBean->getPageSize()
  49. ];
  50. $res = HttpCurl::getCurl($url,$params);
  51. return $res["data"];
  52. }
  53. }