Showing
38 changed files
with
1244 additions
and
88 deletions
... | @@ -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\Renderable\MembershipGoodsTable; | ||
5 | use App\Admin\Repositories\Membership; | 6 | use App\Admin\Repositories\Membership; |
7 | +use App\Models\MembershipGood; | ||
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; |
12 | +use Dcat\Admin\Form\NestedForm; | ||
10 | 13 | ||
11 | class MembershipController extends AdminController | 14 | class MembershipController extends AdminController |
12 | { | 15 | { |
16 | + protected $title = '会员'; | ||
13 | /** | 17 | /** |
14 | * Make a grid builder. | 18 | * Make a grid builder. |
15 | * | 19 | * |
... | @@ -18,14 +22,28 @@ class MembershipController extends AdminController | ... | @@ -18,14 +22,28 @@ class MembershipController extends AdminController |
18 | protected function grid() | 22 | protected function grid() |
19 | { | 23 | { |
20 | return Grid::make(new Membership(), function (Grid $grid) { | 24 | return Grid::make(new Membership(), function (Grid $grid) { |
21 | - $grid->column('id')->sortable(); | 25 | + |
26 | + // 设置自定义视图 | ||
27 | + $grid->setActionClass(Grid\Displayers\Actions::class); | ||
28 | + | ||
29 | + $grid->column('id',__('ID'))->sortable(); | ||
30 | + | ||
22 | $grid->column('name'); | 31 | $grid->column('name'); |
23 | $grid->column('price'); | 32 | $grid->column('price'); |
24 | - $grid->column('origin_price'); | 33 | + $grid->column('line_price'); |
25 | $grid->column('limited_days'); | 34 | $grid->column('limited_days'); |
35 | + $grid->column('limit_unit'); | ||
26 | $grid->column('intro'); | 36 | $grid->column('intro'); |
27 | $grid->column('state'); | 37 | $grid->column('state'); |
28 | $grid->column('sn'); | 38 | $grid->column('sn'); |
39 | + | ||
40 | + $grid->column('video_url'); | ||
41 | + $grid->column('video_cover'); | ||
42 | + $grid->column('bg_images'); | ||
43 | + $grid->column('visits'); | ||
44 | + $grid->column('virtual_sales'); | ||
45 | + $grid->column('sales'); | ||
46 | + | ||
29 | $grid->column('created_at'); | 47 | $grid->column('created_at'); |
30 | $grid->column('updated_at')->sortable(); | 48 | $grid->column('updated_at')->sortable(); |
31 | 49 | ||
... | @@ -49,13 +67,23 @@ class MembershipController extends AdminController | ... | @@ -49,13 +67,23 @@ class MembershipController extends AdminController |
49 | $show->field('id'); | 67 | $show->field('id'); |
50 | $show->field('name'); | 68 | $show->field('name'); |
51 | $show->field('price'); | 69 | $show->field('price'); |
52 | - $show->field('origin_price'); | 70 | + $show->field('line_price'); |
53 | $show->field('limited_days'); | 71 | $show->field('limited_days'); |
72 | + $show->field('limit_unit'); | ||
54 | $show->field('intro'); | 73 | $show->field('intro'); |
55 | $show->field('state'); | 74 | $show->field('state'); |
56 | $show->field('sn'); | 75 | $show->field('sn'); |
76 | + | ||
77 | + $show->field('is_video'); | ||
78 | + $show->field('video_url'); | ||
79 | + $show->field('video_cover'); | ||
80 | + $show->field('bg_images'); | ||
81 | + $show->field('visits'); | ||
82 | + $show->field('virtual_sales'); | ||
83 | + $show->field('sales'); | ||
57 | $show->field('created_at'); | 84 | $show->field('created_at'); |
58 | $show->field('updated_at'); | 85 | $show->field('updated_at'); |
86 | + | ||
59 | }); | 87 | }); |
60 | } | 88 | } |
61 | 89 | ||
... | @@ -68,14 +96,67 @@ class MembershipController extends AdminController | ... | @@ -68,14 +96,67 @@ class MembershipController extends AdminController |
68 | { | 96 | { |
69 | return Form::make(new Membership(), function (Form $form) { | 97 | return Form::make(new Membership(), function (Form $form) { |
70 | $form->display('id'); | 98 | $form->display('id'); |
71 | - $form->text('name'); | 99 | + $form->block(12, function (Form\BlockForm $form) { |
72 | - $form->text('price'); | 100 | + // 设置标题 |
73 | - $form->text('origin_price'); | 101 | + $form->title('基本设置'); |
74 | - $form->text('limited_days'); | 102 | + // 显示底部提交按钮 |
75 | - $form->text('intro'); | 103 | + $form->showFooter(); |
76 | - $form->text('state'); | 104 | + // 设置字段宽度 |
77 | - $form->text('sn'); | 105 | + $form->width(8, 2); |
78 | - | 106 | + |
107 | + | ||
108 | + $form->radio('terminal')->addElementClass('terminal') | ||
109 | + ->options([1 => 'Android', 2 => 'IOS'])->default(2); | ||
110 | + | ||
111 | + $form->text('title')->addElementClass('name'); | ||
112 | + $form->textarea('intro')->addElementClass('intro'); | ||
113 | + | ||
114 | + $form->radio('bg_type')->addElementClass('bg_type') | ||
115 | + ->options([1 => '单图', 2 => '轮播图', 3 => '视频'])->default(1) | ||
116 | + ->when([1,2],function (Form\BlockForm $form){ | ||
117 | + $form->multipleImage('bg_images') | ||
118 | + ->limit(5) | ||
119 | + ->uniqueName() | ||
120 | + ->addElementClass('bg_images'); | ||
121 | + }) | ||
122 | + ->when(3,function (Form\BlockForm $form){ | ||
123 | + $form->file('video_url') | ||
124 | + ->accept('mp4') | ||
125 | + ->autoUpload() | ||
126 | + ->uniqueName() | ||
127 | + ->addElementClass('video_url'); | ||
128 | + | ||
129 | + $form->image('video_cover') | ||
130 | + ->uniqueName() | ||
131 | + ->addElementClass('video_cover'); | ||
132 | + }); | ||
133 | + | ||
134 | + $form->radio('state')->options(['不显示', '显示'])->default(0); | ||
135 | + | ||
136 | + | ||
137 | + $form->radio('is_bind_old')->options(['新增会员商品', '选择已有商品'])->default(0) | ||
138 | + ->when(0,function (Form\BlockForm $form){ | ||
139 | + $form->table('membership_goods','新赠会员商品', function (NestedForm $table) { | ||
140 | + $table->currency('price')->symbol('¥')->addElementClass('price'); | ||
141 | + $table->currency('line_price')->symbol('¥')->addElementClass('line_price'); | ||
142 | + $table->text('limited_days')->addElementClass('limited_days'); | ||
143 | + $table->text('limit_unit')->addElementClass('limit_unit'); | ||
144 | + | ||
145 | + }); | ||
146 | + }) | ||
147 | + ->when(1,function (Form\BlockForm $form){ | ||
148 | + $form->selectTable('membership_goods') | ||
149 | + ->title('会员商品') | ||
150 | + ->from(MembershipGoodsTable::make()) | ||
151 | + ->model(MembershipGood::class, 'id', 'price'); | ||
152 | + }); | ||
153 | + }); | ||
154 | + | ||
155 | +// $form->block(4, function (Form\BlockForm $form) { | ||
156 | +// $form->width(9, 1); | ||
157 | +// $form->html(view('admin.form.phone')); | ||
158 | +// }); | ||
159 | + | ||
79 | $form->display('created_at'); | 160 | $form->display('created_at'); |
80 | $form->display('updated_at'); | 161 | $form->display('updated_at'); |
81 | }); | 162 | }); | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Admin\Controllers; | ||
4 | + | ||
5 | +use App\Admin\Repositories\MembershipGood; | ||
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 MembershipGoodController extends AdminController | ||
12 | +{ | ||
13 | + /** | ||
14 | + * Make a grid builder. | ||
15 | + * | ||
16 | + * @return Grid | ||
17 | + */ | ||
18 | + protected function grid() | ||
19 | + { | ||
20 | + return Grid::make(new MembershipGood(), function (Grid $grid) { | ||
21 | + $grid->column('id')->sortable(); | ||
22 | + $grid->column('price'); | ||
23 | + $grid->column('line_price'); | ||
24 | + $grid->column('limit_days'); | ||
25 | + $grid->column('limit_unit'); | ||
26 | + $grid->column('sale_terminal'); | ||
27 | + $grid->column('state'); | ||
28 | + $grid->column('sn'); | ||
29 | + $grid->column('visits'); | ||
30 | + $grid->column('virtual_sales'); | ||
31 | + $grid->column('sales'); | ||
32 | + $grid->column('stocks'); | ||
33 | + $grid->column('created_at'); | ||
34 | + $grid->column('updated_at')->sortable(); | ||
35 | + | ||
36 | + $grid->filter(function (Grid\Filter $filter) { | ||
37 | + $filter->equal('id'); | ||
38 | + | ||
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 MembershipGood(), function (Show $show) { | ||
53 | + $show->field('id'); | ||
54 | + $show->field('price'); | ||
55 | + $show->field('line_price'); | ||
56 | + $show->field('limit_days'); | ||
57 | + $show->field('limit_unit'); | ||
58 | + $show->field('sale_terminal'); | ||
59 | + $show->field('state'); | ||
60 | + $show->field('sn'); | ||
61 | + $show->field('visits'); | ||
62 | + $show->field('virtual_sales'); | ||
63 | + $show->field('sales'); | ||
64 | + $show->field('stocks'); | ||
65 | + $show->field('created_at'); | ||
66 | + $show->field('updated_at'); | ||
67 | + }); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Make a form builder. | ||
72 | + * | ||
73 | + * @return Form | ||
74 | + */ | ||
75 | + protected function form() | ||
76 | + { | ||
77 | + return Form::make(new MembershipGood(), function (Form $form) { | ||
78 | + $form->display('id'); | ||
79 | + $form->text('price'); | ||
80 | + $form->text('line_price'); | ||
81 | + $form->text('limit_days'); | ||
82 | + $form->text('limit_unit'); | ||
83 | + $form->text('sale_terminal'); | ||
84 | + $form->text('state'); | ||
85 | + $form->text('sn'); | ||
86 | + $form->text('visits'); | ||
87 | + $form->text('virtual_sales'); | ||
88 | + $form->text('sales'); | ||
89 | + $form->text('stocks'); | ||
90 | + | ||
91 | + $form->display('created_at'); | ||
92 | + $form->display('updated_at'); | ||
93 | + }); | ||
94 | + } | ||
95 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Admin\Controllers; | ||
4 | + | ||
5 | +use App\Admin\Repositories\OrderGood; | ||
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 OrderGoodController extends AdminController | ||
12 | +{ | ||
13 | + /** | ||
14 | + * Make a grid builder. | ||
15 | + * | ||
16 | + * @return Grid | ||
17 | + */ | ||
18 | + protected function grid() | ||
19 | + { | ||
20 | + return Grid::make(new OrderGood(), function (Grid $grid) { | ||
21 | + $grid->column('id')->sortable(); | ||
22 | + $grid->column('order_sn'); | ||
23 | + $grid->column('goods_id'); | ||
24 | + $grid->column('goods_name'); | ||
25 | + $grid->column('goods_image'); | ||
26 | + $grid->column('goods_price'); | ||
27 | + $grid->column('goods_number'); | ||
28 | + $grid->column('after_sales'); | ||
29 | + $grid->column('created_at'); | ||
30 | + $grid->column('updated_at')->sortable(); | ||
31 | + | ||
32 | + $grid->filter(function (Grid\Filter $filter) { | ||
33 | + $filter->equal('id'); | ||
34 | + | ||
35 | + }); | ||
36 | + }); | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Make a show builder. | ||
41 | + * | ||
42 | + * @param mixed $id | ||
43 | + * | ||
44 | + * @return Show | ||
45 | + */ | ||
46 | + protected function detail($id) | ||
47 | + { | ||
48 | + return Show::make($id, new OrderGood(), function (Show $show) { | ||
49 | + $show->field('id'); | ||
50 | + $show->field('order_sn'); | ||
51 | + $show->field('goods_id'); | ||
52 | + $show->field('goods_name'); | ||
53 | + $show->field('goods_image'); | ||
54 | + $show->field('goods_price'); | ||
55 | + $show->field('goods_number'); | ||
56 | + $show->field('after_sales'); | ||
57 | + $show->field('created_at'); | ||
58 | + $show->field('updated_at'); | ||
59 | + }); | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Make a form builder. | ||
64 | + * | ||
65 | + * @return Form | ||
66 | + */ | ||
67 | + protected function form() | ||
68 | + { | ||
69 | + return Form::make(new OrderGood(), function (Form $form) { | ||
70 | + $form->display('id'); | ||
71 | + $form->text('order_sn'); | ||
72 | + $form->text('goods_id'); | ||
73 | + $form->text('goods_name'); | ||
74 | + $form->text('goods_image'); | ||
75 | + $form->text('goods_price'); | ||
76 | + $form->text('goods_number'); | ||
77 | + $form->text('after_sales'); | ||
78 | + | ||
79 | + $form->display('created_at'); | ||
80 | + $form->display('updated_at'); | ||
81 | + }); | ||
82 | + } | ||
83 | +} |
... | @@ -10,6 +10,8 @@ use Dcat\Admin\Http\Controllers\AdminController; | ... | @@ -10,6 +10,8 @@ use Dcat\Admin\Http\Controllers\AdminController; |
10 | 10 | ||
11 | class PickPoetryVerseController extends AdminController | 11 | class PickPoetryVerseController extends AdminController |
12 | { | 12 | { |
13 | + protected $title = '推送服务'; | ||
14 | + | ||
13 | /** | 15 | /** |
14 | * Make a grid builder. | 16 | * Make a grid builder. |
15 | * | 17 | * |
... | @@ -71,14 +73,16 @@ class PickPoetryVerseController extends AdminController | ... | @@ -71,14 +73,16 @@ class PickPoetryVerseController extends AdminController |
71 | $form->radio('plant')->addElementClass('plant') | 73 | $form->radio('plant')->addElementClass('plant') |
72 | ->options([1 => 'Android', 2 => 'IOS'])->default(2); | 74 | ->options([1 => 'Android', 2 => 'IOS'])->default(2); |
73 | 75 | ||
74 | - $form->text('title'); | 76 | + $form->text('title')->addElementClass('title'); |
75 | - $form->textarea('content'); | 77 | + $form->textarea('content')->addElementClass('push_content'); |
76 | 78 | ||
77 | - $form->radio('push_type', '发送时间')->options([1 => '立即', 2 => '定时'])->default(1) | 79 | + $form->radio('push_type', '发送时间')->addElementClass('push_type') |
80 | + ->options([1 => '立即', 2 => '定时'])->default(1) | ||
78 | ->when(2, function (Form\BlockForm $form) { | 81 | ->when(2, function (Form\BlockForm $form) { |
79 | $form->datetime('push_time'); | 82 | $form->datetime('push_time'); |
80 | }); | 83 | }); |
81 | - $form->select('action_type')->options(['打开应用', '临境', '会员介绍页', '众妙页']); | 84 | + $form->select('action_type')->addElementClass('action_type') |
85 | + ->options(['打开应用', '临境', '会员介绍页', '众妙页']); | ||
82 | 86 | ||
83 | $form->radio('user_type', '目标人群')->options([1 => '所有人', 2 => '指定用户'])->default(1) | 87 | $form->radio('user_type', '目标人群')->options([1 => '所有人', 2 => '指定用户'])->default(1) |
84 | ->when(2, function (Form\BlockForm $form) { | 88 | ->when(2, function (Form\BlockForm $form) { |
... | @@ -87,6 +91,7 @@ class PickPoetryVerseController extends AdminController | ... | @@ -87,6 +91,7 @@ class PickPoetryVerseController extends AdminController |
87 | }); | 91 | }); |
88 | 92 | ||
89 | $form->block(4, function (Form\BlockForm $form) { | 93 | $form->block(4, function (Form\BlockForm $form) { |
94 | + $form->width(9, 1); | ||
90 | $form->html(view('admin.form.push')); | 95 | $form->html(view('admin.form.push')); |
91 | }); | 96 | }); |
92 | 97 | ... | ... |
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\Models\MembershipGood; | ||
12 | +use Dcat\Admin\Grid; | ||
13 | +use Dcat\Admin\Grid\LazyRenderable; | ||
14 | + | ||
15 | +class MembershipGoodsTable extends LazyRenderable | ||
16 | +{ | ||
17 | + public function grid(): Grid | ||
18 | + { | ||
19 | + return Grid::make(new MembershipGood(), function (Grid $grid) { | ||
20 | + $grid->column('id', 'ID')->sortable(); | ||
21 | + $grid->column('membership_id'); | ||
22 | + $grid->column('price'); | ||
23 | + $grid->column('line_price'); | ||
24 | + $grid->column('limit_days'); | ||
25 | + $grid->column('limit_unit'); | ||
26 | + $grid->column('terminal'); | ||
27 | + | ||
28 | + $grid->quickSearch(['price', 'line_price', 'terminal']); | ||
29 | + | ||
30 | + $grid->paginate(10); | ||
31 | + $grid->disableActions(); | ||
32 | + | ||
33 | + $grid->filter(function (Grid\Filter $filter) { | ||
34 | + $filter->like('price')->width(4); | ||
35 | + $filter->like('terminal')->width(4); | ||
36 | + }); | ||
37 | + }); | ||
38 | + } | ||
39 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -30,6 +30,10 @@ Route::group([ | ... | @@ -30,6 +30,10 @@ Route::group([ |
30 | /** 订单*/ | 30 | /** 订单*/ |
31 | $router->resource('/order', 'OrderController'); | 31 | $router->resource('/order', 'OrderController'); |
32 | 32 | ||
33 | + /** 会员*/ | ||
34 | + $router->resource('/membership', 'MembershipController'); | ||
35 | + | ||
36 | + | ||
33 | $router->group(['prefix'=>'/tool'],function (Router $router){ | 37 | $router->group(['prefix'=>'/tool'],function (Router $router){ |
34 | /** 每日一言*/ | 38 | /** 每日一言*/ |
35 | $router->resource('/every-poem', 'EverydayPoemController'); | 39 | $router->resource('/every-poem', 'EverydayPoemController'); | ... | ... |
app/Console/Commands/InitTemplateData.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Console\Commands; | ||
4 | + | ||
5 | +use App\Models\OnePoem; | ||
6 | +use App\Models\PackPoem; | ||
7 | +use App\Models\VideoTemp; | ||
8 | +use Carbon\Carbon; | ||
9 | +use Illuminate\Console\Command; | ||
10 | +use Illuminate\Support\Facades\Storage; | ||
11 | + | ||
12 | +class InitTemplateData extends Command | ||
13 | +{ | ||
14 | + /** | ||
15 | + * The name and signature of the console command. | ||
16 | + * | ||
17 | + * @var string | ||
18 | + */ | ||
19 | + protected $signature = 'init:temp'; | ||
20 | + | ||
21 | + /** | ||
22 | + * The console command description. | ||
23 | + * | ||
24 | + * @var string | ||
25 | + */ | ||
26 | + protected $description = '初始化模板数据'; | ||
27 | + | ||
28 | + /** | ||
29 | + * Create a new command instance. | ||
30 | + * | ||
31 | + * @return void | ||
32 | + */ | ||
33 | + public function __construct() | ||
34 | + { | ||
35 | + parent::__construct(); | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Execute the console command. | ||
40 | + * | ||
41 | + * @return int | ||
42 | + */ | ||
43 | + public function handle() | ||
44 | + { | ||
45 | + // 一言表 | ||
46 | + OnePoem::query()->truncate(); | ||
47 | + $one_poem = new OnePoem(); | ||
48 | + | ||
49 | + $one_poem->id = 1; | ||
50 | + $one_poem->title = '诉衷情2'; | ||
51 | + $one_poem->author = '欧阳修'; | ||
52 | + $one_poem->content = '清晨帘幕卷轻霜。'; | ||
53 | + $one_poem->annotate = '诉衷情 --清晨帘幕卷轻霜。'; | ||
54 | + $one_poem->spelling = 'qing chen lian mu juan qing shuang'; | ||
55 | + $one_poem->en = 'morning ...'; | ||
56 | + $one_poem->state = 0; | ||
57 | + $one_poem->created_at = Carbon::now(); | ||
58 | + $one_poem->updated_at = Carbon::now(); | ||
59 | + | ||
60 | + $one_poem->save(); | ||
61 | + | ||
62 | + | ||
63 | + // 众妙表 | ||
64 | + PackPoem::query()->truncate(); | ||
65 | + $pack_poem = new PackPoem(); | ||
66 | + | ||
67 | + $pack_poem->id = 1; | ||
68 | + $pack_poem->title = '辛丑年 庚子月 已酉时 巳时'; | ||
69 | + $pack_poem->subtitle = '2022年01月12日13点22分'; | ||
70 | + $pack_poem->left_text = '欧阳修'; | ||
71 | + $pack_poem->right_text = '冬'; | ||
72 | + $pack_poem->poem_id = 1; | ||
73 | + $pack_poem->state = 0; | ||
74 | + $pack_poem->created_at = Carbon::now(); | ||
75 | + $pack_poem->updated_at = Carbon::now(); | ||
76 | + | ||
77 | + $pack_poem->save(); | ||
78 | + | ||
79 | + | ||
80 | + // 模板表 | ||
81 | + VideoTemp::query()->truncate(); | ||
82 | + $video_temp = new VideoTemp(); | ||
83 | + | ||
84 | + $video_temp->title = 'test'; | ||
85 | + $video_temp->type = 1; | ||
86 | + $video_temp->bg_type = 2; | ||
87 | + $video_temp->bg_url = 'files/ce1f0f0a995f93ff2e6d68451ab0873e.png'; | ||
88 | + $video_temp->bg_music = 0; | ||
89 | + $video_temp->text_color = '#FAF1F3'; | ||
90 | + $video_temp->text_bg_color = '#21415E'; | ||
91 | + $video_temp->opacity = 100; | ||
92 | + $video_temp->sn = 1; | ||
93 | + $video_temp->top = 120; | ||
94 | + $video_temp->left = 70; | ||
95 | + $video_temp->font_size = 4; | ||
96 | + $video_temp->state = 0; | ||
97 | + | ||
98 | + $video_temp->save(); | ||
99 | + | ||
100 | + | ||
101 | + // 菜单初始化 | ||
102 | + \Dcat\Admin\Models\Menu::query()->truncate(); | ||
103 | + $admin_menu = json_decode(Storage::disk('public')->get('PoemData/admin_menu.json'), true); | ||
104 | + $data = $admin_menu['RECORDS']; | ||
105 | + foreach ($data as $item){ | ||
106 | + $item['created_at'] = Carbon::now(); | ||
107 | + $item['updated_at'] = Carbon::now(); | ||
108 | + | ||
109 | + \Dcat\Admin\Models\Menu::query()->create($item); | ||
110 | + } | ||
111 | + | ||
112 | + return 0; | ||
113 | + } | ||
114 | +} |
app/Http/Controllers/V1/AuthController.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Http\Controllers\V1; | ||
4 | + | ||
5 | +use App\Http\Controllers\Controller; | ||
6 | +use App\Models\OneUser; | ||
7 | +use App\Models\User; | ||
8 | +use App\Models\UserProfile; | ||
9 | +use Illuminate\Http\Request; | ||
10 | +use Illuminate\Support\Facades\Auth; | ||
11 | +use Jiannei\Response\Laravel\Support\Facades\Response; | ||
12 | +use Laravel\Socialite\Facades\Socialite; | ||
13 | + | ||
14 | +class AuthController extends Controller | ||
15 | +{ | ||
16 | + /** | ||
17 | + * web用户先访问这里进行重定向 | ||
18 | + * @param Request $request | ||
19 | + * @param $service | ||
20 | + * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\RedirectResponse | ||
21 | + */ | ||
22 | + public function redirectToProvider(Request $request, $service) | ||
23 | + { | ||
24 | + return Socialite::driver($service)->redirect(); | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * web用户客户端授权后直接到这里 | ||
29 | + * @param Request $request | ||
30 | + * @param $service | ||
31 | + */ | ||
32 | + public function handleProviderCallback(Request $request, $service) | ||
33 | + { | ||
34 | + $socialUser = Socialite::driver($service)->stateless()->user(); | ||
35 | + dd($socialUser); | ||
36 | +// //据说apple有问题需要用这种办法 | ||
37 | +// if ($service === 'apple'){ | ||
38 | +// // apple 登录 | ||
39 | +// try { | ||
40 | +// if ($code = $request->code) { | ||
41 | +// $response = http('https://appleid.apple.com/auth/token', [ | ||
42 | +// 'grant_type' => 'authorization_code', | ||
43 | +// 'code' => $code, | ||
44 | +// 'redirect_uri' => config('services.apple.redirect') , | ||
45 | +// 'client_id' => config('services.apple.client_id') , | ||
46 | +// 'client_secret' => config('services.apple.client_secret') , | ||
47 | +// ]); | ||
48 | +// $id_token = $response->id_token; | ||
49 | +// } else { | ||
50 | +// $id_token = $request->access_token; | ||
51 | +// } | ||
52 | +// $oauthUser = json_decode(base64_decode(explode('.', $id_token) [1])); | ||
53 | +// } | ||
54 | +// catch(\Exception $e) { | ||
55 | +// return $this->failed('apple 参数错误'); | ||
56 | +// } | ||
57 | +// } | ||
58 | +// function http($url, $params = false) | ||
59 | +// { | ||
60 | +// $ch = curl_init($url); | ||
61 | +// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
62 | +// if ($params) { | ||
63 | +// curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); | ||
64 | +// } curl_setopt($ch, CURLOPT_HTTPHEADER, [ | ||
65 | +// 'Accept: application/json', | ||
66 | +// 'User-Agent: curl', # Apple requires a user agent header at the token endpoint | ||
67 | +// ]); | ||
68 | +// $response = curl_exec($ch); | ||
69 | +// return json_decode($response); | ||
70 | +// } | ||
71 | + } | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + /** | ||
76 | + * 移动端微信用户 | ||
77 | + * @param Request $request | ||
78 | + * @param $service | ||
79 | + * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Resources\Json\JsonResource | ||
80 | + */ | ||
81 | + public function apiHandleProviderCallback(Request $request, $service) | ||
82 | + { | ||
83 | + $code = $request->get('code'); | ||
84 | + if (!$code) return Response::fail('code miss'); | ||
85 | + | ||
86 | + $driver = Socialite::driver($service); | ||
87 | + $response = $driver->getAccessTokenResponse($code); | ||
88 | + if (isset($response['errcode'])) return Response::fail($response['errmsg']); | ||
89 | + | ||
90 | + $driver->setOpenId($response['openid']); | ||
91 | + $oauthUser = $driver->getUserByToken($response['access_token']); | ||
92 | + | ||
93 | +// //另一种写法 | ||
94 | +// $user = User::query()->firstOrCreate([ | ||
95 | +// 'provider_id' => $oauthUser->id, | ||
96 | +// 'provider' => $service, | ||
97 | +// ],[ | ||
98 | +// 'nickname' => $oauthUser->nickname, | ||
99 | +// 'avatar' => $oauthUser->avatar, | ||
100 | +// 'provider' => $service, | ||
101 | +// 'provider_id' => $oauthUser->id, | ||
102 | +// ]); | ||
103 | +// | ||
104 | +// UserProfile::query()->firstOrCreate([ | ||
105 | +// 'user_id' => $user->id, | ||
106 | +// 'unionid' => $oauthUser->unionid, | ||
107 | +// ]); | ||
108 | + | ||
109 | + $user = User::query()->where( 'provider_id', '=', $oauthUser->id ) | ||
110 | + ->where( 'provider', '=', $service ) | ||
111 | + ->first(); | ||
112 | + | ||
113 | + if ($user == null){ | ||
114 | + // 如果该用户不存在则将其保存到 users 表 | ||
115 | + $newUser = new User(); | ||
116 | + | ||
117 | + $newUser->nickname = $oauthUser->nickname; | ||
118 | + $newUser->avatar = $oauthUser->avatar; | ||
119 | + $newUser->provider = $service; | ||
120 | + $newUser->provider_id = $oauthUser->id; | ||
121 | + | ||
122 | + $newUser->save(); | ||
123 | + $user = $newUser; | ||
124 | + | ||
125 | + // user_profile 保存 | ||
126 | + $userProfile = new UserProfile(); | ||
127 | + $userProfile->user_id = $user->id; | ||
128 | + $userProfile->unionid = $oauthUser->unionid; | ||
129 | + $userProfile->save(); | ||
130 | + } | ||
131 | + | ||
132 | + Auth::guard('api')->login($user); | ||
133 | + | ||
134 | + return Response::success([ | ||
135 | + 'user_id' => $user->id, | ||
136 | + 'nickname' => $user->nickname, | ||
137 | + 'mobile' => $user->mobile, | ||
138 | + 'gender' => $user->gender, | ||
139 | + 'avatar' => $user->avatar, | ||
140 | + 'token' => $user->createToken($user->id)->plainTextToken | ||
141 | + ]); | ||
142 | + } | ||
143 | +} |
app/Http/Controllers/V1/OrderController.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Http\Controllers\V1; | ||
4 | + | ||
5 | +use App\Http\Controllers\Controller; | ||
6 | +use Illuminate\Http\Request; | ||
7 | +use Illuminate\Support\Facades\Validator; | ||
8 | +use Jiannei\Response\Laravel\Support\Facades\Response; | ||
9 | + | ||
10 | +class OrderController extends Controller | ||
11 | +{ | ||
12 | + public function index(Request $request) | ||
13 | + { | ||
14 | + $validator = Validator::make($request->all(),[ | ||
15 | + 'goods_id' => 'required|integer', | ||
16 | + 'source' => 'required|string', | ||
17 | + ]); | ||
18 | + | ||
19 | + if ($validator->fails()){ | ||
20 | + return Response::fail('缺少参数',500,$validator->errors()); | ||
21 | + } | ||
22 | + | ||
23 | + | ||
24 | + } | ||
25 | + | ||
26 | + public function store(Request $request) | ||
27 | + { | ||
28 | + $validator = Validator::make($request->all(),[ | ||
29 | + 'goods_id' => 'required|integer', | ||
30 | + 'source' => 'required|string', | ||
31 | + ]); | ||
32 | + | ||
33 | + if ($validator->fails()){ | ||
34 | + return Response::fail('',500,$validator->errors()); | ||
35 | + } | ||
36 | + } | ||
37 | +} |
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | namespace App\Http\Middleware; | 3 | namespace App\Http\Middleware; |
4 | 4 | ||
5 | use Illuminate\Auth\Middleware\Authenticate as Middleware; | 5 | use Illuminate\Auth\Middleware\Authenticate as Middleware; |
6 | +use Jiannei\Response\Laravel\Support\Facades\Response; | ||
6 | 7 | ||
7 | class Authenticate extends Middleware | 8 | class Authenticate extends Middleware |
8 | { | 9 | { |
... | @@ -17,5 +18,7 @@ class Authenticate extends Middleware | ... | @@ -17,5 +18,7 @@ class Authenticate extends Middleware |
17 | if (! $request->expectsJson()) { | 18 | if (! $request->expectsJson()) { |
18 | return route('login'); | 19 | return route('login'); |
19 | } | 20 | } |
21 | + | ||
22 | + Response::errorUnauthorized(); // 授权失败 401 | ||
20 | } | 23 | } |
21 | } | 24 | } | ... | ... |
app/Http/Middleware/LogOperation.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Http\Middleware; | ||
4 | + | ||
5 | +use App\Models\OperationLog; | ||
6 | +use Closure; | ||
7 | +use Illuminate\Http\Request; | ||
8 | +use Illuminate\Support\Facades\Auth; | ||
9 | +use Illuminate\Support\Str; | ||
10 | +use Jiannei\Response\Laravel\Support\Facades\Response; | ||
11 | + | ||
12 | +class LogOperation | ||
13 | +{ | ||
14 | + /** | ||
15 | + * Handle an incoming request. | ||
16 | + * | ||
17 | + * @param \Illuminate\Http\Request $request | ||
18 | + * @param \Closure $next | ||
19 | + * @return mixed | ||
20 | + */ | ||
21 | + public function handle(Request $request, Closure $next) | ||
22 | + { | ||
23 | + if ($this->shouldLogOperation($request)) { | ||
24 | + $user = Auth::user(); | ||
25 | + | ||
26 | + $log = [ | ||
27 | + 'user_id' => $user ? $user->getAuthIdentifier() : 0, | ||
28 | + 'path' => substr($request->path(), 0, 255), | ||
29 | + 'method' => $request->method(), | ||
30 | + 'ip' => $request->getClientIp(), | ||
31 | + 'input' => $this->formatInput($request->input()), | ||
32 | + ]; | ||
33 | + | ||
34 | + try { | ||
35 | + OperationLog::query()->create($log); | ||
36 | + } catch (\Exception $exception) { | ||
37 | + // pass | ||
38 | + Response::fail($exception->getMessage()); | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + // 跨域 | ||
43 | + $response = $next($request); | ||
44 | + $IlluminateResponse = 'Illuminate\Http\Response'; | ||
45 | + $SymfonyResopnse = 'Symfony\Component\HttpFoundation\Response'; | ||
46 | + $headers = [ | ||
47 | + 'Access-Control-Allow-Origin' => '*', | ||
48 | + 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, PATCH, DELETE', | ||
49 | + 'Access-Control-Allow-Headers' => 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Authorization , Access-Control-Request-Headers, X-CSRF-TOKEN' | ||
50 | + ]; | ||
51 | + | ||
52 | + if ($response instanceof $IlluminateResponse) { | ||
53 | + foreach ($headers as $key => $value) { | ||
54 | + $response->header($key, $value); | ||
55 | + } | ||
56 | + return $response; | ||
57 | + } | ||
58 | + | ||
59 | + if ($response instanceof $SymfonyResopnse) { | ||
60 | + foreach ($headers as $key => $value) { | ||
61 | + $response->headers->set($key, $value); | ||
62 | + } | ||
63 | + return $response; | ||
64 | + } | ||
65 | + | ||
66 | + return $response; | ||
67 | + | ||
68 | + } | ||
69 | + | ||
70 | + protected function formatInput(array $input) | ||
71 | + { | ||
72 | + foreach (['password', 'password_confirmation',] as $field) { | ||
73 | + if ($field && ! empty($input[$field])) { | ||
74 | + $input[$field] = Str::limit($input[$field], 3, '******'); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + return json_encode($input); | ||
79 | + } | ||
80 | + | ||
81 | + protected function shouldLogOperation(Request $request) | ||
82 | + { | ||
83 | + return ! $this->inExceptArray($request) | ||
84 | + && $this->inAllowedMethods($request->method()); | ||
85 | + } | ||
86 | + | ||
87 | + protected function inAllowedMethods($method) | ||
88 | + { | ||
89 | + $allowedMethods = collect(['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'])->filter(); | ||
90 | + | ||
91 | + if ($allowedMethods->isEmpty()) { | ||
92 | + return true; | ||
93 | + } | ||
94 | + | ||
95 | + return $allowedMethods->map(function ($method) { | ||
96 | + return strtoupper($method); | ||
97 | + })->contains($method); | ||
98 | + } | ||
99 | + | ||
100 | + protected function inExceptArray(Request $request) | ||
101 | + { | ||
102 | + $except = [ | ||
103 | + | ||
104 | + ]; | ||
105 | + | ||
106 | + $path = Str::replaceFirst('api','',$request->path()); | ||
107 | + if (in_array($path,$except)){ | ||
108 | + return true; | ||
109 | + } | ||
110 | + | ||
111 | + return false; | ||
112 | + } | ||
113 | +} |
... | @@ -10,5 +10,15 @@ class Membership extends Model | ... | @@ -10,5 +10,15 @@ class Membership extends Model |
10 | { | 10 | { |
11 | use HasDateTimeFormatter; | 11 | use HasDateTimeFormatter; |
12 | protected $table = 'membership'; | 12 | protected $table = 'membership'; |
13 | - | 13 | + |
14 | + public function getBgImagesAttribute($value) | ||
15 | + { | ||
16 | + return explode(',', $value); | ||
17 | + } | ||
18 | + | ||
19 | + public function getSingleImgAttribute() | ||
20 | + { | ||
21 | + $array = explode(',', $this->bg_images); | ||
22 | + return $array[0]; | ||
23 | + } | ||
14 | } | 24 | } | ... | ... |
app/Models/MembershipGood.php
0 → 100755
... | @@ -5,6 +5,7 @@ namespace App\Models; | ... | @@ -5,6 +5,7 @@ namespace App\Models; |
5 | use Dcat\Admin\Traits\HasDateTimeFormatter; | 5 | use Dcat\Admin\Traits\HasDateTimeFormatter; |
6 | use Illuminate\Database\Eloquent\SoftDeletes; | 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
7 | use Illuminate\Database\Eloquent\Model; | 7 | use Illuminate\Database\Eloquent\Model; |
8 | +use Illuminate\Support\Facades\Auth; | ||
8 | 9 | ||
9 | class Order extends Model | 10 | class Order extends Model |
10 | { | 11 | { |
... | @@ -12,5 +13,57 @@ class Order extends Model | ... | @@ -12,5 +13,57 @@ class Order extends Model |
12 | use SoftDeletes; | 13 | use SoftDeletes; |
13 | 14 | ||
14 | protected $table = 'order'; | 15 | protected $table = 'order'; |
15 | - | 16 | + |
16 | -} | 17 | + public function order_goods() |
18 | + { | ||
19 | + return $this->hasOne('App\Models\OrderGood','order_sn'); | ||
20 | + } | ||
21 | + | ||
22 | + /** | ||
23 | + * 预创建订单 | ||
24 | + * @param $member_id | ||
25 | + * @param $source | ||
26 | + */ | ||
27 | + public function build($member_id,$source) | ||
28 | + { | ||
29 | + // 获取商品信息 | ||
30 | + $membership = Membership::query()->where('id',$member_id)->first(); | ||
31 | + | ||
32 | + // 实付金额 = 商品金额 | ||
33 | + $pay_amount = $membership->price; | ||
34 | + | ||
35 | + // 创建订单 | ||
36 | + $order = new Order(); | ||
37 | + $order_sn = $this->get_sn('osn'); | ||
38 | + $order->order_sn = $order_sn; | ||
39 | + $order->user_id = Auth::user()->getAuthIdentifier(); | ||
40 | + $order->pay_amount = $pay_amount; | ||
41 | + $order->goods_amount = $membership->price; | ||
42 | + $order->status = 100; | ||
43 | + $order->source = $source; | ||
44 | + | ||
45 | + $order->save(); | ||
46 | + | ||
47 | + $order_good = new OrderGood(); | ||
48 | + $order_good->order_sn = $order_sn; | ||
49 | + $order_good->goods_id = $member_id; | ||
50 | + $order_good->goods_name = $membership->name; | ||
51 | + $order_good->goods_image = $membership->getSingleImg(); | ||
52 | + $order_good->goods_price = $membership->price; | ||
53 | + $order_good->goods_number = 1; | ||
54 | + | ||
55 | + $order_good->save(); | ||
56 | + | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * 获取SN唯一编号 | ||
61 | + * @param string $prefix | ||
62 | + * @return string | ||
63 | + */ | ||
64 | + public function get_sn($prefix = '') | ||
65 | + { | ||
66 | + $Sn = $prefix . strtoupper(dechex(date('m'))) . date('d') . substr(time(), -5) . substr(microtime(), 2, 5) . sprintf('%02d', rand(0, 99)); | ||
67 | + return $Sn; | ||
68 | + } | ||
69 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
app/Models/OrderGood.php
0 → 100755
... | @@ -2,7 +2,6 @@ | ... | @@ -2,7 +2,6 @@ |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | -use Illuminate\Contracts\Auth\MustVerifyEmail; | ||
6 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
7 | use Illuminate\Foundation\Auth\User as Authenticatable; | 6 | use Illuminate\Foundation\Auth\User as Authenticatable; |
8 | use Illuminate\Notifications\Notifiable; | 7 | use Illuminate\Notifications\Notifiable; |
... | @@ -18,9 +17,13 @@ class User extends Authenticatable | ... | @@ -18,9 +17,13 @@ class User extends Authenticatable |
18 | * @var array<int, string> | 17 | * @var array<int, string> |
19 | */ | 18 | */ |
20 | protected $fillable = [ | 19 | protected $fillable = [ |
21 | - 'name', | 20 | + 'nickname', |
22 | - 'email', | 21 | + 'mobile', |
23 | 'password', | 22 | 'password', |
23 | + 'avatar', | ||
24 | + 'gender', | ||
25 | + 'provider', | ||
26 | + 'provider_id', | ||
24 | ]; | 27 | ]; |
25 | 28 | ||
26 | /** | 29 | /** |
... | @@ -32,13 +35,4 @@ class User extends Authenticatable | ... | @@ -32,13 +35,4 @@ class User extends Authenticatable |
32 | 'password', | 35 | 'password', |
33 | 'remember_token', | 36 | 'remember_token', |
34 | ]; | 37 | ]; |
35 | - | ||
36 | - /** | ||
37 | - * The attributes that should be cast. | ||
38 | - * | ||
39 | - * @var array<string, string> | ||
40 | - */ | ||
41 | - protected $casts = [ | ||
42 | - 'email_verified_at' => 'datetime', | ||
43 | - ]; | ||
44 | } | 38 | } | ... | ... |
app/Models/UserProfile.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Models; | ||
4 | + | ||
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
6 | +use Dcat\Admin\Traits\HasDateTimeFormatter; | ||
7 | +use Illuminate\Database\Eloquent\Model; | ||
8 | + | ||
9 | +class UserProfile extends Model | ||
10 | +{ | ||
11 | + use HasFactory,HasDateTimeFormatter; | ||
12 | + | ||
13 | + protected $table = 'user_profiles'; | ||
14 | + | ||
15 | +} |
... | @@ -18,6 +18,13 @@ class EventServiceProvider extends ServiceProvider | ... | @@ -18,6 +18,13 @@ class EventServiceProvider extends ServiceProvider |
18 | Registered::class => [ | 18 | Registered::class => [ |
19 | SendEmailVerificationNotification::class, | 19 | SendEmailVerificationNotification::class, |
20 | ], | 20 | ], |
21 | + | ||
22 | + \SocialiteProviders\Manager\SocialiteWasCalled::class => [ | ||
23 | + // ... other providers | ||
24 | + \SocialiteProviders\Weixin\WeixinExtendSocialite::class.'@handle', | ||
25 | + \SocialiteProviders\Apple\AppleExtendSocialite::class.'@handle', | ||
26 | + | ||
27 | + ], | ||
21 | ]; | 28 | ]; |
22 | 29 | ||
23 | /** | 30 | /** | ... | ... |
... | @@ -15,7 +15,9 @@ | ... | @@ -15,7 +15,9 @@ |
15 | "laravel/framework": "^8.75", | 15 | "laravel/framework": "^8.75", |
16 | "laravel/sanctum": "^2.11", | 16 | "laravel/sanctum": "^2.11", |
17 | "laravel/socialite": "^5.2", | 17 | "laravel/socialite": "^5.2", |
18 | - "laravel/tinker": "^2.5" | 18 | + "laravel/tinker": "^2.5", |
19 | + "socialiteproviders/apple": "^5.0", | ||
20 | + "socialiteproviders/weixin": "^4.1" | ||
19 | }, | 21 | }, |
20 | "require-dev": { | 22 | "require-dev": { |
21 | "facade/ignition": "^2.5", | 23 | "facade/ignition": "^2.5", | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -175,6 +175,9 @@ return [ | ... | @@ -175,6 +175,9 @@ return [ |
175 | App\Providers\EventServiceProvider::class, | 175 | App\Providers\EventServiceProvider::class, |
176 | App\Providers\RouteServiceProvider::class, | 176 | App\Providers\RouteServiceProvider::class, |
177 | 177 | ||
178 | + // 社会化登录 | ||
179 | +// Laravel\Socialite\SocialiteServiceProvider::class, | ||
180 | + SocialiteProviders\Manager\ServiceProvider::class, | ||
178 | ], | 181 | ], |
179 | 182 | ||
180 | /* | 183 | /* |
... | @@ -230,6 +233,8 @@ return [ | ... | @@ -230,6 +233,8 @@ return [ |
230 | 'Validator' => Illuminate\Support\Facades\Validator::class, | 233 | 'Validator' => Illuminate\Support\Facades\Validator::class, |
231 | 'View' => Illuminate\Support\Facades\View::class, | 234 | 'View' => Illuminate\Support\Facades\View::class, |
232 | 235 | ||
236 | + // 社会化登录 | ||
237 | + 'Socialite' => Laravel\Socialite\Facades\Socialite::class, | ||
233 | ], | 238 | ], |
234 | 239 | ||
235 | ]; | 240 | ]; | ... | ... |
... | @@ -42,7 +42,7 @@ return [ | ... | @@ -42,7 +42,7 @@ return [ |
42 | ], | 42 | ], |
43 | 'api' => [ | 43 | 'api' => [ |
44 | 'driver' => 'token', | 44 | 'driver' => 'token', |
45 | - 'provider' => 'one_users', | 45 | + 'provider' => 'users', |
46 | ] | 46 | ] |
47 | ], | 47 | ], |
48 | 48 | ||
... | @@ -67,15 +67,6 @@ return [ | ... | @@ -67,15 +67,6 @@ return [ |
67 | 'users' => [ | 67 | 'users' => [ |
68 | 'driver' => 'eloquent', | 68 | 'driver' => 'eloquent', |
69 | 'model' => App\Models\User::class, | 69 | 'model' => App\Models\User::class, |
70 | - ], | ||
71 | - | ||
72 | - // 'users' => [ | ||
73 | - // 'driver' => 'database', | ||
74 | - // 'table' => 'users', | ||
75 | - // ], | ||
76 | - 'one_users' => [ | ||
77 | - 'driver' => 'eloquent', | ||
78 | - 'model' => App\Models\OneUser::class, | ||
79 | ] | 70 | ] |
80 | ], | 71 | ], |
81 | 72 | ... | ... |
... | @@ -30,4 +30,21 @@ return [ | ... | @@ -30,4 +30,21 @@ return [ |
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), | 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), |
31 | ], | 31 | ], |
32 | 32 | ||
33 | + 'github' => [ | ||
34 | + 'client_id' => env('GITHUB_APPID'), | ||
35 | + 'client_secret' => env('GITHUB_SECRET'), | ||
36 | + 'redirect' => env('GITHUB_REDIRECT'), | ||
37 | + ], | ||
38 | + | ||
39 | + 'weixin' => [ | ||
40 | + 'client_id' => env('WECHAT_APPID'), | ||
41 | + 'client_secret' => env('WECHAT_SECRET'), | ||
42 | + 'redirect' => env('WECHAT_REDIRECT'), | ||
43 | + ], | ||
44 | + 'apple' => [ | ||
45 | + 'client_id' => env('APPLE_CLIENT_ID'), | ||
46 | + 'client_secret' => env('APPLE_CLIENT_SECRET'), | ||
47 | + 'redirect' => env('APPLE_REDIRECT_URI') | ||
48 | + ], | ||
49 | + | ||
33 | ]; | 50 | ]; | ... | ... |
... | @@ -15,11 +15,14 @@ class CreateUsersTable extends Migration | ... | @@ -15,11 +15,14 @@ class CreateUsersTable extends Migration |
15 | { | 15 | { |
16 | Schema::create('users', function (Blueprint $table) { | 16 | Schema::create('users', function (Blueprint $table) { |
17 | $table->id(); | 17 | $table->id(); |
18 | - $table->string('name'); | 18 | + $table->string('nickname')->nullable()->comment('昵称'); |
19 | - $table->string('email')->unique(); | 19 | + $table->string('mobile')->unique()->nullable()->comment('手机号'); |
20 | - $table->timestamp('email_verified_at')->nullable(); | 20 | + $table->string('password')->default('')->comment('密码'); |
21 | - $table->string('password'); | 21 | + $table->string('avatar')->comment('头像'); |
22 | - $table->rememberToken(); | 22 | + $table->string('gender')->default('')->comment('性别'); |
23 | + $table->string('provider')->nullable()->comment('登录提供方'); | ||
24 | + $table->string('provider_id')->nullable()->comment('第三方用户ID'); | ||
25 | + $table->unsignedTinyInteger('state')->comment('状态'); | ||
23 | $table->timestamps(); | 26 | $table->timestamps(); |
24 | }); | 27 | }); |
25 | } | 28 | } | ... | ... |
... | @@ -15,16 +15,19 @@ class CreateMembershipTable extends Migration | ... | @@ -15,16 +15,19 @@ class CreateMembershipTable extends Migration |
15 | { | 15 | { |
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('title')->default('')->comment('标题'); |
19 | - $table->decimal('price')->comment('价格(分)'); | ||
20 | - $table->decimal('origin_price')->comment('原价(分)'); | ||
21 | - $table->integer('limit_days')->comment('有效天数'); | ||
22 | - $table->string('limit_unit')->comment('有效期单位'); | ||
23 | $table->string('intro')->default('')->comment('简介'); | 19 | $table->string('intro')->default('')->comment('简介'); |
24 | - $table->string('image')->default('')->comment('介绍图'); | 20 | + |
25 | - $table->unsignedTinyInteger('sale_term')->default('')->comment('上架终端'); | 21 | + $table->unsignedTinyInteger('bg_type')->default(0)->comment('背景类型,1=单图,2=轮播图,3=视频'); |
26 | - $table->unsignedTinyInteger('state')->comment('状态:1=售卖中'); | 22 | + |
27 | - $table->unsignedTinyInteger('sn')->comment('SN顺序'); | 23 | + $table->string('bg_images')->default('')->comment('介绍图'); |
24 | + $table->unsignedTinyInteger('is_video')->default(0)->comment('视频开关'); | ||
25 | + $table->string('video_url')->default('')->comment('视频地址'); | ||
26 | + $table->string('video_cover')->default('')->comment('视频封面'); | ||
27 | + | ||
28 | + $table->unsignedTinyInteger('terminal')->default(0)->comment('终端,1=Android,2=IOS'); | ||
29 | + $table->unsignedTinyInteger('state')->default(0)->comment('显示0=不显示,1=显示'); | ||
30 | + | ||
28 | $table->timestamps(); | 31 | $table->timestamps(); |
29 | }); | 32 | }); |
30 | } | 33 | } | ... | ... |
... | @@ -20,14 +20,12 @@ class CreateOrderTable extends Migration | ... | @@ -20,14 +20,12 @@ class CreateOrderTable extends Migration |
20 | $table->decimal('pay_amount')->comment('实付金额'); | 20 | $table->decimal('pay_amount')->comment('实付金额'); |
21 | $table->decimal('goods_amount')->comment('商品金额'); | 21 | $table->decimal('goods_amount')->comment('商品金额'); |
22 | $table->unsignedSmallInteger('status')->comment('订单状态:100待付款 101用户取消 102超时取消 103商户取消 201已付款 204已完成'); | 22 | $table->unsignedSmallInteger('status')->comment('订单状态:100待付款 101用户取消 102超时取消 103商户取消 201已付款 204已完成'); |
23 | - $table->timestamp('cancel_time')->comment('关闭时间'); | 23 | + $table->timestamp('cancel_time')->nullable()->comment('关闭时间'); |
24 | $table->string('source')->comment('来源'); | 24 | $table->string('source')->comment('来源'); |
25 | $table->string('pay_number')->default('')->comment('支付交易号'); | 25 | $table->string('pay_number')->default('')->comment('支付交易号'); |
26 | $table->string('pay_type')->default('')->comment('支付类型'); | 26 | $table->string('pay_type')->default('')->comment('支付类型'); |
27 | - $table->timestamp('pay_time')->comment('支付时间'); | 27 | + $table->timestamp('pay_time')->nullable()->comment('支付时间'); |
28 | $table->timestamps(); | 28 | $table->timestamps(); |
29 | - $table->softDeletes(); | ||
30 | - $table->unsignedTinyInteger('is_deleted')->comment('是否删除'); | ||
31 | }); | 29 | }); |
32 | } | 30 | } |
33 | 31 | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +use Illuminate\Database\Migrations\Migration; | ||
4 | +use Illuminate\Database\Schema\Blueprint; | ||
5 | +use Illuminate\Support\Facades\Schema; | ||
6 | + | ||
7 | +class CreateUserProfilesTable extends Migration | ||
8 | +{ | ||
9 | + /** | ||
10 | + * Run the migrations. | ||
11 | + * | ||
12 | + * @return void | ||
13 | + */ | ||
14 | + public function up() | ||
15 | + { | ||
16 | + Schema::create('user_profiles', function (Blueprint $table) { | ||
17 | + $table->id(); | ||
18 | + $table->string('unionid')->default('')->comment('唯一标识'); | ||
19 | + | ||
20 | + $table->string('last_visit_path')->default('')->comment('上次访问路径'); | ||
21 | + $table->timestamp('last_visit_time')->nullable()->comment('上次访问时间'); | ||
22 | + $table->string('registration_id')->default('')->comment('极光注册id'); | ||
23 | + $table->string('alias_id')->default('')->comment('极光推送别名'); | ||
24 | + | ||
25 | + | ||
26 | + $table->string('buy_number')->default(0)->comment('购买次数'); | ||
27 | + $table->string('buy_amount')->default(0)->comment('消费金额'); | ||
28 | + $table->timestamp('last_buy_time')->nullable()->comment('上次购买时间'); | ||
29 | + $table->timestamps(); | ||
30 | + }); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * Reverse the migrations. | ||
35 | + * | ||
36 | + * @return void | ||
37 | + */ | ||
38 | + public function down() | ||
39 | + { | ||
40 | + Schema::dropIfExists('user_profiles'); | ||
41 | + } | ||
42 | +} |
... | @@ -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 CreateOneUsersTable extends Migration | 7 | +class CreateOrderGoodsTable extends Migration |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * Run the migrations. | 10 | * Run the migrations. |
... | @@ -13,17 +13,14 @@ class CreateOneUsersTable extends Migration | ... | @@ -13,17 +13,14 @@ class CreateOneUsersTable extends Migration |
13 | */ | 13 | */ |
14 | public function up() | 14 | public function up() |
15 | { | 15 | { |
16 | - Schema::create('one_users', function (Blueprint $table) { | 16 | + Schema::create('order_goods', function (Blueprint $table) { |
17 | $table->increments('id'); | 17 | $table->increments('id'); |
18 | - $table->string('name')->default('')->comment('昵称'); | 18 | + $table->string('order_sn')->comment('订单编号'); |
19 | - $table->string('phone')->default('')->comment('手机号'); | 19 | + $table->unsignedInteger('goods_id')->comment('商品id'); |
20 | - $table->string('password')->default('')->comment('密码'); | 20 | + $table->string('goods_name')->default('')->comment('商品名称'); |
21 | - $table->text('avatar')->comment('头像'); | 21 | + $table->string('goods_image')->default('')->comment('商品封面'); |
22 | - $table->string('gender')->default('')->comment('性别'); | 22 | + $table->decimal('goods_price')->default('0.00')->comment('商品价格'); |
23 | - $table->string('remember_token')->nullable()->comment('认证令牌'); | 23 | + $table->unsignedInteger('goods_number')->default('0')->comment('商品数量'); |
24 | - $table->string('provider')->nullable()->comment('登录提供方'); | ||
25 | - $table->string('provider_id')->nullable()->comment('第三方用户ID'); | ||
26 | - $table->unsignedTinyInteger('state')->comment('状态'); | ||
27 | $table->timestamps(); | 24 | $table->timestamps(); |
28 | }); | 25 | }); |
29 | } | 26 | } |
... | @@ -35,6 +32,6 @@ class CreateOneUsersTable extends Migration | ... | @@ -35,6 +32,6 @@ class CreateOneUsersTable extends Migration |
35 | */ | 32 | */ |
36 | public function down() | 33 | public function down() |
37 | { | 34 | { |
38 | - Schema::dropIfExists('one_users'); | 35 | + Schema::dropIfExists('order_goods'); |
39 | } | 36 | } |
40 | } | 37 | } | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +use Illuminate\Support\Facades\Schema; | ||
4 | +use Illuminate\Database\Schema\Blueprint; | ||
5 | +use Illuminate\Database\Migrations\Migration; | ||
6 | + | ||
7 | +class CreateMembershipGoodsTable extends Migration | ||
8 | +{ | ||
9 | + /** | ||
10 | + * Run the migrations. | ||
11 | + * | ||
12 | + * @return void | ||
13 | + */ | ||
14 | + public function up() | ||
15 | + { | ||
16 | + Schema::create('membership_goods', function (Blueprint $table) { | ||
17 | + $table->increments('id'); | ||
18 | + $table->integer('membership_id')->comment('会员id'); | ||
19 | + $table->decimal('price')->comment('价格'); | ||
20 | + $table->decimal('line_price')->comment('划线价格'); | ||
21 | + $table->integer('limit_days')->comment('有效天数'); | ||
22 | + $table->string('limit_unit')->default('')->comment('有效期单位'); | ||
23 | + $table->unsignedTinyInteger('terminal')->comment('1=Android,2=IOS'); | ||
24 | + $table->unsignedTinyInteger('state')->comment('0=下架,1=售卖中'); | ||
25 | + $table->unsignedTinyInteger('sn')->comment('SN顺序'); | ||
26 | + $table->unsignedInteger('visits')->comment('访问量'); | ||
27 | + $table->unsignedInteger('virtual_sales')->comment('虚拟销售量'); | ||
28 | + $table->unsignedInteger('sales')->comment('销售量'); | ||
29 | + $table->unsignedInteger('stocks')->comment('库存数量'); | ||
30 | + $table->timestamps(); | ||
31 | + }); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Reverse the migrations. | ||
36 | + * | ||
37 | + * @return void | ||
38 | + */ | ||
39 | + public function down() | ||
40 | + { | ||
41 | + Schema::dropIfExists('membership_goods'); | ||
42 | + } | ||
43 | +} |
This diff is collapsed. Click to expand it.
resources/lang/zh_CN/membership-good.php
0 → 100755
1 | +<?php | ||
2 | +return [ | ||
3 | + 'labels' => [ | ||
4 | + 'MembershipGood' => 'MembershipGood', | ||
5 | + 'membership-good' => 'MembershipGood', | ||
6 | + ], | ||
7 | + 'fields' => [ | ||
8 | + 'price' => '价格', | ||
9 | + 'line_price' => '划线价格', | ||
10 | + 'limit_days' => '有效天数', | ||
11 | + 'limit_unit' => '有效期单位', | ||
12 | + 'sale_terminal' => '上架终端', | ||
13 | + 'state' => '状态', | ||
14 | + 'sn' => '顺序', | ||
15 | + 'visits' => '访问量', | ||
16 | + 'virtual_sales' => '虚拟销售量', | ||
17 | + 'sales' => '销售量', | ||
18 | + 'stocks' => '库存数量', | ||
19 | + ], | ||
20 | + 'options' => [ | ||
21 | + ], | ||
22 | +]; |
... | @@ -6,12 +6,27 @@ return [ | ... | @@ -6,12 +6,27 @@ return [ |
6 | ], | 6 | ], |
7 | 'fields' => [ | 7 | 'fields' => [ |
8 | 'name' => '会员名称', | 8 | 'name' => '会员名称', |
9 | - 'price' => '价格(分)', | ||
10 | 'origin_price' => '原价(分)', | 9 | 'origin_price' => '原价(分)', |
11 | 'limited_days' => '有效天数', | 10 | 'limited_days' => '有效天数', |
12 | 'intro' => '简介', | 11 | 'intro' => '简介', |
13 | 'state' => '状态', | 12 | 'state' => '状态', |
14 | - 'sn' => 'SN顺序', | 13 | + 'membership_id' => '会员id', |
14 | + 'price' => '价格', | ||
15 | + 'line_price' => '划线价格', | ||
16 | + 'limit_days' => '有效天数', | ||
17 | + 'limit_unit' => '有效期单位', | ||
18 | + 'terminal' => '上架终端', | ||
19 | + 'sn' => '顺序', | ||
20 | + 'visits' => '访问量', | ||
21 | + 'virtual_sales' => '虚拟销售量', | ||
22 | + 'sales' => '销售量', | ||
23 | + 'stocks' => '库存数量', | ||
24 | + 'title' => '标题', | ||
25 | + 'bg_type' => '背景类型', | ||
26 | + 'bg_images' => '背景图', | ||
27 | + 'video_url' => '视频', | ||
28 | + 'video_cover' => '视频封面', | ||
29 | + 'is_bind_old' => '是否新增', | ||
15 | ], | 30 | ], |
16 | 'options' => [ | 31 | 'options' => [ |
17 | ], | 32 | ], | ... | ... |
resources/lang/zh_CN/order-good.php
0 → 100755
1 | +<?php | ||
2 | +return [ | ||
3 | + 'labels' => [ | ||
4 | + 'OrderGood' => 'OrderGood', | ||
5 | + 'order-good' => 'OrderGood', | ||
6 | + ], | ||
7 | + 'fields' => [ | ||
8 | + 'order_sn' => '订单编号', | ||
9 | + 'goods_id' => '商品id', | ||
10 | + 'goods_name' => '商品名称', | ||
11 | + 'goods_image' => '商品封面', | ||
12 | + 'goods_price' => '商品价格', | ||
13 | + 'goods_number' => '商品数量', | ||
14 | + 'after_sales' => '后续', | ||
15 | + ], | ||
16 | + 'options' => [ | ||
17 | + ], | ||
18 | +]; |
... | @@ -7,6 +7,11 @@ return [ | ... | @@ -7,6 +7,11 @@ return [ |
7 | 'fields' => [ | 7 | 'fields' => [ |
8 | 'pick_id' => '一言id', | 8 | 'pick_id' => '一言id', |
9 | 'verse_id' => '重新打包的诗句(节)id', | 9 | 'verse_id' => '重新打包的诗句(节)id', |
10 | + 'plant' => '平台', | ||
11 | + 'title' => '标题', | ||
12 | + 'content' => '内容', | ||
13 | + 'action_type' => '点击后打开', | ||
14 | + 'user_id' => '用户id' | ||
10 | ], | 15 | ], |
11 | 'options' => [ | 16 | 'options' => [ |
12 | ], | 17 | ], | ... | ... |
resources/lang/zh_CN/validation.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + | ||
5 | + /* | ||
6 | + |-------------------------------------------------------------------------- | ||
7 | + | Validation Language Lines | ||
8 | + |-------------------------------------------------------------------------- | ||
9 | + | | ||
10 | + | The following language lines contain the default error messages used by | ||
11 | + | the validator class. Some of these rules have multiple versions such | ||
12 | + | as the size rules. Feel free to tweak each of these messages here. | ||
13 | + | | ||
14 | + */ | ||
15 | + | ||
16 | + 'accepted' => 'The :attribute must be accepted.', | ||
17 | + 'active_url' => 'The :attribute is not a valid URL.', | ||
18 | + 'after' => 'The :attribute must be a date after :date.', | ||
19 | + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', | ||
20 | + 'alpha' => 'The :attribute may only contain letters.', | ||
21 | + 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', | ||
22 | + 'alpha_num' => 'The :attribute may only contain letters and numbers.', | ||
23 | + 'array' => '参数 :attribute 必须是一个数组.', | ||
24 | + 'before' => 'The :attribute must be a date before :date.', | ||
25 | + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', | ||
26 | + 'between' => [ | ||
27 | + 'numeric' => 'The :attribute must be between :min and :max.', | ||
28 | + 'file' => 'The :attribute must be between :min and :max kilobytes.', | ||
29 | + 'string' => 'The :attribute must be between :min and :max characters.', | ||
30 | + 'array' => 'The :attribute must have between :min and :max items.', | ||
31 | + ], | ||
32 | + 'boolean' => 'The :attribute field must be true or false.', | ||
33 | + 'confirmed' => '参数 :attribute 确认不匹配.', | ||
34 | + 'date' => 'The :attribute is not a valid date.', | ||
35 | + 'date_equals' => 'The :attribute must be a date equal to :date.', | ||
36 | + 'date_format' => 'The :attribute does not match the format :format.', | ||
37 | + 'different' => 'The :attribute and :other must be different.', | ||
38 | + 'digits' => 'The :attribute must be :digits digits.', | ||
39 | + 'digits_between' => 'The :attribute must be between :min and :max digits.', | ||
40 | + 'dimensions' => 'The :attribute has invalid image dimensions.', | ||
41 | + 'distinct' => 'The :attribute field has a duplicate value.', | ||
42 | + 'email' => 'The :attribute must be a valid email address.', | ||
43 | + 'ends_with' => 'The :attribute must end with one of the following: :values.', | ||
44 | + 'exists' => 'The selected :attribute is invalid.', | ||
45 | + 'file' => 'The :attribute must be a file.', | ||
46 | + 'filled' => 'The :attribute field must have a value.', | ||
47 | + 'gt' => [ | ||
48 | + 'numeric' => 'The :attribute must be greater than :value.', | ||
49 | + 'file' => 'The :attribute must be greater than :value kilobytes.', | ||
50 | + 'string' => 'The :attribute must be greater than :value characters.', | ||
51 | + 'array' => 'The :attribute must have more than :value items.', | ||
52 | + ], | ||
53 | + 'gte' => [ | ||
54 | + 'numeric' => 'The :attribute must be greater than or equal :value.', | ||
55 | + 'file' => 'The :attribute must be greater than or equal :value kilobytes.', | ||
56 | + 'string' => 'The :attribute must be greater than or equal :value characters.', | ||
57 | + 'array' => 'The :attribute must have :value items or more.', | ||
58 | + ], | ||
59 | + 'image' => 'The :attribute must be an image.', | ||
60 | + 'in' => 'The selected :attribute is invalid.', | ||
61 | + 'in_array' => 'The :attribute field does not exist in :other.', | ||
62 | + 'integer' => '参数 :attribute 必须是一个整形.', | ||
63 | + 'ip' => 'The :attribute must be a valid IP address.', | ||
64 | + 'ipv4' => 'The :attribute must be a valid IPv4 address.', | ||
65 | + 'ipv6' => 'The :attribute must be a valid IPv6 address.', | ||
66 | + 'json' => 'The :attribute must be a valid JSON string.', | ||
67 | + 'lt' => [ | ||
68 | + 'numeric' => 'The :attribute must be less than :value.', | ||
69 | + 'file' => 'The :attribute must be less than :value kilobytes.', | ||
70 | + 'string' => 'The :attribute must be less than :value characters.', | ||
71 | + 'array' => 'The :attribute must have less than :value items.', | ||
72 | + ], | ||
73 | + 'lte' => [ | ||
74 | + 'numeric' => 'The :attribute must be less than or equal :value.', | ||
75 | + 'file' => 'The :attribute must be less than or equal :value kilobytes.', | ||
76 | + 'string' => 'The :attribute must be less than or equal :value characters.', | ||
77 | + 'array' => 'The :attribute must not have more than :value items.', | ||
78 | + ], | ||
79 | + 'max' => [ | ||
80 | + 'numeric' => 'The :attribute may not be greater than :max.', | ||
81 | + 'file' => 'The :attribute may not be greater than :max kilobytes.', | ||
82 | + 'string' => '参数 :attribute 最大长度不可超过 :max 个字符.', | ||
83 | + 'array' => 'The :attribute may not have more than :max items.', | ||
84 | + ], | ||
85 | + 'mimes' => 'The :attribute must be a file of type: :values.', | ||
86 | + 'mimetypes' => 'The :attribute must be a file of type: :values.', | ||
87 | + 'min' => [ | ||
88 | + 'numeric' => 'The :attribute must be at least :min.', | ||
89 | + 'file' => 'The :attribute must be at least :min kilobytes.', | ||
90 | + 'string' => '参数 :attribute 必须至少满足 :min 个字符.', | ||
91 | + 'array' => 'The :attribute must have at least :min items.', | ||
92 | + ], | ||
93 | + 'multiple_of' => 'The :attribute must be a multiple of :value.', | ||
94 | + 'not_in' => 'The selected :attribute is invalid.', | ||
95 | + 'not_regex' => 'The :attribute format is invalid.', | ||
96 | + 'numeric' => 'The :attribute must be a number.', | ||
97 | + 'password' => 'The password is incorrect.', | ||
98 | + 'present' => 'The :attribute field must be present.', | ||
99 | + 'regex' => 'The :attribute format is invalid.', | ||
100 | + 'required' => '参数 :attribute 字段是必选项.', | ||
101 | + 'required_if' => 'The :attribute field is required when :other is :value.', | ||
102 | + 'required_unless' => 'The :attribute field is required unless :other is in :values.', | ||
103 | + 'required_with' => 'The :attribute field is required when :values is present.', | ||
104 | + 'required_with_all' => 'The :attribute field is required when :values are present.', | ||
105 | + 'required_without' => 'The :attribute field is required when :values is not present.', | ||
106 | + 'required_without_all' => 'The :attribute field is required when none of :values are present.', | ||
107 | + 'same' => '参数 :attribute 和 :other 必须一致.', | ||
108 | + 'size' => [ | ||
109 | + 'numeric' => 'The :attribute must be :size.', | ||
110 | + 'file' => 'The :attribute must be :size kilobytes.', | ||
111 | + 'string' => 'The :attribute must be :size characters.', | ||
112 | + 'array' => 'The :attribute must contain :size items.', | ||
113 | + ], | ||
114 | + 'starts_with' => 'The :attribute must start with one of the following: :values.', | ||
115 | + 'string' => '参数 :attribute 必须是一个字符串.', | ||
116 | + 'timezone' => 'The :attribute must be a valid zone.', | ||
117 | + 'unique' => 'The :attribute has already been taken.', | ||
118 | + 'uploaded' => 'The :attribute failed to upload.', | ||
119 | + 'url' => 'The :attribute format is invalid.', | ||
120 | + 'uuid' => 'The :attribute must be a valid UUID.', | ||
121 | + | ||
122 | + /* | ||
123 | + |-------------------------------------------------------------------------- | ||
124 | + | Custom Validation Language Lines | ||
125 | + |-------------------------------------------------------------------------- | ||
126 | + | | ||
127 | + | Here you may specify custom validation messages for attributes using the | ||
128 | + | convention "attribute.rule" to name the lines. This makes it quick to | ||
129 | + | specify a specific custom language line for a given attribute rule. | ||
130 | + | | ||
131 | + */ | ||
132 | + | ||
133 | + 'custom' => [ | ||
134 | + 'attribute-name' => [ | ||
135 | + 'rule-name' => 'custom-message', | ||
136 | + ], | ||
137 | + ], | ||
138 | + | ||
139 | + /* | ||
140 | + |-------------------------------------------------------------------------- | ||
141 | + | Custom Validation Attributes | ||
142 | + |-------------------------------------------------------------------------- | ||
143 | + | | ||
144 | + | The following language lines are used to swap our attribute placeholder | ||
145 | + | with something more reader friendly such as "E-Mail Address" instead | ||
146 | + | of "email". This simply helps us make our message more expressive. | ||
147 | + | | ||
148 | + */ | ||
149 | + | ||
150 | + 'attributes' => [], | ||
151 | + | ||
152 | +]; |
1 | <style> | 1 | <style> |
2 | .box-card { | 2 | .box-card { |
3 | - width: 380px; | 3 | + width: 400px; |
4 | border: 1px solid rgb(220, 223, 230); | 4 | border: 1px solid rgb(220, 223, 230); |
5 | border-radius: 40px; | 5 | border-radius: 40px; |
6 | margin-right: 24px; | 6 | margin-right: 24px; |
... | @@ -26,21 +26,21 @@ | ... | @@ -26,21 +26,21 @@ |
26 | 26 | ||
27 | .notification-app-name{ | 27 | .notification-app-name{ |
28 | width: 160px; | 28 | width: 160px; |
29 | - font-size: 12px; | 29 | + font-size: 13px; |
30 | top: 222px; | 30 | top: 222px; |
31 | - left: 90px; | 31 | + left: 92px; |
32 | } | 32 | } |
33 | .notification-title{ | 33 | .notification-title{ |
34 | width: 210px; | 34 | width: 210px; |
35 | font-size: 14px; | 35 | font-size: 14px; |
36 | top: 242px; | 36 | top: 242px; |
37 | - left: 65px; | 37 | + left: 67px; |
38 | } | 38 | } |
39 | .notification-detail{ | 39 | .notification-detail{ |
40 | - width: 210px; | 40 | + width: 230px; |
41 | font-size: 13px; | 41 | font-size: 13px; |
42 | top: 265px; | 42 | top: 265px; |
43 | - left: 65px; | 43 | + left: 67px; |
44 | word-break: break-all; | 44 | word-break: break-all; |
45 | white-space: nowrap; | 45 | white-space: nowrap; |
46 | text-overflow: ellipsis; | 46 | text-overflow: ellipsis; |
... | @@ -50,9 +50,9 @@ | ... | @@ -50,9 +50,9 @@ |
50 | <hr> | 50 | <hr> |
51 | <div class="box-card"> | 51 | <div class="box-card"> |
52 | <div class="phone-content"> | 52 | <div class="phone-content"> |
53 | - <img src="{{asset('storage/image/ios1-2.png')}}" alt="" width="338" height="625" id="bg_img"> | 53 | + <img src="{{asset('storage/image/ios1-2.png')}}" alt="" width="358" height="625" id="bg_img"> |
54 | <div class="notification-app-name"> 一言-临境 </div> | 54 | <div class="notification-app-name"> 一言-临境 </div> |
55 | - <div class="notification-title"> demo 标题 </div> | 55 | + <div class="notification-title"> Demo 标题 </div> |
56 | <div class="notification-detail"> 开发者249d42a097c1944e进行了广播推送,这是一条广播 </div> | 56 | <div class="notification-detail"> 开发者249d42a097c1944e进行了广播推送,这是一条广播 </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
... | @@ -66,13 +66,21 @@ | ... | @@ -66,13 +66,21 @@ |
66 | if (plant === 1) { | 66 | if (plant === 1) { |
67 | $('#bg_img').attr('src', asset + '/image/android-2.png'); | 67 | $('#bg_img').attr('src', asset + '/image/android-2.png'); |
68 | $('.notification-app-name').css('top','244px').css('left','80px'); | 68 | $('.notification-app-name').css('top','244px').css('left','80px'); |
69 | - $('.notification-title').css('top','264px').css('left','55px'); | 69 | + $('.notification-title').css('top','264px').css('left','57px'); |
70 | - $('.notification-detail').css('top','287px').css('left','55px'); | 70 | + $('.notification-detail').css('top','287px').css('left','57px'); |
71 | }else{ | 71 | }else{ |
72 | $('#bg_img').attr('src', asset + '/image/ios1-2.png'); | 72 | $('#bg_img').attr('src', asset + '/image/ios1-2.png'); |
73 | - $('.notification-app-name').css('top','222px').css('left','90px'); | 73 | + $('.notification-app-name').css('top','222px').css('left','92px'); |
74 | - $('.notification-title').css('top','242px').css('left','65px'); | 74 | + $('.notification-title').css('top','242px').css('left','67px'); |
75 | - $('.notification-detail').css('top','265px').css('left','65px'); | 75 | + $('.notification-detail').css('top','265px').css('left','67px'); |
76 | + } | ||
77 | + | ||
78 | + if ($('.title').val()) { | ||
79 | + $('.notification-title').html($('.title').val()); | ||
80 | + } | ||
81 | + | ||
82 | + if ($('.push_content').val()) { | ||
83 | + $('.notification-detail').html($('.push_content').val()); | ||
76 | } | 84 | } |
77 | 85 | ||
78 | 86 | ... | ... |
... | @@ -14,8 +14,17 @@ use Illuminate\Routing\Router; | ... | @@ -14,8 +14,17 @@ use Illuminate\Routing\Router; |
14 | | | 14 | | |
15 | */ | 15 | */ |
16 | 16 | ||
17 | -//Route::prefix('v1')->middleware('auth:sanctum')->group(function ($api){ | 17 | +Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Router $api){ |
18 | + | ||
19 | + /** web用户跳转登录*/ | ||
20 | + $api->get('auth/{service}', 'AuthController@redirectToProvider'); | ||
21 | + $api->get('auth/{service}/callback', 'AuthController@handleProviderCallback'); | ||
22 | + | ||
23 | + /** 移动端微信用户登录*/ | ||
24 | + $api->get('login/{service}/callback', 'AuthController@apiHandleProviderCallback'); | ||
25 | +}); | ||
18 | 26 | ||
27 | +//Route::prefix('v1')->middleware('auth:sanctum')->group(function ($api){ | ||
19 | Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Router $api) { | 28 | Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Router $api) { |
20 | 29 | ||
21 | /**首页*/ | 30 | /**首页*/ |
... | @@ -24,5 +33,6 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route | ... | @@ -24,5 +33,6 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route |
24 | /** 临境 */ | 33 | /** 临境 */ |
25 | $api->apiResource('/immersive', 'ImmerseController'); | 34 | $api->apiResource('/immersive', 'ImmerseController'); |
26 | 35 | ||
27 | - | 36 | + /** 创建订单 */ |
37 | + $api->apiResource('/order', 'OrderController'); | ||
28 | }); | 38 | }); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment