作者 lyh

gx

@@ -65,4 +65,20 @@ class ManageController extends BaseController @@ -65,4 +65,20 @@ class ManageController extends BaseController
65 return $this->success($data); 65 return $this->success($data);
66 } 66 }
67 67
  68 + /**
  69 + * @remark :排序
  70 + * @name :setSort
  71 + * @author :lyh
  72 + * @method :post
  73 + * @time :2023/8/10 16:40
  74 + */
  75 + public function setSort(ManageLogic $logic){
  76 + $this->request->validate([
  77 + 'id'=>'required',
  78 + ],[
  79 + 'id.required' => 'ID不能为空',
  80 + ]);
  81 + $logic->setParamStatus();
  82 + $this->response('success');
  83 + }
68 } 84 }
@@ -18,6 +18,7 @@ class ManageLogic extends BaseLogic @@ -18,6 +18,7 @@ class ManageLogic extends BaseLogic
18 public function __construct() 18 public function __construct()
19 { 19 {
20 parent::__construct(); 20 parent::__construct();
  21 + $this->param = $this->requestAll;
21 $this->model = new Manage(); 22 $this->model = new Manage();
22 } 23 }
23 24
@@ -33,4 +34,19 @@ class ManageLogic extends BaseLogic @@ -33,4 +34,19 @@ class ManageLogic extends BaseLogic
33 $info = $this->model->read(['id'=>$id]); 34 $info = $this->model->read(['id'=>$id]);
34 return $info['name'] ?? ''; 35 return $info['name'] ?? '';
35 } 36 }
  37 +
  38 + /**
  39 + * @remark :设置排序
  40 + * @name :setSort
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2023/8/10 16:42
  44 + */
  45 + public function setParamStatus(){
  46 + $rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
  47 + if($rs === false){
  48 + $this->fail('修改失败');
  49 + }
  50 + return $this->success();
  51 + }
36 } 52 }
@@ -64,7 +64,7 @@ class Logic @@ -64,7 +64,7 @@ class Logic
64 * @author zbj 64 * @author zbj
65 * @date 2023/4/13 65 * @date 2023/4/13
66 */ 66 */
67 - public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) 67 + public function getList(array $map = [], array $sort = ['sort' => 'desc'], array $columns = ['*'], int $limit = 20)
68 { 68 {
69 // 闭包查询条件格式化 69 // 闭包查询条件格式化
70 $query = $this->formatQuery($map); 70 $query = $this->formatQuery($map);
@@ -8,6 +8,6 @@ class AiBlog extends Base @@ -8,6 +8,6 @@ class AiBlog extends Base
8 { 8 {
9 protected $table = 'gl_ai_blog'; 9 protected $table = 'gl_ai_blog';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 } 13 }
@@ -8,6 +8,6 @@ class AiNews extends Base @@ -8,6 +8,6 @@ class AiNews extends Base
8 { 8 {
9 protected $table = 'gl_ai_news'; 9 protected $table = 'gl_ai_news';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 } 13 }
@@ -8,6 +8,6 @@ class AiProduct extends Base @@ -8,6 +8,6 @@ class AiProduct extends Base
8 { 8 {
9 protected $table = 'gl_ai_product'; 9 protected $table = 'gl_ai_product';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 } 13 }
@@ -8,6 +8,6 @@ class AyrRelease extends Base @@ -8,6 +8,6 @@ class AyrRelease extends Base
8 { 8 {
9 protected $table = 'gl_ayr_release'; 9 protected $table = 'gl_ayr_release';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 } 13 }
@@ -8,7 +8,7 @@ class AyrShare extends Base @@ -8,7 +8,7 @@ class AyrShare extends Base
8 { 8 {
9 protected $table = 'gl_ayr_share'; 9 protected $table = 'gl_ayr_share';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 13
14 const COUNT = 3; 14 const COUNT = 3;
@@ -15,7 +15,8 @@ class BNav extends Base @@ -15,7 +15,8 @@ class BNav extends Base
15 { 15 {
16 16
17 protected $table = 'gl_web_nav'; 17 protected $table = 'gl_web_nav';
18 - 18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
19 use SoftDeletes; 20 use SoftDeletes;
20 21
21 public $hidden = ['deleted_at','project_id']; 22 public $hidden = ['deleted_at','project_id'];
@@ -45,7 +45,8 @@ class CustomerVisit extends Base @@ -45,7 +45,8 @@ class CustomerVisit extends Base
45 use HasFactory; 45 use HasFactory;
46 46
47 protected $table = 'gl_customer_visit'; 47 protected $table = 'gl_customer_visit';
48 - 48 + //连接数据库
  49 + protected $connection = 'custom_mysql';
49 const LIMIT = 15; 50 const LIMIT = 15;
50 51
51 /** @var int PC端 */ 52 /** @var int PC端 */
@@ -7,4 +7,6 @@ use App\Models\Base; @@ -7,4 +7,6 @@ use App\Models\Base;
7 class CustomerVisitItem extends Base 7 class CustomerVisitItem extends Base
8 { 8 {
9 protected $table = 'gl_customer_visit_item'; 9 protected $table = 'gl_customer_visit_item';
  10 + //连接数据库
  11 + protected $connection = 'custom_mysql';
10 } 12 }
@@ -8,5 +8,5 @@ class File extends Base @@ -8,5 +8,5 @@ class File extends Base
8 { 8 {
9 protected $table = 'gl_file'; 9 protected $table = 'gl_file';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 } 12 }
@@ -9,5 +9,5 @@ class Image extends Base @@ -9,5 +9,5 @@ class Image extends Base
9 protected $table = 'gl_image'; 9 protected $table = 'gl_image';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -8,7 +8,7 @@ class News extends Base @@ -8,7 +8,7 @@ class News extends Base
8 { 8 {
9 protected $table = 'gl_news'; 9 protected $table = 'gl_news';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 12
13 public static function getNumByProjectId($project_id){ 13 public static function getNumByProjectId($project_id){
14 return self::where('project_id', $project_id)->where('status', 1)->count(); 14 return self::where('project_id', $project_id)->where('status', 1)->count();
@@ -12,5 +12,5 @@ class NewsCategory extends Base @@ -12,5 +12,5 @@ class NewsCategory extends Base
12 { 12 {
13 protected $table = 'gl_news_category'; 13 protected $table = 'gl_news_category';
14 //连接数据库 14 //连接数据库
15 -// protected $connection = 'custom_mysql'; 15 + protected $connection = 'custom_mysql';
16 } 16 }
@@ -8,5 +8,5 @@ class NewsLabel extends Base @@ -8,5 +8,5 @@ class NewsLabel extends Base
8 { 8 {
9 protected $table = 'gl_news_label'; 9 protected $table = 'gl_news_label';
10 //连接数据库 10 //连接数据库
11 -// protected $connection = 'custom_mysql'; 11 + protected $connection = 'custom_mysql';
12 } 12 }
@@ -14,6 +14,8 @@ class Attr extends Base @@ -14,6 +14,8 @@ class Attr extends Base
14 14
15 //设置关联表名 15 //设置关联表名
16 protected $table = 'gl_product_attr'; 16 protected $table = 'gl_product_attr';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
17 19
18 public function setAttrsAttribute($value) 20 public function setAttrsAttribute($value)
19 { 21 {
@@ -18,6 +18,8 @@ class Category extends Base @@ -18,6 +18,8 @@ class Category extends Base
18 18
19 //设置关联表名 19 //设置关联表名
20 protected $table = 'gl_product_category'; 20 protected $table = 'gl_product_category';
  21 + //连接数据库
  22 + protected $connection = 'custom_mysql';
21 23
22 const STATUS_ACTIVE = 1; 24 const STATUS_ACTIVE = 1;
23 25
@@ -11,6 +11,8 @@ class CategoryRelated extends Base @@ -11,6 +11,8 @@ class CategoryRelated extends Base
11 11
12 //设置关联表名 12 //设置关联表名
13 protected $table = 'gl_product_category_related'; 13 protected $table = 'gl_product_category_related';
  14 + //连接数据库
  15 + protected $connection = 'custom_mysql';
14 16
15 const CREATED_AT = null; 17 const CREATED_AT = null;
16 const UPDATED_AT = null; 18 const UPDATED_AT = null;
@@ -11,5 +11,7 @@ class Describe extends Base @@ -11,5 +11,7 @@ class Describe extends Base
11 11
12 //设置关联表名 12 //设置关联表名
13 protected $table = 'gl_product_describe'; 13 protected $table = 'gl_product_describe';
  14 + //连接数据库
  15 + protected $connection = 'custom_mysql';
14 16
15 } 17 }
@@ -15,6 +15,8 @@ class Keyword extends Base @@ -15,6 +15,8 @@ class Keyword extends Base
15 15
16 protected $appends = ['route']; 16 protected $appends = ['route'];
17 17
  18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
18 public function getRouteAttribute(){ 20 public function getRouteAttribute(){
19 return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id); 21 return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id);
20 } 22 }
@@ -15,7 +15,8 @@ class KeywordRelated extends Base @@ -15,7 +15,8 @@ class KeywordRelated extends Base
15 const CREATED_AT = null; 15 const CREATED_AT = null;
16 const UPDATED_AT = null; 16 const UPDATED_AT = null;
17 17
18 - 18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
19 /** 20 /**
20 * 关联产品关键词 21 * 关联产品关键词
21 * @param $product_id 22 * @param $product_id
@@ -17,7 +17,8 @@ class Product extends Base @@ -17,7 +17,8 @@ class Product extends Base
17 17
18 //设置关联表名 18 //设置关联表名
19 protected $table = 'gl_product'; 19 protected $table = 'gl_product';
20 - 20 + //连接数据库
  21 + protected $connection = 'custom_mysql';
21 const STATUS_DRAFT = 0; 22 const STATUS_DRAFT = 0;
22 const STATUS_ON = 1; 23 const STATUS_ON = 1;
23 const STATUS_RECYCLE = 2; 24 const STATUS_RECYCLE = 2;
@@ -7,4 +7,6 @@ use App\Models\Base; @@ -7,4 +7,6 @@ use App\Models\Base;
7 class BCustomTemplate extends Base 7 class BCustomTemplate extends Base
8 { 8 {
9 protected $table = 'gl_web_custom_template'; 9 protected $table = 'gl_web_custom_template';
  10 + //连接数据库
  11 + protected $connection = 'custom_mysql';
10 } 12 }
@@ -16,4 +16,7 @@ class BTemplate extends Base @@ -16,4 +16,7 @@ class BTemplate extends Base
16 const SOURCE_PRODUCT = 2;//产品页 16 const SOURCE_PRODUCT = 2;//产品页
17 17
18 protected $table = 'gl_web_template'; 18 protected $table = 'gl_web_template';
  19 + //连接数据库
  20 + protected $connection = 'custom_mysql';
19 } 21 }
  22 +
@@ -7,4 +7,6 @@ use App\Models\Base; @@ -7,4 +7,6 @@ use App\Models\Base;
7 class Proofreading extends Base 7 class Proofreading extends Base
8 { 8 {
9 protected $table = 'gl_web_proofreading'; 9 protected $table = 'gl_web_proofreading';
  10 + //连接数据库
  11 + protected $connection = 'custom_mysql';
10 } 12 }
@@ -10,7 +10,7 @@ class WebSetting extends Base @@ -10,7 +10,7 @@ class WebSetting extends Base
10 protected $table = 'gl_web_setting'; 10 protected $table = 'gl_web_setting';
11 11
12 //连接数据库 12 //连接数据库
13 -// protected $connection = 'custom_mysql'; 13 + protected $connection = 'custom_mysql';
14 14
15 15
16 } 16 }
@@ -9,5 +9,5 @@ class WebSettingCountry extends Base @@ -9,5 +9,5 @@ class WebSettingCountry extends Base
9 protected $table = 'gl_web_setting_country'; 9 protected $table = 'gl_web_setting_country';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -9,5 +9,5 @@ class WebSettingForm extends Base @@ -9,5 +9,5 @@ class WebSettingForm extends Base
9 protected $table = 'gl_web_setting_from'; 9 protected $table = 'gl_web_setting_from';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -9,5 +9,5 @@ class WebSettingHtml extends Base @@ -9,5 +9,5 @@ class WebSettingHtml extends Base
9 protected $table = 'gl_web_setting_html'; 9 protected $table = 'gl_web_setting_html';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -9,5 +9,5 @@ class WebSettingReceiving extends Base @@ -9,5 +9,5 @@ class WebSettingReceiving extends Base
9 protected $table = 'gl_web_setting_receiving'; 9 protected $table = 'gl_web_setting_receiving';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -9,5 +9,5 @@ class WebSettingService extends Base @@ -9,5 +9,5 @@ class WebSettingService extends Base
9 protected $table = 'gl_web_setting_service'; 9 protected $table = 'gl_web_setting_service';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 } 13 }
@@ -9,7 +9,7 @@ class WebSettingText extends Base @@ -9,7 +9,7 @@ class WebSettingText extends Base
9 protected $table = 'gl_web_setting_text'; 9 protected $table = 'gl_web_setting_text';
10 10
11 //连接数据库 11 //连接数据库
12 -// protected $connection = 'custom_mysql'; 12 + protected $connection = 'custom_mysql';
13 13
14 //定义常量参数 14 //定义常量参数
15 const TYPE_PAGE = 1; 15 const TYPE_PAGE = 1;
@@ -84,6 +84,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -84,6 +84,7 @@ Route::middleware(['aloginauth'])->group(function () {
84 Route::any('/info', [Aside\Manage\ManageController::class, 'info'])->name('admin.manage_info'); 84 Route::any('/info', [Aside\Manage\ManageController::class, 'info'])->name('admin.manage_info');
85 Route::post('/save', [Aside\Manage\ManageController::class, 'save'])->name('admin.manage_save'); 85 Route::post('/save', [Aside\Manage\ManageController::class, 'save'])->name('admin.manage_save');
86 Route::any('/delete', [Aside\Manage\ManageController::class, 'delete'])->name('admin.manage_delete'); 86 Route::any('/delete', [Aside\Manage\ManageController::class, 'delete'])->name('admin.manage_delete');
  87 + Route::any('/sort', [Aside\Manage\ManageController::class, 'setSort'])->name('admin.manage_sort');
87 88
88 //菜单 89 //菜单
89 Route::prefix('menu')->group(function () { 90 Route::prefix('menu')->group(function () {