<?php

use Illuminate\Support\Facades\DB;
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;

class WebTest extends TestCase
{
    protected $token = 'b8b8b69b99b4ea317606df85b0e4bf55';

    /**
     * 测试模拟请求
     * @param string $method
     * @param string $url
     * @param array $params
     */
    public function request(string $method,string $url,array $params=[],$needToken=true){
        print_r(PHP_EOL.PHP_EOL.json_encode($params,JSON_UNESCAPED_UNICODE).PHP_EOL);
        if($needToken){
            $token=empty($this->token)?$this->getToken():$this->token;
        }else{
            $token='';
        }
        $headers = [
            'X-Requested-With'=>'XMLHttpRequest',
            'Content-Type' => 'application/x-www-form-urlencoded',
            'token' => $token // AuthCheck的时候会进行刷新赋值
        ];
        $server = $this->transformHeadersToServerVars($headers);
        $response = $this->call($method,$url,$params,[], [], $server);
        print_r('HTTP状态码：'.$response->getStatusCode().PHP_EOL);
        print_r('返回值：'.PHP_EOL);
        $data = json_decode($response->getContent(),true);
//        $this->assertEquals(0,$data['ret']??-1);
        echo PHP_EOL.PHP_EOL.json_encode($data,JSON_UNESCAPED_UNICODE);
        return $data;
    }

    protected function getToken(){
        $response = $this->call('post','/api/app/login',['user_name'=>$this->username,'password'=>$this->password,'app_code'=>'JYGJ','app_key'=>'D0AB3EE73EDD8F70EB23E37231FCBC33']);
        if($response->getStatusCode()!=200){
            echo '登录失败';exit;
        }
        $data = json_decode($response->getContent(),true);
        if(!isset($data['code'])||isset($data['code']) && $data['code']!=0){
            print_r($data);
            exit;
        }
        return $data['data']['api_token'];
    }

    public function testGetListByType()
    {
        $data=[
            'type_id'=>1,
            'page'=>1,
            'page_size'=>10
        ];
        $this->request('get','/api/blog/get-list-by-type',$data);
    }

    public function testSaveBlog(){
        $updateUvStr="update blog set total_view = total_view +'107', virtual_view = virtual_view +'107' where id='25';update blog set total_view = total_view +'262', virtual_view = virtual_view +'262' where id='32';update blog set total_view = total_view +'113', virtual_view = virtual_view +'113' where id='22';update blog set total_view = total_view +'66', virtual_view = virtual_view +'66' where id='3';update blog set total_view = total_view +'235', virtual_view = virtual_view +'235' where id='26';update blog set total_view = total_view +'22', virtual_view = virtual_view +'22' where id='27';update blog set total_view = total_view +'196', virtual_view = virtual_view +'196' where id='9';update blog set total_view = total_view +'213', virtual_view = virtual_view +'213' where id='28';update blog set total_view = total_view +'295', virtual_view = virtual_view +'295' where id='10';update blog set total_view = total_view +'214', virtual_view = virtual_view +'214' where id='29';update blog set total_view = total_view +'255', virtual_view = virtual_view +'255' where id='13';update blog set total_view = total_view +'70', virtual_view = virtual_view +'70' where id='12';update blog set total_view = total_view +'7', virtual_view = virtual_view +'7' where id='14';update blog set total_view = total_view +'70', virtual_view = virtual_view +'70' where id='11';update blog set total_view = total_view +'69', virtual_view = virtual_view +'69' where id='5';update blog set total_view = total_view +'59', virtual_view = virtual_view +'59' where id='4';update blog set total_view = total_view +'161', virtual_view = virtual_view +'161' where id='2';update blog set total_view = total_view +'120', virtual_view = virtual_view +'120' where id='6';update blog set total_view = total_view +'292', virtual_view = virtual_view +'292' where id='18';update blog set total_view = total_view +'283', virtual_view = virtual_view +'283' where id='8';update blog set total_view = total_view +'235', virtual_view = virtual_view +'235' where id='7';update blog set total_view = total_view +'10', virtual_view = virtual_view +'10' where id='1';";
        DB::statement(DB::raw($updateUvStr));die;
        $dataStr='{"id":25,"user_id":1,"plate_id":1,"pub_date":"2023-03-09 10:20:38","title":"2023中国数字营销趋势报告ywl1","content":"<p><span style=\"font-family: sans-serif; font-size: 24px;\"><strong><img src=\"https://digital.yongsy.com/uploads/20221226/28939bab3aaa36744cf6b7ece4178e3f.png\" alt=\"\" /></strong></span></p>\n<hr />\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 20%;\"><span style=\"font-size: 24px;\"><img src=\"https://oss.matchpages.cn/matchpages/share_center/2023/0323/1821/641bc6b30f79f/logo-starify2X.webp\" alt=\"logo-starify2X.webp \" data-resolution=\"204*57\" /></span></td>\n<td style=\"width: 80%;\">\n<h1 data-sf_anchor=\"0\"><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong>营销科学家视角：关于营销趋势12345</strong></span></h1>\n<div><span style=\"font-family:  sans-serif; font-size: 24px;\">明年的<a href=\"https://digital.yongsy.com/\">数字营销</a>市场，最值得关注的趋势应该是结合元宇宙、虚拟人等方面的IP数智营销。今年以来，不同品牌的一些尝试已经开始有正向回报，无论是品牌价值提升，还是销售收入增加，都表明这个趋势已经成立，值得快速跟进和拓展。AA我的</span></div>\n</td>\n</tr>\n</tbody>\n</table>\n<div>&nbsp;</div>\n<h1 data-sf_anchor=\"1\"><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong>营销科学家视角：关于营销趋势12345<br /></strong></span><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong><iframe src=\"//player.bilibili.com/player.html?aid=315662862&amp;bvid=BV1rP411C7kt&amp;cid=1190502893&amp;page=1\" frameborder=\"no\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"> </iframe><br />营销科学家视角：关于营销趋势12345</strong></span></h1>\n<div><span style=\"font-family:  sans-serif; font-size: 24px;\">明年的<a href=\"https://digital.yongsy.com/\">数字营销</a>市场，最值得关注的趋势应该是结合元宇宙、虚拟人等方面的IP数智营销。今年以来，不同品牌的一些尝试已经开始有正向回报，无论是品牌价值提升，还是销售收入增加，都表明这个趋势已经成立，值得快速跟进和拓展。AA我的</span></div>\n<h2 data-sf_anchor=\"2\"><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong>&mdash;&mdash;李勇，谷元文创创始人</strong></span></h2>\n<ul>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">流量上，从消费者的视角各平台扮演社会消费的定位是不一样，</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">在消费者眼中各有各独特的价值。</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">企业必须在当前复杂，割裂，碎片的消费者触点中研究清楚用户的决策路径、研究好每个平台的价值，</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">从single source panel出发，用同源panel来研究。个保法后企业遇到的是一方数据量太小，</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">二方平台间数据有围墙，那就必须要关注隐私计算，联合建模方面的技术和人才，要把一方，二方，三方的数据联接起来一起用。内容上，洞察要落到真正营销策略上的落地，透过社交媒体找到洞察各类人群的喜好，洞察以后再按照他们的喜好去创造新内容，用新内容引发新流量，大家可以看秒针今年发布的社媒号角图，这其实我觉得是未来行业的强需求。</span></li>\n</ul>\n<h3 data-sf_anchor=\"3\"><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong>&mdash;&mdash;赵洁，秒针系统总裁</strong></span></h3>\n<ol>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">趋势一：广告投放进一步的智能化，机器不断取代人。数字广告是目前应用人工智能和先进算法最集中的领域。监督学习应用在效果广告投放上已经非常成熟，更高级的人工智能则应用在识别广告的创意和所推广的商品上，从而让机器能够像人一样去尝试理解广告的内涵与商业的模式，并在此基础上优化投放的策略。当然，提高劳动生产率的人工智能，如自动生成创意、自动出价等，也大幅度减少了人的手工劳动。</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">趋势二：围墙花园化情况更加显著。广告主越来越难以拿到从媒体端反馈的个体级别的投放数据。同样，在一个媒体生态内进行的投放，也越来越难以利用其他第三方提供的数据或优化服务，而只能依赖于该媒体本身的优化能力。这会导致的结果是，广告主的&ldquo;营销权力&rdquo;进一步被削弱，营销效果很大程度上由媒体自己的资源和技术制约，广告主的操作空间进一步减少。</span></li>\n<li><span style=\"font-family:  sans-serif; font-size: 24px;\">趋势三：广告的展现方式更加多样化，创新广告形式将不断涌现。技术提升所带来的必然。另外，我也相信元宇宙一定会大行其道，而数字广告肯定会突破&ldquo;广告位的边框&rdquo;，以前所未有的形态展现在受众面前。</span></li>\n</ol>\n<h3 data-sf_anchor=\"4\"><span style=\"font-family:  sans-serif; font-size: 24px;\"><strong>&mdash;&mdash;宋星，纷析咨询创始人</strong></span></h3>","outline_bar":[{"label":"营销科学家视角：关于营销趋势12345","value":0},{"label":"营销科学家视角：关于营销趋势12345营销科学家视角：关于营销趋势12345","value":1},{"label":"——李勇，谷元文创创始人","value":2},{"label":"——赵洁，秒针系统总裁","value":3},{"label":"——宋星，纷析咨询创始人","value":4}],"description":"明年的数字营销市场，最值得关注的趋势应该是结合元宇宙、虚拟人等方面的IP数智营销。今年以来，不同品牌的一些尝试已经开始有正向回报，无论是品牌价值提升，还是销售收入增加，都表明这个趋势已经成立，值得快速跟进和拓展。","image_url":"https://oss.matchpages.cn/matchpages/share_center/2023/0224/4161/63f855e6d5c9d/image%20190.jpg","image_alt":"image 190.jpg","main_image":"https://oss.matchpages.cn/matchpages/share_center/2023/0224/4161/63f855e6d5c9d/image%20190.jpg","main_image_alt":"image 190.jpg","virtual_view":600,"total_view":642,"download_url":"https://oss.matchpages.cn/matchpages/share_center/2023/0413/1793/64376b8cb294a/%E5%85%B3%E4%BA%8E%E6%98%9F%E5%85%89WhatsApp%E8%81%8A%E5%A4%A9%E6%9C%BA%E5%99%A8%E4%BA%BA%E6%B6%88%E8%80%97%E6%94%BF%E7%AD%96%E4%BB%8B%E7%BB%8D.pdf","seo_id":63,"is_top":1,"sort":0,"is_recommend":0,"status":0,"create_time":"2023-03-28 17:05:59","update_time":"2023-08-04 16:07:01","seo_data":{"id":63,"user_id":1,"urla":"2023中国数字营销趋势报告ywl1","relation_table":"blog","relation_id":25,"seo_title":"2023中国数字营销趋势报告\n","seo_keyword":"2023中国数字营销趋势报告\n","seo_describe":"2023中国数字营销趋势报告\n","status":0,"create_time":"2023-03-28 17:05:59","update_time":"2023-08-04 16:07:01"},"type_ids":[30],"tag_ids":[7]}';
        $data=json_decode($dataStr,true);
        $this->request('post','api/blog/save',$data);
    }

    public function testGetBlog(){
        $this->request('get','/api/blog/info?id=1',[]);
    }

    public function testRenderPage(){
        $this->request('get','/case-list',[]);
    }

    public function testBlogRecently(){
        $this->request('get','/blog-recently',[]);
    }


    public function testGetPublishBlogListByTypeId(){
        $data=[];
        $data['type_id']=0;
        $data['page_size']=6;
        $data['page']=6;
        $this->request('post','/api/blog/visitor-get-list-by-type',$data);
    }

    public function testGetPublishBlogListByTagId(){
        $data=[];
        $data['tag_id']=0;
        $data['page_size']=6;
        $data['page']=6;
        $this->request('post','/api/blog/visitor-get-list-by-tag',$data);
    }


    /**
     * 初始化静态页面seo
     * */
    public function testInitStaticPage(){
       /* $addData=[];
        $addData['id']=0;
        $addData['page_name']='内容中心';
        $addData['route_path']='blog-recently.index';
        $addData['seo_data']=[
          'seo_describe'=>'',
          'seo_keyword'=>'',
          'seo_title'=>'',
          'urla'=>'',
        ];
        $addData['seo_id']=0;
        $addData['sort']=0;
        $this->request('post','api/static-page/save',$addData);
        die;*/
        $seoData= [
            'index' => [
                'seoTitle' => '星光外贸营销软件,WhatsApp获客利器,5分钟上手',
                'seoKeywords' => '外贸私域营销,whatsapp营销,外贸独立站,外贸crm,facebook营销,linkedin营销,外贸邮件营销,Google营销，Yandex开发',
                'seoDescription' => '星光营销软件，为外贸企业和跨境电商提供私域营销解决方案。从获客、营销、管理、展会营销管理、建站、广告等多产品为外贸企业提一站式的数字营销服务。产品包括Google获客、facebook营销、linkedin开发、邮件营销、whatsapp官方营销、外贸CRM、独立站DTC运营、google广告和SEO等，帮助企业实现外贸订单增长。'
            ],
            'product-matchpages' => [
                'seoTitle' => '外贸建站专家, 定制品牌网站，3000+设计组件 | 星光营销软件 ',
                'seoKeywords' => '外贸建站，DTC网站定制，品牌建站，网页高端设计，网站开发，Shopify, WordPress',
                'seoDescription' => '聚页创意是建站SaaS开发商，为企业提供外贸建站和电商品牌建站全流程服务。设计牛、动画炫、SEO强。海量模板，任您挑选。同时有100+篇系统的免费外贸建站教程和SEO教程，覆盖域名、建站主机、建站主题、插件、网站模板、免费Google SEO小工具，让你系统了解网站建设全流程。'
            ],
            'product-search' => [
                'seoTitle' => '智能采集邮箱、数据、WhatsApp营销 | 星光营销软件 ',
                'seoKeywords' => 'Google搜索工具，Facebook搜索工具，WhatsApp营销工具，邮件搜索工具，LinkedIn搜索工具',
                'seoDescription' => '星光软件，提供智能采集数据功能，通过主流搜索入口，为全球用户提供搜索数据WhatsApp电话、WhatsApp群组、网站、邮箱、电话、社媒链接及相关粉丝重要信息等多维度数据。'
            ],
            'product-whatsapp' => [
                'seoTitle' => 'WhatsApp营销，群组营销 | 星光营销软件',
                'seoKeywords' => 'WhatsApp短信模板，WhatsApp营销，WhatsApp API开发，WhatsApp群组营销',
                'seoDescription' => '星光营销软件WhatsApp营销，来自官方授权，可将内容快速触达买家手机，实现1对 1的直接沟通高效采集、一键验证、批量群发，数据采集的同时同步验证'
            ],
            'product-expo' => [
                'seoTitle' => '会邦人展会直播资讯发布平台 | 星光软件',
                'seoKeywords' => '会邦人 Matchexpo, 全球展会预约发布，线下展会营销，直播活动营销，跨境直播营销，新闻资讯发布',
                'seoDescription' => '星光营销软件联合会邦人展会营销发布平台，统统为企业提供线上展会、线下展会营销和直播等资讯发布支持。'
            ],
            'product-email' => [
                'seoTitle' => '邮件智能营销免费试用，群发邮件工具 | 星光软件',
                'seoKeywords' => '邮件智能营销，群发邮件工具，星光软件，免费试用，WhatsApp营销，Whatsapp短信营销',
                'seoDescription' => '使用星光邮件活动 (Email Campaigns) 中的智能电子邮件营销工具群发邮件，让您的邮件互动体验顺畅而有效，同时帮您将更多联系人转化为客户。'
            ],
            'service' => [
                'seoTitle' => '出海技能培训和在线服务 | 星光软件',
                'seoKeywords' => 'Google广告服务，数字营销服务，社媒运营服务，星光软件试用服务',
                'seoDescription' => '星光团队为客户提供成功经验分享，持续赋能。认知突破，经验才可以转化为生产力。'
            ],
            'channel' => [
                'seoTitle' => '渠道合作伙伴扶持计划 | 星光软件',
                'seoKeywords' => '渠道伙伴计划，星光软件，WhatsApp营销工具，邮件营销工具，CRM软件，谷歌广告',
                'seoDescription' => '聚页渠道是聚页发展的核心力量，于2021年12月正式成立。聚页渠道中心下设招商、运营、业务创新、技术支持、客户成功、培训、数据管理以及业务支持八大核心部门，业务涵盖汽车、家电、高科技、教育、服装等全行业，从战略分析规划、销售体系提效、培训体系搭建、行业运营提升、全域数据聚合分析等各维度全方位赋能服务商，帮助服务商深入了解聚页产品，提高销售能力，实现业务持续增长。'
            ],
            'price' => [
                'seoTitle' => '服务价格-邮件营销-WhatsApp营销 | 星光软件',
                'seoKeywords' => '星光软件，WhatsApp营销工具，邮件营销工具，CRM软件，谷歌广告',
                'seoDescription' => '通过星光营销，帮助您将联系人转为收入。为不同规模的企业提供多样化套餐体系。包含了WhatsApp营销，落地页工具，邮件营销工具等服务。'
            ],
            'about-us' => [
                'seoTitle' => '关于我们-星光',
                'seoKeywords' => '关于我们-星光',
                'seoDescription' => '关于我们-星光'
            ],
            'help' => [
                'seoTitle' => '帮助中心 - 星光',
                'seoKeywords' => '星光使用技巧',
                'seoDescription' => '星光使用技巧'
            ],
            'thank-page' => [
                'seoTitle' => '提交成功-星光跨境营销系统',
                'seoKeywords' => '感谢您的合作-星光跨境营销系统',
                'seoDescription' => '感谢您的合作-星光跨境营销系统'
            ],
            'contact-us' => [
                'seoTitle' => '联系我们-星光跨境营销系统',
                'seoKeywords' => '联系我们-星光跨境营销系统',
                'seoDescription' => '联系我们-星光跨境营销系统'
            ],
            'join-us' => [
                'seoTitle' => '加入我们-星光跨境营销系统',
                'seoKeywords' => '加入我们-星光跨境营销系统',
                'seoDescription' => '加入我们-星光跨境营销系统'
            ]
        ];
        foreach ($seoData as $key=> $value){
            $addData=$this->buildPageData($key,$value);
            $this->request('post','api/static-page/save',$addData);
        }
    }

    private function buildPageData($key,$params){
        $data=[];
        $data['route_path']=$key;
        switch ($key){
            case 'index':{
                $data['page_name']='首页';
                $data['seo_data']['urla']='home';
            }
                break;
            case 'product-matchpages':{
                $data['page_name']='独立站';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'product-search':{
                $data['page_name']='智能搜索';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'product-whatsapp':{
                $data['page_name']='Whatsapp营销';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'product-expo':{
                $data['page_name']='展会发布营销平台';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'product-email':{
                $data['page_name']='邮件智能营销平台';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'service':{
                $data['page_name']='服务';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'channel':{
                $data['page_name']='渠道';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'price':{
                $data['page_name']='价格';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'about-us':{
                $data['page_name']='关于我们';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'help':{
                $data['page_name']='帮助中心';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'join-us':{
                $data['page_name']='加入我们';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'contact-us':{
                $data['page_name']='联系我们';
                $data['seo_data']['urla']=$key;
            }
                break;
            case 'thank-page':{
                $data['page_name']='使用表单感谢页';
                $data['seo_data']['urla']=$key;
            }
                break;
        }
        $data['seo_data']['seo_describe']=$params['seoDescription'];
        $data['seo_data']['seo_keyword']=$params['seoKeywords'];
        $data['seo_data']['seo_title']=$params['seoTitle'];
        return $data;
    }

    public function testPageGetList(){
////批量修改类型
//    $router->post('blog/type-plural-edit',['uses' =>'BlogController@typePluralEdit']);
//    //批量修改标签
//    $router->post('blog/tag-plural-edit',['uses' =>'BlogController@tagPluralEdit']);
//    //批量删除
//    $router->post('blog/batch-delete-news',['uses' =>'BlogController@batchDeleteNews']);
//    //批量修改状态
//    $router->post('blog/batch-status-news',['uses' =>'BlogController@batchStatusNews']);

// // 批量修改类型
//    $router->post('product/type-plural-edit', 'ProductController@typePluralEdit');
//    // 批量修改标签
//    $router->post('product/tag-plural-edit', 'ProductController@tagPluralEdit');
//    // 批量删除
//    $router->post('product/batch-delete-product', 'ProductController@batchDeleteProduct');
//    // 批量修改状态
//    $router->post('product/batch-status-product', 'ProductController@batchStatusProduct');
//
//        // 批量修改类型
//        $router->post('meeting/type-plural-edit', 'MeetingController@typePluralEdit');
//        // 批量修改标签
//        $router->post('meeting/tag-plural-edit', 'MeetingController@tagPluralEdit');
//        //批量删除
//        $router->post('meeting/batch-delete-meeting', 'MeetingController@batchDeleteMeeting');
//        //批量修改状态
//        $router->post('meeting/batch-status-meeting', 'MeetingController@batchStatusMeeting');

        $params = [
            'ids' => [],
            'type_ids' => []
        ];
        $this->request('post','api/blog/type-plural-edit', $params);

    }

    /**
     * 表单保存
     * */
    public function testFormSave(){
        $data=[];
        $data['name']='文章反馈';
       /* $data['form_items']=[
            [
                'name'=>'这篇文章有帮助吗？',
                'type'=>'200',//单选
                'sort'=>0,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>[
                    [
                        'sort'=>0,
                        'content'=>'是'
                    ],
                    [
                        'sort'=>1,
                        'content'=>'否'
                    ]

                ]
            ],
            [
                'name'=>'太好了！我们是否还有哪些改善空间，好让文章能更好地帮上忙？',
                'type'=>'101',//多行文本
                'sort'=>1,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'感谢你的宝贵意见。你认为这篇文章符合以下的哪一项描述？',
                'type'=>'200',//单选
                'sort'=>2,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>[
                    [
                        'sort'=>0,
                        'content'=>'不正确：没有反映出我在产品中看到的情况'
                    ],
                    [
                        'sort'=>1,
                        'content'=>'不清楚：内容难以理解'
                    ],
                    [
                        'sort'=>2,
                        'content'=>'缺少信息：内容不够全面'
                    ],
                    [
                        'sort'=>3,
                        'content'=>'不相关：与我搜寻的内容不相符'
                    ]

                ]
            ],
            [
                'name'=>'我们是否还有哪些改善空间，好让文章能更好地帮上忙？',
                'type'=>'101',//单选
                'sort'=>3,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'允许 Starify 就我的文件意见回馈与我联系',
                'type'=>'200',//单选
                'sort'=>5,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>[
                    [
                        'sort'=>0,
                        'content'=>'是'
                    ],
                    [
                        'sort'=>1,
                        'content'=>'否'
                    ]

                ]
            ],
            [
                'name'=>'电子邮件地址',
                'type'=>'100',//单行文本
                'sort'=>6,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'来源链接',
                'type'=>'100',//单行文本
                'sort'=>7,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ]
        ];*/
        $data['name']='联系我们';
        $data['form_items']=[
            [
                'name'=>'姓名',
                'type'=>'100',//单行文本
                'sort'=>1,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'联系电话',
                'type'=>'100',//单行文本
                'sort'=>2,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'公司名称',
                'type'=>'100',//单行文本
                'sort'=>3,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'公司规模',
                'type'=>'100',//单行文本
                'sort'=>4,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'所在城市',
                'type'=>'100',//单行文本
                'sort'=>5,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'您的公司邮箱',
                'type'=>'100',//单行文本
                'sort'=>6,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'您的公司网址',
                'type'=>'100',//单行文本
                'sort'=>7,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'公司介绍',
                'type'=>'101',//单行文本
                'sort'=>8,//
                'is_required'=>1,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ],
            [
                'name'=>'来源链接',
                'type'=>'100',//单行文本
                'sort'=>9,//
                'is_required'=>0,
                'is_email'=>0,
                'is_phone'=>0,
                'is_url'=>0,
                'is_min'=>0,
                'is_max'=>0,
                'min_val'=>0,
                'max_val'=>0,
                'content'=>''
            ]
        ];
        $this->request('post','/api/form/save-info',$data);
    }

    /**
     * 获取表单列表
     * */
    public function testGetFormList(){
        $this->request('get','/api/form/list?date=&page=1&page_size=10&keyword=',[]);
    }

    /**
     * 获取表单列表
     * */
    public function testGetRecordList(){
        $this->request('get','/api/form/record/list?date=&page=1&page_size=10&keyword=',[]);
    }

    /**
     * 获取表单详情
     * */
    public function testFormGetInfo(){
        $data=[];
        $data['id']=5;
        $this->request('get','/api/form/get-info',$data);
    }

    /**
     * 测试表单提交
     * */
    public function testFormRecord(){
        $dataStr='{"form_id":3,"name_10":"youwl5@qq.com","product_ids":[57,62,60]}';
        $data=json_decode($dataStr,true);

        $this->request('post','/api/form/agent-record',$data);
    }

    /**
     * 测试获取广告列表
     * */
    public function testAdList(){
        $data=[];
        $this->request('get','/api/ad/get-list?date=&page=1&page_size=10&keyword=&website_id=',$data);
    }

    public function testGetGlobalList(){
        $data=[];
        $this->request('get','/api/global/list',$data);
    }

    public function testGetSmsCode(){
        $data=[];
        $data['phone']='13779948283';
        $this->request('get','/api/common/get-sms-code',$data,false);
    }

    public function testWeb(){
        $data=[];
        $this->request('get','/api/mail/test',$data);
    }

    public function testGetTreeProductList(){
        $data=[];
        $this->request('get','/api/product/get-tree-type-list',$data);
    }

    public function testWebUtm() {
        ////utm List
        //   $router->get('/web-utm/get-list', ['uses' => 'WebUtmController@getUtmList']);
        //    //utm one
        //   $router->get('/web-utm/info', ['uses' => 'WebUtmController@getUtmInfo']);
        //    //utm save
        //   $router->post('/web-utm/info', ['uses' => 'WebUtmController@addOrModUtm']);
        //    //utm del
        //   $router->delete('/web-utm/info', ['uses' => 'WebUtmController@delUtm']);

        //        $data = [];
        //        $ret = $this->request('get', '/api/web-utm/get-list', $data);
        //        print_r($ret);

//        $data = [
//            'website_url' => 'https://www.gahumitotebag.com/',
//            'campaign_id' => 'abc.123',
//            'campaign_name' => '春季促销',
//            'campaign_source' => '谷歌',
//            'campaign_term' => '跑步+鞋',
//            'campaign_medium' => '每次点击费用',
//            'campaign_content' => '徽标链接'
//        ];
//        $ret = $this->request('post', '/api/web-utm/info', $data);
//        print_r($ret);

//            $data = ['id' => 4];
//            $ret = $this->request('get', '/api/web-utm/info', $data);
//            print_r($ret);

        $data = ['id' => 4];
        $ret = $this->request('delete', '/api/web-utm/info', $data);
        print_r($ret);


//        $this->request('get', '/api/product/get-tree-type-list', $data);
//        $this->request('get', '/api/product/get-tree-type-list', $data);
//        $this->request('get', '/api/product/get-tree-type-list', $data);
    }
}
