Nessuna descrizione

SyncAdCost.php 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Symfony\Component\Console\Input\InputOption;
  5. use Symfony\Component\Console\Input\InputArgument;
  6. use TopClient;
  7. use DB;
  8. use YPSMS;
  9. class SyncAdCost extends Command {
  10. protected $signature = 'SyncAdCost';
  11. /**
  12. * The console command description.
  13. *
  14. * @var string
  15. */
  16. protected $description = '微信同步地域投入';
  17. public function handle()
  18. {
  19. $this->SyncAdCost();
  20. }
  21. public function SyncAdCost(){
  22. #今日
  23. $today = date('Y-m-d', strtotime('-1 day'));
  24. $stime = strtotime($today);
  25. $etime = strtotime($today.' 23:59:00');
  26. $apps = $this->get_config();
  27. foreach($apps as $k=>$app){
  28. $data = $this->get_data($stime, $etime, $app['token'], $app['utime'], $app['cookie']);
  29. if(!empty($data)){
  30. //成功获取数据,开始同步入库
  31. foreach($data as $key=>$val){
  32. $params = array();
  33. $params['wexin_appid'] = $app['wexin_appid'];
  34. $params['ad_time'] = $today;
  35. $params['city'] = $val['city'];
  36. $params['cost'] = $val['paid'];
  37. $params['exposure_times'] = $val['exp_pv'];
  38. $params['click_times'] = $val['clk_pv'];
  39. $params['click_rate'] = $val['ctr'];
  40. $params['conversion_times'] = $val['comindex'];
  41. $params['conversion_cost'] = $val['cpa'];
  42. //查看表中是否已有该条数据
  43. $if_e = DB::table('ad_cost')->where('wexin_appid', $params['wexin_appid'])->where('ad_time', $params['ad_time'])->where('city', $params['city'])->first();
  44. if(isset($if_e->id)){
  45. $ret = DB::table('ad_cost')->where('id', $if_e->id)->update($params);
  46. }else{
  47. $ret = DB::table('ad_cost')->insert($params);
  48. }
  49. }
  50. }
  51. }
  52. }
  53. public function get_data($stime, $etime, $token, $utime, $cookie){
  54. $url = 'https://mp.weixin.qq.com/promotion/as_rock?action=get_audience_report&args=%7B%22city_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%2C%5C%22exp_pv%5C%22%2C%5C%22clk_pv%5C%22%2C%5C%22ctr%5C%22%2C%5C%22conv_index%5C%22%2C%5C%22conv_index_cpa%5C%22%2C%5C%22conv_index_cvr%5C%22%2C%5C%22comindex%5C%22%2C%5C%22cpa%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%7D%2C%22page%22%3A0%2C%22page_size%22%3A1000%7D%2C%22gender_and_age_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%2C%22gender%22%3A3%7D%2C%22page%22%3A0%2C%22page_size%22%3A1000%7D%2C%22interest_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%2C%22interest%22%3A1%7D%2C%22page%22%3A1%2C%22page_size%22%3A1000%2C%22order_cond%22%3A%7B%22field_name%22%3A%22paid%22%2C%22ascending%22%3Afalse%7D%7D%7D&token='.$token.'&appid=&spid=&_='.$utime;
  55. $header = [
  56. 'cookie:'.$cookie,
  57. //'referer:https://mp.weixin.qq.com/promotion/frame?t=ad_system/common_frame&t1=campaign/data_stats&token=2668231205',
  58. //'authority:mp.weixin.qq.com',
  59. //'x-requested-with:XMLHttpRequest',
  60. //'accept-encoding:gzip, deflate, br',
  61. //'user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
  62. ];
  63. $result = $this->curl($url, $header);
  64. return $result;
  65. }
  66. public function get_config(){
  67. $array = [
  68. [
  69. 'wexin_appid' => 'wx67d996b213022be0',
  70. 'token' => '2838348741',
  71. 'utime' => '1569577667158',
  72. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; mmad_session=1224e37c262d2de17468a0dcdc2b1500ba9b70b7db751f6c7106231cb50edde9428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c673d5d91b3861b782816e59fe8961ceb2a558aeda99bd477aa4478263d861466f78e9096edc0873f62e33114dbc517f1c38b1645f1f21250215f766194b0fa00b618861144cfd99c81feecd3a472ac106dc; data_bizuin=3562897271; data_ticket=rMmoh+rOJJ19Z/xyP7nqyarmqZr1zKc7bgkXhTyVeURDZG7bzSWKmuQkv0kp/LXx; sp_login_mark=156957482049102',
  73. ],
  74. [
  75. 'wexin_appid' => 'wx47cc02c5ec7baec5',
  76. 'token' => '315211287',
  77. 'utime' => '1569581763756',
  78. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; mmad_session=915443d18e865b4ef6e3927b8943e8cfdbf775f85660e957a17202ea64eca4a6428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6733b021c238f8a7ecba45f7fff1bf464986263fb8e374365a9e2c371184ebd0c38e9096edc0873f62e33114dbc517f1c38506cf0feead42d08059beea34cfd583b8861144cfd99c81feecd3a472ac106dc; data_bizuin=3873173804; data_ticket=k9lXqAaXqYUbaL6HKcRUNlVwmufmBtGEouhmgZf7m9REcEqHYj10htHtma2fiHUT; sp_login_mark=156958172398246; ts_last=mp.weixin.qq.com/promotion/frame',
  79. ],
  80. [
  81. 'wexin_appid' => 'wxe8a89637887547b2',
  82. 'token' => '2101716434',
  83. 'utime' => '1569581895875',
  84. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=788a9e137132421500011fe5fb7d14c30ab5ddba407bed3b2a76ff4a9819b0bc428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6734d59e76de449caf2e808f22b65fbe6be331b0b121e235a186a67d7b97980e325e9096edc0873f62e33114dbc517f1c384b1532ea8d46847c5836f611553d39338861144cfd99c81feecd3a472ac106dc; data_bizuin=3879199417; data_ticket=iCVPRKf85T7+FgJoqDegDgJGnvyaxq/1o5Eg7/Wc+eUl2Y9iJeCVfqXTgihiWOS5; sp_login_mark=156958188069084',
  85. ],
  86. [
  87. 'wexin_appid' => 'wx72b9cbf593b39b3d',
  88. 'token' => '2464164730',
  89. 'utime' => '1569582041958',
  90. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=6233ce3f6e6a124d158bbe56e4113352f79714c4bffb3efe8d107f71d0ffe3eb9b9948254aa41e2dcd83c249f9b7f60a7c92673ce321651d1b1498ecce4922ca54ab7b720d2f934c25e032e9b04f80783304c6f78fb85265c558ffc3dfad51c298f9d3bab5dc998ff792eda395846215384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3888174381; data_ticket=XAJELocJr1RHfQ+6vxwnXhGzRPsqZvikz63+GSaBqvD5gdQbOH2+mbbP5efocrSp; sp_login_mark=156958202162377',
  91. ],
  92. [
  93. 'wexin_appid' => 'wxbfaf520646dc92f2',
  94. 'token' => '866566173',
  95. 'utime' => '1569582150581',
  96. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=4f2056eada0e2f18234135128bee7088f237e26fd7d69337bedc8094ccff12f2428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67342f5c4b84fe256d37c45f44aa7b5639861c677fc8de6842d514f5b4b7704b926e9096edc0873f62e33114dbc517f1c388fe6c4202de572bd51ec9b3ab6f4ba838861144cfd99c81feecd3a472ac106dc; data_bizuin=3885085389; data_ticket=tRQmM+ZV/Zr4TJtZKqETZiUw76ZRqT0QUAYdQy0sk6tbLgD8ZXShcsR1Z9HRoeSG; sp_login_mark=156958211327970',
  97. ],
  98. [
  99. 'wexin_appid' => 'wxd674fe3adf8aaca4',
  100. 'token' => '3070490779',
  101. 'utime' => '1569582247685',
  102. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=e9c5f4711cddf41a13b5ce1d280cdc5785f5743ca877aeab5099a8c2094e61f49b9948254aa41e2dcd83c249f9b7f60a485edd79a51ac5974160f7461d4fca0e0e710b3cd44c91959e13a930f938d1523304c6f78fb85265c558ffc3dfad51c24e76414042a06b80ad977e4d2cea8abd384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3561765436; data_ticket=98NaKblb3gVxO2QaEDmO/vZXGms+HBGuipXaxfwDJSPk5pVut38Un0F/iVNlrn34; sp_login_mark=156958221282774',
  103. ],
  104. [
  105. 'wexin_appid' => 'wx49983d60c92fa52f',
  106. 'token' => '1718060682',
  107. 'utime' => '1569582326452',
  108. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=6c6207c3b97a5ca051d8a09b2725b2e4fa16d1d2686760b2abdecb7825c58e25ff40ddc6884c6993c617353cb71da1a3b99ee5c1592f35e9ac399e2308a6b4f738bb7a02c9a1cd0d1c2bbe431b5b5d5b637da209a0189b71482e6e92650c9f90978f8ed1c5941ca47717ba1f349b071f2470aeb12bd6e0743537b3af0d0359ab3a10096921400f2cc68d80f78c742b3b; data_bizuin=3576820018; data_ticket=0/WL1jSSSd0CPESE5xS2pESGSEWAWJhuOpdCRQt096p2J41PmZU4M00yX4ogAOT1; sp_login_mark=156958230248313',
  109. ],
  110. [
  111. 'wexin_appid' => 'wxd5de545eda56fe72',
  112. 'token' => '4026955015',
  113. 'utime' => '1569582436875',
  114. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; data_bizuin=3593805607; mmad_session=516d46449be318ede5f154ca87e29213cf8af65080e21d7564c042ef1624f0dfff40ddc6884c6993c617353cb71da1a32b6bd211d3736fbf804b00b4d4251c7f5ce6af242dde87ef19384a952c043424637da209a0189b71482e6e92650c9f908fc4a235140a01b0c1e2cc0c7f614b05f4ce8953464cbb21fd45f4b28b486e213a10096921400f2cc68d80f78c742b3b; data_ticket=gEuCwnl9d+tQ9glTdx8XOmLn7KVoTExC5ASUckZq1ZuzY11NM9fII4t4Bl+nIO/T; sp_login_mark=156958242518479',
  115. ],
  116. [
  117. 'wexin_appid' => 'wxd4b6710f28ac9ca7',
  118. 'token' => '3551468263',
  119. 'utime' => '1569582512634',
  120. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=697551a90cfbf867b8a55e3581541f99518c01ac2b749fcf6f161dd909dabe29428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c673a7ccf90fe1b4d33f5105916d6cbc4018d37b17d99c00024a5a8b95558c60c1fae9096edc0873f62e33114dbc517f1c38d143346ea4b5aa20ab79bd925214b1578861144cfd99c81feecd3a472ac106dc; data_bizuin=3865173364; data_ticket=Fhn6TMCNhaPItbomVWqUtli0S3UY0UgsEgcVMbfSHZ24FpEQlDBdW3NcCiGuSCHp; sp_login_mark=156958250220358',
  121. ],
  122. [
  123. 'wexin_appid' => 'wxefb2d250fd5ab419',
  124. 'token' => '531215198',
  125. 'utime' => '1569582570381',
  126. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=feac8b05849714a59850e21afb925f28f901831a5571816ce560468d86de6a90ff40ddc6884c6993c617353cb71da1a32cf662f71841709c1471afe48a8db3063882d9481bffd0312803bebadfb9796e637da209a0189b71482e6e92650c9f90fb0e5506abc90f8fc3b92a4b9600fd678dc0ac65ad354857aef2fa1366e9515c3a10096921400f2cc68d80f78c742b3b; data_bizuin=3587791882; data_ticket=MWetN7KD6BfSclbDD8R6ck0iyq+Xddq9YVD0eRcWhyGp6vNec52pDgyummAJ2Unn; sp_login_mark=156958256127993',
  127. ],
  128. [
  129. 'wexin_appid' => 'wx6d6d1d8bbbf69271',
  130. 'token' => '2753254932',
  131. 'utime' => '1569582624642',
  132. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=8ba5ed0cefc4fe59074dd254a901ad16ec7f7282756ad9d4e75adcf82f41200b9b9948254aa41e2dcd83c249f9b7f60a3236f848d7acfddb55ef09ee612d0299b9246cc2abe5908e51f19822783f33b33304c6f78fb85265c558ffc3dfad51c2daa7aa497a0a18c17948553694233244384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3864061076; data_ticket=YWGb3JqR35at/Fk/P0dcDrtULbPcs9fkcVJgeCMQyLj4SmIaFg30qKzPsBSSY+TJ; sp_login_mark=156958261696194',
  133. ],
  134. [
  135. 'wexin_appid' => 'wx8d9019183bdd8529',
  136. 'token' => '3897248071',
  137. 'utime' => '1569582688771',
  138. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=550e8a1d9ddf9a5e333ed8213b3442db89a4e88a930e1c10c1ccf4c44417b84cd5ddc3b83eb6bdcc6d0fb67b14a597152fe9dbbe2854ac633d6c321e4ffaf37a5d95b0e65279d1470587946222e83f5c3335d28f793fa360a15607202cde5ec50a972c4a47b45795a64536c7c1626b3d68d8d9e9d6fbe2c355b4e8a29630ab20a0cd14724db066fdc2f299b0d42ca6e3; data_bizuin=3863254099; data_ticket=d4GaAlqqdc2DA990jKzRFqjJQ44JLw/eTGHHH7TBMG4AwrDbozD7OBVk4c7iIAwp; sp_login_mark=156958267893066',
  139. ],
  140. [
  141. 'wexin_appid' => 'wx81c666056498ba69',
  142. 'token' => '2354365122',
  143. 'utime' => '1576573025263',
  144. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=8e87f160eb6c869daf5fad45360438970712ca152885245897b1bc0eed99340b428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67393bbcd81fe1dfe5cc637a8ccf08d3709373a316c0b46530d4e12fec46c346daee9096edc0873f62e33114dbc517f1c3850877ccf0388f430eb45034bb00daf758861144cfd99c81feecd3a472ac106dc; data_bizuin=3896159180; data_ticket=PLEGJwFzQ33UGOkFhdS2t53iQmVde/39NoL7wBFUNB9FryurIQbK1lSdX8GLk3if; sp_login_mark=157657295994230',
  145. ],
  146. [
  147. 'wexin_appid' => 'wx458690ee4642e62e',
  148. 'token' => '2839801746',
  149. 'utime' => '1576573436556',
  150. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=0e6a4e99eab6bba7c3f73c10b466ff1a1825dc3ec8fd7fc2b716e306e8b09481428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67323d3d63051a2c8a1f2095f5523274f5373c532cc14b0ae57399bd2f661c6d888e9096edc0873f62e33114dbc517f1c387e89230ee6520667a448f3bb992135b98861144cfd99c81feecd3a472ac106dc; data_bizuin=3888202971; data_ticket=GlPQBf9FSnVcECK2y1qHmTfT6gVAOH8KrwCm23Jv8DnRlAO8A9Rp94Mm+/fftFzA; sp_login_mark=157657341380488',
  151. ],
  152. [
  153. 'wexin_appid' => 'wx9592760088e842ab',
  154. 'token' => '1989957288',
  155. 'utime' => '1576573511091',
  156. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=f7f65e526a68ce5343bd6b9cc2424f34932f8188d1c4837bba0e401afa0f0c78428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6732dc82ca2348ad7c77e6d15381dc02afaef01b3c1f57a04929211378a0753f490e9096edc0873f62e33114dbc517f1c38b4227dd311b2910e594df697ba80f9ee8861144cfd99c81feecd3a472ac106dc; data_bizuin=3867155174; data_ticket=Nxq+i9hUNgqme6C/jZ7CeGeAxr22DipVTF6/oL/CRb5dA9YPlyH4qPylll8pv81L; sp_login_mark=157657349849268',
  157. ],
  158. [
  159. 'wexin_appid' => 'wx93a67b889a197fd6',
  160. 'token' => '1803672793',
  161. 'utime' => '1576573590018',
  162. 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; data_bizuin=3589921537; mmad_session=57fe24bb1e1f9e4a5f2e959c545cc13e6b52e0c0ffcb904e36f47a14037d2d5d428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67388c2c75620e1347967f4e2b3bec9e6cab4779489053af726a7dd60171be53732e9096edc0873f62e33114dbc517f1c388adc2f1932efd765f09ba88df59e97198861144cfd99c81feecd3a472ac106dc; data_ticket=KKI+HUO6zznU+rrpGGbNfaxqtH6wugNYrjaXGBCANvxcGhDXlezPHHQosA0GmRPG; sp_login_mark=157657356982482',
  163. ],
  164. ];
  165. return $array;
  166. }
  167. public function curl($url, $header){
  168. //$url = urlencode($url);
  169. //echo $url;exit;
  170. $ch = curl_init();//初始化curl
  171. curl_setopt($ch, CURLOPT_URL,$url);
  172. curl_setopt($ch, CURLOPT_HEADER, 0);//
  173. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  174. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
  175. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//绕过ssl验证
  176. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  177. $data = curl_exec($ch);//运行curl
  178. curl_close($ch);
  179. $data = json_decode($data,true);
  180. if(isset($data['city_datas']) && !empty($data['city_datas'])){
  181. return $data['city_datas'];
  182. }else{
  183. return false;
  184. }
  185. }
  186. }