作者 邓超

Merge branch 'develop' into dc

  1 +<?php
  2 +
  3 +namespace App\Console\Commands\YesterdayCount;
  4 +
  5 +use App\Models\CustomerVisit\CustomerVisitItem;
  6 +use App\Models\Project\DeployBuild;
  7 +use Illuminate\Console\Command;
  8 +use Illuminate\Support\Facades\DB;
  9 +
  10 +class Yesterday extends Command
  11 +{
  12 + public $error = 0;
  13 + /**
  14 + * The name and signature of the console command.
  15 + *
  16 + * @var string
  17 + */
  18 + protected $signature = 'yesterday_count';
  19 +
  20 + /**
  21 + * The console command description.
  22 + *
  23 + * @var string
  24 + */
  25 + protected $description = '统计昨日数据';
  26 + /**
  27 + * @name :(定时执行)handle
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2023/5/12 14:48
  31 + */
  32 + public function handle()
  33 + {
  34 + $deployModel = new DeployBuild();
  35 + $list = $deployModel->list();
  36 + $data = [];
  37 + foreach ($list as $v){
  38 + $arr = [];
  39 + $yesterday = now()->subDay();
  40 + $arr['yesterday_pv_num'] = DB::table('gl_customer_visit_item')->whereDate('created_at', $yesterday)->where('domain',$v['test_domain'])->count();
  41 + $arr['yesterday_ip_num'] = DB::table('gl_customer_visit')->whereDate('created_at', $yesterday)->where('domain',$v['test_domain'])->count();
  42 + $arr['inquiry_num'] = DB::table('gl_inquiry_set')->whereDate('created_at', $yesterday)->where('project_id',$v['project_id'])->count();
  43 + $arr['date'] = date('Y-m-d',time());
  44 + $data[] = $arr;
  45 + }
  46 + DB::table('gl_yesterday_count')->insert($data);
  47 + echo $this->error;
  48 + }
  49 +}
@@ -23,6 +23,7 @@ class Kernel extends ConsoleKernel @@ -23,6 +23,7 @@ class Kernel extends ConsoleKernel
23 $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 23 $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
24 $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 24 $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
25 $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 25 $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
  26 + $schedule->command('yesterday_count')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
26 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 27 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
27 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 28 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
28 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 29 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\HomeCount;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Bside\BaseController;
  7 +
  8 +class CountController extends BaseController
  9 +{
  10 + /**
  11 + * @name :(昨日统计数据)yesterday_count
  12 + * @author :lyh
  13 + * @method :post
  14 + * @time :2023/5/23 17:23
  15 + */
  16 + public function count(){
  17 + $data = [];
  18 + //TODO::全球搜方案信息
  19 + //TODO::网站访问量统计
  20 + //TODO::关键字排名数据
  21 + //TODO::关键字排名数据
  22 + return $this->response('success',Code::SUCCESS,$data);
  23 + }
  24 +
  25 +
  26 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside;
  4 +
  5 +
  6 +use App\Http\Logic\Bside\VisitLogic;
  7 +use Illuminate\Http\Request;
  8 +
  9 +
  10 +/**
  11 + * 访问明细
  12 + * Class VisitController
  13 + * @package App\Http\Controllers\Bside
  14 + * @author zbj
  15 + * @date 2023/5/22
  16 + */
  17 +class VisitController extends BaseController
  18 +{
  19 +
  20 + public function index(VisitLogic $logic)
  21 + {
  22 + $data = $logic->getList();
  23 + return $this->success($data);
  24 + }
  25 +
  26 + public function item(Request $request, VisitLogic $logic){
  27 + $request->validate([
  28 + 'id'=>'required'
  29 + ],[
  30 + 'id.required' => 'ID不能为空'
  31 + ]);
  32 + $map = [
  33 + ['customer_visit_id' => $this->param['id']]
  34 + ];
  35 + $data = $logic->getItemList($map);
  36 + return $this->success($data);
  37 + }
  38 +
  39 +}
@@ -40,7 +40,9 @@ class AyrReleaseLogic extends BaseLogic @@ -40,7 +40,9 @@ class AyrReleaseLogic extends BaseLogic
40 public function release_add(){ 40 public function release_add(){
41 $this->param['project_id'] = $this->user['project_id']; 41 $this->param['project_id'] = $this->user['project_id'];
42 $this->param['operator_id'] = $this->user['id']; 42 $this->param['operator_id'] = $this->user['id'];
43 - $this->param['images'] = implode(',',$this->param['images']); 43 + if(isset($this->param['images']) && !empty($this->param['images'])){
  44 + $this->param['images'] = implode(',',$this->param['images']);
  45 + }
44 $this->param['platforms'] = json_encode($this->param['platforms']); 46 $this->param['platforms'] = json_encode($this->param['platforms']);
45 $rs = $this->model->add($this->param); 47 $rs = $this->model->add($this->param);
46 if($rs === false){ 48 if($rs === false){
@@ -213,9 +213,11 @@ class AyrShareLogic extends BaseLogic @@ -213,9 +213,11 @@ class AyrShareLogic extends BaseLogic
213 $this->fail('不支持视频'); 213 $this->fail('不支持视频');
214 } 214 }
215 //验证图片数 215 //验证图片数
216 - $img_num = count($this->param['images']);  
217 - if($img_num > $this->send_num[$v]){  
218 - $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图'); 216 + if(isset($this->param['images']) && !empty($this->param['images'])){
  217 + $img_num = count($this->param['images']);
  218 + if($img_num > $this->send_num[$v]){
  219 + $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图');
  220 + }
219 } 221 }
220 //验证图片数 222 //验证图片数
221 // $img_num = count($this->param['video']); 223 // $img_num = count($this->param['video']);
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\HomeCount;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +
  7 +class CountLogic extends BaseLogic
  8 +{
  9 + public function __construct()
  10 + {
  11 + parent::__construct();
  12 +
  13 + $this->model = new Yes();
  14 + }
  15 +
  16 + /**
  17 + * @name :(昨日统计数据)yesterday_count
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2023/5/23 17:30
  21 + */
  22 + public function yesterday_count(){
  23 + return $this->success();
  24 + }
  25 +}
@@ -23,7 +23,7 @@ class DeptUserLogic extends BaseLogic @@ -23,7 +23,7 @@ class DeptUserLogic extends BaseLogic
23 */ 23 */
24 public function dept_user_save(){ 24 public function dept_user_save(){
25 if(isset($this->param['id']) && !empty($this->param['id'])){ 25 if(isset($this->param['id']) && !empty($this->param['id'])){
26 - $rs = $this->dept_user_edit($this->param); 26 + $rs = $this->dept_user_edit();
27 }else{ 27 }else{
28 $rs = $this->dept_user_add(); 28 $rs = $this->dept_user_add();
29 } 29 }
@@ -60,8 +60,8 @@ class DeptUserLogic extends BaseLogic @@ -60,8 +60,8 @@ class DeptUserLogic extends BaseLogic
60 * @method :post 60 * @method :post
61 * @time :2023/5/17 17:54 61 * @time :2023/5/17 17:54
62 */ 62 */
63 - public function dept_user_edit($param){  
64 - $rs = $this->model->edit($param,['id'=>$this->param['id']]); 63 + public function dept_user_edit(){
  64 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
65 if($rs === false){ 65 if($rs === false){
66 $this->fail('error'); 66 $this->fail('error');
67 } 67 }
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside;
  4 +
  5 +use App\Http\Logic\Logic;
  6 +use App\Models\Visit\Visit;
  7 +use App\Models\Visit\VisitItem;
  8 +
  9 +
  10 +/**
  11 + * Class VisitLogic
  12 + * @package App\Http\Logic\Bside
  13 + * @author zbj
  14 + * @date 2023/5/22
  15 + */
  16 +class VisitLogic extends BaseLogic
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 +
  22 + $this->model = new Visit();
  23 + }
  24 +
  25 + public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)
  26 + {
  27 + return Logic::getList($map, $sort, ['id', 'url', 'referrer_url', 'device_port', 'country', 'ip', 'depth', 'created_at'], $limit);
  28 + }
  29 +
  30 + public function getItemList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20){
  31 + $this->model = new VisitItem();
  32 + return Logic::getList($map, $sort, ['url', 'created_at'], 0);
  33 + }
  34 +
  35 +}
@@ -24,12 +24,9 @@ class AyrReleaseRequest extends FormRequest @@ -24,12 +24,9 @@ class AyrReleaseRequest extends FormRequest
24 { 24 {
25 return [ 25 return [
26 'title'=>'required', 26 'title'=>'required',
27 -// 'images'=>'required|array',  
28 -// 'video'=>'required',  
29 'content'=>'required', 27 'content'=>'required',
30 'share_id'=>'required', 28 'share_id'=>'required',
31 'platforms'=>'required|array', 29 'platforms'=>'required|array',
32 -// 'schedule_date'=>'required',  
33 ]; 30 ];
34 } 31 }
35 32
  1 +<?php
  2 +
  3 +namespace App\Models\CustomerVisit;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class CustomerVisit extends Base
  8 +{
  9 + protected $table = 'gl_customer_visit';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\CustomerVisit;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class CustomerVisitItem extends Base
  8 +{
  9 + protected $table = 'gl_customer_visit_item';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\HomeCount;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class YesterdayCount extends Base
  8 +{
  9 + protected $table = 'gl_yesterday_count';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Visit;
  4 +
  5 +
  6 +use App\Models\Base;
  7 +
  8 +/**
  9 + * Class Visit
  10 + * @package App\Models
  11 + * @author zbj
  12 + * @date 2023/5/22
  13 + */
  14 +class Visit extends Base
  15 +{
  16 +
  17 + //设置关联表名
  18 + protected $table = 'gl_customer_visit';
  19 +
  20 + protected $appends = ['device_text'];
  21 +
  22 + public static function deviceMap(){
  23 + return [
  24 + 1 => 'PC',
  25 + 2 => '移动端'
  26 + ];
  27 + }
  28 +
  29 + /**
  30 + * @return string
  31 + * @author zbj
  32 + * @date 2023/5/22
  33 + */
  34 + public function getDeviceTextAttribute(){
  35 + return self::deviceMap()[$this->device_port] ?? '';
  36 + }
  37 +
  38 +
  39 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Visit;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +/**
  8 + * Class VisitItem
  9 + * @package App\Models
  10 + * @author zbj
  11 + * @date 2023/5/22
  12 + */
  13 +class VisitItem extends Base
  14 +{
  15 +
  16 + //设置关联表名
  17 + protected $table = 'gl_customer_visit_item';
  18 +
  19 +
  20 +}
@@ -262,6 +262,11 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () { @@ -262,6 +262,11 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () {
262 Route::any('/get_google_rank', [\App\Http\Controllers\Bside\RankDataController::class, 'get_google_rank'])->name('rank_data_get_google_rank'); 262 Route::any('/get_google_rank', [\App\Http\Controllers\Bside\RankDataController::class, 'get_google_rank'])->name('rank_data_get_google_rank');
263 }); 263 });
264 264
  265 + //访问数据
  266 + Route::prefix('visit')->group(function () {
  267 + Route::any('/', [\App\Http\Controllers\Bside\VisitController::class, 'index'])->name('visit_list');
  268 + Route::any('/item', [\App\Http\Controllers\Bside\VisitController::class, 'item'])->name('visit_item');
  269 + });
265 270
266 }); 271 });
267 //无需登录验证的路由组 272 //无需登录验证的路由组