作者 lyh

gx脚本

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:05
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\News;
  11 +
  12 +use App\Http\Controllers\Bside\BaseController;
  13 +use App\Http\Logic\Bside\News\NewsExtendLogic;
  14 +use App\Models\News\NewsExtend;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class NewsExtendController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new NewsExtendLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取所有扩展字段
  27 + * @name :lists
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/26 15:08
  31 + */
  32 + public function lists()
  33 + {
  34 + $lists = $this->logic->list($this->map);
  35 + $this->response('success', Code::SUCCESS, $lists);
  36 + }
  37 +
  38 + /**
  39 + * @remark :保存扩展字段
  40 + * @name :save
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2025/5/26 15:09
  44 + */
  45 + public function save()
  46 + {
  47 + $this->request->validate([
  48 + 'title' => 'required',
  49 + 'type' => 'required',
  50 + ], [
  51 + 'title.required' => '字段名称不能为空',
  52 + 'type.required' => '字段类型不能为空',
  53 + ]);
  54 + $info = $this->logic->extendSave();
  55 + $this->response('success', Code::SUCCESS, $info);
  56 + }
  57 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:11
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\News;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\News\NewsExtend;
  14 +
  15 +class NewsExtendLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new NewsExtend();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :列表页
  26 + * @name :list
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2025/5/26 15:17
  30 + */
  31 + public function list($map){
  32 + $data = $this->model->list($map);
  33 + return $this->success($data);
  34 + }
  35 +
  36 + /**
  37 + * @remark :
  38 + * @name :extendSave
  39 + * @author :lyh
  40 + * @method :post
  41 + * @time :2025/5/26 15:13
  42 + */
  43 + public function extendSave(){
  44 +
  45 + }
  46 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtend.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:08
  8 + */
  9 +
  10 +namespace App\Models\News;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class NewsExtend extends Base
  15 +{
  16 + protected $table = 'gl_news_extend';
  17 + protected $connection = 'custom_mysql';
  18 +}