作者 lyh

gx数据

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CheckListController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/4/17 9:25
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Optimize;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\Project\OptimizeCheckList;
  15 +use Illuminate\Http\Request;
  16 +
  17 +/**
  18 + * @remark :保存清单
  19 + * @name :CheckListController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2025/4/17 9:25
  23 + */
  24 +class CheckListController extends BaseController
  25 +{
  26 + public function __construct(Request $request)
  27 + {
  28 + parent::__construct($request);
  29 + $this->model = new OptimizeCheckList();
  30 + }
  31 +
  32 + /**
  33 + * @remark :获取分页检查清单数据
  34 + * @name :lists
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2025/4/17 9:31
  38 + */
  39 + public function lists(){
  40 + $field = ['id','status','sort','text','created_at'];
  41 + $data = $this->model->list($this->map,$this->page,$this->row,'id',$field);
  42 + $this->response('success',Code::SUCCESS,$data);
  43 + }
  44 +
  45 + /**
  46 + * @remark :保存检查清单
  47 + * @name :save
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2025/4/17 9:32
  51 + */
  52 + public function save(){
  53 + if(isset($this->param['id']) && !empty($this->param['id'])){
  54 + $id = $this->param['id'];
  55 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  56 + }else{
  57 + $id = $this->model->addReturnId($this->param);
  58 + }
  59 + $this->response('success',Code::SUCCESS,['id'=>$id]);
  60 + }
  61 +
  62 + /**
  63 + * @remark :修改状态
  64 + * @name :status
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/4/17 9:48
  68 + */
  69 + public function status(){
  70 + $this->request->validate([
  71 + 'id'=>'required',
  72 + 'status'=>'required'
  73 + ],[
  74 + 'id.required' => '主键不能为空',
  75 + 'status.required' => '状态不能为空',
  76 + ]);
  77 + $data = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
  78 + $this->response('success',Code::SUCCESS,$data);
  79 + }
  80 +
  81 + /**
  82 + * @remark :删除数据
  83 + * @name :del
  84 + * @author :lyh
  85 + * @method :post
  86 + * @time :2025/4/17 9:48
  87 + */
  88 + public function del(){
  89 + $this->request->validate([
  90 + 'id'=>'required',
  91 + ],[
  92 + 'id.required' => '主键不能为空',
  93 + ]);
  94 + if(!is_array($this->param['id'])){
  95 + $this->param['id'] = ['in',[$this->param['id']]];
  96 + }
  97 + $data = $this->model->del($this->map);
  98 + $this->response('success',Code::SUCCESS,$data);
  99 + }
  100 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CheckLogController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/4/17 10:07
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Optimize;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\Project\OptimizeCheckLog;
  15 +use Illuminate\Http\Request;
  16 +
  17 +/**
  18 + * @remark :检查日志
  19 + * @name :CheckLogController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2025/4/17 10:15
  23 + */
  24 +class CheckLogController extends BaseController
  25 +{
  26 + public function __construct(Request $request)
  27 + {
  28 + parent::__construct($request);
  29 + $this->model = new OptimizeCheckLog();
  30 + }
  31 +
  32 + /**
  33 + * @remark :检查日志列表
  34 + * @name :lists
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2025/4/17 10:17
  38 + */
  39 + public function lists(){
  40 + $field = ['id','check_id','date','status','images','result','created_at'];
  41 + $this->map['status'] = 1;
  42 + $lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field);
  43 + $this->response('success',Code::SUCCESS,$lists);
  44 + }
  45 +
  46 + /**
  47 + * @remark :保存数据
  48 + * @name :save
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2025/4/17 10:27
  52 + */
  53 + public function save(){
  54 + $this->request->validate([
  55 + 'id'=>'required', 'check_id'=>'required',
  56 + 'date'=>'required', 'result'=>'required',
  57 + ],[
  58 + 'id.required' => '主键不能为空', 'check_id.required' => '问题id不能为空',
  59 + 'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空',
  60 + ]);
  61 + $this->param = $this->model->saveHandleParam($this->param,$this->manage['id']);
  62 + if(isset($this->param['id']) && !empty($this->param['id'])){
  63 + $id = $this->param['id'];
  64 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  65 + }else{
  66 + $id = $this->model->addReturnId($this->param);
  67 + }
  68 + $this->response('success',Code::SUCCESS,['id'=>$id]);
  69 + }
  70 +
  71 + /**
  72 + * @remark :修改状态
  73 + * @name :status
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2025/4/17 10:43
  77 + */
  78 + public function status(){
  79 + $this->request->validate([
  80 + 'id'=>'required',
  81 + 'status'=>'required',
  82 + ],[
  83 + 'id.required' => '主键不能为空',
  84 + 'status.required' => 'status不能为空',
  85 + ]);
  86 + $data = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
  87 + $this->response('success',Code::SUCCESS,$data);
  88 + }
  89 +
  90 + /**
  91 + * @remark :删除数据
  92 + * @name :del
  93 + * @author :lyh
  94 + * @method :post
  95 + * @time :2025/4/17 10:52
  96 + */
  97 + public function del(){
  98 + $this->request->validate([
  99 + 'id'=>'required',
  100 + ],[
  101 + 'id.required' => '主键不能为空',
  102 + ]);
  103 + if(!is_array($this->param['id'])){
  104 + $this->param['id'] = ['in',[$this->param['id']]];
  105 + }
  106 + $data = $this->model->del($this->map);
  107 + $this->response('success',Code::SUCCESS,$data);
  108 + }
  109 +}
@@ -826,4 +826,24 @@ class ProductController extends BaseController @@ -826,4 +826,24 @@ class ProductController extends BaseController
826 } 826 }
827 return $keyword_name; 827 return $keyword_name;
828 } 828 }
  829 +
  830 + /**
  831 + * @remark :删除关联产品
  832 + * @name :delRelatedProductId
  833 + * @author :lyh
  834 + * @method :post
  835 + * @time :2025/4/17 11:01
  836 + */
  837 + public function delRelatedProductId(){
  838 + $this->request->validate([
  839 + 'id'=>'required',
  840 + 'related_product_id'=>'required',
  841 + ],[
  842 + 'id.required' => '产品ID不能为空',
  843 + 'related_product_id.required' => '关联产品不能为空',
  844 + ]);
  845 + $productModel = new Product();
  846 + $data = $productModel->edit(['related_product_id'=>null],['id'=>$this->param['id']]);
  847 + $this->response('success',Code::SUCCESS,$data);
  848 + }
829 } 849 }
@@ -11,6 +11,13 @@ namespace App\Models\Project; @@ -11,6 +11,13 @@ namespace App\Models\Project;
11 11
12 use App\Models\Base; 12 use App\Models\Base;
13 13
  14 +/**
  15 + * @remark :售后数据统计
  16 + * @name :After
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/4/17 9:26
  20 + */
14 class After extends Base 21 class After extends Base
15 { 22 {
16 protected $table = 'gl_project_after'; 23 protected $table = 'gl_project_after';
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :OptimizeCheckList.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/4/17 9:27
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :优化检查清单
  16 + * @name :OptimizeCheckList
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/4/17 9:27
  20 + */
  21 +class OptimizeCheckList extends Base
  22 +{
  23 + protected $table = 'gl_optimize_check_list';
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :OptimizeCheckList.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/4/17 9:27
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Helper\Arr;
  13 +use App\Models\Base;
  14 +
  15 +/**
  16 + * @remark :优化检查日志
  17 + * @name :OptimizeCheckList
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/4/17 9:27
  21 + */
  22 +class OptimizeCheckLog extends Base
  23 +{
  24 + protected $table = 'gl_optimize_check_log';
  25 +
  26 + /**
  27 + * @remark :获取器图片数据
  28 + * @name :getImagesAttribute
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2025/4/17 10:26
  32 + */
  33 + public function getImagesAttribute($value){
  34 + return Arr::s2a($value);
  35 + }
  36 +
  37 + /**
  38 + * @remark :保存数据设置参数
  39 + * @name :handleParam
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2025/4/17 10:35
  43 + */
  44 + public function saveHandleParam($param,$manage_id){
  45 + if(isset($param['images'])){
  46 + $param['images'] = Arr::a2s($param['images'] ?? []);
  47 + }
  48 + $this->param['operator_id'] = $manage_id;
  49 + $this->param['date'] = date('Y-m-d hH:i:s');
  50 + return $param;
  51 + }
  52 +}
@@ -283,6 +283,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -283,6 +283,7 @@ Route::middleware(['bloginauth'])->group(function () {
283 Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType'); 283 Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType');
284 Route::any('/getButton', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getButton'])->name('product_getButton'); 284 Route::any('/getButton', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getButton'])->name('product_getButton');
285 Route::any('/batchSetKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetKeyword'])->name('product_batchSetKeyword'); 285 Route::any('/batchSetKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetKeyword'])->name('product_batchSetKeyword');
  286 + Route::any('/delRelatedProductId', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delRelatedProductId'])->name('product_delRelatedProductId');
286 //产品分类batchSetKeyword 287 //产品分类batchSetKeyword
287 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); 288 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
288 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); 289 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');