TestQRcode.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. declare(strict_types=1);
  3. use PHPUnit\Framework\TestCase;
  4. /**
  5. * Created by PhpStorm.
  6. * User: stanley-king
  7. * Date: 2017/5/20
  8. * Time: 下午4:09
  9. */
  10. define('APP_ID', 'test');
  11. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  12. require_once(BASE_ROOT_PATH . '/global.php');
  13. require_once(BASE_CORE_PATH . '/lrlz.php');
  14. require_once(BASE_ROOT_PATH . '/fooder.php');
  15. require_once(BASE_HELPER_PATH . '/util_helper.php');
  16. require_once(BASE_HELPER_PATH . '/third_author/signaturer.php');
  17. class TestQRcode extends TestCase
  18. {
  19. public static function setUpBeforeClass(): void
  20. {
  21. Base::run_util();
  22. }
  23. public function testMiniCode()
  24. {
  25. $member_id = 52620;
  26. $queue = Logic('queue');
  27. $queue->makeMemberMiniQrCode(['member_id' => $member_id]);
  28. $url = $this->mini_code($member_id);
  29. }
  30. public function testMakeChannel()
  31. {
  32. $channels = [1000,1001];
  33. foreach ($channels as $channel)
  34. {
  35. $resp = thrid_author\signaturer::instance()->minicode("/pages/index/index?channel={$channel}",430);
  36. if(!empty($resp))
  37. {
  38. $save_path = BASE_ROOT_PATH . "/test/channel/{$channel}.png";
  39. $length = file_put_contents($save_path,$resp);
  40. if(!$length) {
  41. Log::record("Cannot write file: {$save_path}",Log::ERR);
  42. }
  43. else {
  44. Log::record("Create channel image success.",Log::DEBUG);
  45. }
  46. }
  47. }
  48. }
  49. public function testSendInviter()
  50. {
  51. $inviter_id = 52641;
  52. $invitee_id = 52638;
  53. $queue_logic = Logic('queue');
  54. $queue_logic->sendInviterSubMsg(['inviter_id' => $inviter_id,'invitee_id' => $invitee_id]);
  55. $openid = 'ocimY5Bi5voa71ejczOUmxqsDgtU';
  56. $tmpid = 'zBNktaey9EM2DcBzUNsjnAan2NvYpj_nKZDY__f9pGA';
  57. $time = '2020年8月7日';
  58. $data = ['thing4' => ['value' => '江南'], 'time3' => ['value' => "{$time}"]];
  59. thrid_author\signaturer::instance()->send_submsg($openid,$tmpid,'pages/index/index',$data);
  60. }
  61. private function mini_code($uid)
  62. {
  63. $passwd = util::passwd;
  64. $name = md5("{$uid}.{$passwd}") . ".png";
  65. $save_path = BASE_UPLOAD_PATH . DS . ATTACH_MINI_QRCODE . DS . $name;
  66. $url = UPLOAD_SITE_URL . DS . ATTACH_MINI_QRCODE . DS . $name;
  67. if(!file_exists($save_path)) {
  68. QueueClient::push('makeMemberMiniQrCode',['member_id' => $uid]);
  69. }
  70. return $url;
  71. }
  72. public function testPgenA()
  73. {
  74. for ($i = 0; $i < 1000;$i++) {
  75. $save_path = BASE_UPLOAD_PATH . DS.ATTACH_MQRCODE.DS . "{$i}.png";
  76. util::qrcode("http://www.baidu.com","{$i}.png");
  77. }
  78. }
  79. public function testPgenB()
  80. {
  81. for ($i = 1000; $i < 2000;$i++) {
  82. $save_path = BASE_UPLOAD_PATH . DS.ATTACH_MQRCODE.DS . "{$i}.png";
  83. util::qrcode("http://www.baidu.com","{$i}.png");
  84. }
  85. }
  86. public function testPgenC()
  87. {
  88. $bonus_urls = 'http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=37011497008878285022,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=49871497008878288715,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=33191497008878290461,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=82431497008878291960,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=75231497008878293546,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=44051497008878295127,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=53821497008878296732,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=86091497008878298565,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=74421497008878300374,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=14151497008878302183,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=32051497008878303995,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=20181497008878305885,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=21191497008878307698,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=98471497008878309606,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=65191497008878310999,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=74271497008878312456,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=73931497008878314075,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=34831497008878315481,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=89881497008878316845,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=22671497008878318517,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=83171497008878320622,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=64211497008878322835,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=46141497008878324900,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=66361497008878326428,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=70031497008878328081,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=63311497008878329563,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=48021497008878331028,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=57461497008878332611,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=53811497008878334176,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=35381497008878335685,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=60581497008878337530,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=40351497008878339039,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=34101497008878340555,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=45241497008878342056,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=99571497008878343781,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=98201497008878345332,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=11161497008878346835,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=50641497008878348356,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=31871497008878349868,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=10441497008878351341,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=86001497008878353114,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=84661497008878354491,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=66581497008878355813,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=51331497008878357564,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=50671497008878359373,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=24191497008878361338,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=47561497008878363350,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=93111497008878365557,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=35871497008878367456,http://p.lrlz.com/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn=39991497008878369137';
  89. $urls = explode(',',$bonus_urls);
  90. $i = 0;
  91. foreach ($urls as $url)
  92. {
  93. $save_path = "/Users/stanley-king/Desktop/qrcode/{$i}.png";
  94. util::qrcode_path($url,$save_path);
  95. $i++;
  96. }
  97. }
  98. public function testPgenD()
  99. {
  100. $roomid = 37;
  101. $inviter = 39623;
  102. require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
  103. // $url = url_helper::room_invite_url($roomid,$inviter);
  104. $url = "http://192.168.0.131/mobile/index.php?act=member_talk&op=qr_invite&client_type=ajax&room_id=37&inviter=39623&relay_id=0";
  105. $save_path = "/Users/huangdong/work/shopnc/data/upload/room/qrcodes/{$roomid}_{$inviter}.png";
  106. if(!file_exists($save_path)){
  107. util::qrcode_path($url,$save_path);
  108. }
  109. // unlink($save_path);
  110. }
  111. }