$adzone_id, "activity_material_id"=>$activity_material_id ]; $res = $app->content->getActivityInfo($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["data"]; } /** * 获取私域用户邀请码 * @param $codeType int 邀请码类型,1 - 渠道邀请,2 - 渠道裂变,3 -会员邀请 * @param int $relationId 渠道关系ID */ public static function getInviteCode($codeType, $relationId = 0) { $app = self::getApp(); $params = [ "relation_app"=>"common", "code_type"=>$codeType ]; if($relationId){ $params["relation_id"] = $relationId; } $res = $app->sc->getInviteCode($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["msg"]); } return $res["data"]; } /** * 渠道备案 * @param $inviteCode string 邀请码 * @param $infoType int 类型,必选 默认为1: */ public static function savePublisherInfo($inviteCode, $infoType) { $app = self::getApp(); $params = [ "inviter_code"=>$inviteCode, "info_type"=>$infoType ]; $res = $app->sc->savePublisherInfo($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["data"]; } /** * 获取备案信息 * @param $infoType int 类型,必选 1:渠道信息;2:会员信息 * @param $id string 渠道或者会员ID * @param string $relationApp 默认common */ public static function getPublisherInfo($infoType,$id,$relationApp="common") { $app = self::getApp(); $params = [ "info_type"=>$infoType, "relation_app"=>$relationApp ]; switch ($infoType){ case 1: $params["relation_id"] = $id; break; case 2: $params["special_id"] = $id; break; } $res = $app->sc->getPublisherInfo($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["data"]; } /** * 获取拉新用户订单 * @param $activityId string 活动ID * @param int $page int 第几页 */ public static function getNewOrder($activityId, $page = 1) { $app = self::getApp(); $params = [ "page_no"=>$page, "activity_id"=>$activityId ]; $res = $app->dg->getOrderNewUser($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["results"]; } /** * 获取淘口令接口 * @param $url string 地址 */ public static function taokoulingCreate($url) { $app = self::getApp(); $params = [ "url"=>$url ]; $res = $app->tpwd->create($params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["data"]; } /** * 淘口令解析&转链 * @param $kouling 淘口令 */ public static function taokoulingConvert($kouling) { $app = self::getApp(); $params = [ "password_content"=>$kouling, "adzone_id"=>"70362850341" ]; $res = $app->tpwd->httpPost("taobao.tbk.tpwd.convert",$params); $res = json_decode(json_encode($res),true); if(isset($res["code"])){ throw new TaobaoException($res["sub_msg"]); } return $res["data"]; } /** * 获取饿了么外卖推广链接 * @param $userId string 用户ID * @param $actId string 活动ID * @param string $linkType string 类型 * @param string $spreadId 推广位 */ public static function getElmWaimaiSpreadUrl($userId, $actId, $linkType="mini",$spreadId = "111538400047") { $key = "elmUrl:".$userId."linktype:".$linkType."actid:".$actId; //判断缓存中是否存在 $val = self::getCacheFromRedis($key); if($val){ return $val; } //不存在则从官方获取 $res = self::getActivityInfo($spreadId,$actId); switch ($linkType){ case "h5": //h5链接 $val = $res["short_click_url"]; break; case "mini": //小程序 $val = $res["wx_miniprogram_path"]; break; } self::setRedisCache($key,$val,0); return $val; } }