作者 Your Name

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

@@ -28,7 +28,12 @@ class AiCommandController extends BaseController @@ -28,7 +28,12 @@ class AiCommandController extends BaseController
28 ]); 28 ]);
29 #TODO 通过key获取到ai指令对象 29 #TODO 通过key获取到ai指令对象
30 $data = Common::send_openai_msg($this->chat_url,$this->param); 30 $data = Common::send_openai_msg($this->chat_url,$this->param);
31 - $this->set_ai_log($data); 31 + $param = [
  32 + 'key'=>$this->param['key'],
  33 + 'keywords'=>$this->param['keywords'],
  34 + 'remark'=>json_encode($data)
  35 + ];
  36 + $this->set_ai_log($param);
32 $this->response('success',Code::SUCCESS,$data); 37 $this->response('success',Code::SUCCESS,$data);
33 } 38 }
34 39
@@ -42,8 +47,9 @@ class AiCommandController extends BaseController @@ -42,8 +47,9 @@ class AiCommandController extends BaseController
42 //写入日志 47 //写入日志
43 $param = [ 48 $param = [
44 'key'=> $this->param['key'], 49 'key'=> $this->param['key'],
45 - 'keywords'=>$this->param['key'],  
46 - 'remark' =>$data 50 + 'keywords'=>$this->param['keywords'],
  51 + 'remark' =>$data['remark'],
  52 + 'operator_id'=>$this->uid
47 ]; 53 ];
48 $aiLog = new AiLog(); 54 $aiLog = new AiLog();
49 return $aiLog->add($param); 55 return $aiLog->add($param);
@@ -8,6 +8,7 @@ use App\Helper\Arr; @@ -8,6 +8,7 @@ use App\Helper\Arr;
8 use App\Http\Controllers\Bside\BaseController; 8 use App\Http\Controllers\Bside\BaseController;
9 use App\Http\Logic\Bside\Product\ProductLogic; 9 use App\Http\Logic\Bside\Product\ProductLogic;
10 use App\Http\Requests\Bside\Product\ProductRequest; 10 use App\Http\Requests\Bside\Product\ProductRequest;
  11 +use App\Models\Product\CategoryRelated;
11 use App\Rules\Ids; 12 use App\Rules\Ids;
12 use Illuminate\Http\Request; 13 use Illuminate\Http\Request;
13 14
@@ -26,11 +27,18 @@ class ProductController extends BaseController @@ -26,11 +27,18 @@ class ProductController extends BaseController
26 if(!empty($this->param['search'])){ 27 if(!empty($this->param['search'])){
27 $map[] = ['title', 'like', "%{$this->param['search']}%"]; 28 $map[] = ['title', 'like', "%{$this->param['search']}%"];
28 } 29 }
29 - if(!empty($this->param['created_at'])){ 30 + if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){
30 $map[] = ['created_at', 'between', $this->param['created_at']]; 31 $map[] = ['created_at', 'between', $this->param['created_at']];
31 } 32 }
  33 + if(!empty($this->param['category_id'])){
  34 + $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray();
  35 + $map[] = ['id', 'in', $ids];
  36 + }
  37 + if(!empty($this->param['status'])){
  38 + $map[] = ['status', $this->param['status']];
  39 + }
32 $sort = ['id' => 'desc']; 40 $sort = ['id' => 'desc'];
33 - $data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_at', 'updated_at']); 41 + $data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_uid', 'created_at', 'updated_at']);
34 return $this->success($data); 42 return $this->success($data);
35 } 43 }
36 44
@@ -42,7 +50,7 @@ class ProductController extends BaseController @@ -42,7 +50,7 @@ class ProductController extends BaseController
42 ]); 50 ]);
43 $data = $logic->getInfo($this->param['id']); 51 $data = $logic->getInfo($this->param['id']);
44 return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'gallery', 'attrs', 'category_id', 'keywords', 'intro', 'content', 52 return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'gallery', 'attrs', 'category_id', 'keywords', 'intro', 'content',
45 - 'describe', 'seo_mate', 'related_product_id', 'status'])); 53 + 'describe', 'seo_mate', 'related_product_id', 'status', 'category_id_text', 'status_text', 'created_uid', 'created_uid_text']));
46 } 54 }
47 55
48 public function save(ProductRequest $request, ProductLogic $logic) 56 public function save(ProductRequest $request, ProductLogic $logic)
@@ -192,7 +192,7 @@ class ImageController @@ -192,7 +192,7 @@ class ImageController
192 'data' => $data, 192 'data' => $data,
193 ]; 193 ];
194 $this->header['Content-Type'] = $type; 194 $this->header['Content-Type'] = $type;
195 - $response = response($result,$result_code,$this->header);; 195 + $response = response($result,$result_code,$this->header);
196 throw new HttpResponseException($response); 196 throw new HttpResponseException($response);
197 } 197 }
198 } 198 }
@@ -34,7 +34,7 @@ class ProjectGroupLogic extends BaseLogic @@ -34,7 +34,7 @@ class ProjectGroupLogic extends BaseLogic
34 */ 34 */
35 public function group_add(){ 35 public function group_add(){
36 //查看当前用户组是否存在 36 //查看当前用户组是否存在
37 - $this->model->read(['name'=>$this->param['name'],'create_id'=>1]); 37 + $this->model->read(['name'=>$this->param['name'],'create_id'=>$this->user['id']]);
38 $rs = $this->model->add($this->param); 38 $rs = $this->model->add($this->param);
39 if($rs === false){ 39 if($rs === false){
40 $this->fail('error'); 40 $this->fail('error');
@@ -50,7 +50,10 @@ class ProjectGroupLogic extends BaseLogic @@ -50,7 +50,10 @@ class ProjectGroupLogic extends BaseLogic
50 */ 50 */
51 public function group_edit(){ 51 public function group_edit(){
52 //查看当前用户组是否存在 52 //查看当前用户组是否存在
53 - $this->model->read(['name'=>$this->param['name'],'create_id'=>1]); 53 + $rs = $this->model->read(['name'=>$this->param['name'],'create_id'=>$this->user['id']]);
  54 + if($rs === false){
  55 + $this->fail('error');
  56 + }
54 return $this->success(); 57 return $this->success();
55 } 58 }
56 59
@@ -61,6 +64,11 @@ class ProjectGroupLogic extends BaseLogic @@ -61,6 +64,11 @@ class ProjectGroupLogic extends BaseLogic
61 * @method 64 * @method
62 */ 65 */
63 public function group_del(){ 66 public function group_del(){
  67 + $this->param['id'] = ['in',$this->param['id']];
  68 + $rs = $this->model->del($this->param);
  69 + if($rs === false){
  70 + $this->fail('error');
  71 + }
64 return $this->success(); 72 return $this->success();
65 } 73 }
66 } 74 }
@@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product; @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
  7 +use App\Http\Logic\Bside\User\UserLogic;
7 use App\Models\Product\CategoryRelated; 8 use App\Models\Product\CategoryRelated;
8 use App\Models\Product\Product; 9 use App\Models\Product\Product;
9 use App\Models\RouteMap; 10 use App\Models\RouteMap;
@@ -24,6 +25,32 @@ class ProductLogic extends BaseLogic @@ -24,6 +25,32 @@ class ProductLogic extends BaseLogic
24 $this->model = new Product(); 25 $this->model = new Product();
25 } 26 }
26 27
  28 + public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)
  29 + {
  30 + $data = parent::getList($map, $sort, $columns, $limit);
  31 + foreach ($data['list'] as &$v){
  32 + foreach ($v['category_id'] as $category_id){
  33 + $v['category_id_text'][] =(new CategoryLogic())->getCacheInfo($category_id)['title']??'';
  34 + }
  35 + $v['category_id_text'] = Arr::arrToSet($v['category_id_text'], 'trim');
  36 + $v['status_text'] = Product::statusMap()[$v['status']] ?? '';
  37 + $v['created_uid_text'] = (new UserLogic())->getCacheInfo($v['created_uid'])['name'] ?? '';
  38 + }
  39 + return $this->success($data);
  40 + }
  41 +
  42 + public function getInfo($id)
  43 + {
  44 + $info = parent::getInfo($id);
  45 + foreach ($info['category_id'] as $category_id) {
  46 + $info['category_id_text'][] = (new CategoryLogic())->getCacheInfo($category_id)['title'] ?? '';
  47 + }
  48 + $info['category_id_text'] = Arr::arrToSet($info['category_id_text'], 'trim');
  49 + $info['status_text'] = Product::statusMap()[$info['status']] ?? '';
  50 + $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
  51 + return $this->success($info);
  52 + }
  53 +
27 public function save($param){ 54 public function save($param){
28 //封面取第一个图片 55 //封面取第一个图片
29 $param['thumb'] = $param['gallery'][0] ?? ''; 56 $param['thumb'] = $param['gallery'][0] ?? '';
@@ -31,6 +58,7 @@ class ProductLogic extends BaseLogic @@ -31,6 +58,7 @@ class ProductLogic extends BaseLogic
31 try { 58 try {
32 $data = $param; 59 $data = $param;
33 unset($data['route']); 60 unset($data['route']);
  61 + $data['created_uid'] = $this->user['id'];
34 $res = parent::save($data); 62 $res = parent::save($data);
35 //关联分类 63 //关联分类
36 CategoryRelated::saveRelated($res['id'], $data['category_id']); 64 CategoryRelated::saveRelated($res['id'], $data['category_id']);
@@ -16,14 +16,14 @@ class Product extends Base @@ -16,14 +16,14 @@ class Product extends Base
16 16
17 const STATUS_DRAFT = 0; 17 const STATUS_DRAFT = 0;
18 const STATUS_ON = 1; 18 const STATUS_ON = 1;
19 - const STATUS_OFF = 2; 19 + const STATUS_RECYCLE = 2;
20 20
21 21
22 public static function statusMap(){ 22 public static function statusMap(){
23 return [ 23 return [
24 self::STATUS_DRAFT => '草稿', 24 self::STATUS_DRAFT => '草稿',
25 - self::STATUS_ON => '已上架',  
26 - self::STATUS_OFF => '未上架', 25 + self::STATUS_ON => '已发布',
  26 + self::STATUS_RECYCLE => '回收站',
27 ]; 27 ];
28 } 28 }
29 29
  1 +<?php
  2 +
  3 +namespace App\Models\Project;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class Country extends Base
  8 +{
  9 + protected $table = 'gl_project_country';
  10 +}
1 -<?php  
2 -  
3 -namespace App\Models;  
4 -  
5 -class ProjectGroup extends Base  
6 -{  
7 - //设置关联表名  
8 - protected $table = 'gl_project_group';  
9 - //自动维护create_at创建时间 updated_at修改时间  
10 - public $timestamps = true;  
11 -}  
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSetting extends Base
  8 +{
  9 + protected $table = 'gl_web_setting';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingCountry extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_country';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingForm extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_from';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingHtml extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_html';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingService extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_service';
  10 +}
@@ -106,7 +106,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -106,7 +106,11 @@ Route::middleware(['bloginauth'])->group(function () {
106 //公用ai自动生成 106 //公用ai自动生成
107 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); 107 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post');
108 }); 108 });
109 - 109 + //ai指令
  110 + Route::prefix('setting')->group(function () {
  111 + //公用ai自动生成
  112 + Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'lists'])->name('web_setting_lists');
  113 + });
110 //产品 114 //产品
111 Route::prefix('product')->group(function () { 115 Route::prefix('product')->group(function () {
112 //产品 116 //产品