作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Ai;
  4 +
  5 +use App\Http\Controllers\Bside\BaseController;
  6 +use App\Http\Logic\Bside\Ai\AiBlogLogic;
  7 +use App\Http\Requests\Bside\Ai\AiBlogRequest;
  8 +
  9 +class AiBlogController extends BaseController
  10 +{
  11 + /**
  12 + * @remark :Ai博客发布
  13 + * @name :save
  14 + * @author :lyh
  15 + * @method :post
  16 + * @time :2023/7/5 14:33
  17 + */
  18 + public function save(AiBlogRequest $aiBlogRequest,AiBlogLogic $aiBlogLogic){
  19 + $aiBlogRequest->validated();
  20 + $aiBlogLogic->blogSave();
  21 + $this->response('success');
  22 + }
  23 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Ai;
  4 +
  5 +use App\Http\Controllers\Bside\BaseController;
  6 +use App\Http\Logic\Bside\Ai\AiNewsLogic;
  7 +use App\Http\Requests\Bside\Ai\AiNewsRequest;
  8 +
  9 +/**
  10 + * @remark :ai发布新闻
  11 + * @name :AiNewsController
  12 + * @author :lyh
  13 + * @time :2023/7/5 14:17
  14 + */
  15 +class AiNewsController extends BaseController
  16 +{
  17 + /**
  18 + * @remark :Ai新闻发布
  19 + * @name :save
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/7/5 14:33
  23 + */
  24 + public function save(AiNewsRequest $aiNewsRequest,AiNewsLogic $aiNewsLogic){
  25 + $aiNewsRequest->validated();
  26 + $aiNewsLogic->newsSave();
  27 + $this->response('success');
  28 + }
  29 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Ai;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Bside\BaseController;
  7 +use App\Http\Logic\Bside\Ai\AiProductLogic;
  8 +use App\Http\Requests\Bside\Ai\AiProductRequest;
  9 +
  10 +class AiProductController extends BaseController
  11 +{
  12 + /**
  13 + * @remark :Ai产品发布
  14 + * @name :save
  15 + * @author :lyh
  16 + * @method :post
  17 + * @time :2023/7/5 14:34
  18 + */
  19 + public function save(AiProductRequest $aiProductRequest,AiProductLogic $aiProductLogic){
  20 + $aiProductRequest->validated();
  21 + $aiProductLogic->productSave();
  22 + $this->response('success');
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取产品列表
  27 + * @name :productList
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2023/7/5 17:03
  31 + */
  32 + public function productList(AiProductLogic $aiProductLogic){
  33 + $list = $aiProductLogic->productList($this->map);
  34 + $this->response('success',Code::SUCCESS,$list);
  35 + }
  36 +
  37 + /**
  38 + * @remark :获取产品分类
  39 + * @name :productCateList
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2023/7/5 17:04
  43 + */
  44 + public function productCateList(AiProductLogic $aiProductLogic){
  45 + $list = $aiProductLogic->productCateList($this->map);
  46 + $this->response('success',Code::SUCCESS,$list);
  47 + }
  48 +}
@@ -147,11 +147,7 @@ class ComController extends BaseController @@ -147,11 +147,7 @@ class ComController extends BaseController
147 } 147 }
148 148
149 public function ceshi(){ 149 public function ceshi(){
150 - $data = DB::table('gl_customer_visit')  
151 - ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))  
152 - ->groupBy('country')->where(['domain'=>'http://lxl.petuu.shop/'])  
153 - ->orderBy('ip','desc')->limit(10)->get()->toArray();  
154 - return $data; 150 +
155 } 151 }
156 152
157 /** 153 /**
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Ai;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Ai\AiBlog;
  7 +
  8 +class AiBlogLogic extends BaseLogic
  9 +{
  10 + public function __construct()
  11 + {
  12 + parent::__construct();
  13 + $this->param = $this->requestAll;
  14 + $this->model = new AiBlog();
  15 + }
  16 +
  17 + /**
  18 + * @remark :ai发布博客
  19 + * @name :blogSave
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/7/5 14:46
  23 + */
  24 + public function blogSave(){
  25 + $this->param['project_id'] = $this->user['project_id'];
  26 + $rs = $this->model->add($this->param);
  27 + if($rs === false){
  28 + $this->fail('error');
  29 + }
  30 + return $this->success();
  31 + }
  32 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Ai;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Ai\AiNews;
  7 +
  8 +class AiNewsLogic extends BaseLogic
  9 +{
  10 + public function __construct()
  11 + {
  12 + parent::__construct();
  13 + $this->param = $this->requestAll;
  14 + $this->model = new AiNews();
  15 + }
  16 +
  17 + /**
  18 + * @remark :AI发布新闻
  19 + * @name :newsSave
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/7/5 14:44
  23 + */
  24 + public function newsSave(){
  25 + $this->param['project_id'] = $this->user['project_id'];
  26 + $rs = $this->model->add($this->param);
  27 + if($rs === false){
  28 + $this->fail('error');
  29 + }
  30 + return $this->success();
  31 + }
  32 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Ai;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Ai\AiProduct;
  7 +use App\Models\Product\Category;
  8 +use App\Models\Product\Product;
  9 +
  10 +class AiProductLogic extends BaseLogic
  11 +{
  12 + public function __construct()
  13 + {
  14 + parent::__construct();
  15 + $this->param = $this->requestAll;
  16 + $this->model = new AiProduct();
  17 + }
  18 +
  19 + /**
  20 + * @remark :ai发布产品
  21 + * @name :productSave
  22 + * @author :lyh
  23 + * @method :post
  24 + * @time :2023/7/5 14:47
  25 + */
  26 + public function productSave(){
  27 + $this->param['project_id'] = $this->user['project_id'];
  28 + $rs = $this->model->add($this->param);
  29 + if($rs === false){
  30 + $this->fail('error');
  31 + }
  32 + return $this->success();
  33 + }
  34 +
  35 + /**
  36 + * @param $map
  37 + * @remark :获取产品列表
  38 + * @name :productList
  39 + * @author :lyh
  40 + * @method :post
  41 + * @time :2023/7/5 15:08
  42 + */
  43 + public function productList($map){
  44 + $map['project_id'] = $this->user['project_id'];
  45 + $productModel = new Product();
  46 + $list = $productModel->list($map,'created_at',['id','title','attrs','describe','project_id']);
  47 + return $this->success($list);
  48 + }
  49 +
  50 + /**
  51 + * @remark :获取产品分类
  52 + * @name :productCateList
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/7/5 15:09
  56 + */
  57 + public function productCateList($map){
  58 + $map['project_id'] = $this->user['project_id'];
  59 + $productCateModel = new Category();
  60 + $list = $productCateModel->list($map,'created_at',['id','project_id','title']);
  61 + return $this->success($list);
  62 + }
  63 +}
@@ -48,7 +48,6 @@ class CountLogic extends BaseLogic @@ -48,7 +48,6 @@ class CountLogic extends BaseLogic
48 'company'=>$this->project['company'], 48 'company'=>$this->project['company'],
49 'scheme'=>$this->project['deploy_build']['plan'], 49 'scheme'=>$this->project['deploy_build']['plan'],
50 'service_duration'=>$this->project['deploy_build']['service_duration'], 50 'service_duration'=>$this->project['deploy_build']['service_duration'],
51 - 'domain'=>$this->project['deploy_build']['test_domain']  
52 ]; 51 ];
53 return $this->success($data); 52 return $this->success($data);
54 } 53 }
@@ -97,8 +97,7 @@ class MonthCountLogic extends BaseLogic @@ -97,8 +97,7 @@ class MonthCountLogic extends BaseLogic
97 public function flowCount(&$arr,&$startTime,&$endTime,$project_id){ 97 public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
98 $pv_ip = DB::table('gl_count') 98 $pv_ip = DB::table('gl_count')
99 ->where(['project_id'=>$project_id]) 99 ->where(['project_id'=>$project_id])
100 - ->where('date','>=',$startTime.' 00:00:00')  
101 - ->where('date','<=',$endTime.' 23:59:59') 100 + ->whereBetween('date', [$startTime.' 00:00:00',$endTime.' 23:59:59'])
102 ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num')) 101 ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
103 ->first(); 102 ->first();
104 $arr['pv'] = $pv_ip->pv_num; 103 $arr['pv'] = $pv_ip->pv_num;
@@ -28,7 +28,7 @@ class DeptUserLogic extends BaseLogic @@ -28,7 +28,7 @@ class DeptUserLogic extends BaseLogic
28 $rs = $this->dept_user_add(); 28 $rs = $this->dept_user_add();
29 } 29 }
30 if ($rs === false) { 30 if ($rs === false) {
31 - $this->fail('部门添加成员失败'); 31 + $this->fail('error');
32 } 32 }
33 return $this->success(); 33 return $this->success();
34 } 34 }
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Bside\Ai;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class AiBlogRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'keywords'=>'required',
  28 + 'new_title'=>'required',
  29 + 'text'=>'required',
  30 + ];
  31 + }
  32 +
  33 + public function messages()
  34 + {
  35 + return [
  36 + 'keywords.required' => '关键字不能为空',
  37 + 'new_title.required' => '新标题不能为空',
  38 + 'text.required' => '内容不能为空',
  39 + ];
  40 + }
  41 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Bside\Ai;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class AiNewsRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'keywords'=>'required',
  28 + 'new_title'=>'required',
  29 + 'text'=>'required',
  30 + ];
  31 + }
  32 +
  33 + public function messages()
  34 + {
  35 + return [
  36 + 'keywords.required' => '关键字不能为空',
  37 + 'new_title.required' => '新标题不能为空',
  38 + 'text.required' => '内容不能为空',
  39 + ];
  40 + }
  41 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Bside\Ai;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class AiProductRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'product_id'=>'required',
  28 + 'category_id'=>'required',
  29 + 'keywords'=>'required',
  30 + 'new_title'=>'required',
  31 + 'new_keywords'=>'required',
  32 + 'text'=>'required',
  33 + ];
  34 + }
  35 +
  36 + public function messages()
  37 + {
  38 + return [
  39 + 'product_id.required'=>'所属产品不能为空',
  40 + 'category_id.required'=>'分类不能为空',
  41 + 'keywords.required'=>'核心关键字不能为空',
  42 + 'new_title.required'=>'新标题不能为空',
  43 + 'new_keywords.required'=>'新关键字不能为空',
  44 + 'text.required'=>'内容不能为空',
  45 + ];
  46 + }
  47 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Ai;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class AiBlog extends Base
  8 +{
  9 + protected $table = 'gl_ai_blog';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Ai;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class AiNews extends Base
  8 +{
  9 + protected $table = 'gl_ai_news';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Ai;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class AiProduct extends Base
  8 +{
  9 + protected $table = 'gl_ai_product';
  10 +}
@@ -98,6 +98,17 @@ Route::middleware(['bloginauth'])->group(function () { @@ -98,6 +98,17 @@ Route::middleware(['bloginauth'])->group(function () {
98 //公用ai自动生成 98 //公用ai自动生成
99 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); 99 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post');
100 }); 100 });
  101 +
  102 + //ai生成相关接口
  103 + Route::prefix('ai')->group(function () {
  104 + //ai
  105 + Route::any('/news/', [\App\Http\Controllers\Bside\Ai\AiNewsController::class, 'save'])->name('ai_news_save');
  106 + Route::any('/blog/', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'save'])->name('ai_blog_save');
  107 + Route::any('/product/', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'save'])->name('ai_product_save');
  108 + Route::any('/product/productList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productList'])->name('ai_product_productList');
  109 + Route::any('/product/productCateList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productCateList'])->name('ai_product_productCateList');
  110 + });
  111 +
101 //网站设置 112 //网站设置
102 Route::prefix('setting')->group(function () { 113 Route::prefix('setting')->group(function () {
103 //首页设置 114 //首页设置