正在显示
12 个修改的文件
包含
357 行增加
和
0 行删除
| 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\Http\Controllers\Bside\BaseController; | ||
| 6 | +use App\Http\Logic\Bside\Ai\AiProductLogic; | ||
| 7 | +use App\Http\Requests\Bside\Ai\AiProductRequest; | ||
| 8 | + | ||
| 9 | +class AiProductController extends BaseController | ||
| 10 | +{ | ||
| 11 | + /** | ||
| 12 | + * @remark :Ai产品发布 | ||
| 13 | + * @name :save | ||
| 14 | + * @author :lyh | ||
| 15 | + * @method :post | ||
| 16 | + * @time :2023/7/5 14:34 | ||
| 17 | + */ | ||
| 18 | + public function save(AiProductRequest $aiProductRequest,AiProductLogic $aiProductLogic){ | ||
| 19 | + $aiProductRequest->validated(); | ||
| 20 | + $aiProductLogic->productSave(); | ||
| 21 | + $this->response('success'); | ||
| 22 | + } | ||
| 23 | +} |
app/Http/Logic/Bside/Ai/AiBlogLogic.php
0 → 100644
| 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 | +} |
app/Http/Logic/Bside/Ai/AiNewsLogic.php
0 → 100644
| 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 | +} |
app/Http/Logic/Bside/Ai/AiProductLogic.php
0 → 100644
| 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\Product; | ||
| 8 | + | ||
| 9 | +class AiProductLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + $this->param = $this->requestAll; | ||
| 15 | + $this->model = new AiProduct(); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @remark :ai发布产品 | ||
| 20 | + * @name :productSave | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/7/5 14:47 | ||
| 24 | + */ | ||
| 25 | + public function productSave(){ | ||
| 26 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 27 | + $rs = $this->model->add($this->param); | ||
| 28 | + if($rs === false){ | ||
| 29 | + $this->fail('error'); | ||
| 30 | + } | ||
| 31 | + return $this->success(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @param $map | ||
| 36 | + * @remark :获取产品列表 | ||
| 37 | + * @name :productList | ||
| 38 | + * @author :lyh | ||
| 39 | + * @method :post | ||
| 40 | + * @time :2023/7/5 15:08 | ||
| 41 | + */ | ||
| 42 | + public function productList($map){ | ||
| 43 | + $map['project_id'] = $this->user['project_id']; | ||
| 44 | + $productModel = new Product(); | ||
| 45 | + $list = $productModel->list($map,'created_at',['id','title','attrs','describe','project_id']); | ||
| 46 | + return $this->success($list); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @remark :获取产品分类 | ||
| 51 | + * @name :productCateList | ||
| 52 | + * @author :lyh | ||
| 53 | + * @method :post | ||
| 54 | + * @time :2023/7/5 15:09 | ||
| 55 | + */ | ||
| 56 | + public function productCateList(){ | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | +} |
app/Http/Requests/Bside/Ai/AiBlogRequest.php
0 → 100644
| 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 | +} |
app/Http/Requests/Bside/Ai/AiNewsRequest.php
0 → 100644
| 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 | +} |
app/Models/Ai/AiBlog.php
0 → 100644
app/Models/Ai/AiNews.php
0 → 100644
-
请 注册 或 登录 后发表评论