123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- declare(strict_types=1);
- use PHPUnit\Framework\TestCase;
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/5/20
- * Time: 下午4:09
- */
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_HELPER_PATH . '/util_helper.php');
- require_once(BASE_HELPER_PATH . '/third_author/signaturer.php');
- class TestQRcode extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- }
- public function testMiniCode()
- {
- $member_id = 52620;
- $queue = Logic('queue');
- $queue->makeMemberMiniQrCode(['member_id' => $member_id]);
- $url = $this->mini_code($member_id);
- }
- public function testMakeChannel()
- {
- $channels = [1000,1001];
- foreach ($channels as $channel)
- {
- $resp = thrid_author\signaturer::instance()->minicode("/pages/index/index?channel={$channel}",430);
- if(!empty($resp))
- {
- $save_path = BASE_ROOT_PATH . "/test/channel/{$channel}.png";
- $length = file_put_contents($save_path,$resp);
- if(!$length) {
- Log::record("Cannot write file: {$save_path}",Log::ERR);
- }
- else {
- Log::record("Create channel image success.",Log::DEBUG);
- }
- }
- }
- }
- public function testSendInviter()
- {
- $inviter_id = 52641;
- $invitee_id = 52638;
- $queue_logic = Logic('queue');
- $queue_logic->sendInviterSubMsg(['inviter_id' => $inviter_id,'invitee_id' => $invitee_id]);
- $openid = 'ocimY5Bi5voa71ejczOUmxqsDgtU';
- $tmpid = 'zBNktaey9EM2DcBzUNsjnAan2NvYpj_nKZDY__f9pGA';
- $time = '2020年8月7日';
- $data = ['thing4' => ['value' => '江南'], 'time3' => ['value' => "{$time}"]];
- thrid_author\signaturer::instance()->send_submsg($openid,$tmpid,'pages/index/index',$data);
- }
- private function mini_code($uid)
- {
- $passwd = util::passwd;
- $name = md5("{$uid}.{$passwd}") . ".png";
- $save_path = BASE_UPLOAD_PATH . DS . ATTACH_MINI_QRCODE . DS . $name;
- $url = UPLOAD_SITE_URL . DS . ATTACH_MINI_QRCODE . DS . $name;
- if(!file_exists($save_path)) {
- QueueClient::push('makeMemberMiniQrCode',['member_id' => $uid]);
- }
- return $url;
- }
- public function testPgenA()
- {
- for ($i = 0; $i < 1000;$i++) {
- $save_path = BASE_UPLOAD_PATH . DS.ATTACH_MQRCODE.DS . "{$i}.png";
- util::qrcode("http://www.baidu.com","{$i}.png");
- }
- }
- public function testPgenB()
- {
- for ($i = 1000; $i < 2000;$i++) {
- $save_path = BASE_UPLOAD_PATH . DS.ATTACH_MQRCODE.DS . "{$i}.png";
- util::qrcode("http://www.baidu.com","{$i}.png");
- }
- }
- public function testPgenC()
- {
- $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';
- $urls = explode(',',$bonus_urls);
- $i = 0;
- foreach ($urls as $url)
- {
- $save_path = "/Users/stanley-king/Desktop/qrcode/{$i}.png";
- util::qrcode_path($url,$save_path);
- $i++;
- }
- }
- public function testPgenD()
- {
- $roomid = 37;
- $inviter = 39623;
- require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
- // $url = url_helper::room_invite_url($roomid,$inviter);
- $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";
- $save_path = "/Users/huangdong/work/shopnc/data/upload/room/qrcodes/{$roomid}_{$inviter}.png";
- if(!file_exists($save_path)){
- util::qrcode_path($url,$save_path);
- }
- // unlink($save_path);
- }
- }
|