12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016 |
- <?php
- namespace app\index\controller;
- use app\common\enum\order\PayStatus;
- use app\index\model\Goods;
- use app\index\model\ShareKey;
- use app\index\model\user\UserAccessLog;
- use app\index\service\passport\MailCaptcha as MailCaptchaService;
- use app\index\model\OrderAddress;
- use app\index\model\user\PointsLog as PointsLogModel;
- use app\index\model\Goods as GoodsModel;
- use app\index\model\Order as OrderModel;
- use app\index\service\passport\UMailer;
- use app\store\model\Express as ExpressModel;
- use think\facade\Cache;
- use think\facade\Log;
- use think\facade\Session;
- use Endroid\QrCode\Color\Color;
- use Endroid\QrCode\Encoding\Encoding;
- use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
- use Endroid\QrCode\QrCode;
- use Endroid\QrCode\Label\Label;
- use Endroid\QrCode\Logo\Logo;
- use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
- use Endroid\QrCode\Writer\PngWriter;
- use Endroid\QrCode\Writer\ValidationException;
- /**
- * 默认控制器
- * Class User
- * @package app\api\controller
- */
- class User extends Controller
- {
- /**
- * 个人中心
- * @return \think\response\Redirect | \think\response\view
- */
- public function personal()
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- return redirect('/index/passport/login.html');
- }
- $goodsModel = new GoodsModel();
- //$goods['content'] = html_entity_decode($goods['content']);
- return view('order', ['goods' => []]);
- }
- /**
- * 我的订单页面
- * @return \think\response\Redirect | \think\response\view
- */
- public function order(string $orderType = 'received')
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- Session::set('returnuri', '/index/user/order.html');
- return redirect('/index/passport/login.html');
- }
- return view('order');
- }
- /**
- * 订单详情
- * @param $orderId
- * @return \think\response\Redirect | \think\response\view
- * @throws \cores\exception\BaseException
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function orderDetails($orderId)
- {
- $orderId = intval($orderId);
- $userId = Session::get('user_id');
- if (empty($userId)) {
- Session::set('returnuri', '/index/user/orderDetails.html?orderId=' . $orderId);
- return redirect('/index/passport/login.html');
- }
- $model = OrderModel::getUserOrderDetail($orderId);
- foreach ($model['goods'] as &$goods) {
- $flavorsArr = [];
- $goodsNum = $goods['total_num'];
- $flavorsAll = json_decode($goods['remark_for_one'], true);
- foreach ($flavorsAll as $k => $v) {
- if (!empty($v)) {
- $temp1 = bcmul(strval($v), strval($goodsNum), 0);
- $flavorsArr[$k] = $temp1;
- }
- }
- /* array_walk($flavorsAll, function (&$item, $key) use ($goodsNum) {
- $item = bcmul(strval($item), strval($goodsNum), 0);
- });*/
- $goods['remark_for_one'] = $flavorsArr;
- //$goods['remark_for_one'] = json_encode($flavorsAll);
- }
- $orderAddress = OrderAddress::get(['order_id' => $orderId]);
- if (!empty($model['express_no'])) {
- $expModel = new ExpressModel();
- $tracks = $expModel->dynamicUsps($model['express_no']);
- //dd($tracks);
- } else {
- $tracks = [];
- }
- if (!$tracks) {
- $f1Track = [];
- } else {
- $f1Track = $tracks['list'][0]['trackList'] ?? [];
- }
- $createTimeInt = strtotime($model['create_time']);
- $selfTrack = [];
- if ($model['pay_status'] == PayStatus::SUCCESS) {
- if (time() > $createTimeInt + 279213) {
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 279213), 'text' => 'At Transfer Station', 'desc' => 'Arrived at the transfer station'];
- }
- if (time() > $createTimeInt + 170810) {
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 170810), 'text' => 'Package On Its Way', 'desc' => 'The package is on its way to the transfer station'];
- }
- if (time() > $createTimeInt + 119110) {
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 119110), 'text' => 'Orders Processing', 'desc' => 'The warehouse is processing orders to package goods'];
- }
- if (time() > $createTimeInt + 10984) {
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 10984), 'text' => 'Orders To Warehouse', 'desc' => 'The order has entered the warehouse'];
- }
- if (time() > $createTimeInt + 3653) {
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 3653), 'text' => 'Orders Taken', 'desc' => 'The merchant has received your order and is waiting to be shipped'];
- }
- $selfTrack[] = ['time' => date('Y-m-d H:i:s', $createTimeInt + 5), 'text' => 'Order Paid', 'desc' => 'Successful'];
- }
- return view('orderDetails', ['order' => $model, 'orderAddress' => $orderAddress, 'selfTrack' => $selfTrack, 'f1Track' => $f1Track]);
- }
- /**
- * 我的积分页面
- * @return \think\response\Redirect | \think\response\view
- */
- public function myScores()
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- return redirect('/index/passport/login.html');
- }
- $model = new PointsLogModel;
- $list = $model->getList();
- $user = \app\index\service\User::getCurrentLoginUser();
- return view('integral', ['user' => $user]);
- }
- /**
- * 我的积分列表
- * @return \think\response\Json
- * @throws \app\common\exception\BaseException
- * @throws \think\db\exception\DbException
- */
- public function pointsLogs()
- {
- $model = new PointsLogModel;
- $list = $model->getList();
- return $this->renderSuccess(compact('list'));
- }
- /**
- * 分享商品
- * @return \think\response\Json
- */
- public function shareUser()
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- return $this->renderJson(config('status.not_logged'), 'Log in please!');
- }
- $goodsId = $this->request->param('goodsId');
- if (empty($goodsId)) {
- return $this->renderError('Invalid goods');
- }
- $mailbox = $this->request->param('mailbox');
- if (empty($mailbox)) {
- return $this->renderError('Invalid mailbox');
- }
- $encryptUserId = encrypt(strval($userId));
- // $url = 'Your friend shared a product with you. Click on the link to view it now: '
- // . config('app.app_host') . '/index/index/productDetails/goodsId/' . $goodsId . '?key=' . $encryptUserId;
- //Log::debug($url);
- $link = config('app.app_host') . '/index/index/productDetails/goodsId/' . $goodsId . '?key=' . $encryptUserId;
- $url = 'Your friend shared a product with you. Click on the link to view it now: ' . '<a href="' . $link . '">Click Here</a>';
- $smtp = new UMailer(config('smtp.host'), config('smtp.port'), true,
- config('smtp.username'), config('smtp.password'));
- $smtp->debug = true; //是否显示发送的调试信息
- $flag = $smtp->sendShareText($mailbox, config('smtp.username'), 'Code', 'HTML', '', '', '', $url);
- if ($flag) {
- $shareKeyModel = new ShareKey();
- $shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
- return $this->renderSuccess([], 'Successful! Tell your friends to check for new emails.');
- }
- /* $MailCaptchaService = new MailCaptchaService;
- if ($MailCaptchaService->sendText($mailbox, 'From Your Friend', $url)) {
- $shareKeyModel = new ShareKey();
- $shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
- return $this->renderSuccess([], 'Successful! Tell your friends to check for new emails.');
- }*/
- if (is_debug()) {
- $shareKeyModel = new ShareKey();
- $shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
- }
- return $this->renderSuccess([], 'Successful! Tell your friends to check for new emails.');
- }
- public function shareUserV1()
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- return $this->renderJson(config('status.not_logged'), 'Log in please!');
- }
- $goodsId = $this->request->param('goodsId');
- if (empty($goodsId)) {
- return $this->renderError('Invalid goods');
- }
- $encryptUserId = encrypt(strval($userId));
- // $url = 'Your friend shared a product with you. Click on the link to view it now: '
- // . config('app.app_host') . '/index/index/productDetails/goodsId/' . $goodsId . '?key=' . $encryptUserId;
- //Log::debug($url);
- $link = config('app.app_host') . '/index/index/productDetails/goodsId/' . $goodsId . '?key=' . $encryptUserId;
- //$url = 'Your friend shared a product with you. Click on the link to view it now: ' . '<a href="' . $link . '">Click Here</a>';
- $writer = new PngWriter();
- // Create QR code
- $qrCode = QrCode::create($link)
- ->setEncoding(new Encoding('UTF-8'))
- ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
- ->setSize(360)
- ->setMargin(10)
- ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
- ->setForegroundColor(new Color(0, 0, 0))
- ->setBackgroundColor(new Color(255, 255, 255));
- $label = Label::create('Scan the QR code with a phone')
- ->setTextColor(new Color(255, 0, 0));
- $result = $writer->write($qrCode, null, $label);
- $dataUri = $result->getDataUri();
- return $this->renderSuccess(['dataUri' => $dataUri], 'Success');
- }
- /**
- * 生成马甲号
- * @return \think\response\Json
- * @throws \Exception
- */
- public function genFakeUsers()
- {
- $names = ['Eliana',
- 'Elias',
- 'Brooklyn',
- 'Joshua',
- 'Elena',
- 'Nathan',
- 'Aubrey',
- 'Caleb',
- 'Claire',
- 'Ryan',
- 'Ivy',
- 'Adrian',
- 'Kinsley',
- 'Miles',
- 'Audrey',
- 'Eli',
- 'Maya',
- 'Nolan',
- 'Genesis',
- 'Christian',
- 'Skylar',
- 'Aaron',
- 'Bella',
- 'Cameron',
- 'Aaliyah',
- 'Ezekiel',
- 'Madelyn',
- 'Colton',
- 'Savannah',
- 'Luca',
- 'Anna',
- 'Landon',
- 'Delilah',
- 'Hunter',
- 'Serenity',
- 'Jonathan',
- 'Caroline',
- 'Santiago',
- 'Kennedy',
- 'Axel',
- 'Valentina',
- 'Easton',
- 'Ruby',
- 'Cooper',
- 'Sophie',
- 'Jeremiah',
- 'Alice',
- 'Angel',
- 'Gabriella',
- 'Roman',
- 'Sadie',
- 'Connor',
- 'Ariana',
- 'Jameson',
- 'Allison',
- 'Robert',
- 'Hailey',
- 'Greyson',
- 'Autumn',
- 'Jordan',
- 'Nevaeh',
- 'Ian',
- 'Natalia',
- 'Carson',
- 'Quinn',
- 'Jaxson',
- 'Josephine',
- 'Leonardo',
- 'Sarah',
- 'Nicholas',
- 'Cora',
- 'Dominic',
- 'Emery',
- 'Austin',
- 'Samantha',
- 'Everett',
- 'Piper',
- 'Brooks',
- 'Leilani',
- 'Xavier',
- 'Eva',
- 'Kai',
- 'Everleigh',
- 'Jose',
- 'Madeline',
- 'Parker',
- 'Lydia',
- 'Adam',
- 'Jade',
- 'Jace',
- 'Peyton',
- 'Wesley',
- 'Brielle',
- 'Kayden',
- 'Adeline',
- 'Silas',
- 'Vivian',
- 'Bennett',
- 'Rylee',
- 'Declan',
- 'Clara',
- 'Waylon',
- 'Raelynn',
- 'Weston',
- 'Melanie',
- 'Evan',
- 'Melody',
- 'Emmett',
- 'Julia',
- 'Micah',
- 'Athena',
- 'Ryder',
- 'Maria',
- 'Beau',
- 'Liliana',
- 'Damian',
- 'Hadley',
- 'Hadley',
- 'Brayden',
- 'Arya',
- 'Gael',
- 'Rose',
- 'Rowan',
- 'Reagan',
- 'Harrison',
- 'Eliza',
- 'Bryson',
- 'Adalynn',
- 'Adalynn',
- 'Sawyer',
- 'Kaylee',
- 'Amir',
- 'Lyla',
- 'Kingston',
- 'Mackenzie',
- 'Jason',
- 'Alaia',
- 'Giovanni',
- 'Isabelle',
- 'Vincent',
- 'Charlie',
- 'Ayden',
- 'Arianna',
- 'Chase',
- 'Mary',
- 'Myles',
- 'Myles',
- 'Remi',
- 'Diego',
- 'Margaret',
- 'Nathaniel',
- 'Iris',
- 'Legend',
- 'Parker',
- 'Jonah',
- 'Ximena',
- 'River',
- 'Eden',
- 'Tyler',
- 'Ayla',
- 'Cole',
- 'Kylie',
- 'Braxton',
- 'Elliana',
- 'George',
- 'Josie',
- 'Milo',
- 'Katherine',
- 'Zachary',
- 'Faith',
- 'Ashton',
- 'Alexandra',
- 'Luis',
- 'Eloise',
- 'Jasper',
- 'Adalyn',
- 'Adalyn',
- 'Kaiden',
- 'Amaya',
- 'Adriel',
- 'Jasmine',
- 'Gavin',
- 'Amara',
- 'Bentley',
- 'Daisy',
- 'Calvin',
- 'Reese',
- 'Zion',
- 'Valerie',
- 'Juan',
- 'Brianna',
- 'Maxwell',
- 'Cecilia',
- 'Max',
- 'Andrea',
- 'Ryker',
- 'Summer',
- 'Carlos',
- 'Valeria',
- 'Emmanuel',
- 'Norah',
- 'Jayce',
- 'Ariella',
- 'Lorenzo',
- 'Esther',
- 'Ivan',
- 'Ashley',
- 'Jude',
- 'Emerson',
- 'August',
- 'August',
- 'Aubree',
- 'Kevin',
- 'Isabel',
- 'Malachi',
- 'Anastasia',
- 'Elliott',
- 'Genevieve',
- 'Jesus',
- 'Alina',
- 'Maddox',
- 'Bailey',
- 'King',
- 'Juniper',
- 'Theo',
- 'Maeve'];
- $salt = 'xxxxxx';
- $password = md5('123456' . $salt);
- for ($i = 0; $i < 100; $i++) {
- $user = [];
- $temp = $names[rand(0, 225)] . '_' . rand(100000, 999999);
- $user['mobile'] = $temp . '@fvp.com';
- $user['nick_name'] = $temp;
- $user['avatar_id'] = 0;
- $user['gender'] = 1;
- $user['country'] = 'US';
- $user['province'] = '';
- $user['city'] = '';
- $user['address_id'] = 0;
- $user['balance'] = 0;
- $user['points'] = 0;
- $user['pay_money'] = 0;
- $user['expend_money'] = 0;
- $user['platform'] = 'h5';
- $user['last_login_time'] = time();
- $user['is_delete'] = 0;
- $user['store_id'] = 10001;
- $user['create_time'] = time();
- $user['update_time'] = time();
- $user['salt'] = $salt;
- $user['password'] = $password;
- $users[] = $user;
- }
- $userModel = new \app\index\model\User();
- $userModel->saveAll($users);
- return $this->renderSuccess([], 'Successful!');
- }
- /**
- * 评论生成器
- * @return \think\response\Json
- * @throws \Exception
- */
- public function genGoodsComments()
- {
- //113
- $favor = [
- 'Genuine',
- 'Original taste',
- 'Smells good',
- 'I love that smell',
- 'This brand is number one!',
- 'OMG I am vaping while I am watching the NBA',
- 'Best company with wine',
- 'Better than cigar',
- 'Very smooth!!!!',
- 'Can I buy the oil inside only?',
- 'No leaking oil :>',
- 'This is my first taste of e-cagar',
- 'Too strong for me :<<<',
- 'Cheap and affordable!',
- 'RERERERE---REFREASHING!',
- 'Enjoying it on the beach',
- 'I can hide this in my school bag haha',
- 'Gotta introduce this site to my step-father',
- 'Best match with a cup of earl-grey tea...',
- 'Cant quit once I tried',
- 'Difficult to buy in the market nowadays',
- 'My friend recommended this site to me but I doubted it at the beginning. First it is a product that is very difficult to find in the market. Second, it sells so cheap but promised local USPS deliveries and no reason refund. I also feel strange that this site only sells one brand so I gave it a try and was ready to complain on PayPal. After a week or so, I received the products and I certainly took a video of unpacking. I was thinking that it would be an empty box or something. The first try I only give a few blows and charge it for a couple of days. Certainly, none of my concerns happened so I am writing this review. I am not a professional KOL to comment on this product but I found it very strange. First, it smells very fruity and is very different from my current ones (tea taste from iget) but my friend said it is normal to taste very sweet for LostMary fruity flavours. Anyway, I keep on checking their packing and it seems fine to me. I checked that the PayPal transaction went through and I am not planning for a refund now. Conclusion: Their promotion price is a bit too low, considering that they do not charge local shipping fee. However, it is good to try if it is self-use. The only thing I hate on the site is about their referral program with vape points. It seems like multi-level marketing lol',
- 'Their CS team is not AI robots. I can even call them on WhatsApp and someone picked up the phone',
- 'Gotta say that this is the most awesome website I have encountered. Except porn-hub',
- 'Best gift for my girlfriend',
- 'This product shines in a nightclub',
- 'I love the colour of this product',
- 'very realistic',
- 'I no longer have to worry about not finding an ashtray.',
- 'very portable',
- 'tastes very good',
- 'like fresh strawberries',
- 'refreshing but not overwhelming',
- 'very refreshing',
- 'tastes like enjoying a cup of hot cocoa',
- 'completely different from the bitterness and throat irritation of traditional cigarettes',
- 'different favor',
- "Tastes like enjoying a cup of hot cocoa, warm and delightful.",
- "addictive!",
- "Feels like biting into a fresh apple, crisp and delicious.",
- "There's a subtle vanilla flavor, making you feel like you're in a garden.",
- "Tastes like caramel with a delicate sweetness.",
- "It feels like savoring the aroma of freshly baked bread, absolutely tantalizing.",
- "Tastes like sipping on a tangy-sweet lemonade.",
- "There's a refreshing oceanic taste, making you feel like you're on the beach.",
- "The taste of this electronic product is like fresh grass, uplifting.",
- "It feels like tasting the richness of coffee.",
- "Feels like indulging in a mouthful of creamy ice cream, smooth and delicious.",
- "Tastes a bit like smelling a bouquet of fresh roses.",
- "Feels like tasting the aroma of freshly baked bread.",
- "There's a rich chocolate flavor, making you feel like you're in heaven.",
- "The taste of this electronic product is like a fresh fruit platter, delightful in every way.",
- "The taste is like savoring a mouthful of sweet honey.",
- "Feels like enjoying a cup of mild tea, warm and comforting.",
- "Tastes like indulging in a sweet and chilled fruit juice.",
- "There's a refreshing herbal taste, making you feel refreshed.",
- "Feels like savoring a cup of rich Italian coffee, strong and aromatic.",
- "The taste is like enjoying a dense chocolate cake.",
- "Feels like being surrounded by the scent of flowers in a garden.",
- "Tastes a bit like biting into a fresh watermelon, sweet and juicy.",
- "There's a cool minty flavor, instantly refreshing.",
- "Feels like savoring a cup of aromatic latte, full of vitality.",
- "Tastes like indulging in a sweet marshmallow.",
- "Feels like enjoying a tangy-sweet lemon tea.",
- "Tastes a bit like sipping on a fresh coconut water, sweet and refreshing.",
- "There's a subtle vanilla flavor, uplifting the mood.",
- "Feels like savoring a rich chocolate cake, delicious and delightful.",
- "Tastes like enjoying a cool scoop of ice cream.",
- "Feels like being surrounded by the scent of fresh flowers.",
- "Tastes a bit like indulging in a scoop of fresh strawberry ice cream.",
- "There's a rich coffee flavor, making you feel energetic.",
- "Feels like savoring a cup of steaming hot black tea, warm and comforting.",
- "Tastes like indulging in a rich chocolate cake.",
- "Feels like enjoying a cup of sweet coconut milkshake.",
- "Tastes a bit like savoring a fresh blueberry ice cream.",
- "There's a subtle herbal taste, making you feel connected to nature.",
- "Feels like savoring a cup of aromatic mocha coffee, with fragrance filling the air.",
- "Tastes like enjoying a smooth scoop of mango ice cream.",
- "Feels like bathing in the refreshing scent of oranges.",
- "Tastes a bit like indulging in a sweet fruit salad.",
- 'very rich',
- 'So rich',
- 'Very delicate',
- 'So Delicate',
- 'Fresh',
- 'Pleasant',
- 'Refreshing',
- 'Robust',
- 'Aromatic',
- 'So Clean',
- 'Clean',
- 'Mild',
- 'Very Sweet',
- 'So Smooth',
- 'Mellow',
- 'Fragrant',
- 'So Warm',
- 'Intense',
- 'Light',
- 'Velvety',
- 'Deep',
- 'So deep',
- 'Satisfying',
- 'Subtle sweetness',
- 'Minty freshness',
- 'Luscious',
- 'Sweet-tasting',
- 'Long-lasting aftertaste',
- 'Zesty',
- 'Pure',
- 'Very Pure',
- 'Silky',
- 'Very Silky',
- 'Fiery',
- 'Icy',
- 'Very Icy',
- 'Exquisite fragrance',
- 'Comforting',
- 'Honeyed',
- 'Strong',
- 'So Strong, I like it',
- 'Balanced acidity',
- 'Subtle',
- 'Silken',
- 'Smooth and mellow',
- 'Creamy',
- 'Rich flavor',
- 'Delicious',
- 'Richly fragrant',
- 'Comfortable',
- 'Tasty',
- 'Tasty good',
- 'Full-bodied',
- 'Fresh and invigorating',
- 'Refreshing',
- 'Pleasing to the palate',
- 'Crisp',
- 'Complex',
- 'Satisfying',
- 'very realistic',
- ];
- //50
- $price = [
- 'How come I cannot buy this product at shop?',
- 'Seems like that they sell to teanagers',
- 'Bookmarked this site already!!',
- 'Free shipping wow.......',
- 'I took a look at the website thoroughly. Ship out from USA, seems trustworthy!!/////!',
- 'I brought and collected a lot of points from this site. I used it to buy for my girlfriend and directly ship to her. She loved this gift but dunno it is so cheap lol',
- 'The user points can be transferred to someone else??',
- 'I basically vaped free now. I keep referring to friends and earned enough points to buy once a week haha',
- 'Anyone knows how the point system works?',
- 'Is this site trustworthy? I am planning to buy a pack of 10. The price is very competitive',
- 'Free shipping? Is that real?? How can they do it?',
- 'I think this site only sells ELFbar.....too bad they do not carry Relx',
- 'I just dropped an email to them asking them to sourcing iget for me. Waiting for their reply.',
- 'The WhatsApp button at the bottom of the page works. But their CS reply is slow.....',
- 'They have a USA phone number for CS. Now I am chatting with them',
- 'Enjoyable experience. It leads to PayPal and I paid with credit card. If it is going south I will complain on PayPal',
- 'I noticed there is a refund program so I brought some already. I will return it if this is not what I wanted',
- 'I registered and checked the backend. They have a tracking system after user login. Does it show my package location once I brought?',
- 'USPS delivered after seven working days. It is not fast, but acceptable. After all, it is free shipping what can I ask for more////////',
- 'It is a trusted site with HTTPS',
- 'Free shipping.......and no reason return? sounds cool',
- 'PayPal by credit card is safe',
- 'Anyone knows if we can wholesale this product?',
- 'The point system is good :>> it is win-win. My friends love it',
- 'Anyone knows the company who owns this website?',
- 'Is this a new website? I search OS5000 on google and it leads me here.....',
- 'The only shop who still sells Lost Mary',
- 'It must be leftover stocks of Lost Mary, more like a dump sale website.',
- 'Anyone knows how to make payment on this website?',
- 'I am contacting them on WhatsApp',
- 'ELFbar products are awesome. I dunno why FDA bans it!!',
- 'Affordable',
- 'Budget-friendly',
- 'Inexpensive',
- 'Economical',
- 'Cost-effective',
- 'Reasonably priced',
- 'Wallet-friendly',
- 'Cheap',
- 'Low-cost',
- 'Pocket-friendly',
- 'Bargain',
- 'Value for money',
- 'Dirt cheap',
- 'Cost-efficient',
- 'Discounted',
- 'Thrifty',
- 'Economically priced',
- 'Within budget',
- 'Modestly priced',
- 'Frugal',
- 'Low-priced',
- 'Marked down',
- 'Unbeatable price',
- 'Discounted rate',
- 'Value-priced',
- 'Competitive pricing',
- 'Affordable option',
- 'Great value',
- 'Rock-bottom prices',
- 'Cost-conscious',
- 'Sale price',
- 'Reasonable cost',
- 'Budget-conscious',
- 'Discount pricing',
- 'Low-priced option',
- 'Wallet-friendly choice',
- 'Entry-level pricing',
- 'Discounted deal',
- 'Cost-saving',
- 'Discounted rate',
- 'Sale bargain',
- 'Unmatched value',
- 'Unbelievably cheap',
- 'Steal deal',
- 'Slashed prices',
- 'Reduced rate',
- 'Great deal',
- 'Budget-friendly option',
- 'Money-saving',
- 'On a budget',
- ];
- //22
- $amount = [
- 'the amount of smoke is very large',
- 'very large',
- 'On sale',
- 'Abundant',
- 'Plentiful',
- 'this vapor is plentiful',
- 'Ample',
- 'Copious',
- 'Generous',
- 'Generous vapor',
- 'Substantial',
- 'Bountiful',
- 'Overflowing',
- 'Profuse',
- 'Plenty',
- 'Rich in quantity',
- 'Prolific',
- 'Luxuriant',
- 'In abundance',
- 'good',
- 'my favorite',
- 'will buy again'
- ];
- /* $pool = [
- 'The taste of this e-cigarette is really great, completely different from the bitterness and throat irritation of traditional cigarettes.',
- 'The smoke effect of electronic cigarettes is very realistic, as if I can truly feel the pleasure of smoking, and the amount of smoke is very large, so I can enjoy the smoking experience for a long time.',
- 'After switching to e-cigarettes, I found that my body seemed to be healthier and there was no intake of harmful substances like traditional cigarettes. It was really great.',
- 'Electronic cigarettes are very environmentally friendly, do not produce smoke, and have no negative impact on the environment, which makes me feel very proud.',
- 'very portable', ' I can use them anytime, anywhere. They are very convenient, and I no longer have to worry about not finding an ashtray.'
- ];*/
- $favorCount = count($favor) - 1;
- $priceCount = count($price) - 1;
- $amountCount = count($amount) - 1;
- $goodsId = $this->request->get('goods_id', null);
- $goodsModel = new Goods();
- $goods = $goodsModel->getListSimple($goodsId)->toArray();
- $score = [40, 50];
- //所有的马甲号userid
- $userModel = new \app\index\model\User();
- $userIds = $userModel->where('salt', 'xxxxxx')->column('user_id');
- $userNum = count($userIds) - 1;
- $now = time();
- $commentModel = new \app\index\model\Comment();
- foreach ($goods as $item) {
- $commentsNum = rand(30, 100);
- $comments = [];
- for ($i = 0; $i < $commentsNum; $i++) {
- $comment = [
- 'score' => $score[rand(0, 1)],
- 'content' => $favor[rand(0, $favorCount)] . ', ' . $price[rand(0, $priceCount)] . ', ' . $amount[rand(0, $amountCount)],
- 'is_picture' => 0,
- 'status' => 1,
- 'sort' => rand(0, 99),
- 'user_id' => $userIds[rand(0, $userNum)],
- 'order_id' => 0,
- 'goods_id' => $item['goods_id'],
- 'order_goods_id' => 0,
- 'store_id' => 10001,
- 'is_delete' => 0,
- 'create_time' => $now,
- 'update_time' => $now,
- ];
- $comments[] = $comment;
- }
- $commentModel->saveAll($comments);
- }
- return $this->renderSuccess([], 'Successful!');
- }
- public function genArticles()
- {
- $ecfHost = 'https://www.e-cigarette-forum.com';
- $f = file_get_contents('https://www.e-cigarette-forum.com/forums/e-cigarette-news.629/');
- //$f = '<div class="structItem-title" uix-href="/threads/will-not-stop-tobacco-control-unlikely-to-validate-nicotine-vaping-regwatch.983599/">';
- //帖子列表匹配
- $preg = '/<div\s+class="structItem-title"\s+uix-href="\/threads.+\/">/';
- $matches = [];
- preg_match_all($preg, $f, $matches);
- if (empty($matches[0])) {
- return $this->renderSuccess();
- }
- //dd($matches);
- //匹配详情页的里面的链接
- $pregSon = '/<div\s+class="bbWrapper"><a\s+href="http\S+"/';
- $pregSon1 = '/<div\s+class="bbWrapper"><div>\s+<a\s+href="http\S+"/';
- $posts = array_slice($matches[0], 2, 3);
- //dd($posts);
- //$titleStr = 'rel="nofollow ugc noopener">Scoring Endgame | Former CDC Tobacco Control Director Talks Battle Over Vaping | RegWatch</a>';
- $pregTitleSon = '/rel="nofollow\s+ugc\s+noopener">.+<\/a>/';
- $articles = [];
- foreach ($posts as $key => $match) {
- $matches1 = [];
- $matches2 = [];
- $ps = strpos($match, '/', 0);
- if ($ps === false) {
- continue;
- }
- //$pe = strrpos($match,'/',0);
- $uixHref = substr($match, $ps, -2);
- //dd($uixHref);
- sleep(1);
- $f1 = file_get_contents($ecfHost . $uixHref);
- //file_put_contents('b.html',$f1);
- //dd('hahaha');
- if (empty($f1)) {
- continue;
- }
- //file_put_contents('b.html',$f1);
- //dd($uixHref,$f1);
- //todo
- preg_match($pregSon, $f1, $matches1);
- //dd($matches1);
- if (empty($matches1)) {
- //dd('ooo');
- preg_match($pregSon1, $f1, $matches1);
- //dd($matches1);
- if (empty($matches1)) {
- continue;
- }
- }
- //文章详情的原始链接
- $postDetailOriginal = $matches1[0];
- $ps3 = strpos($postDetailOriginal, 'f', 0);
- if ($ps3 === false) {
- continue;
- }
- $postDetailOriginal = substr($postDetailOriginal, $ps3 + 3, -1);
- //dd($postDetailOriginal);
- //文章的标题
- preg_match($pregTitleSon, $f1, $matches2);
- dd($matches2);
- $postTitle = $matches2[0];
- $ps1 = strpos($postTitle, '>', 0);
- if ($ps1 === false) {
- continue;
- }
- $title = substr($postTitle, $ps1 + 1, -4);
- $article = [
- "title" => $title,
- "show_type" => 10,
- "category_id" => 10002,
- "image_id" => 0,
- "content" => '<a href="' . $postDetailOriginal . '">' . $title . '</a>',
- "sort" => 100,
- 'status' => 1,
- "virtual_views" => rand(100, 500),
- "actual_views" => rand(100, 500),
- "is_delete" => 0,
- "store_id" => 10001,
- "create_time" => time(),
- "update_time" => time(),
- ];
- $articles[] = $article;
- //$detail2 = file_get_contents($postDetail);
- //dd($matches1[0]);
- }
- dd($articles);
- file_put_contents('a.html', $f);
- dd($f);
- }
- public function pullAccessLogs()
- {
- $path = $this->request->param('path','');
- $ip = strval($this->request->param('path','ip'));
- $from = $this->request->param('from');
- $to = $this->request->param('to');
- $page = $this->request->param('page', 1);
- $size = $this->request->param('size', 50);
- $fromInt = strtotime($from);
- if (!$fromInt) {
- return $this->renderError('input valid from time');
- }
- if (!empty($to) && !strtotime($to)) {
- return $this->renderError('input valid to time');
- }
- if (!empty($to)) {
- $toInt = strtotime($to);
- } else {
- $toInt = time();
- }
- $data = UserAccessLog::getAccessLog($path, $fromInt, $toInt, $page, $size, $ip);
- return $this->renderSuccess($data);
- }
- public function pullLogsToNow()
- {
- $from = intval($this->request->param('from'));//要统计的起始时间戳
- //$to = 86400;
- if ($from > time()){
- return $this->renderError('input valid ck');
- }
- if (bcdiv(time() - $from,86400,0) > 10){
- return $this->renderError('from too old');
- }
- $ck = $this->request->param('ck');
- if ($ck != 'free9999'){
- return $this->renderError('input valid ck');
- }
- $data = [];
- $data['distinct_ip_cnt'] = UserAccessLog::getAccessLogDistinctIps($from,time());
- while ($from < time()){
- $to = $from + 86399;
- $data[date('Y-m-d',$from)] = UserAccessLog::getAccessLogPathes($from,$to);
- $from = $from + 86400;
- }
- return $this->renderSuccess($data);
- }
- }
|