env("JU_TUI_KE_API_KEY"), "page"=>$page, "pageSize"=>100 ]; $res = HttpCurl::getCurl($url,$params); return $res; } /** * 获取订单列表 * @param GetOrderListParamBean $getOrderListParamBean */ public static function getOrderList(GetOrderListParamBean $getOrderListParamBean) { $url = self::$baseUrl."union/orders"; $params = [ "apikey"=>env("JU_TUI_KE_API_KEY") ]; if ($getOrderListParamBean->getStartTime()){ $params["start_time"] = $getOrderListParamBean->getStartTime(); } if ($getOrderListParamBean->getEndTime()){ $params["end_time"] = $getOrderListParamBean->getEndTime(); } if ($getOrderListParamBean->getQueryType()){ $params["query_type"] = $getOrderListParamBean->getQueryType(); } if ($getOrderListParamBean->getStatus()){ $params["status"] = $getOrderListParamBean->getStatus(); } if ($getOrderListParamBean->getOrderSn()){ $params["order_sn"] = $getOrderListParamBean->getOrderSn(); } if ($getOrderListParamBean->getPage()){ $params["page"] = $getOrderListParamBean->getPage(); } if ($getOrderListParamBean->getPageSize()){ $params["pageSize"] = $getOrderListParamBean->getPageSize(); } $res = HttpCurl::getCurl($url,$params); return $res; } /** * 获取活动转链接口 * @param $sid string 推广位 * @param $actId int 活动ID */ public static function transferAct($sid,$actId) { $instance = new LoggerFactoryUtil(JutuikeUtil::class); $key = "jutuikeTransferAct-".$sid."-".$actId; $val = self::getCacheFromRedis($key); if($val){ $instance->info("缓存中获取:".$val); return json_decode($val,true); } $url = self::$baseUrl."union/act"; $params = [ "apikey"=>env("JU_TUI_KE_API_KEY"), "sid"=>$sid, "act_id"=>$actId ]; $res = HttpCurl::getCurl($url,$params); $instance->info("上游发挥信息:".json_encode($res)); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("活动ID:".$actId); $instance->info("推广位ID:".$sid); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } $val = $res["data"]; self::setRedisCache($key,json_encode($val),0); return $val; } /** * 获取转链的商品信息 * @param $linkurl 转链url */ public static function transferGoodsLink($linkurl) { $url = self::$baseJuheurl."union/wn_convert"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID"), "content"=>$linkurl, ]; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } /** * 转链API接口 * @param $goodsId 商品ID * @param $sid 推广位ID * @param string $source 来源 jd-京东,vip-唯品会,pdd-拼多多,kaola-考拉,taobao-淘宝 默认vip */ public static function convert($goodsId,$sid,$source="taobao") { $url = self::$baseJuheurl."union/convert"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID"), "goodsId"=>$goodsId, "sid"=>$sid, "source"=>$source, ]; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } /** * 获取平台分类接口 * @param string $source */ public static function goodsCategory($source) { $url = self::$baseJuheurl."union/goods_category"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID"), ]; $params["source"] = $source; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } /** * 获取商品列表 * @param GoodsListParamBean $goodsListParamBean */ public static function goodsList(GoodsListParamBean $goodsListParamBean) { $url = self::$baseJuheurl."union/query_goods"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID"), "source"=>$goodsListParamBean->getSource(), "cat"=>$goodsListParamBean->getCat(), "page"=>$goodsListParamBean->getPage(), "pageSize"=>$goodsListParamBean->getPageSize(), ]; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } /** * 商品搜索接口 * @param GoodsSearchParamBean $goodsSearchParamBean */ public static function goodsSearch(GoodsSearchParamBean $goodsSearchParamBean) { $url = self::$baseJuheurl."union/search"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID"), "sid"=>$goodsSearchParamBean->getSource(), "source"=>$goodsSearchParamBean->getSource(), "keyword"=>$goodsSearchParamBean->getKeyword(), "sort"=>$goodsSearchParamBean->getSort(), "page"=>$goodsSearchParamBean->getPage(), "pageSize"=>$goodsSearchParamBean->getPageSize(), ]; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } /** * 电商平台列表接口 */ public static function plateformList() { $url = self::$baseJuheurl."union/platform"; $params = [ "pub_id"=>env("JU_TUI_KE_PUB_ID") ]; $res = HttpCurl::postCurl($url,$params); if($res["code"]!=1){ $instance = new LoggerFactoryUtil(JutuikeUtil::class); $instance->info("上游返回数据:".json_encode($res)); throw new CommonException(ErrorEnum::ERROR_TRANS_LINK); } return $res["data"]; } }