| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- namespace app\admin\controller;
- use crmeb\services\async\LuckyCalc;
- use crmeb\services\async\ClearanceCalc;
- use crmeb\utils\Redis;
- use think\facade\Log;
- use app\api\controller\board\UserBoardController;
- use app\models\redis\SystemCarousel;
- use app\models\system\SystemPool;
- use app\models\user\UserSearch;
- use app\models\user\WechatUser;
- use crmeb\payment\MachantPay;
- use crmeb\services\async\LuckyExtACalc;
- use crmeb\services\async\LuckyExtBCalc;
- use crmeb\services\async\task\AsyncClass;
- use crmeb\services\async\task\WechatNotify;
- use think\facade\Config;
- use RobThree\Auth\TwoFactorAuth;
- use RobThree\Auth\TwoFactorAuthException;
- use tw\redis\TwRedis;
- use tw\redis\UserRds;
- class Test
- {
- public function index()
- {
- $redis = Redis::instance();
- var_dump($redis->get(['CRMEB','TESD']));
- echo '</br>';
- $twredis = TwRedis::instance();
- echo '</br>';
- print_r($twredis::hGetAll('user:1'));
- }
- protected function test_board() {
- Log::warning("board updated.");
- $ctl = new UserBoardController();
- $ctl->cache_board();
- }
- protected function test_calc() {
- $activities = [new ClearanceCalc(), new LuckyCalc(), new LuckyExtACalc(), new LuckyExtBCalc()];
- foreach($activities as $activity) {
- $activity->calc();
- }
- }
- protected function test_carousel() {
- SystemCarousel::add('good test', '/pages/leader_board/index');
- print_r(SystemCarousel::getFirst(20));
- SystemCarousel::removeTrash();
- }
- protected function test_wechat_robot() {
- $key = Config::get('app.qy_weixin_robot_aristotle');
- // $svc = \crmeb\services\QyWeixinService::instance();
- // $svc->key($key)->markdown("### user commented\n>hhhh\n1. upm youth\n2. shiny tommorowwww")->post();
- WechatNotify::push(WechatNotify::TYPE_COMMENT, $key, 'gdf');
- }
- protected function test_2fa()
- {
- $tfa = new TwoFactorAuth('twong');
- $secret = $tfa->createSecret();
- echo 'secret:' . $secret;
- $img = $tfa->getQRCodeImageAsDataUri('twongqr', $secret);
- echo 'img:' . $img;
- echo '<img src="'.$img .'" />';
- echo 'chunk:' . chunk_split($secret, 4, ' ');
- $code = $tfa->getCode($secret);
- echo 'code:' . $code;
- echo 'result:' . $tfa->verifyCode($secret, $code);
- }
- protected function test_routine_reg()
- {
- $routine['nickName'] = '山河另';
- $routine['gender']=1;
- $routine['language'] = 'zncn';
- $routine['city']='zd';//
- $routine['province']='hn';
- $routine['country']='cn';//
- $routine['avatarUrl']='http://x';
- $routine['openId']='great';//
- $routine['session_key']='bbc';
- $routine['unionId']='';//用户在开放平台的唯一标识符
- $routine['spid'] = 3;
- $routine['code'] = '5';
- $routine['session_key'] = 'bi';
- $routine['login_type'] = 'routine';
- echo WechatUser::routineOauth($routine);
- }
- protected function test_async_func()
- {
- return AsyncClass::push('tw\async\tasks\UserTaskClass', [], 'generate_user_poster', [3]);
- }
- protected function test_redis()
- {
- $ur = new UserRds();
- $ur->set(1, 'streak', 3);
- echo $ur->get(1, 'streak') . '</br>';
- echo $ur->get(1, 'notexists') . '</br>';
- $ur->sets(1, ['name'=>'didi', 'age'=>28]);
- print_r($ur->gets(1, ['name', 'age'])) . '</br>';
- print_r($ur->gets(1, ['friends', 'teacher'])) . '</br>';
- print_r($ur->getAll(1)) . '</br>';
- }
- protected function test_enterprise_pay()
- {
- list($ok, $ec, $es) = MachantPay::toWeixin('oFWXD4lYL1n9jupjlWx7Qt6Qdu7Y', 'wxmp00000001', 100, 'test', 'yyk');
- var_dump($ok, $ec, $es);
- }
- protected function get_rsa_key()
- {
- MachantPay::get_rsa();
- }
- public function test()
- {
- // $this->get_rsa_key();
- // $this->test_enterprise_pay();
- // echo $this->test_async_func();
- // $this->test_redis();
- // echo UserSearch::InsertHistory(1, "good");
- // print_r(UserSearch::getList(1, 20));
- // return $this->test_routine_reg();
- // echo SystemPool::incrby(1000, 1, 'clr', 2000);
- // print_r(SystemPool::getList(1, 20));
- }
- }
|