作者 lyh

gx脚本

<?php
/**
* @remark :
* @name :NewsExtendController.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:05
*/
namespace App\Http\Controllers\Bside\News;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\News\NewsExtendLogic;
use App\Models\News\NewsExtend;
use Illuminate\Http\Request;
class NewsExtendController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new NewsExtendLogic();
}
/**
* @remark :获取所有扩展字段
* @name :lists
* @author :lyh
* @method :post
* @time :2025/5/26 15:08
*/
public function lists()
{
$lists = $this->logic->list($this->map);
$this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :保存扩展字段
* @name :save
* @author :lyh
* @method :post
* @time :2025/5/26 15:09
*/
public function save()
{
$this->request->validate([
'title' => 'required',
'type' => 'required',
], [
'title.required' => '字段名称不能为空',
'type.required' => '字段类型不能为空',
]);
$info = $this->logic->extendSave();
$this->response('success', Code::SUCCESS, $info);
}
}
... ...
<?php
/**
* @remark :
* @name :NewsExtendLogic.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:11
*/
namespace App\Http\Logic\Bside\News;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\News\NewsExtend;
class NewsExtendLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new NewsExtend();
$this->param = $this->requestAll;
}
/**
* @remark :列表页
* @name :list
* @author :lyh
* @method :post
* @time :2025/5/26 15:17
*/
public function list($map){
$data = $this->model->list($map);
return $this->success($data);
}
/**
* @remark :
* @name :extendSave
* @author :lyh
* @method :post
* @time :2025/5/26 15:13
*/
public function extendSave(){
}
}
... ...
<?php
/**
* @remark :
* @name :NewsExtend.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:08
*/
namespace App\Models\News;
use App\Models\Base;
class NewsExtend extends Base
{
protected $table = 'gl_news_extend';
protected $connection = 'custom_mysql';
}
... ...