12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace App\Http\Utils\KenDeJi;
- use App\Exceptions\CommonException;
- use App\Http\Bean\Util\KenDeJi\GetKfcOrdersParamBean;
- use App\Http\Enum\ErrorEnum;
- use App\Http\Utils\BaseUtil;
- use Tool\ShanTaoTool\HttpCurl;
- class KenDeJiUtil extends BaseUtil
- {
- /**
- * 获取肯德基活动转链
- * @param $sid string 推广位ID
- * @param string $phone 手机号码
- */
- public static function getKfcActUrl($sid, $phone = "")
- {
- $url = "http://api.jutuike.com/Kfc/act";
- $params = [
- "apikey"=>env("JU_TUI_KE_API_KEY"),
- "sid"=>$sid
- ];
- if($phone){
- $params["mobile"] = $phone;
- }
- $res = HttpCurl::getCurl($url,$params);
- if($res["code"]!= 1){
- throw new CommonException(ErrorEnum::ERROR_KFC_URL);
- }
- return $res["data"];
- }
- /**
- * 获取kfc订单
- * @param GetKfcOrdersParamBean $getKfcOrdersParamBean
- */
- public static function getKfcOrders(GetKfcOrdersParamBean $getKfcOrdersParamBean)
- {
- $url = "http://api.jutuike.com/kfc/orders";
- $params = [
- "apikey"=>env("JU_TUI_KE_API_KEY"),
- "start_time"=>$getKfcOrdersParamBean->getStartTime(),
- "end_time"=>$getKfcOrdersParamBean->getEndTime(),
- "query_type"=>$getKfcOrdersParamBean->getQueryType(),
- "status"=>$getKfcOrdersParamBean->getStatus(),
- "page"=>$getKfcOrdersParamBean->getPage(),
- "pageSize"=>$getKfcOrdersParamBean->getPageSize()
- ];
- $res = HttpCurl::getCurl($url,$params);
- if($res["code"]==1){
- return $res["data"];
- }
- if($res["msg"]=="【对应条件内无数据】"){
- return [];
- }
- }
- }
|