app開屏廣告


最近公司有個需求需要做app開屏廣告(跳轉到不同的頁面)--下面是app開屏廣告的處理

1.管理后台效果圖

(1)廣告鏈接--商品詳情

 

(2)廣告鏈接--關聯模塊

(3)廣告鏈接--消息富文本

(4)廣告鏈接--H5頁面

(5)廣告鏈接--蜂雷頭條

2.數據表的設計

 CREATE TABLE `lc_open_ad` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `second` int(11) DEFAULT NULL COMMENT '開屏廣告停留時長(單位:秒)',
  `ad_effective_start` datetime DEFAULT NULL COMMENT '開屏廣告有效時間--開始時間',
  `ad_effective_end` datetime DEFAULT NULL COMMENT '開屏廣告有效時間--結束時間',
  `ad_url` varchar(100) DEFAULT NULL COMMENT ' 開屏廣告圖片地址',
  `ad_link_type` int(11) DEFAULT NULL COMMENT '廣告鏈接類型(1商品詳情頁、2關聯模塊、3消息富文本、4H5頁面、5蜂雷頭條詳情頁)',
  `ad_link_content` text COMMENT '廣告鏈接內容 (json格式)',
  `create_id` bigint(20) DEFAULT NULL COMMENT ' 創建人',
  `create_time` datetime DEFAULT NULL COMMENT '創建時間',
  `update_id` bigint(20) DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT NULL COMMENT '修改時間',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '狀態: 1 正常 2 禁用',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已刪除 0正常  1 已刪除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8 COMMENT='開屏廣告\n{"ad_type":"一級分類(默認1)","ad_link_type":"1(商品詳情頁)","itemid":"商品sku_id","sno":"商品sku_no"}\n{"ad_type":"一級分類(默認1)","ad_link_type":"2(關聯模塊)","plate_type":"1限時蜂搶、2新品、3蜂神榜、4蜂覓、5首頁"}\n{"ad_type":"一級分類(默認1)","ad_link_type":"3(消息富文本)","rich_text_id":"消息富文本id"}\n{"ad_type":"一級分類(默認1)","ad_link_type":"4(H5頁面)","url":"H5頁面地址"}\n{"ad_type":"一級分類(默認1)","ad_link_type":"5(蜂雷頭條詳情頁)","id":"蜂雷頭條id"}';

3.數據表值的存儲

4.管理后台添加(修改)的數據接收格式

{"id":"","second":"10","ad_url":"/Public/Uploads/ad/origin/5a1a68890eda5.jpg","ad_effective_start":"2016-10-12 00:00:00","ad_effective_end":"2016-10-13 00:00:00","ad_type":"1","ad_link_type":"1","ad_link_content":{"sku_id":"111111","sku_no":"P11111-01"}}
{"id":"","second":"10","ad_url":"/Public/Uploads/ad/origin/5a1a68890eda5.jpg","ad_effective_start":"2016-10-10 00:00:00","ad_effective_end":"2016-10-15 00:00:00","ad_type":"1","ad_link_type":"2","ad_link_content":{"plate_type":"1"}}
{"id":"","second":"10","ad_url":"/Public/Uploads/ad/origin/5a1a68890eda5.jpg","ad_effective_start":"2016-10-23 00:00:00","ad_effective_end":"2016-10-24 00:00:00","ad_type":"1","ad_link_type":"3","ad_link_content":{"rich_text_id":"富文本消息id--為空添加,不為空修改","content":"ssssssssssssss"}}
{"id":"","second":"10","ad_url":"/Public/Uploads/ad/origin/5a1a68890eda5.jpg","ad_effective_start":"2016-10-10 00:00:00","ad_effective_end":"2016-10-15 00:00:00","ad_type":"1","ad_link_type":"4","ad_link_content":{"url":"goods/detail?sno=P001219-01&itemid=1002975101}}
{"id":"","second":"10","ad_url":"/Public/Uploads/ad/origin/5a1a68890eda5.jpg","ad_effective_start":"2016-10-10 00:00:00","ad_effective_end":"2016-10-15 00:00:00","ad_type":"1","ad_link_type":"5","ad_link_content":{"id":"66"}}    

 6.php代碼實現

(1)控制器

    /**
     * @title App開屏廣告--添加(修改)
     * @param data 是 json 接收參數,格式:{"id":"為空添加,不為空修改","second":"開屏廣告停留時間(單位:秒)","ad_url":"開屏廣告圖片地址(相對路徑)","ad_effective_start":"開屏廣告有效時間--開始時間","ad_effective_end":"開屏廣告有效時間--結束時間","ad_type":"廣告類型(不傳默認1)","ad_link_type":"廣告鏈接類型(1商品詳情頁、2關聯模塊、3消息富文本、4H5頁面、5蜂雷頭條詳情頁)","ad_link_content":"廣告鏈接內容"}
     * @example app/kaipin_ad_save?
     * @method POST 
     * @author 鄒柯
     */
    public function kaipin_ad_saveAction(){        
        load('Common.check');
        $public=D('Public');     
        $data=trim(I('post.data'));
        $res=$public->dealJson($data);
        $id=trim($res['id']);
        //廣告類型
        $ad_type=trim($res['ad_type']);
        if(empty($ad_type)){
            $ad_type=1;
        }
        //開屏廣告停留時間
        $second=trim($res['second']);
        if(empty($second)){
            $data = array('msg' =>"開屏廣告停留時長不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if(!is_numeric($second) || $second <= 0){
            $data = array('msg' =>"開屏廣告停留時長必須為大於等於1的整形!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }  
        //開屏廣告圖片地址
        $ad_url=trim($res['ad_url']);
        if(empty($ad_url)){
            $data = array('msg' =>"開屏廣告圖片必須上傳!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        //廣告有效時間
        $ad_effective_start=trim($res['ad_effective_start']);
        if(empty($ad_effective_start)){
            $data = array('msg' =>"廣告有效時間--開始時間不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if(!IsDate($ad_effective_start,'Y-m-d H:i:s')){
            $data = array('msg' =>"廣告有效時間--結束時間格式錯誤!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        $ad_effective_end=trim($res['ad_effective_end']);
        if(empty($ad_effective_end) && !empty($ad_effective_end)){
            $data = array('msg' =>"廣告有效時間--結束時間不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if(!IsDate($ad_effective_end,'Y-m-d H:i:s')){
            $data = array('msg' =>"廣告有效時間--結束時間格式錯誤!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if($ad_effective_start > $ad_effective_end){
            $data = array('msg' =>"廣告有效時間開始時間不能大於結束時間!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        //廣告鏈接類型
        $ad_link_type=trim($res['ad_link_type']);
        if(empty($ad_link_type)){
            $data = array('msg' =>"廣告鏈接類型不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if(!is_numeric($ad_link_type) || $ad_link_type <= 0){
            $data = array('msg' =>"廣告鏈接類型必須為大於等於1的整形!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }  
        if(!in_array($ad_link_type,array(1,2,3,4,5))){
            $data = array('msg' =>"廣告鏈接類型值非法!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        //廣告鏈接內容
        $ad_link_content=$res['ad_link_content'];
        if(empty($ad_link_content)){
            $data = array('msg' =>"廣告鏈接內容不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }       
        $app=D('App');
        $list=$app->kaipin_ad_add($id,$second,$ad_url,$ad_effective_start,$ad_effective_end,$ad_type,$ad_link_type,$ad_link_content); 
        if((int)$list==100){
            $data = array('msg' =>"廣告有效時間沖突!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        if($list==false){
            $data = array('msg' =>"添加失敗!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        $data = array('msg' =>"添加成功!" , 'status'=>'0','result'=>$list);
        $this->ajaxReturn($data);
    }
  /**
     * @title 開屏廣告圖片上傳
     * @example app/img_upload?
     * @param ad_url 是 file 開屏廣告圖片名稱(上傳圖片的尺寸1440_2560)
     * @return_param_explain  returnPath:相對路徑(存儲用) preview:全路徑(展示用)
     * @method POST
     * @author 鄒柯
     */
    public function img_uploadAction(){
        if(!empty($_FILES["ad_url"]["name"])){
             $width="1440";
             $height="2560";
             $app = D('App');
             $data = $app->upload_file('ad_url',$width,$height);
        }else{
             $data = array(
                'msg' => "參數錯誤",
                'status' => '1'
             );
        }
        
        $this->ajaxReturn($data);
    }  

(2)模型

     //App開屏廣告--添加(修改)
     public function kaipin_ad_add($id,$second,$ad_url,$ad_effective_start,$ad_effective_end,$ad_type,$ad_link_type,$ad_link_content){  
         $open_ad=M('open_ad');
         $create_time=date('Y-m-d H:i:s',time());
         $create_user=$_SESSION['user']['personnel_code'];
         
         //判斷時間是否沖突
         $where2="status=1 and is_deleted=0";
         if(!empty($id)){
             $where2 .=" and id !='".$id."'";
         }
         $rs=$open_ad->field('ad_effective_start,ad_effective_end')->where($where2)->select();
         $r_start=array_unique(array_column($rs,'ad_effective_start'));
         $r_end=array_unique(array_column($rs,'ad_effective_end'));
         if(in_array($ad_effective_start,$r_start)){
             return 100;
         }
         if(in_array($ad_effective_end,$r_end)){
             return 100;
         }
         foreach($r_end as $k=>$v){
             if($v > $ad_effective_start && $v <= $ad_effective_end){
                  return 100;
             }
             continue;
         }       
         foreach($rs as $k=>$v){
             if($v['ad_effective_start'] <=$ad_effective_start && $ad_effective_end <=$v['ad_effective_end']){
                  return 100;
             }
         }
         switch($ad_link_type){
             case 1: //商品詳情頁
                 $ad_link_content_info=array(
                     'ad_type'=>$ad_type,
                     'ad_link_type'=>$ad_link_type,
                     'itemid'=>$ad_link_content['sku_id'],
                     'sno'=>$ad_link_content['sku_no']
                 );
                 break; 
             case 2://關聯模塊
                 $ad_link_content_info=array(
                     'ad_type'=>$ad_type,
                     'ad_link_type'=>$ad_link_type,
                     'plate_type'=>$ad_link_content['plate_type'],
                 );
                 break;
             case 3://廣告富文本
                 $rich_text=M('rich_text');
                 //添加
                 if(empty($ad_link_content['rich_text_id'])){
                      $data=array(
                            'content'=>html_entity_decode($ad_link_content['content']),
                            'create_id'=>$create_user,
                            'create_time'=>$create_time,
                            'update_id'=>$create_user,
                            'update_time'=>$create_time,                          
                            'type'=>2
                      );
                      $re=$rich_text->data($data)->add();
                      //獲取自增id
                      $id2=$rich_text->getLastInsID();
                 }else{
                      $data=array(
                            'content'=>html_entity_decode($ad_link_content['content']),
                            'update_id'=>$create_user,
                            'update_time'=>$create_time,
                      );
                      $re=$rich_text->where(array('id'=>$ad_link_content['rich_text_id']))->data($data)->save();
                      $id2=$ad_link_content['rich_text_id'];
                 }     
                 
                 $ad_link_content_info=array(
                     'ad_type'=>$ad_type,
                     'ad_link_type'=>$ad_link_type,
                     'rich_text_id'=>$id2
                 );
                 break;
             case 4://H5頁面
                 $ad_link_content_info=array(
                     'ad_type'=>$ad_type,
                     'ad_link_type'=>$ad_link_type,
                     'url'=>$ad_link_content['url']
                 );
                 break;
             default://蜂雷頭條詳情頁                 
                 $ad_link_content_info=array(
                     'ad_type'=>$ad_type,
                     'ad_link_type'=>$ad_link_type,
                     'id'=>$ad_link_content['id']
                 );
                 break;                 
         }  
         //轉換成json       
         $ad_link_content_json = json_encode($ad_link_content_info);
         //添加
         if(empty($id)){
             //添加開屏廣告
            $data2=array(
                   'second'=>$second,
                   'ad_url'=>$ad_url,
                   'ad_effective_start'=>$ad_effective_start,
                   'ad_effective_end'=>$ad_effective_end,
                   'ad_link_type'=>$ad_link_type,
                   'ad_link_content'=>$ad_link_content_json,
                   'create_id'=>$create_user,
                   'create_time'=>$create_time,
                   'update_id'=>$create_user,
                   'update_time'=>$create_time,
            );
            $res2=$open_ad->data($data2)->add();
         }else{//修改
             //添加開屏廣告
            $wh = "id='".$id."'";
            $res_in=$open_ad->field('id,second,ad_effective_start,ad_effective_end,ad_url,ad_link_type,ad_link_content')->where($wh)->find();
            $data2=array(
                   'second'=>$second,
                   'ad_url'=>$ad_url,
                   'ad_effective_start'=>$ad_effective_start,
                   'ad_effective_end'=>$ad_effective_end,
                   'ad_link_type'=>$ad_link_type,
                   'ad_link_content'=>$ad_link_content_json,
                   'update_id'=>$create_user,
                   'update_time'=>$create_time,
            );
            $res2=$open_ad->data($data2)->where(array('id'=>$id))->save();
         }         
         if(!$res2){
               return false;
         }
         //寫日志
         if(empty($id)){
             $type=1; //添加
             $message_before='';
             $message="添加了1條【開始時間為:".$ad_effective_start.",結束時間為:".$ad_effective_end."】的開屏廣告信息";   
         }else{
             $type=2; //修改               
             $message_before=json_encode($res_in);     
             $message="修改了1條id為".$id."的app開屏廣告信息";   
         }
         $message_after=json_encode($data2);
         D('public')->wLog($message,$message_before,$message_after,$type);
         return true;
     }
  /*
    *  驗證圖片尺寸是否合法
    *  img_tmp_width  :   上傳圖片寬
    *  img_tmp_height :   上傳圖片高
    *  width  :    規定圖片寬
    *  height :    規定圖片高
    */
    private function checkImgSize($width,$height,$img_tmp_width,$img_tmp_height){
        if(empty($width) || empty($height) || empty($img_tmp_width) || empty($img_tmp_height)){
            $status = '1';
            $msg = "圖片寬高不能為空!";
        }elseif($width<>$img_tmp_width ||  $height<>$img_tmp_height){
            $status = '1';
            $msg = '圖片尺寸錯誤,正確值:'.$width.'px * '.$height.'px';    
        }else{
            $status = '0';
            $msg = '驗證通過';
        }
        $result = array('status'=>$status,'msg'=>$msg);    
        return $result;
    }
    public function upload_file($file_name,$width,$height) {
        //檢查圖片尺寸是否合法       
        $image_size = getimagesize($_FILES[$file_name]['tmp_name']);
        $img_tmp_width=$image_size['0'];
        $img_tmp_height=$image_size['1'];
        $size_result = $this->checkImgSize($width,$height,$img_tmp_width,$img_tmp_height);
        if($size_result['status'] == '1'){
             return $size_result;   //格式錯誤直接返回
        }
        //執行上傳   
        $upload_path = C('upload_path');                      // Public/Uploads/
        $upload = new \Think\Upload();                        // 實例化上傳類
        $upload->maxSize = 3145728;                           // 設置附件上傳大小
        $upload->exts = array('jpg', 'gif', 'png', 'jpeg');   // 設置附件上傳類型
        $upload->rootPath = './' . rtrim($upload_path, '/');  // 設置附件上傳根目錄
        $upload_img_url=C('upload_img_url');                  // /www/web/feelee_mall_img/public_html/
        $rootPath=$upload_img_url . rtrim($upload_path, '/'); // 設置附件上傳根目錄 /www/web/feelee_mall_img/public_html/Public/Uploads
        $upload->rootPath = $rootPath;
        $savepath = '/ad/';
        $path = '/' . $upload_path;
        $upload->saveName = uniqid();
        $upload->savePath = $savepath;
        $upload->replace = true;
        $upload->autoSub = true;
        $upload->subName = "origin"; //date("Ymd");
        $path1='/ad/origin/';
        if(!is_dir($path1)){
            mkdir($path1,0755);
        }
        // 上傳單個文件
        $info = $upload->uploadOne($_FILES[$file_name]);
        if (!$info) {// 上傳錯誤提示錯誤信息
            $upload_error = C('upload_error_msg');
            $error = $upload_error[$upload->getError()];
            if ($error == '') {
                $error = $upload->getError();
            }
            return $data = array(
                'msg' => $error,
                'status' => 1,
                'result'=>null                
            );
        } else {// 上傳成功 獲取上傳文件信息
            $filenames = $path . $info['savepath'] . $info['savename'];
            //生成縮略圖
            $info2=$this->createThumb($info,$rootPath);
            $preview=C('img_base').$filenames;
            return  $data = array(
                'msg' => '上傳成功',
                'status' => '0',
                'result' =>array(
                    'returnPath'=>$filenames,//保存用
                    'preview'=>$preview      //顯示用
                )       
            );
        }
    }
    //生成縮略圖
    public function createThumb($info,$rootPath){
        $path2=$rootPath.'/ad/thumb/';
        if(!is_dir($path2)){
            mkdir($path2,0755);
        }
        $pic_size=C('pic_size');
        $cn=count($pic_size);
        $image=new \Think\Image();
        //打開要生成縮略圖的文件
        for($i=0;$i<$cn;$i++){
            $image->open($rootPath."/ad/origin/".$info['savename']);
            $url_pic='/thumb/'.$pic_size[$i] ."_". $info['savename'];
            $in=strpos($pic_size[$i],"_");
            $width=substr($pic_size[$i],0,$in);
            $height=substr($pic_size[$i],$in+1);
            //生成ios縮略圖
            $image->thumb($width,$height,1)->save($rootPath."/ad".$url_pic);
        }
    }

配置文件:

 //圖片縮略圖尺寸    'pic_size'=>array("640_960","640_1136","720_1280","750_1334","800_1280","1080_1920","1125_2436","1242_2208","1440_2560"),

 

(3)app--前端取值--根據android和ios不同屏幕尺寸返回不同大小的圖片

控制器:

 /**
     * @title 開屏廣告頁
     * @example app/kai_pin_ad? 調試參數:{"type":"1"}
     * @param data 是 json 接收參數,格式:{type:"圖片尺寸1(640_960)、2(640_1136)、3(720_1280)、4(750_1334)、5(800_1280)、6(1080_1920)、7(1125_2436)、8(1242_2208)、9(1440_2560)"}
     * @return_param_explain id:開屏廣告id ad_effective_start:開屏廣告有效時間--開始時間 ad_effective_end:開屏廣告有效時間--結束時間 second:開屏廣告停留時間(單位:秒) ad_url:開屏廣告圖片地址 ad_link_type_name:廣告鏈接類型(1商品詳情頁、2關聯模塊、3消息富文本、4H5頁面、5蜂雷頭條詳情頁) param:根據鏈接類型--跳轉地址或參數
     * @method POST 
     * @author 鄒柯
     */
    public function kai_pin_adAction(){
        $public=new PublicModel();     
        $data=trim(I('post.data'));
        $res=$public->dealJson($data);
        $user_id=session('user.user_id');
        $type=trim($res['type']);
        if(empty($type)){
            $data = array('msg' =>"圖片尺寸類型不能為空!" , 'status'=>'1','result'=>null);
            $this->ajaxReturn($data);
        }
        $app=new AppModel();
        $list=$app->kai_pin_ad($type,$user_id); 
        $data = array('msg' =>"加載成功!" , 'status'=>'0','result'=>$list);
        $this->ajaxReturn($data);
    }

模型:

   public function kai_pin_ad($type,$user_id){
        $time=date('Y-m-d H:i:s',time());
        $where="'".$time."' <=ad_effective_end and status=1";
        $open_ad=M('open_ad');
        $list=$open_ad->field('id,second,ad_effective_start,ad_effective_end,ad_url,ad_link_type,ad_link_content,is_deleted')
                ->where($where)
                ->select();
        if(empty($list)){
             return null;
        }else{
             foreach($list as $k=>$v){
                $ad_link_content_arr=json_decode($v['ad_link_content'],true);
                $ad_link_type=$v['ad_link_type'];
                switch($ad_link_type){
                   case 1: //商品詳情頁
                       //獲取種子店
                       if(empty($user_id)){
                           $store_id=C('setting_store');
                       }else{//獲取該登錄用戶的上級店鋪id
                           $inf=M('customer')->where('user_id="'.$user_id.'" and is_deleted=0')->field('partent_user_id')->find();
                           $store_id=M('store')->where('user_id="'.$inf['partent_user_id'].'"')->getField('id');
                       }
                       $data=array(
                           'itemid'=>$ad_link_content_arr['itemid'],
                           'sno'=>$ad_link_content_arr['sno'],
                           'store_id'=>$store_id
                       );
                       break; 
                   case 2://關聯模塊
                       $data=array('plate_type'=>$ad_link_content_arr['plate_type']);  
                       break;
                   case 3://廣告富文本
                       $rich_text=M('rich_text');
                       $where2="id='".$ad_link_content_arr['rich_text_id']."' and is_deleted=0 and status=1";
                       $res=$rich_text->field('id,content')->where($where2)->find();
                       $data=array(
                            'id'=>$ad_link_content_arr['rich_text_id'],
                            'title'=>"廣告詳情",
                            'content'=>$res['content'],
                            'url'=>'common/rich_text?id='.$ad_link_content_arr['rich_text_id'].'&type=2'
                       );
                       break;
                   case 4://H5頁面
                       $data=array('url'=>$ad_link_content_arr['url']);
                       break;
                   default://蜂雷頭條詳情頁
                       $headlines = M('headlines','t_',C('select_db')); 
                       $list2=$headlines->where(array('id'=>$ad_link_content_arr['id']))->field('id,title,content')->find();
                       $data=array(
                           'id'=>$ad_link_content_arr['id'],
                           'title'=>$list2['title']
                       );   
                       break;   
                }
                $or_url=C('img_base')."Public/Uploads/ad/thumb/";
                $in=strripos($v['ad_url'],"/");
                $filename=substr($v['ad_url'],$in+1);
                $pic_size=C('pic_size');
                $ct=$type-1;
                $in=strpos($pic_size[$ct],"_");
                $width=substr($pic_size[$ct],0,$in);
                $height=substr($pic_size[$ct],$in+1);
                $ad_url_pic=$or_url.$pic_size[$ct] ."_". $filename;
                $arr[$k]=array(
                    'id'=>$v['id'],
                    'ad_effective_start'=>$v['ad_effective_start'],
                    'ad_effective_end'=>$v['ad_effective_end'],
                    'ad_link_type'=>$ad_link_type,
                    'second'=>$v['second'],
                    'ad_url'=>$ad_url_pic,
                    'redirect_url'=>$data,
                    'is_deleted'=>$v['is_deleted']
                );
            }
            return $arr;
        }   
    } 

配置文件:

 //圖片縮略圖尺寸    'pic_size'=>array("640_960","640_1136","720_1280","750_1334","800_1280","1080_1920","1125_2436","1242_2208","1440_2560"),

 

 

返回的數據結構:

{
    "msg":"加載成功!",
    "status":"0",
    "result":[{
        "id":"7",
        "ad_effective_start":"2017-12-15 13:33:37",
        "ad_effective_end":"2017-12-15 21:22:37",
        "ad_link_type":"3",
        "second":"4",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_1002883101.jpg",
        "redirect_url":{
            "id":106,
            "title":"廣告詳情",
            "content":"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "url":"common\/rich_text?id=106&type=2"
        },
        "is_deleted":"1"
    },
    {
        "id":"14",
        "ad_effective_start":"2017-12-10 00:00:00",
        "ad_effective_end":"2017-12-10 19:00:00",
        "ad_link_type":"4",
        "second":"10",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_1002883101.jpg",
        "redirect_url":{
            "url":"www.baidu.com"
        },
        "is_deleted":"1"
    },
    {
        "id":"15",
        "ad_effective_start":"2016-12-09 00:00:00",
        "ad_effective_end":"2017-12-09 19:00:00",
        "ad_link_type":"5",
        "second":"10",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_1002883101.jpg",
        "redirect_url":{
            "id":"63",
            "title":"詩聖杜甫"
        },
        "is_deleted":"0"
    },
    {
        "id":"99",
        "ad_effective_start":"2018-01-04 09:09:17",
        "ad_effective_end":"2018-01-06 07:07:17",
        "ad_link_type":"2",
        "second":"8",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a227452bde39.png",
        "redirect_url":{
            "plate_type":"003"
        },
        "is_deleted":"1"
    },
    {
        "id":"100",
        "ad_effective_start":"2018-01-11 06:06:34",
        "ad_effective_end":"2018-01-13 10:10:34",
        "ad_link_type":"1",
        "second":"8",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a229c940ca46.png",
        "redirect_url":{
            "itemid":1000000008,
            "sno":"P001219-10",
            "store_id":"117080350981001"
        },
        "is_deleted":"1"
    },
    {
        "id":"108",
        "ad_effective_start":"2021-03-02 00:00:46",
        "ad_effective_end":"2021-03-05 23:59:46",
        "ad_link_type":"4",
        "second":"1",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a24b794701b5.png",
        "redirect_url":{
            "url":"http:\/\/fenglei_manage.com"
        },
        "is_deleted":"1"
    },
    {
        "id":"109",
        "ad_effective_start":"2021-01-01 00:00:53",
        "ad_effective_end":"2021-01-02 23:59:53",
        "ad_link_type":"4",
        "second":"5",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a24b97b0e289.png",
        "redirect_url":{
            "url":"http:\/\/fenglei_manage.com\/"
        },
        "is_deleted":"1"
    },
    {
        "id":"110",
        "ad_effective_start":"2018-01-01 00:00:00",
        "ad_effective_end":"2018-01-03 23:59:00",
        "ad_link_type":"1",
        "second":"5",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a2536a29fa2e.png",
        "redirect_url":{
            "itemid":1000000013,
            "sno":"P001219-15",
            "store_id":"117080350981001"
        },
        "is_deleted":"1"
    },
    {
        "id":"111",
        "ad_effective_start":"2018-01-10 00:00:00",
        "ad_effective_end":"2018-01-12 23:59:00",
        "ad_link_type":"5",
        "second":"6",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a2536cc11c0f.png",
        "redirect_url":{
            "id":67,
            "title":null
        },
        "is_deleted":"1"
    },
    {
        "id":"112",
        "ad_effective_start":"2018-01-15 00:00:00",
        "ad_effective_end":"2018-01-17 23:59:00",
        "ad_link_type":"4",
        "second":"8",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a2536f978fc3.png",
        "redirect_url":{
            "url":"http:\/\/fenglei_manage.com\/"
        },
        "is_deleted":"1"
    },
    {
        "id":"115",
        "ad_effective_start":"2017-12-21 00:00:00",
        "ad_effective_end":"2017-12-30 23:59:00",
        "ad_link_type":"5",
        "second":"8",
        "ad_url":"http:\/\/img.test.feelee.cc\/Public\/Uploads\/ad\/thumb\/640_960_5a268632c171c.png",
        "redirect_url":{
            "id":66,
            "title":null
        },
        "is_deleted":"1"
    }]
}

返回的數據結構字段說明:

id:開屏廣告id

ad_effective_start:開屏廣告有效時間--開始時間

ad_effective_end:開屏廣告有效時間--結束時間

second:開屏廣告停留時間(單位:秒)

ad_url:開屏廣告圖片地址

ad_link_type_name:廣告鏈接類型(1商品詳情頁、2關聯模塊、3消息富文本、4H5頁面、5蜂雷頭條詳情頁)

redirect_url:根據鏈接類型--跳轉地址或參數
     當ad_link_type為1時redirect_url={"itemid":"商品sku_id","sno":"商品sku_no","store_id":"未登錄用戶(種子店)、登錄用戶上級店鋪id"}
     當ad_link_type為2時redirect_url={"plate_type":"1限時蜂搶、2新品、3蜂神榜、4蜂覓、5首頁"}
     當ad_link_type為3時redirect_url={"rich_text_id":"消息富文本id"}     
當ad_link_type為4時redirect_url={"url":"H5頁面地址"} 當ad_link_type為5時redirect_url={"id":"蜂雷頭條id","title":"蜂雷頭條標題"}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM