李帅

init

Showing 32 changed files with 790 additions and 55 deletions
...@@ -10,6 +10,8 @@ use Dcat\Admin\Http\Controllers\AdminController; ...@@ -10,6 +10,8 @@ use Dcat\Admin\Http\Controllers\AdminController;
10 10
11 class AuthorController extends AdminController 11 class AuthorController extends AdminController
12 { 12 {
13 + protected $title = '作者';
14 +
13 /** 15 /**
14 * Make a grid builder. 16 * Make a grid builder.
15 * 17 *
...@@ -20,14 +22,16 @@ class AuthorController extends AdminController ...@@ -20,14 +22,16 @@ class AuthorController extends AdminController
20 return Grid::make(new Author(), function (Grid $grid) { 22 return Grid::make(new Author(), function (Grid $grid) {
21 $grid->column('id')->sortable(); 23 $grid->column('id')->sortable();
22 $grid->column('name'); 24 $grid->column('name');
23 - $grid->column('dynasty'); 25 + $grid->column('dynasty')->editable();
24 - $grid->column('introduce'); 26 + $grid->column('introduce')->limit(45);
25 $grid->column('created_at'); 27 $grid->column('created_at');
26 $grid->column('updated_at')->sortable(); 28 $grid->column('updated_at')->sortable();
27 29
28 $grid->filter(function (Grid\Filter $filter) { 30 $grid->filter(function (Grid\Filter $filter) {
29 - $filter->equal('id'); 31 + $filter->equal('id')->width(2);
30 - 32 + $filter->like('username')->width(3);
33 + $filter->like('name')->width(3);
34 + $filter->panel();
31 }); 35 });
32 }); 36 });
33 } 37 }
......
1 +<?php
2 +
3 +namespace App\Admin\Controllers;
4 +
5 +use App\Admin\Renderable\PoemTable;
6 +use App\Admin\Repositories\EverydayPoem;
7 +use App\Models\OnePoem;
8 +use Carbon\Carbon;
9 +use Dcat\Admin\Form;
10 +use Dcat\Admin\Form\NestedForm;
11 +use Dcat\Admin\Grid;
12 +use Dcat\Admin\Layout\Content;
13 +use Dcat\Admin\Show;
14 +use Dcat\Admin\Http\Controllers\AdminController;
15 +
16 +class EverydayPoemController extends AdminController
17 +{
18 + protected $title = '每日一言';
19 +
20 + /**
21 + * Make a grid builder.
22 + *
23 + * @return Grid
24 + */
25 + protected function grid()
26 + {
27 + return Grid::make(new EverydayPoem(), function (Grid $grid) {
28 +
29 + $grid->model()->with('poem');
30 +
31 + $grid->column('id')->sortable();
32 + $grid->column('date');
33 + $grid->column('poem.title');
34 + $grid->column('poem.author');
35 + $grid->column('poem.content')->limit(50);
36 + $grid->column('created_at');
37 + $grid->column('updated_at')->sortable();
38 +
39 + $grid->filter(function (Grid\Filter $filter) {
40 + $filter->equal('id');
41 +
42 + });
43 + });
44 + }
45 +
46 + /**
47 + * Make a show builder.
48 + *
49 + * @param mixed $id
50 + *
51 + * @return Show
52 + */
53 + protected function detail($id)
54 + {
55 + return Show::make($id, new EverydayPoem(), function (Show $show) {
56 +
57 + $show->field('id');
58 + $show->field('date');
59 + $show->field('poem_id');
60 + $show->field('sn');
61 + $show->field('created_at');
62 + $show->field('updated_at');
63 + });
64 + }
65 +
66 + /**
67 + * Make a form builder.
68 + *
69 + * @return Form
70 + */
71 + protected function form()
72 + {
73 + return Form::make(new EverydayPoem(['poem']), function (Form $form) {
74 +
75 + $form->display('id');
76 + $form->text('date');
77 + $form->text('should');
78 + $form->display('poem.title');
79 + $form->display('poem.author');
80 + $form->display('poem.content');
81 +
82 + $form->display('created_at');
83 + $form->display('updated_at');
84 + });
85 + }
86 +
87 + public function create(Content $content)
88 + {
89 + return $content
90 + ->translation($this->translation())
91 + ->title($this->title())
92 + ->description($this->description()['create'] ?? trans('admin.create'))
93 + ->body(Form::make(new EverydayPoem(), function (Form $form) {
94 + $form->table('everyday','每日一言', function (NestedForm $table) {
95 + $table->date('date');
96 + $table->text('should');
97 + $table->selectTable('poem_id')
98 + ->title('一言诗词库')
99 + ->from(PoemTable::make())
100 + ->model(OnePoem::class, 'id', 'title');
101 + });
102 + }));
103 + }
104 +
105 +
106 + public function store()
107 + {
108 + $all = request()->all();
109 +
110 + try{
111 + $data = [];
112 + $now = Carbon::now();
113 + foreach ($all['everyday'] as $item) {
114 + if ($item['_remove_'] == 1) continue;
115 + $data[] = [
116 + 'date' => $item['date'],
117 + 'should' => $item['should'],
118 + 'poem_id' => $item['poem_id'],
119 + 'created_at' => $now,
120 + 'updated_at' => $now,
121 + ];
122 + }
123 +
124 + \App\Models\EverydayPoem::query()->insert($data);
125 +
126 + }catch (\Exception $exception){
127 + return $this->form()->response()->error($exception->getMessage());
128 + }
129 +
130 +
131 + return $this->form()->response()->refresh()->success(trans('admin.save_succeeded'));
132 + }
133 +}
1 +<?php
2 +
3 +namespace App\Admin\Controllers;
4 +
5 +use App\Admin\Repositories\OnePoem;
6 +use App\Admin\Repositories\Verse;
7 +use App\Models\Author;
8 +use App\Models\Poetry;
9 +use Dcat\Admin\Form;
10 +use Dcat\Admin\Grid;
11 +use Dcat\Admin\Layout\Content;
12 +use Dcat\Admin\Show;
13 +use Dcat\Admin\Http\Controllers\AdminController;
14 +use Dcat\Admin\Widgets\Card;
15 +
16 +class OnePoemController extends AdminController
17 +{
18 + protected $title = '一言';
19 +
20 + /**
21 + * Make a grid builder.
22 + *
23 + * @return Grid
24 + */
25 + protected function grid()
26 + {
27 + return Grid::make(new OnePoem(), function (Grid $grid) {
28 + $grid->column('id')->sortable();
29 + $grid->column('title');
30 + $grid->column('content');
31 + $grid->column('annotate');
32 + $grid->column('spelling');
33 + $grid->column('en');
34 + $grid->column('created_at');
35 + $grid->column('updated_at')->sortable();
36 +
37 + $grid->filter(function (Grid\Filter $filter) {
38 + $filter->equal('id');
39 + });
40 + });
41 + }
42 +
43 + /**
44 + * Make a show builder.
45 + *
46 + * @param mixed $id
47 + *
48 + * @return Show
49 + */
50 + protected function detail($id)
51 + {
52 + return Show::make($id, new OnePoem(), function (Show $show) {
53 + $show->field('id');
54 + $show->field('title');
55 + $show->field('content');
56 + $show->field('annotate');
57 + $show->field('spelling');
58 + $show->field('en');
59 + $show->field('poetry_id');
60 + $show->field('created_at');
61 + $show->field('updated_at');
62 + });
63 + }
64 +
65 +
66 + public function create(Content $content)
67 + {
68 + return $content
69 + ->translation($this->translation())
70 + ->title($this->title())
71 + ->description('注意:基础库中内容只做参考,创建的一言与其他表数据不耦合!理论上可自行组装句子,也可按诗词原文复制。')
72 +// ->description($this->description()['create'] ?? trans('admin.create'))
73 + ->body(Card::make($this->PoetryGrid()))
74 + ->body($this->form());
75 + }
76 +
77 + /**
78 + * Make a form builder.
79 + *
80 + * @return Form
81 + */
82 + protected function form()
83 + {
84 + return Form::make(new OnePoem(), function (Form $form) {
85 + $form->display('id');
86 + $form->text('title');
87 + $form->text('author');
88 + $form->text('content');
89 + $form->text('annotate');
90 + $form->text('spelling');
91 + $form->text('en');
92 +
93 + $form->display('created_at');
94 + $form->display('updated_at');
95 + });
96 + }
97 +
98 + protected function PoetryGrid()
99 + {
100 + return Grid::make(new Verse(), function (Grid $grid) {
101 + $grid->model()->with(['poetry']);
102 +
103 + $grid->column('id')->sortable();
104 + $grid->column('author_id')->display(function (){
105 + $id = $this->poetry_id;
106 + $poetry = Poetry::query()->find($id);
107 + $author_id = $poetry->author_id;
108 + $author = Author::query()->find($author_id);
109 + return $author->name;
110 + })->copyable();
111 + $grid->column('poetry.name')->copyable();
112 +
113 + $grid->column('stanza')->copyable();
114 + $grid->column('annotate')->copyable();
115 + $grid->column('spelling')->copyable();
116 + $grid->column('en')->copyable();
117 +// $grid->column('created_at');
118 +// $grid->column('updated_at')->sortable();
119 +
120 +
121 + $grid->withBorder();
122 + $grid->quickSearch(['stanza'])->placeholder('快捷搜索诗句(节)');
123 +
124 + $grid->paginate(5);
125 + $grid->simplePaginate();
126 +
127 + $grid->disableActions();
128 + $grid->disableCreateButton();
129 +
130 +
131 + $grid->filter(function (Grid\Filter $filter) {
132 + $filter->like('poetry.name')->width(3);
133 + $filter->like('stanza')->width(5);
134 + $filter->panel();
135 +
136 + });
137 + });
138 + }
139 +}
1 +<?php
2 +
3 +namespace App\Admin\Controllers;
4 +
5 +use App\Admin\Repositories\Order;
6 +use Dcat\Admin\Form;
7 +use Dcat\Admin\Grid;
8 +use Dcat\Admin\Show;
9 +use Dcat\Admin\Http\Controllers\AdminController;
10 +
11 +class OrderController extends AdminController
12 +{
13 + /**
14 + * Make a grid builder.
15 + *
16 + * @return Grid
17 + */
18 + protected function grid()
19 + {
20 + return Grid::make(new Order(), function (Grid $grid) {
21 + $grid->column('id')->sortable();
22 + $grid->column('order_sn');
23 + $grid->column('user_id');
24 + $grid->column('pay_amount');
25 + $grid->column('goods_amount');
26 + $grid->column('status');
27 + $grid->column('cancel_time');
28 + $grid->column('pay_number');
29 + $grid->column('pay_type');
30 + $grid->column('pay_time');
31 + $grid->column('created_at');
32 + $grid->column('updated_at')->sortable();
33 +
34 + $grid->filter(function (Grid\Filter $filter) {
35 + $filter->equal('id');
36 +
37 + });
38 + });
39 + }
40 +
41 + /**
42 + * Make a show builder.
43 + *
44 + * @param mixed $id
45 + *
46 + * @return Show
47 + */
48 + protected function detail($id)
49 + {
50 + return Show::make($id, new Order(), function (Show $show) {
51 + $show->field('id');
52 + $show->field('order_sn');
53 + $show->field('user_id');
54 + $show->field('pay_amount');
55 + $show->field('goods_amount');
56 + $show->field('status');
57 + $show->field('cancel_time');
58 + $show->field('pay_number');
59 + $show->field('pay_type');
60 + $show->field('pay_time');
61 + $show->field('created_at');
62 + $show->field('updated_at');
63 + });
64 + }
65 +
66 + /**
67 + * Make a form builder.
68 + *
69 + * @return Form
70 + */
71 + protected function form()
72 + {
73 + return Form::make(new Order(), function (Form $form) {
74 + $form->display('id');
75 + $form->text('order_sn');
76 + $form->text('user_id');
77 + $form->text('pay_amount');
78 + $form->text('goods_amount');
79 + $form->text('status');
80 + $form->text('cancel_time');
81 + $form->text('pay_number');
82 + $form->text('pay_type');
83 + $form->text('pay_time');
84 +
85 + $form->display('created_at');
86 + $form->display('updated_at');
87 + });
88 + }
89 +}
...@@ -2,14 +2,18 @@ ...@@ -2,14 +2,18 @@
2 2
3 namespace App\Admin\Controllers; 3 namespace App\Admin\Controllers;
4 4
5 -use App\Admin\Repositories\PickPoetry; 5 +use App\Admin\Renderable\PoemTable;
6 +use App\Admin\Repositories\OnePoem;
7 +use App\Admin\Repositories\PackPoem;
6 use Dcat\Admin\Form; 8 use Dcat\Admin\Form;
7 use Dcat\Admin\Grid; 9 use Dcat\Admin\Grid;
8 use Dcat\Admin\Show; 10 use Dcat\Admin\Show;
9 use Dcat\Admin\Http\Controllers\AdminController; 11 use Dcat\Admin\Http\Controllers\AdminController;
10 12
11 -class PickPoetryController extends AdminController 13 +class PackPoemController extends AdminController
12 { 14 {
15 + protected $title = '众妙';
16 +
13 /** 17 /**
14 * Make a grid builder. 18 * Make a grid builder.
15 * 19 *
...@@ -17,15 +21,18 @@ class PickPoetryController extends AdminController ...@@ -17,15 +21,18 @@ class PickPoetryController extends AdminController
17 */ 21 */
18 protected function grid() 22 protected function grid()
19 { 23 {
20 - return Grid::make(new PickPoetry(), function (Grid $grid) { 24 + return Grid::make(new PackPoem(), function (Grid $grid) {
25 + $grid->model()->with('poem');
26 +
21 $grid->column('id')->sortable(); 27 $grid->column('id')->sortable();
22 $grid->column('title'); 28 $grid->column('title');
23 $grid->column('subtitle'); 29 $grid->column('subtitle');
24 - $grid->column('left_tag_id'); 30 + $grid->column('left_text');
25 - $grid->column('right_tag_id'); 31 + $grid->column('right_text');
26 - $grid->column('poetry_id'); 32 + $grid->column('poem.title');
27 - $grid->column('use_num'); 33 + $grid->column('poem.content')->limit(50);
28 - $grid->column('state'); 34 + $grid->column('poem.author');
35 +// $grid->column('state');
29 $grid->column('created_at'); 36 $grid->column('created_at');
30 $grid->column('updated_at')->sortable(); 37 $grid->column('updated_at')->sortable();
31 38
...@@ -45,14 +52,13 @@ class PickPoetryController extends AdminController ...@@ -45,14 +52,13 @@ class PickPoetryController extends AdminController
45 */ 52 */
46 protected function detail($id) 53 protected function detail($id)
47 { 54 {
48 - return Show::make($id, new PickPoetry(), function (Show $show) { 55 + return Show::make($id, new PackPoem(), function (Show $show) {
49 $show->field('id'); 56 $show->field('id');
50 $show->field('title'); 57 $show->field('title');
51 $show->field('subtitle'); 58 $show->field('subtitle');
52 - $show->field('left_tag_id'); 59 + $show->field('left_text');
53 - $show->field('right_tag_id'); 60 + $show->field('right_text');
54 $show->field('poetry_id'); 61 $show->field('poetry_id');
55 - $show->field('use_num');
56 $show->field('state'); 62 $show->field('state');
57 $show->field('created_at'); 63 $show->field('created_at');
58 $show->field('updated_at'); 64 $show->field('updated_at');
...@@ -66,16 +72,24 @@ class PickPoetryController extends AdminController ...@@ -66,16 +72,24 @@ class PickPoetryController extends AdminController
66 */ 72 */
67 protected function form() 73 protected function form()
68 { 74 {
69 - return Form::make(new PickPoetry(), function (Form $form) { 75 + return Form::make(new PackPoem(['poem']), function (Form $form) {
70 $form->display('id'); 76 $form->display('id');
71 $form->text('title'); 77 $form->text('title');
72 $form->text('subtitle'); 78 $form->text('subtitle');
73 - $form->text('left_tag_id'); 79 + $form->text('left_text');
74 - $form->text('right_tag_id'); 80 + $form->text('right_text');
75 - $form->text('poetry_id'); 81 +
76 - $form->text('use_num'); 82 + if ($form->isEditing()) {
77 - $form->text('state'); 83 + $form->display('poem.title');
78 - 84 + $form->display('poem.author');
85 + $form->display('poem.content');
86 + }else{
87 + $form->selectTable('poem_id')
88 + ->title('一言诗词库')
89 + ->from(PoemTable::make())
90 + ->model(OnePoem::class, 'id', 'title');
91 + }
92 +
79 $form->display('created_at'); 93 $form->display('created_at');
80 $form->display('updated_at'); 94 $form->display('updated_at');
81 }); 95 });
......
1 +<?php
2 +/**
3 + * Created by PhpStorm.
4 + * User: lishuai
5 + * Date: 2022/1/10
6 + * Time: 5:57 PM
7 + */
8 +
9 +namespace App\Admin\Renderable;
10 +
11 +use App\Admin\Repositories\OnePoem;
12 +use Dcat\Admin\Grid;
13 +use Dcat\Admin\Grid\LazyRenderable;
14 +
15 +class PoemTable extends LazyRenderable
16 +{
17 + public function grid(): Grid
18 + {
19 + return Grid::make(new OnePoem(), function (Grid $grid) {
20 + $grid->column('id', 'ID')->sortable();
21 + $grid->column('title');
22 + $grid->column('author');
23 + $grid->column('content');
24 + $grid->column('annotate');
25 + $grid->column('spelling');
26 + $grid->column('en');
27 +
28 + $grid->quickSearch(['title', 'author', 'content', 'annotate']);
29 +
30 + $grid->paginate(10);
31 + $grid->disableActions();
32 +
33 + $grid->filter(function (Grid\Filter $filter) {
34 + $filter->like('username')->width(4);
35 + $filter->like('name')->width(4);
36 + });
37 + });
38 + }
39 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
2 2
3 namespace App\Admin\Repositories; 3 namespace App\Admin\Repositories;
4 4
5 -use App\Models\PickPoetry as Model; 5 +use App\Models\EverydayPoem as Model;
6 use Dcat\Admin\Repositories\EloquentRepository; 6 use Dcat\Admin\Repositories\EloquentRepository;
7 7
8 -class PickPoetry extends EloquentRepository 8 +class EverydayPoem extends EloquentRepository
9 { 9 {
10 /** 10 /**
11 * Model. 11 * Model.
......
1 +<?php
2 +
3 +namespace App\Admin\Repositories;
4 +
5 +use App\Models\OnePoem as Model;
6 +use Dcat\Admin\Repositories\EloquentRepository;
7 +
8 +class OnePoem extends EloquentRepository
9 +{
10 + /**
11 + * Model.
12 + *
13 + * @var string
14 + */
15 + protected $eloquentClass = Model::class;
16 +}
1 +<?php
2 +
3 +namespace App\Admin\Repositories;
4 +
5 +use App\Models\Order as Model;
6 +use Dcat\Admin\Repositories\EloquentRepository;
7 +
8 +class Order extends EloquentRepository
9 +{
10 + /**
11 + * Model.
12 + *
13 + * @var string
14 + */
15 + protected $eloquentClass = Model::class;
16 +}
1 +<?php
2 +
3 +namespace App\Admin\Repositories;
4 +
5 +use App\Models\PackPoem as Model;
6 +use Dcat\Admin\Repositories\EloquentRepository;
7 +
8 +class PackPoem extends EloquentRepository
9 +{
10 + /**
11 + * Model.
12 + *
13 + * @var string
14 + */
15 + protected $eloquentClass = Model::class;
16 +}
1 +<?php
2 +
3 +namespace App\Admin\Repositories;
4 +
5 +use App\Models\PickPoetryVerse as Model;
6 +use Dcat\Admin\Repositories\EloquentRepository;
7 +
8 +class PickPoetryVerse extends EloquentRepository
9 +{
10 + /**
11 + * Model.
12 + *
13 + * @var string
14 + */
15 + protected $eloquentClass = Model::class;
16 +}
...@@ -14,4 +14,19 @@ Route::group([ ...@@ -14,4 +14,19 @@ Route::group([
14 14
15 $router->get('/', 'HomeController@index'); 15 $router->get('/', 'HomeController@index');
16 16
17 + $router->resource('/author', 'AuthorController');
18 + $router->resource('/poetry', 'PoetryController');
19 + $router->resource('/verse', 'VerseController');
20 +
21 + /** 一言 */
22 + $router->resource('/poem', 'OnePoemController');
23 +
24 + /** 众妙*/
25 + $router->resource('/package', 'PackPoemController');
26 +
27 + /** 每日一言*/
28 + $router->resource('/tool/every-poem', 'EverydayPoemController');
29 +
30 + /** 推荐*/
31 +// $router->resource('/tool/recommend','');
17 }); 32 });
......
...@@ -10,5 +10,9 @@ class Author extends Model ...@@ -10,5 +10,9 @@ class Author extends Model
10 { 10 {
11 use HasDateTimeFormatter; 11 use HasDateTimeFormatter;
12 protected $table = 'author'; 12 protected $table = 'author';
13 - 13 +
14 + public function poetry()
15 + {
16 + return $this->hasMany(Poetry::class);
17 + }
14 } 18 }
......
1 +<?php
2 +
3 +namespace App\Models;
4 +
5 +use Dcat\Admin\Traits\HasDateTimeFormatter;
6 +
7 +use Illuminate\Database\Eloquent\Model;
8 +
9 +class EverydayPoem extends Model
10 +{
11 + use HasDateTimeFormatter;
12 + protected $table = 'everyday_poem';
13 +
14 + public function poem()
15 + {
16 + return $this->belongsTo(OnePoem::class);
17 + }
18 +}
...@@ -6,9 +6,9 @@ use Dcat\Admin\Traits\HasDateTimeFormatter; ...@@ -6,9 +6,9 @@ use Dcat\Admin\Traits\HasDateTimeFormatter;
6 6
7 use Illuminate\Database\Eloquent\Model; 7 use Illuminate\Database\Eloquent\Model;
8 8
9 -class PickPoetry extends Model 9 +class OnePoem extends Model
10 { 10 {
11 use HasDateTimeFormatter; 11 use HasDateTimeFormatter;
12 - protected $table = 'pick_poetry'; 12 + protected $table = 'one_poem';
13 13
14 } 14 }
......
1 +<?php
2 +
3 +namespace App\Models;
4 +
5 +use Dcat\Admin\Traits\HasDateTimeFormatter;
6 +use Illuminate\Database\Eloquent\SoftDeletes;
7 +use Illuminate\Database\Eloquent\Model;
8 +
9 +class Order extends Model
10 +{
11 + use HasDateTimeFormatter;
12 + use SoftDeletes;
13 +
14 + protected $table = 'order';
15 +
16 +}
1 +<?php
2 +
3 +namespace App\Models;
4 +
5 +use Dcat\Admin\Traits\HasDateTimeFormatter;
6 +
7 +use Illuminate\Database\Eloquent\Model;
8 +
9 +class PackPoem extends Model
10 +{
11 + use HasDateTimeFormatter;
12 + protected $table = 'pack_poem';
13 +
14 + public function poem()
15 + {
16 + return $this->belongsTo(OnePoem::class);
17 + }
18 +}
...@@ -10,5 +10,14 @@ class Poetry extends Model ...@@ -10,5 +10,14 @@ class Poetry extends Model
10 { 10 {
11 use HasDateTimeFormatter; 11 use HasDateTimeFormatter;
12 protected $table = 'poetry'; 12 protected $table = 'poetry';
13 - 13 +
14 + public function author()
15 + {
16 + return $this->belongsTo(Author::class);
17 + }
18 +
19 + protected function verses()
20 + {
21 + return $this->hasMany(Verse::class);
22 + }
14 } 23 }
......
...@@ -10,5 +10,9 @@ class Verse extends Model ...@@ -10,5 +10,9 @@ class Verse extends Model
10 { 10 {
11 use HasDateTimeFormatter; 11 use HasDateTimeFormatter;
12 protected $table = 'verse'; 12 protected $table = 'verse';
13 - 13 +
14 + public function poetry()
15 + {
16 + return $this->belongsTo(Poetry::class);
17 + }
14 } 18 }
......
...@@ -67,7 +67,7 @@ return [ ...@@ -67,7 +67,7 @@ return [
67 | 67 |
68 */ 68 */
69 69
70 - 'timezone' => 'UTC', 70 + 'timezone' => 'Asia/Shanghai',
71 71
72 /* 72 /*
73 |-------------------------------------------------------------------------- 73 |--------------------------------------------------------------------------
......
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
4 use Illuminate\Database\Schema\Blueprint; 4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Database\Migrations\Migration; 5 use Illuminate\Database\Migrations\Migration;
6 6
7 -class CreatePoetryTagTable extends Migration 7 +class CreatePoemTagTable extends Migration
8 { 8 {
9 /** 9 /**
10 * Run the migrations. 10 * Run the migrations.
...@@ -13,9 +13,9 @@ class CreatePoetryTagTable extends Migration ...@@ -13,9 +13,9 @@ class CreatePoetryTagTable extends Migration
13 */ 13 */
14 public function up() 14 public function up()
15 { 15 {
16 - Schema::create('poetry_tag', function (Blueprint $table) { 16 + Schema::create('poem_tag', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 - $table->unsignedBigInteger('poetry_id')->index()->comment('诗词id'); 18 + $table->unsignedBigInteger('poem_id')->index()->comment('诗词id');
19 $table->unsignedBigInteger('tag_id')->index()->comment('标签id'); 19 $table->unsignedBigInteger('tag_id')->index()->comment('标签id');
20 }); 20 });
21 } 21 }
...@@ -27,6 +27,6 @@ class CreatePoetryTagTable extends Migration ...@@ -27,6 +27,6 @@ class CreatePoetryTagTable extends Migration
27 */ 27 */
28 public function down() 28 public function down()
29 { 29 {
30 - Schema::dropIfExists('poetry_tag'); 30 + Schema::dropIfExists('poem_tag');
31 } 31 }
32 } 32 }
......
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
4 use Illuminate\Database\Schema\Blueprint; 4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Database\Migrations\Migration; 5 use Illuminate\Database\Migrations\Migration;
6 6
7 -class CreatePickPoetryTable extends Migration 7 +class CreatePackPoemTable extends Migration
8 { 8 {
9 /** 9 /**
10 * Run the migrations. 10 * Run the migrations.
...@@ -13,15 +13,14 @@ class CreatePickPoetryTable extends Migration ...@@ -13,15 +13,14 @@ class CreatePickPoetryTable extends Migration
13 */ 13 */
14 public function up() 14 public function up()
15 { 15 {
16 - Schema::create('pick_poetry', function (Blueprint $table) { 16 + Schema::create('pack_poem', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 $table->string('title')->default('')->comment('标题'); 18 $table->string('title')->default('')->comment('标题');
19 $table->string('subtitle')->default('')->comment('副标题'); 19 $table->string('subtitle')->default('')->comment('副标题');
20 $table->string('left_text')->default('')->comment('左侧文本'); 20 $table->string('left_text')->default('')->comment('左侧文本');
21 $table->string('right_text')->default('')->comment('右侧文本'); 21 $table->string('right_text')->default('')->comment('右侧文本');
22 - $table->unsignedBigInteger('poetry_id')->index()->comment('诗词id'); 22 + $table->unsignedBigInteger('poem_id')->index()->comment('诗词id');
23 - $table->unsignedBigInteger('use_num')->comment('使用次数'); 23 + $table->unsignedTinyInteger('state')->default(0)->comment('状态');
24 - $table->unsignedTinyInteger('state')->comment('状态');
25 $table->timestamps(); 24 $table->timestamps();
26 }); 25 });
27 } 26 }
...@@ -33,6 +32,6 @@ class CreatePickPoetryTable extends Migration ...@@ -33,6 +32,6 @@ class CreatePickPoetryTable extends Migration
33 */ 32 */
34 public function down() 33 public function down()
35 { 34 {
36 - Schema::dropIfExists('pick_poetry'); 35 + Schema::dropIfExists('pack_poem');
37 } 36 }
38 } 37 }
......
...@@ -16,11 +16,14 @@ class CreateMembershipTable extends Migration ...@@ -16,11 +16,14 @@ class CreateMembershipTable extends Migration
16 Schema::create('membership', function (Blueprint $table) { 16 Schema::create('membership', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 $table->string('name')->default('')->comment('会员名称'); 18 $table->string('name')->default('')->comment('会员名称');
19 - $table->integer('price')->comment('价格(分)'); 19 + $table->decimal('price')->comment('价格(分)');
20 - $table->integer('origin_price')->comment('原价(分)'); 20 + $table->decimal('origin_price')->comment('原价(分)');
21 - $table->integer('limited_days')->comment('有效天数'); 21 + $table->integer('limit_days')->comment('有效天数');
22 + $table->string('limit_unit')->comment('有效期单位');
22 $table->string('intro')->default('')->comment('简介'); 23 $table->string('intro')->default('')->comment('简介');
23 - $table->unsignedTinyInteger('state')->comment('状态'); 24 + $table->string('image')->default('')->comment('介绍图');
25 + $table->unsignedTinyInteger('sale_term')->default('')->comment('上架终端');
26 + $table->unsignedTinyInteger('state')->comment('状态:1=售卖中');
24 $table->unsignedTinyInteger('sn')->comment('SN顺序'); 27 $table->unsignedTinyInteger('sn')->comment('SN顺序');
25 $table->timestamps(); 28 $table->timestamps();
26 }); 29 });
......
1 +<?php
2 +
3 +use Illuminate\Support\Facades\Schema;
4 +use Illuminate\Database\Schema\Blueprint;
5 +use Illuminate\Database\Migrations\Migration;
6 +
7 +class CreateOnePoemTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('one_poem', function (Blueprint $table) {
17 + $table->increments('id');
18 + $table->string('title')->default('')->comment('诗词标题');
19 + $table->string('author')->default('')->comment('作者');
20 + $table->string('content')->default('')->comment('正文');
21 + $table->text('annotate')->nullable()->comment('注解');
22 + $table->text('spelling')->nullable()->comment('拼音');
23 + $table->text('en')->nullable()->comment('英文解释');
24 + $table->unsignedTinyInteger('state')->index()->default(0)->comment('状态');
25 + $table->timestamps();
26 + });
27 + }
28 +
29 + /**
30 + * Reverse the migrations.
31 + *
32 + * @return void
33 + */
34 + public function down()
35 + {
36 + Schema::dropIfExists('one_poem');
37 + }
38 +}
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
4 use Illuminate\Database\Schema\Blueprint; 4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Database\Migrations\Migration; 5 use Illuminate\Database\Migrations\Migration;
6 6
7 -class CreatePickPoetryVerseTable extends Migration 7 +class CreateEverydayPoemTable extends Migration
8 { 8 {
9 /** 9 /**
10 * Run the migrations. 10 * Run the migrations.
...@@ -13,10 +13,12 @@ class CreatePickPoetryVerseTable extends Migration ...@@ -13,10 +13,12 @@ class CreatePickPoetryVerseTable extends Migration
13 */ 13 */
14 public function up() 14 public function up()
15 { 15 {
16 - Schema::create('pick_poetry_verse', function (Blueprint $table) { 16 + Schema::create('everyday_poem', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 - $table->unsignedBigInteger('pick_id')->index()->comment('官方秀id'); 18 + $table->date('date')->unique()->comment('日期');
19 - $table->unsignedBigInteger('verse_id')->index()->comment('诗句(节)id'); 19 + $table->string('should')->default('')->comment('宜');
20 + $table->unsignedBigInteger('poem_id')->index()->comment('一言');
21 + $table->timestamps();
20 }); 22 });
21 } 23 }
22 24
...@@ -27,6 +29,6 @@ class CreatePickPoetryVerseTable extends Migration ...@@ -27,6 +29,6 @@ class CreatePickPoetryVerseTable extends Migration
27 */ 29 */
28 public function down() 30 public function down()
29 { 31 {
30 - Schema::dropIfExists('pick_poetry_verse'); 32 + Schema::dropIfExists('everyday_poem');
31 } 33 }
32 } 34 }
......
1 +<?php
2 +
3 +use Illuminate\Support\Facades\Schema;
4 +use Illuminate\Database\Schema\Blueprint;
5 +use Illuminate\Database\Migrations\Migration;
6 +
7 +class CreateOrderTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('order', function (Blueprint $table) {
17 + $table->increments('id');
18 + $table->string('order_sn')->index()->default('')->comment('订单号');
19 + $table->unsignedBigInteger('user_id')->index()->comment('用户id');
20 + $table->decimal('pay_amount')->comment('实付金额');
21 + $table->decimal('goods_amount')->comment('商品金额');
22 + $table->unsignedSmallInteger('status')->comment('订单状态:100待付款 101用户取消 102超时取消 103商户取消 201已付款 204已完成');
23 + $table->timestamp('cancel_time')->comment('关闭时间');
24 + $table->string('source')->comment('来源');
25 + $table->string('pay_number')->default('')->comment('支付交易号');
26 + $table->string('pay_type')->default('')->comment('支付类型');
27 + $table->timestamp('pay_time')->comment('支付时间');
28 + $table->timestamps();
29 + $table->softDeletes();
30 + $table->unsignedTinyInteger('is_deleted')->comment('是否删除');
31 + });
32 + }
33 +
34 + /**
35 + * Reverse the migrations.
36 + *
37 + * @return void
38 + */
39 + public function down()
40 + {
41 + Schema::dropIfExists('order');
42 + }
43 +}
1 +<?php
2 +return [
3 + 'labels' => [
4 + 'EverydayPoem' => 'EverydayPoem',
5 + 'everyday-poem' => 'EverydayPoem',
6 + ],
7 + 'fields' => [
8 + 'date' => '日期',
9 + 'poem_id' => '一言',
10 + 'should' => '宜',
11 + 'sn' => '序号',
12 + ],
13 + 'options' => [
14 + ],
15 +];
1 +<?php
2 +return [
3 + 'labels' => [
4 + 'OnePoem' => 'OnePoem',
5 + 'one-poem' => 'OnePoem',
6 + ],
7 + 'fields' => [
8 + 'title' => '标题',
9 + 'content' => '正文',
10 + 'stanza' => '诗节',
11 + 'annotate' => '注解',
12 + 'spelling' => '拼音',
13 + 'en' => '英文解释',
14 + 'poetry_id' => '诗词id',
15 + 'state' => '状态',
16 +
17 + 'author' => '作者',
18 + 'author_id' => '作者id',
19 + 'name' => '题目',
20 + 'subname' => '小标题',
21 + 'alias' => '别名',
22 +
23 + 'poetry' => [
24 + 'name' => '诗词名'
25 + ]
26 + ],
27 + 'options' => [
28 + ],
29 +];
1 +<?php
2 +return [
3 + 'labels' => [
4 + 'Order' => 'Order',
5 + 'order' => 'Order',
6 + ],
7 + 'fields' => [
8 + 'order_sn' => '订单号',
9 + 'user_id' => '用户id',
10 + 'pay_amount' => '实付金额',
11 + 'goods_amount' => '商品金额',
12 + 'status' => '订单状态',
13 + 'cancel_time' => '关闭时间',
14 + 'pay_number' => '支付交易号',
15 + 'pay_type' => '支付类型',
16 + 'pay_time' => '支付时间',
17 + ],
18 + 'options' => [
19 + ],
20 +];
1 <?php 1 <?php
2 return [ 2 return [
3 'labels' => [ 3 'labels' => [
4 - 'PickPoetry' => 'PickPoetry', 4 + 'PackPoem' => 'PackPoem',
5 - 'pick-poetry' => 'PickPoetry', 5 + 'pack-poem' => 'PackPoem',
6 ], 6 ],
7 'fields' => [ 7 'fields' => [
8 'title' => '标题', 8 'title' => '标题',
9 'subtitle' => '副标题', 9 'subtitle' => '副标题',
10 - 'left_tag_id' => '左侧标签', 10 + 'left_text' => '左侧文本',
11 - 'right_tag_id' => '右侧标签', 11 + 'right_text' => '右侧文本',
12 - 'poetry_id' => '诗词id', 12 + 'poem_id' => '一言',
13 'use_num' => '使用次数', 13 'use_num' => '使用次数',
14 'state' => '状态', 14 'state' => '状态',
15 +
16 + 'poem'=>[
17 + 'title' => '一言',
18 + 'content' => '正文',
19 + 'author' => '作者'
20 + ]
15 ], 21 ],
16 'options' => [ 22 'options' => [
17 ], 23 ],
......
1 +<?php
2 +return [
3 + 'labels' => [
4 + 'PickPoetryVerse' => 'PickPoetryVerse',
5 + 'pick-poetry-verse' => 'PickPoetryVerse',
6 + ],
7 + 'fields' => [
8 + 'pick_id' => '一言id',
9 + 'verse_id' => '重新打包的诗句(节)id',
10 + ],
11 + 'options' => [
12 + ],
13 +];
...@@ -10,6 +10,7 @@ return [ ...@@ -10,6 +10,7 @@ return [
10 'annotate' => '注解', 10 'annotate' => '注解',
11 'spelling' => '拼音', 11 'spelling' => '拼音',
12 'en' => '英文解释', 12 'en' => '英文解释',
13 + 'state' => '状态',
13 ], 14 ],
14 'options' => [ 15 'options' => [
15 ], 16 ],
......