Skip to content

Commit 765824f

Browse files
committed
chore: add sort_index
1 parent 3a94301 commit 765824f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

laravel/app/Http/Controllers/Api/ApiParamController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function __construct()
3939
public function index()
4040
{
4141
$perPage = $this->getPerPage();
42-
$list = ApiParam::orderBy('id', 'desc')->paginate($perPage);
42+
// 1. 增加customer用户,并增加排序操作
43+
$list = ApiParam::orderBy('sort_index', 'desc')->orderBy('id', 'desc')->where('state', 1)->paginate($perPage);
4344
return $this->out(200, $list);
4445
}
4546

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AlterApiParamTable extends Migration {
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('api_param', function(Blueprint $table) {
17+
$table->tinyInteger('is_show_customer', false, true)->default(1)->after('state')->comment('Customer用户是否展示');
18+
$table->smallInteger('sort_index', false, true)->default(0)->after('state')->comment('排序,大数靠前');
19+
});
20+
}
21+
22+
23+
/**
24+
* Reverse the migrations.
25+
*
26+
* @return void
27+
*/
28+
public function down()
29+
{
30+
// down
31+
}
32+
33+
}

0 commit comments

Comments
 (0)