123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace App\Console\Test;
- use App\Cache\StatisticCache;
- use App\Cache\UserCache;
- use App\Facade\Site;
- use App\Jobs\ReportDy;
- use App\Libs\Utils;
- use App\Models\User\User;
- use App\Models\User\UserEarningsLogs;
- use App\Services\OpenApi\OpenService;
- use App\Services\Pay\PayService;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Redis;
- use Vinkla\Hashids\Facades\Hashids;
- /**
- * 测试
- */
- class TestCommand extends Command
- {
- /**
- * @var string
- */
- protected $signature = 'test {--token=} {--uid=} {--eid=}';
- /**
- * The console command description.
- * php artisan Payment:BasePayment --bid='1'
- *
- * @var string
- */
- protected $description = '测试';
- private $openService;
- private $payService;
- public function __construct(
- OpenService $openService,
- PayService $payService
- )
- {
- parent::__construct();
- $this->openService = $openService;
- $this->payService = $payService;
- }
- /**
- * handle
- */
- public function handle()
- {
- // $result = $this->payService->reportPay(18, date('YmdHis').getMillisecond().rand(1000,9999));
- // dd($result);
- //
- // dd('exit');
- $token = $this->option('token');
- $uid = $this->option('uid');
- $eid = $this->option('eid');
- if ($eid) dd(Hashids::decode($eid));
- if (!$token) $token = '67ecfebf74424f52472cec71769c339f';
- if (!$uid) $uid = 18;
- // $instance = $this->openService->getInstance();
- // $res = $instance->generateShareLink('app/home', json_encode(['promotion_code'=>100001, 'invite_code'=>100023]));
- // $res = $instance->getShareQueryInfo('https://z.douyin.com/6sJ3LOR');
- // dd($res);
- // $path = urlencode('pages/index/index?invite_code=100055');
- // $res = $instance->createQRCode('pages/index/index');
- // 写入测试用户token
- UserCache::setTokenData($token, ['uid'=>$uid, 'distribution_channel_id'=>1, 'send_order_id'=>0, 'from_uid'=>0]);
- // 写入测试用户最近阅读记录
- UserCache::delRecentBooks($uid);
- $bids = [1,5,6,4,29,59,47,68,53,86,87,58,100,37];
- foreach ($bids as $bid) {
- $book_info = DB::table('books')->where('id', $bid)->select('name', 'cover')->first();
- $random_sequence = mt_rand(1,20);
- $chapter = DB::table('chapters')->where(['bid'=>$bid, 'is_check'=>1, 'is_deleted'=>0, 'sequence'=>$random_sequence])
- ->select('id', 'name')->first();
- UserCache::setRecentBooks($uid, [
- 'bid' => $bid,
- 'book_name' => getProp($book_info, 'name'),
- 'cover' => getProp($book_info, 'cover'),
- 'cid' => getProp($chapter, 'id'),
- 'chapter_name' => getProp($chapter, 'name'),
- 'read_time' => date('Y-m-d H:i:s', time()+mt_rand(0,1800)),
- 'sequence' => $random_sequence,
- 'gender' => 2
- ]);
- }
- // 写入测试用户当前阅读书籍和章节
- UserCache::delCurrentChapter($uid);
- UserCache::setCurrentChapter($uid, [
- 'bid' => 94,
- 'book_name' => '闪婚后,晏先生被甜妻撩上瘾',
- 'cover' => 'http://zwcontent.oss-cn-hangzhou.aliyuncs.com/books/cover/ed5Ntjzi3W.jpg',
- 'cid' => 100000970,
- 'chapter_name' => '第152章 吃瓜',
- 'read_time' => date('Y-m-d H:i:s', time()+1800),
- 'sequence' => 152,
- 'gender' => 2,
- ]);
- }
- }
|