From ca66b1d5997009c9a9260033d56e002dbe50d2e4 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 7 Apr 2022 10:49:11 +0800 Subject: [PATCH 01/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ArticleCategoryController.php | 7 +++ .../Http/Controllers/ArticleController.php | 46 ++++++++++++++++++- .../Resources/ArticleCategoryResource.php | 23 ++++++++++ app/Endpoint/Api/routes.php | 2 + ..._add_cover_to_article_categories_table.php | 34 ++++++++++++++ resources/lang/zh_CN/article-category.php | 1 + 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 app/Endpoint/Api/Http/Resources/ArticleCategoryResource.php create mode 100644 database/migrations/2022_04_07_100309_add_cover_to_article_categories_table.php diff --git a/app/Admin/Controllers/ArticleCategoryController.php b/app/Admin/Controllers/ArticleCategoryController.php index 7747f6bc..d370b766 100644 --- a/app/Admin/Controllers/ArticleCategoryController.php +++ b/app/Admin/Controllers/ArticleCategoryController.php @@ -7,6 +7,7 @@ use App\Admin\Repositories\ArticleCategory; use App\Exceptions\BizException; use App\Models\Article; use App\Models\ArticleCategory as ArticleCategoryModel; +use Carbon\Carbon; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; @@ -26,6 +27,7 @@ class ArticleCategoryController extends AdminController return Grid::make(new ArticleCategoryModel(), function (Grid $grid) { $grid->column('id')->sortable(); $grid->column('name')->tree(); + $grid->column('cover')->image(100, 100); $grid->column('is_show') ->if(function () { return Admin::user()->can('dcat.admin.article_categories.edit'); @@ -110,6 +112,11 @@ class ArticleCategoryController extends AdminController $form->display('id'); $form->select('parent_id')->options(ArticleCategoryModel::selectOptions()); $form->text('name')->required(); + $form->image('cover') + ->move('article-category/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload()->retainable(); $form->switch('is_show'); $form->switch('is_recommend'); $form->number('sort')->min(0)->default(0); diff --git a/app/Endpoint/Api/Http/Controllers/ArticleController.php b/app/Endpoint/Api/Http/Controllers/ArticleController.php index 44edf8d0..15c72299 100644 --- a/app/Endpoint/Api/Http/Controllers/ArticleController.php +++ b/app/Endpoint/Api/Http/Controllers/ArticleController.php @@ -2,11 +2,13 @@ namespace App\Endpoint\Api\Http\Controllers; +use App\Endpoint\Api\Http\Resources\ArticleCategoryResource; use App\Endpoint\Api\Http\Resources\ArticleResource; use App\Endpoint\Api\Http\Resources\ArticleSimpleResource; use App\Exceptions\BizException; use App\Helpers\Paginator as PaginatorHelper; use App\Models\Article; +use App\Models\ArticleCategory; use App\Models\ArticleLikesLog; use App\Models\ArticlePointsLog; use App\Models\PointsLog; @@ -50,7 +52,49 @@ class ArticleController extends Controller ], $cate); $query = Article::query()->with(['likesInfo'=>function ($q) use ($request) { $user_id = $request->user()?->id; - return $q->where('user_id', $user_id??0); + return $q->where('user_id', $user_id ?? 0); + }])->where('is_show', 1); + if ($categoryId) { + $query->where('category_id', $categoryId); + } + if ($key) { + $query->where('title', 'like', '%'.$key.'%'); + } + + $query->orderBy('is_recommend', 'desc'); + $query->orderBy('sort', 'desc'); + $query->orderBy('created_at', 'desc'); + + $list = $query->simplePaginate(PaginatorHelper::resolvePerPage('per_page', 20, 50)); + return ArticleSimpleResource::collection($list); + } + + public function healthCategory(Request $request) + { + $key = (string) $request->query('key'); + $categoryId = app_settings('app.article_health'); + $query = ArticleCategory::query()->where('parent_id', $categoryId)->where('is_show', 1); + + if ($key) { + $query->where('name', 'like', '%'.$key.'%'); + } + + $query->orderBy('is_recommend', 'desc'); + $query->orderBy('sort', 'desc'); + $query->orderBy('created_at', 'desc'); + + $categories = $query->get(); + + return ArticleCategoryResource::collection($categories); + } + + public function articleList($id, Request $request) + { + $key = (string) $request->query('key'); + $categoryId = $id; + $query = Article::query()->with(['likesInfo'=>function ($q) use ($request) { + $user_id = $request->user()?->id; + return $q->where('user_id', $user_id ?? 0); }])->where('is_show', 1); if ($categoryId) { $query->where('category_id', $categoryId); diff --git a/app/Endpoint/Api/Http/Resources/ArticleCategoryResource.php b/app/Endpoint/Api/Http/Resources/ArticleCategoryResource.php new file mode 100644 index 00000000..f8e8b4bc --- /dev/null +++ b/app/Endpoint/Api/Http/Resources/ArticleCategoryResource.php @@ -0,0 +1,23 @@ + $this->id, + 'name' => $this->name, + 'cover' => $this->cover ?? '', + ]; + } +} diff --git a/app/Endpoint/Api/routes.php b/app/Endpoint/Api/routes.php index ebb68180..7990b2b6 100644 --- a/app/Endpoint/Api/routes.php +++ b/app/Endpoint/Api/routes.php @@ -75,6 +75,8 @@ Route::group([ Route::get('product/search-hot-keys', [ProductSkuController::class, 'searchHotKeys']); //文章列表 Route::get('articles', [ArticleController::class, 'index']); + Route::get('articles/health-category', [ArticleController::class, 'healthCategory']); + Route::get('articles/by-category/{category}', [ArticleController::class, 'articleList']); //指定文章配置 Route::get('article-config', [ArticleController::class, 'config']); diff --git a/database/migrations/2022_04_07_100309_add_cover_to_article_categories_table.php b/database/migrations/2022_04_07_100309_add_cover_to_article_categories_table.php new file mode 100644 index 00000000..7ce1afbe --- /dev/null +++ b/database/migrations/2022_04_07_100309_add_cover_to_article_categories_table.php @@ -0,0 +1,34 @@ +string('cover')->nullable()->comment('封面图'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('article_categories', function (Blueprint $table) { + // + $table->dropColumn(['cover']); + }); + } +} diff --git a/resources/lang/zh_CN/article-category.php b/resources/lang/zh_CN/article-category.php index c6243a57..bbde1ff0 100644 --- a/resources/lang/zh_CN/article-category.php +++ b/resources/lang/zh_CN/article-category.php @@ -7,6 +7,7 @@ return [ ], 'fields' => [ 'name' => '名称', + 'cover' => '封面图', 'parent_id' => '父级', 'is_show' => '显示', 'is_recommend' => '推荐', From 5d563592edbf766d1564f50e2082d8110f93abbe Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 11:28:33 +0800 Subject: [PATCH 02/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=84=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/BargainActivity.php | 11 ++++++ app/Models/BargainOrder.php | 11 ++++++ app/Models/BargainOrderLog.php | 11 ++++++ app/Models/BargainSku.php | 13 +++++++ ...110305_create_bargain_activities_table.php | 39 +++++++++++++++++++ ..._06_110958_create_bargain_orders_table.php | 37 ++++++++++++++++++ ...04_06_111642_create_bargain_skus_table.php | 33 ++++++++++++++++ ..._06_112225_add_bargain_to_orders_table.php | 35 +++++++++++++++++ ...112539_create_bargain_order_logs_table.php | 34 ++++++++++++++++ 9 files changed, 224 insertions(+) create mode 100644 app/Models/BargainActivity.php create mode 100644 app/Models/BargainOrder.php create mode 100644 app/Models/BargainOrderLog.php create mode 100644 app/Models/BargainSku.php create mode 100644 database/migrations/2022_04_06_110305_create_bargain_activities_table.php create mode 100644 database/migrations/2022_04_06_110958_create_bargain_orders_table.php create mode 100644 database/migrations/2022_04_06_111642_create_bargain_skus_table.php create mode 100644 database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php create mode 100644 database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php diff --git a/app/Models/BargainActivity.php b/app/Models/BargainActivity.php new file mode 100644 index 00000000..85a36932 --- /dev/null +++ b/app/Models/BargainActivity.php @@ -0,0 +1,11 @@ +id(); + $table->string('name')->comment('活动名称'); + $table->text('description')->nullable()->comment('活动描述'); + $table->boolean('is_enable')->nullable()->comment('是否开启'); + $table->text('rules')->nullable()->comment('砍价规则'); + $table->unsignedInteger('times')->default(0)->comment('有效刀,0为不限'); + $table->unsignedInteger('expire_hours')->default(0)->comment('过期小时'); + $table->timestamp('start_at')->nullable()->comment('开始时间'); + $table->timestamp('end_at')->nullable()->comment('结束时间'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_activities'); + } +} diff --git a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php new file mode 100644 index 00000000..0160114b --- /dev/null +++ b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('activity_id')->comment('参与活动ID'); + $table->unsignedBigInteger('user_id')->comment('发起用户ID'); + $table->unsignedBigInteger('sku_id')->comment('砍价商品'); + $table->boolean('status')->default(false)->comment('状态:0未砍完,1已砍完'); + $table->timestamp('expire_at')->nullable()->comment('过期时间'); + $table->string('remark')->nullable()->comment('备注'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_orders'); + } +} diff --git a/database/migrations/2022_04_06_111642_create_bargain_skus_table.php b/database/migrations/2022_04_06_111642_create_bargain_skus_table.php new file mode 100644 index 00000000..26977b0d --- /dev/null +++ b/database/migrations/2022_04_06_111642_create_bargain_skus_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('activity_id')->comment('活动ID'); + $table->unsignedBigInteger('sku_id')->comment('商品ID'); + // $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_skus'); + } +} diff --git a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php new file mode 100644 index 00000000..227b692f --- /dev/null +++ b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php @@ -0,0 +1,35 @@ +unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); + $table->unsignedBigInteger('bargain_order_id')->nullable()->comment('关联砍价单ID'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('orders', function (Blueprint $table) { + // + $table->dropColumn(['bargain_amount', 'bargain_order_id']); + }); + } +} diff --git a/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php b/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php new file mode 100644 index 00000000..bc71a827 --- /dev/null +++ b/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php @@ -0,0 +1,34 @@ +id(); + $table->unsignedBigInteger('order_id')->comment('订单ID'); + $table->unsignedBigInteger('user_id')->comment('用户ID'); + $table->unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_order_logs'); + } +} From 3a8ac3123c361a64cab3808df2607d6a69df682d Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 11:54:15 +0800 Subject: [PATCH 03/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_04_06_110958_create_bargain_orders_table.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php index 0160114b..49e19429 100644 --- a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php +++ b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php @@ -18,8 +18,11 @@ class CreateBargainOrdersTable extends Migration $table->unsignedBigInteger('activity_id')->comment('参与活动ID'); $table->unsignedBigInteger('user_id')->comment('发起用户ID'); $table->unsignedBigInteger('sku_id')->comment('砍价商品'); - $table->boolean('status')->default(false)->comment('状态:0未砍完,1已砍完'); + $table->unsignedBigInteger('sku_price')->default(0)->comment('原价:分'); + $table->unsignedBigInteger('bargain_price')->default(0)->comment('已砍价格:分'); + $table->boolean('status')->default(false)->comment('状态:0未开始,1已开始,2已完成'); $table->timestamp('expire_at')->nullable()->comment('过期时间'); + $table->unsignedBigInteger('order_id')->nullable()->comment('下单支付ID'); $table->string('remark')->nullable()->comment('备注'); $table->timestamps(); }); From 2a680ab50f2a5391361f90da77419f3f6a0e7a08 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 13:53:42 +0800 Subject: [PATCH 04/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=BF=81=E7=A7=BBstatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_04_06_110958_create_bargain_orders_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php index 49e19429..e8d8c16b 100644 --- a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php +++ b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php @@ -20,7 +20,7 @@ class CreateBargainOrdersTable extends Migration $table->unsignedBigInteger('sku_id')->comment('砍价商品'); $table->unsignedBigInteger('sku_price')->default(0)->comment('原价:分'); $table->unsignedBigInteger('bargain_price')->default(0)->comment('已砍价格:分'); - $table->boolean('status')->default(false)->comment('状态:0未开始,1已开始,2已完成'); + $table->unsignedTinyInteger('status')->default(0)->comment('状态:0未开始,1已开始,2已完成'); $table->timestamp('expire_at')->nullable()->comment('过期时间'); $table->unsignedBigInteger('order_id')->nullable()->comment('下单支付ID'); $table->string('remark')->nullable()->comment('备注'); From 4c7f65ad91305c131990bec42e1b618a4c9d3594 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 14:02:35 +0800 Subject: [PATCH 05/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=85=B3=E8=81=94=E7=A0=8D=E4=BB=B7=E5=8D=95?= =?UTF-8?q?ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_04_06_112225_add_bargain_to_orders_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php index 227b692f..31b56789 100644 --- a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php +++ b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php @@ -16,7 +16,7 @@ class AddBargainToOrdersTable extends Migration Schema::table('orders', function (Blueprint $table) { // $table->unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); - $table->unsignedBigInteger('bargain_order_id')->nullable()->comment('关联砍价单ID'); + // $table->unsignedBigInteger('bargain_order_id')->nullable()->comment('关联砍价单ID'); }); } From a76160ce0d6f1929d32a852f5cde8a84e8151c6c Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 17:52:45 +0800 Subject: [PATCH 06/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainActivityController.php | 177 +++++++++++++++ app/Admin/Repositories/BargainActivity.php | 16 ++ app/Admin/routes.php | 3 + .../Controllers/BargainActivityController.php | 23 ++ app/Endpoint/Api/routes.php | 2 + app/Models/BargainActivity.php | 22 ++ ...110305_create_bargain_activities_table.php | 1 + dcat_admin_ide_helper.php | 205 +++++++++++------- resources/lang/zh_CN/bargain-activity.php | 22 ++ 9 files changed, 391 insertions(+), 80 deletions(-) create mode 100644 app/Admin/Controllers/BargainActivityController.php create mode 100644 app/Admin/Repositories/BargainActivity.php create mode 100644 app/Endpoint/Api/Http/Controllers/BargainActivityController.php create mode 100644 resources/lang/zh_CN/bargain-activity.php diff --git a/app/Admin/Controllers/BargainActivityController.php b/app/Admin/Controllers/BargainActivityController.php new file mode 100644 index 00000000..5d0b93eb --- /dev/null +++ b/app/Admin/Controllers/BargainActivityController.php @@ -0,0 +1,177 @@ +column('id')->sortable(); + $grid->column('name'); + // $grid->column('description'); + $grid->column('is_enable') + ->if(function () { + return Admin::user()->can('dcat.admin.bargain_activities.edit'); + }) + ->then(function (Column $column) { + $column->switch(); + }) + ->else(function (Column $column) { + $column->bool(); + }); + // $grid->column('rules'); + $grid->column('times'); + // $grid->column('expire_hours'); + $grid->column('start_at'); + $grid->column('end_at'); + $grid->column('created_at'); + $grid->column('updated_at')->sortable(); + + //新增 + if (Admin::user()->can('dcat.admin.bargain_activities.create')) { + $grid->disableCreateButton(false); + // $grid->enableDialogCreate(); + } + + $grid->actions(function (Grid\Displayers\Actions $actions) { + $actions->disableView(Admin::user()->cannot('dcat.admin.bargain_activities.show')); + $actions->disableDelete(Admin::user()->cannot('dcat.admin.bargain_activities.destroy')); + //修改 + $actions->disableEdit(Admin::user()->cannot('dcat.admin.bargain_activities.edit')); + }); + + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + $filter->like('name')->width(3); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return function (Row $row) use ($id) { + $activity = BargainActivityModel::with(['skus'])->findOrFail($id); + $row->column(6, function ($column) use ($activity) { + $column->row(Show::make($activity, function (Show $show) use ($activity) { + $show->panel() + ->tools(function ($tools) { + $tools->disableEdit(Admin::user()->cannot('dcat.admin.bargain_activities.edit')); + // $tools->disableList(); + $tools->disableDelete(Admin::user()->cannot('dcat.admin.bargain_activities.destroy')); + }); + $show->row(function (Show\Row $show) use ($activity) { + $show->field('id')->width(10, 1); + $show->field('name')->width(10, 1); + $show->field('is_enable')->using([0=>'未开启', '已开启'])->dot([ + '0'=>'#b3b9bf', + '1'=>'success', + ])->width(10, 1); + $show->width(6)->field('start_at'); + $show->width(6)->field('end_at'); + $show->width(6)->field('times')->append('刀'); + $show->width(6)->field('expire_hours')->append('h'); + + $show->width(12)->field('skus')->width(10, 1)->as(function ($value) { + return array_column($value, 'name'); + })->label(); + + $show->field('description')->unescape()->width(10, 1); + + $show->width(6)->field('created_at'); + $show->width(6)->field('updated_at'); + }); + })); + }); + $row->column(6, function ($column) use ($activity) { + //砍价记录-todo + }); + }; + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + $builder = BargainActivity::with(['skus']); + return Form::make($builder, function (Form $form) { + $form->display('id'); + $form->display('created_at'); + $form->display('updated_at'); + $form->block(6, function (Form\BlockForm $form) { + $form->text('name')->required(); + $form->switch('is_enable'); + $form->dateRange('start_at', 'end_at', '活动时间')->required(); + $form->multipleSelectTable('skus') + ->from(ProductSkuSimpleTable::make()) + ->model(ProductSku::class, 'id', 'name') + ->customFormat(function ($v) { + if (!$v) { + return []; + } + // 这一步非常重要,需要把数据库中查出来的二维数组转化成一维数组 + return array_column($v, 'id'); + })->required(); + $form->number('times')->min(0); + $form->number('expire_hours')->min(0); + $form->textarea('rules')->customFormat(function ($value) { + return implode(',', json_decode($value)); + })->saving(function ($value) { + // dd($value, explode(',', $value)); + return json_encode(explode(',', $value)); + }); + $form->showFooter(); + }); + $form->block(6, function (Form\BlockForm $form) { + $form->multipleImage('images') + ->move('bargain/images/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload()->retainable()->sortable(); + $form->editor('description')->height('600'); + }); + $form->saving(function ($form) { + if ($form->is_enable) { + //查询是否有除了自己以外开启的活动 + if ($form->id) { + if (BargainActivityModel::where('id', '<>', $form->id)->isEnable()->exists()) { + return $form->response()->error('当前已有开启的活动'); + } + } else { + if (BargainActivityModel::isEnable()->exists()) { + return $form->response()->error('当前已有开启的活动'); + } + } + } + }); + }); + } +} diff --git a/app/Admin/Repositories/BargainActivity.php b/app/Admin/Repositories/BargainActivity.php new file mode 100644 index 00000000..c694272c --- /dev/null +++ b/app/Admin/Repositories/BargainActivity.php @@ -0,0 +1,16 @@ +get('dealer-delivery-bills', 'DealerDeliveryBillController@index')->name('dealer_delivery_bills.index'); $router->get('dealer-delivery-bills/{dealer_delivery_bill}', 'DealerDeliveryBillController@show')->name('dealer_delivery_bills.show'); + //商城端-砍价活动 + $router->resource('bargain-activities', 'BargainActivityController')->names('bargain_activities'); + /** api接口 **/ $router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories'); $router->get('api/product-group-details', 'ProductGroupController@details')->name('api.product_group_details'); diff --git a/app/Endpoint/Api/Http/Controllers/BargainActivityController.php b/app/Endpoint/Api/Http/Controllers/BargainActivityController.php new file mode 100644 index 00000000..521ba98d --- /dev/null +++ b/app/Endpoint/Api/Http/Controllers/BargainActivityController.php @@ -0,0 +1,23 @@ +response()->json([ + // 'name' + ]); + } +} diff --git a/app/Endpoint/Api/routes.php b/app/Endpoint/Api/routes.php index 7990b2b6..4d70178d 100644 --- a/app/Endpoint/Api/routes.php +++ b/app/Endpoint/Api/routes.php @@ -195,6 +195,8 @@ Route::group([ Route::get('order/orders/{package}/shipping-info', [OrderController::class, 'shippingInfo']); Route::get('users/{phone}', [\App\Endpoint\Api\Http\Controllers\UserController::class, 'show']); + + Route::get('bargains/{bargain}', [\App\Endpoint\Api\Http\Controllers\BargainActivityController::class, 'detail']); }); Route::group([ diff --git a/app/Models/BargainActivity.php b/app/Models/BargainActivity.php index 85a36932..9b14ccb9 100644 --- a/app/Models/BargainActivity.php +++ b/app/Models/BargainActivity.php @@ -2,10 +2,32 @@ namespace App\Models; +use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class BargainActivity extends Model { use HasFactory; + use HasDateTimeFormatter; + + public static $enabledText = [ + 0=>'禁用', + 1=>'启用', + ]; + + public static $enabledColor = [ + 0=>'#b3b9bf', + 1=>'success', + ]; + + public function skus() + { + return $this->belongsToMany(ProductSku::class, 'bargain_skus', 'activity_id', 'sku_id'); + } + + public function scopeIsEnable($query) + { + return $query->where('is_enable', true); + } } diff --git a/database/migrations/2022_04_06_110305_create_bargain_activities_table.php b/database/migrations/2022_04_06_110305_create_bargain_activities_table.php index f35b38f8..5b865480 100644 --- a/database/migrations/2022_04_06_110305_create_bargain_activities_table.php +++ b/database/migrations/2022_04_06_110305_create_bargain_activities_table.php @@ -16,6 +16,7 @@ class CreateBargainActivitiesTable extends Migration Schema::create('bargain_activities', function (Blueprint $table) { $table->id(); $table->string('name')->comment('活动名称'); + $table->text('images')->nullable()->comment('活动图'); $table->text('description')->nullable()->comment('活动描述'); $table->boolean('is_enable')->nullable()->comment('是否开启'); $table->text('rules')->nullable()->comment('砍价规则'); diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 93bb1676..33c72eab 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -7,11 +7,11 @@ * * @author jqh <841324345@qq.com> */ - namespace Dcat\Admin { use Illuminate\Support\Collection; /** + * @property Grid\Column|Collection width * @property Grid\Column|Collection id * @property Grid\Column|Collection cover * @property Grid\Column|Collection content @@ -99,12 +99,21 @@ namespace Dcat\Admin { * @property Grid\Column|Collection total_revenue * @property Grid\Column|Collection transferable * @property Grid\Column|Collection is_frozen + * @property Grid\Column|Collection is_enable + * @property Grid\Column|Collection rules + * @property Grid\Column|Collection times + * @property Grid\Column|Collection expire_hours + * @property Grid\Column|Collection start_at + * @property Grid\Column|Collection end_at + * @property Grid\Column|Collection bargain_amount + * @property Grid\Column|Collection sku_price + * @property Grid\Column|Collection bargain_price + * @property Grid\Column|Collection status + * @property Grid\Column|Collection expire_at * @property Grid\Column|Collection continue_click_times * @property Grid\Column|Collection last_click_at * @property Grid\Column|Collection ranges - * @property Grid\Column|Collection is_enable * @property Grid\Column|Collection administrator_id - * @property Grid\Column|Collection status * @property Grid\Column|Collection task_id * @property Grid\Column|Collection threshold * @property Grid\Column|Collection limit @@ -116,6 +125,17 @@ namespace Dcat\Admin { * @property Grid\Column|Collection lvl * @property Grid\Column|Collection total_amount * @property Grid\Column|Collection order_completed_at + * @property Grid\Column|Collection shipping_fee + * @property Grid\Column|Collection consignee_name + * @property Grid\Column|Collection consignee_telephone + * @property Grid\Column|Collection consignee_zone + * @property Grid\Column|Collection consignee_address + * @property Grid\Column|Collection pay_sn + * @property Grid\Column|Collection pay_way + * @property Grid\Column|Collection out_trade_no + * @property Grid\Column|Collection pay_at + * @property Grid\Column|Collection delivery_bill_id + * @property Grid\Column|Collection product_id * @property Grid\Column|Collection earningable_type * @property Grid\Column|Collection earningable_id * @property Grid\Column|Collection total_earnings @@ -123,35 +143,27 @@ namespace Dcat\Admin { * @property Grid\Column|Collection fee_rate * @property Grid\Column|Collection payer_id * @property Grid\Column|Collection pay_info - * @property Grid\Column|Collection pay_at * @property Grid\Column|Collection settle_at * @property Grid\Column|Collection pay_image - * @property Grid\Column|Collection pay_way * @property Grid\Column|Collection is_manager * @property Grid\Column|Collection real_amount - * @property Grid\Column|Collection start_at - * @property Grid\Column|Collection end_at * @property Grid\Column|Collection is_settle - * @property Grid\Column|Collection product_id * @property Grid\Column|Collection sales_volume * @property Grid\Column|Collection last_consignor_id * @property Grid\Column|Collection new_consignor_id * @property Grid\Column|Collection price * @property Grid\Column|Collection sale_price + * @property Grid\Column|Collection deposit_qty * @property Grid\Column|Collection reason * @property Grid\Column|Collection consignor_id * @property Grid\Column|Collection settle_state - * @property Grid\Column|Collection consignee_name - * @property Grid\Column|Collection consignee_telephone - * @property Grid\Column|Collection consignee_zone - * @property Grid\Column|Collection consignee_address * @property Grid\Column|Collection pay_time * @property Grid\Column|Collection paied_time * @property Grid\Column|Collection shipping_time * @property Grid\Column|Collection shippinged_time * @property Grid\Column|Collection allocated_at - * @property Grid\Column|Collection pay_sn - * @property Grid\Column|Collection out_trade_no + * @property Grid\Column|Collection local_status + * @property Grid\Column|Collection deposit_status * @property Grid\Column|Collection min_order_amount * @property Grid\Column|Collection price_1st * @property Grid\Column|Collection price_2st @@ -174,6 +186,8 @@ namespace Dcat\Admin { * @property Grid\Column|Collection before_lvl * @property Grid\Column|Collection change_lvl * @property Grid\Column|Collection revoke_id + * @property Grid\Column|Collection is_deposit + * @property Grid\Column|Collection deposit_stock * @property Grid\Column|Collection rate * @property Grid\Column|Collection service_amount * @property Grid\Column|Collection account_amount @@ -225,8 +239,8 @@ namespace Dcat\Admin { * @property Grid\Column|Collection after_expire_at * @property Grid\Column|Collection remain_quantity * @property Grid\Column|Collection gift_for_sku_id + * @property Grid\Column|Collection is_gift * @property Grid\Column|Collection max - * @property Grid\Column|Collection shipping_fee * @property Grid\Column|Collection products_total_amount * @property Grid\Column|Collection note * @property Grid\Column|Collection user_coupon_id @@ -315,6 +329,7 @@ namespace Dcat\Admin { * @property Grid\Column|Collection status_remark * @property Grid\Column|Collection old_password * + * @method Grid\Column|Collection width(string $label = null) * @method Grid\Column|Collection id(string $label = null) * @method Grid\Column|Collection cover(string $label = null) * @method Grid\Column|Collection content(string $label = null) @@ -402,12 +417,21 @@ namespace Dcat\Admin { * @method Grid\Column|Collection total_revenue(string $label = null) * @method Grid\Column|Collection transferable(string $label = null) * @method Grid\Column|Collection is_frozen(string $label = null) + * @method Grid\Column|Collection is_enable(string $label = null) + * @method Grid\Column|Collection rules(string $label = null) + * @method Grid\Column|Collection times(string $label = null) + * @method Grid\Column|Collection expire_hours(string $label = null) + * @method Grid\Column|Collection start_at(string $label = null) + * @method Grid\Column|Collection end_at(string $label = null) + * @method Grid\Column|Collection bargain_amount(string $label = null) + * @method Grid\Column|Collection sku_price(string $label = null) + * @method Grid\Column|Collection bargain_price(string $label = null) + * @method Grid\Column|Collection status(string $label = null) + * @method Grid\Column|Collection expire_at(string $label = null) * @method Grid\Column|Collection continue_click_times(string $label = null) * @method Grid\Column|Collection last_click_at(string $label = null) * @method Grid\Column|Collection ranges(string $label = null) - * @method Grid\Column|Collection is_enable(string $label = null) * @method Grid\Column|Collection administrator_id(string $label = null) - * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection task_id(string $label = null) * @method Grid\Column|Collection threshold(string $label = null) * @method Grid\Column|Collection limit(string $label = null) @@ -419,6 +443,17 @@ namespace Dcat\Admin { * @method Grid\Column|Collection lvl(string $label = null) * @method Grid\Column|Collection total_amount(string $label = null) * @method Grid\Column|Collection order_completed_at(string $label = null) + * @method Grid\Column|Collection shipping_fee(string $label = null) + * @method Grid\Column|Collection consignee_name(string $label = null) + * @method Grid\Column|Collection consignee_telephone(string $label = null) + * @method Grid\Column|Collection consignee_zone(string $label = null) + * @method Grid\Column|Collection consignee_address(string $label = null) + * @method Grid\Column|Collection pay_sn(string $label = null) + * @method Grid\Column|Collection pay_way(string $label = null) + * @method Grid\Column|Collection out_trade_no(string $label = null) + * @method Grid\Column|Collection pay_at(string $label = null) + * @method Grid\Column|Collection delivery_bill_id(string $label = null) + * @method Grid\Column|Collection product_id(string $label = null) * @method Grid\Column|Collection earningable_type(string $label = null) * @method Grid\Column|Collection earningable_id(string $label = null) * @method Grid\Column|Collection total_earnings(string $label = null) @@ -426,35 +461,27 @@ namespace Dcat\Admin { * @method Grid\Column|Collection fee_rate(string $label = null) * @method Grid\Column|Collection payer_id(string $label = null) * @method Grid\Column|Collection pay_info(string $label = null) - * @method Grid\Column|Collection pay_at(string $label = null) * @method Grid\Column|Collection settle_at(string $label = null) * @method Grid\Column|Collection pay_image(string $label = null) - * @method Grid\Column|Collection pay_way(string $label = null) * @method Grid\Column|Collection is_manager(string $label = null) * @method Grid\Column|Collection real_amount(string $label = null) - * @method Grid\Column|Collection start_at(string $label = null) - * @method Grid\Column|Collection end_at(string $label = null) * @method Grid\Column|Collection is_settle(string $label = null) - * @method Grid\Column|Collection product_id(string $label = null) * @method Grid\Column|Collection sales_volume(string $label = null) * @method Grid\Column|Collection last_consignor_id(string $label = null) * @method Grid\Column|Collection new_consignor_id(string $label = null) * @method Grid\Column|Collection price(string $label = null) * @method Grid\Column|Collection sale_price(string $label = null) + * @method Grid\Column|Collection deposit_qty(string $label = null) * @method Grid\Column|Collection reason(string $label = null) * @method Grid\Column|Collection consignor_id(string $label = null) * @method Grid\Column|Collection settle_state(string $label = null) - * @method Grid\Column|Collection consignee_name(string $label = null) - * @method Grid\Column|Collection consignee_telephone(string $label = null) - * @method Grid\Column|Collection consignee_zone(string $label = null) - * @method Grid\Column|Collection consignee_address(string $label = null) * @method Grid\Column|Collection pay_time(string $label = null) * @method Grid\Column|Collection paied_time(string $label = null) * @method Grid\Column|Collection shipping_time(string $label = null) * @method Grid\Column|Collection shippinged_time(string $label = null) * @method Grid\Column|Collection allocated_at(string $label = null) - * @method Grid\Column|Collection pay_sn(string $label = null) - * @method Grid\Column|Collection out_trade_no(string $label = null) + * @method Grid\Column|Collection local_status(string $label = null) + * @method Grid\Column|Collection deposit_status(string $label = null) * @method Grid\Column|Collection min_order_amount(string $label = null) * @method Grid\Column|Collection price_1st(string $label = null) * @method Grid\Column|Collection price_2st(string $label = null) @@ -477,6 +504,8 @@ namespace Dcat\Admin { * @method Grid\Column|Collection before_lvl(string $label = null) * @method Grid\Column|Collection change_lvl(string $label = null) * @method Grid\Column|Collection revoke_id(string $label = null) + * @method Grid\Column|Collection is_deposit(string $label = null) + * @method Grid\Column|Collection deposit_stock(string $label = null) * @method Grid\Column|Collection rate(string $label = null) * @method Grid\Column|Collection service_amount(string $label = null) * @method Grid\Column|Collection account_amount(string $label = null) @@ -528,8 +557,8 @@ namespace Dcat\Admin { * @method Grid\Column|Collection after_expire_at(string $label = null) * @method Grid\Column|Collection remain_quantity(string $label = null) * @method Grid\Column|Collection gift_for_sku_id(string $label = null) + * @method Grid\Column|Collection is_gift(string $label = null) * @method Grid\Column|Collection max(string $label = null) - * @method Grid\Column|Collection shipping_fee(string $label = null) * @method Grid\Column|Collection products_total_amount(string $label = null) * @method Grid\Column|Collection note(string $label = null) * @method Grid\Column|Collection user_coupon_id(string $label = null) @@ -618,15 +647,12 @@ namespace Dcat\Admin { * @method Grid\Column|Collection status_remark(string $label = null) * @method Grid\Column|Collection old_password(string $label = null) */ - class Grid - { - } + class Grid {} - class MiniGrid extends Grid - { - } + class MiniGrid extends Grid {} /** + * @property Show\Field|Collection width * @property Show\Field|Collection id * @property Show\Field|Collection cover * @property Show\Field|Collection content @@ -714,12 +740,21 @@ namespace Dcat\Admin { * @property Show\Field|Collection total_revenue * @property Show\Field|Collection transferable * @property Show\Field|Collection is_frozen + * @property Show\Field|Collection is_enable + * @property Show\Field|Collection rules + * @property Show\Field|Collection times + * @property Show\Field|Collection expire_hours + * @property Show\Field|Collection start_at + * @property Show\Field|Collection end_at + * @property Show\Field|Collection bargain_amount + * @property Show\Field|Collection sku_price + * @property Show\Field|Collection bargain_price + * @property Show\Field|Collection status + * @property Show\Field|Collection expire_at * @property Show\Field|Collection continue_click_times * @property Show\Field|Collection last_click_at * @property Show\Field|Collection ranges - * @property Show\Field|Collection is_enable * @property Show\Field|Collection administrator_id - * @property Show\Field|Collection status * @property Show\Field|Collection task_id * @property Show\Field|Collection threshold * @property Show\Field|Collection limit @@ -731,6 +766,17 @@ namespace Dcat\Admin { * @property Show\Field|Collection lvl * @property Show\Field|Collection total_amount * @property Show\Field|Collection order_completed_at + * @property Show\Field|Collection shipping_fee + * @property Show\Field|Collection consignee_name + * @property Show\Field|Collection consignee_telephone + * @property Show\Field|Collection consignee_zone + * @property Show\Field|Collection consignee_address + * @property Show\Field|Collection pay_sn + * @property Show\Field|Collection pay_way + * @property Show\Field|Collection out_trade_no + * @property Show\Field|Collection pay_at + * @property Show\Field|Collection delivery_bill_id + * @property Show\Field|Collection product_id * @property Show\Field|Collection earningable_type * @property Show\Field|Collection earningable_id * @property Show\Field|Collection total_earnings @@ -738,35 +784,27 @@ namespace Dcat\Admin { * @property Show\Field|Collection fee_rate * @property Show\Field|Collection payer_id * @property Show\Field|Collection pay_info - * @property Show\Field|Collection pay_at * @property Show\Field|Collection settle_at * @property Show\Field|Collection pay_image - * @property Show\Field|Collection pay_way * @property Show\Field|Collection is_manager * @property Show\Field|Collection real_amount - * @property Show\Field|Collection start_at - * @property Show\Field|Collection end_at * @property Show\Field|Collection is_settle - * @property Show\Field|Collection product_id * @property Show\Field|Collection sales_volume * @property Show\Field|Collection last_consignor_id * @property Show\Field|Collection new_consignor_id * @property Show\Field|Collection price * @property Show\Field|Collection sale_price + * @property Show\Field|Collection deposit_qty * @property Show\Field|Collection reason * @property Show\Field|Collection consignor_id * @property Show\Field|Collection settle_state - * @property Show\Field|Collection consignee_name - * @property Show\Field|Collection consignee_telephone - * @property Show\Field|Collection consignee_zone - * @property Show\Field|Collection consignee_address * @property Show\Field|Collection pay_time * @property Show\Field|Collection paied_time * @property Show\Field|Collection shipping_time * @property Show\Field|Collection shippinged_time * @property Show\Field|Collection allocated_at - * @property Show\Field|Collection pay_sn - * @property Show\Field|Collection out_trade_no + * @property Show\Field|Collection local_status + * @property Show\Field|Collection deposit_status * @property Show\Field|Collection min_order_amount * @property Show\Field|Collection price_1st * @property Show\Field|Collection price_2st @@ -789,6 +827,8 @@ namespace Dcat\Admin { * @property Show\Field|Collection before_lvl * @property Show\Field|Collection change_lvl * @property Show\Field|Collection revoke_id + * @property Show\Field|Collection is_deposit + * @property Show\Field|Collection deposit_stock * @property Show\Field|Collection rate * @property Show\Field|Collection service_amount * @property Show\Field|Collection account_amount @@ -840,8 +880,8 @@ namespace Dcat\Admin { * @property Show\Field|Collection after_expire_at * @property Show\Field|Collection remain_quantity * @property Show\Field|Collection gift_for_sku_id + * @property Show\Field|Collection is_gift * @property Show\Field|Collection max - * @property Show\Field|Collection shipping_fee * @property Show\Field|Collection products_total_amount * @property Show\Field|Collection note * @property Show\Field|Collection user_coupon_id @@ -930,6 +970,7 @@ namespace Dcat\Admin { * @property Show\Field|Collection status_remark * @property Show\Field|Collection old_password * + * @method Show\Field|Collection width(string $label = null) * @method Show\Field|Collection id(string $label = null) * @method Show\Field|Collection cover(string $label = null) * @method Show\Field|Collection content(string $label = null) @@ -1017,12 +1058,21 @@ namespace Dcat\Admin { * @method Show\Field|Collection total_revenue(string $label = null) * @method Show\Field|Collection transferable(string $label = null) * @method Show\Field|Collection is_frozen(string $label = null) + * @method Show\Field|Collection is_enable(string $label = null) + * @method Show\Field|Collection rules(string $label = null) + * @method Show\Field|Collection times(string $label = null) + * @method Show\Field|Collection expire_hours(string $label = null) + * @method Show\Field|Collection start_at(string $label = null) + * @method Show\Field|Collection end_at(string $label = null) + * @method Show\Field|Collection bargain_amount(string $label = null) + * @method Show\Field|Collection sku_price(string $label = null) + * @method Show\Field|Collection bargain_price(string $label = null) + * @method Show\Field|Collection status(string $label = null) + * @method Show\Field|Collection expire_at(string $label = null) * @method Show\Field|Collection continue_click_times(string $label = null) * @method Show\Field|Collection last_click_at(string $label = null) * @method Show\Field|Collection ranges(string $label = null) - * @method Show\Field|Collection is_enable(string $label = null) * @method Show\Field|Collection administrator_id(string $label = null) - * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection task_id(string $label = null) * @method Show\Field|Collection threshold(string $label = null) * @method Show\Field|Collection limit(string $label = null) @@ -1034,6 +1084,17 @@ namespace Dcat\Admin { * @method Show\Field|Collection lvl(string $label = null) * @method Show\Field|Collection total_amount(string $label = null) * @method Show\Field|Collection order_completed_at(string $label = null) + * @method Show\Field|Collection shipping_fee(string $label = null) + * @method Show\Field|Collection consignee_name(string $label = null) + * @method Show\Field|Collection consignee_telephone(string $label = null) + * @method Show\Field|Collection consignee_zone(string $label = null) + * @method Show\Field|Collection consignee_address(string $label = null) + * @method Show\Field|Collection pay_sn(string $label = null) + * @method Show\Field|Collection pay_way(string $label = null) + * @method Show\Field|Collection out_trade_no(string $label = null) + * @method Show\Field|Collection pay_at(string $label = null) + * @method Show\Field|Collection delivery_bill_id(string $label = null) + * @method Show\Field|Collection product_id(string $label = null) * @method Show\Field|Collection earningable_type(string $label = null) * @method Show\Field|Collection earningable_id(string $label = null) * @method Show\Field|Collection total_earnings(string $label = null) @@ -1041,35 +1102,27 @@ namespace Dcat\Admin { * @method Show\Field|Collection fee_rate(string $label = null) * @method Show\Field|Collection payer_id(string $label = null) * @method Show\Field|Collection pay_info(string $label = null) - * @method Show\Field|Collection pay_at(string $label = null) * @method Show\Field|Collection settle_at(string $label = null) * @method Show\Field|Collection pay_image(string $label = null) - * @method Show\Field|Collection pay_way(string $label = null) * @method Show\Field|Collection is_manager(string $label = null) * @method Show\Field|Collection real_amount(string $label = null) - * @method Show\Field|Collection start_at(string $label = null) - * @method Show\Field|Collection end_at(string $label = null) * @method Show\Field|Collection is_settle(string $label = null) - * @method Show\Field|Collection product_id(string $label = null) * @method Show\Field|Collection sales_volume(string $label = null) * @method Show\Field|Collection last_consignor_id(string $label = null) * @method Show\Field|Collection new_consignor_id(string $label = null) * @method Show\Field|Collection price(string $label = null) * @method Show\Field|Collection sale_price(string $label = null) + * @method Show\Field|Collection deposit_qty(string $label = null) * @method Show\Field|Collection reason(string $label = null) * @method Show\Field|Collection consignor_id(string $label = null) * @method Show\Field|Collection settle_state(string $label = null) - * @method Show\Field|Collection consignee_name(string $label = null) - * @method Show\Field|Collection consignee_telephone(string $label = null) - * @method Show\Field|Collection consignee_zone(string $label = null) - * @method Show\Field|Collection consignee_address(string $label = null) * @method Show\Field|Collection pay_time(string $label = null) * @method Show\Field|Collection paied_time(string $label = null) * @method Show\Field|Collection shipping_time(string $label = null) * @method Show\Field|Collection shippinged_time(string $label = null) * @method Show\Field|Collection allocated_at(string $label = null) - * @method Show\Field|Collection pay_sn(string $label = null) - * @method Show\Field|Collection out_trade_no(string $label = null) + * @method Show\Field|Collection local_status(string $label = null) + * @method Show\Field|Collection deposit_status(string $label = null) * @method Show\Field|Collection min_order_amount(string $label = null) * @method Show\Field|Collection price_1st(string $label = null) * @method Show\Field|Collection price_2st(string $label = null) @@ -1092,6 +1145,8 @@ namespace Dcat\Admin { * @method Show\Field|Collection before_lvl(string $label = null) * @method Show\Field|Collection change_lvl(string $label = null) * @method Show\Field|Collection revoke_id(string $label = null) + * @method Show\Field|Collection is_deposit(string $label = null) + * @method Show\Field|Collection deposit_stock(string $label = null) * @method Show\Field|Collection rate(string $label = null) * @method Show\Field|Collection service_amount(string $label = null) * @method Show\Field|Collection account_amount(string $label = null) @@ -1143,8 +1198,8 @@ namespace Dcat\Admin { * @method Show\Field|Collection after_expire_at(string $label = null) * @method Show\Field|Collection remain_quantity(string $label = null) * @method Show\Field|Collection gift_for_sku_id(string $label = null) + * @method Show\Field|Collection is_gift(string $label = null) * @method Show\Field|Collection max(string $label = null) - * @method Show\Field|Collection shipping_fee(string $label = null) * @method Show\Field|Collection products_total_amount(string $label = null) * @method Show\Field|Collection note(string $label = null) * @method Show\Field|Collection user_coupon_id(string $label = null) @@ -1233,41 +1288,31 @@ namespace Dcat\Admin { * @method Show\Field|Collection status_remark(string $label = null) * @method Show\Field|Collection old_password(string $label = null) */ - class Show - { - } + class Show {} /** * @method \App\Admin\Extensions\Form\Product\SelectAttr selectAttr(...$params) * @method \App\Admin\Extensions\Form\Product\SelectSpec selectSpec(...$params) */ - class Form - { - } + class Form {} } namespace Dcat\Admin\Grid { /** - + * @method $this circleDot(...$params) */ - class Column - { - } + class Column {} /** - + */ - class Filter - { - } + class Filter {} } namespace Dcat\Admin\Show { /** * @method $this showLabel(...$params) */ - class Field - { - } + class Field {} } diff --git a/resources/lang/zh_CN/bargain-activity.php b/resources/lang/zh_CN/bargain-activity.php new file mode 100644 index 00000000..96bec3e3 --- /dev/null +++ b/resources/lang/zh_CN/bargain-activity.php @@ -0,0 +1,22 @@ + [ + 'BargainActivity' => '砍价活动', + 'bargain-activities' => '砍价活动', + ], + 'fields' => [ + 'name' => '活动名称', + 'description' => '活动描述', + 'is_enable' => '是否开启', + 'rules' => '砍价规则', + 'times' => '有效刀', + 'expire_hours' => '过期小时', + 'start_at' => '开始时间', + 'end_at' => '结束时间', + 'skus'=>'关联商品', + 'images' => '活动图', + ], + 'options' => [ + ], +]; From 942edeabe8a856a3c681a545e864b65438783174 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 8 Apr 2022 15:50:24 +0800 Subject: [PATCH 07/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainActivityController.php | 12 +- .../Controllers/BargainActivityController.php | 23 -- .../Http/Controllers/BargainController.php | 243 ++++++++++++++++++ .../Resources/BargainActivityResource.php | 26 ++ .../Resources/BargainOrderLogResource.php | 27 ++ .../Http/Resources/BargainOrderResource.php | 27 ++ .../Api/Http/Resources/ProduckSkuResource.php | 1 + app/Endpoint/Api/routes.php | 12 +- app/Models/BargainActivity.php | 5 + app/Models/BargainOrder.php | 29 +++ app/Models/BargainOrderLog.php | 16 ++ app/Models/BargainSku.php | 10 + app/Models/Order.php | 11 + app/Models/ProductSku.php | 17 ++ app/Services/BargainService.php | 106 ++++++++ app/Services/OrderService.php | 15 +- ...110305_create_bargain_activities_table.php | 2 + 17 files changed, 553 insertions(+), 29 deletions(-) delete mode 100644 app/Endpoint/Api/Http/Controllers/BargainActivityController.php create mode 100644 app/Endpoint/Api/Http/Controllers/BargainController.php create mode 100644 app/Endpoint/Api/Http/Resources/BargainActivityResource.php create mode 100644 app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php create mode 100644 app/Endpoint/Api/Http/Resources/BargainOrderResource.php create mode 100644 app/Services/BargainService.php diff --git a/app/Admin/Controllers/BargainActivityController.php b/app/Admin/Controllers/BargainActivityController.php index 5d0b93eb..f59eddd1 100644 --- a/app/Admin/Controllers/BargainActivityController.php +++ b/app/Admin/Controllers/BargainActivityController.php @@ -101,6 +101,7 @@ class BargainActivityController extends AdminController return array_column($value, 'name'); })->label(); + $show->field('images')->image()->width(10, 1); $show->field('description')->unescape()->width(10, 1); $show->width(6)->field('created_at'); @@ -148,6 +149,13 @@ class BargainActivityController extends AdminController // dd($value, explode(',', $value)); return json_encode(explode(',', $value)); }); + $form->text('share_title', '分享文案')->placeholder('默认使用活动名称'); + $form->image('share_image', '分享图') + ->move('bargain/share/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->autoUpload() + ->retainable() + ->removable(false)->required(); $form->showFooter(); }); $form->block(6, function (Form\BlockForm $form) { @@ -161,8 +169,8 @@ class BargainActivityController extends AdminController $form->saving(function ($form) { if ($form->is_enable) { //查询是否有除了自己以外开启的活动 - if ($form->id) { - if (BargainActivityModel::where('id', '<>', $form->id)->isEnable()->exists()) { + if ($form->model()->id) { + if (BargainActivityModel::where('id', '<>', $form->model()->id)->isEnable()->exists()) { return $form->response()->error('当前已有开启的活动'); } } else { diff --git a/app/Endpoint/Api/Http/Controllers/BargainActivityController.php b/app/Endpoint/Api/Http/Controllers/BargainActivityController.php deleted file mode 100644 index 521ba98d..00000000 --- a/app/Endpoint/Api/Http/Controllers/BargainActivityController.php +++ /dev/null @@ -1,23 +0,0 @@ -response()->json([ - // 'name' - ]); - } -} diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php new file mode 100644 index 00000000..bb84b9cb --- /dev/null +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -0,0 +1,243 @@ +findOrFail($id); + if (!$activity->is_enable) { + throw new BizException('砍价活动暂未开始'); + } + if ($activity->start_at > now() || $activity->end_at < now()) { + throw new BizException('不在活动时间范围'); + } + + return BargainActivityResource::make($activity); + } + + /** + * 通过砍价商品查看当前砍价记录 + * + * @param [type] $id + * @param Request $request + * @return void + */ + public function bargainSku($id) + { + //判断商品是否参与砍价 + $bargainSku = BargainSku::with(['activity'=>function ($query) { + return $query->where('is_enable', true)->where('start_at', '<=', now())->where('end_at', '>=', now()); + }, 'sku'])->where('sku_id', $id)->first(); + + if (!($bargainSku && $bargainSku->activity)) { + throw new BizException('该商品未参与砍价活动,或者活动已结束'); + } + + return response()->json([ + 'sku' => [ + 'name' => (string) $bargainSku->sku->name, + 'subtitle' => (string) $bargainSku->sku->subtitle, + 'cover' => (string) $bargainSku->sku->cover, + 'sell_price' => (string) $bargainSku->sku->sell_price_format, + 'vip_price' => (string) $bargainSku->sku->vip_price_format, + ], + 'max_bargain_price'=> array_sum(json_decode($bargainSku->activity->rules)), + ]); + } + + /** + * 通过商品获取当前砍价进度(看自己的) + * + * @param Request $request + * @return void + */ + public function barginaOrderBySku($id, Request $request) + { + // $order = []; + $user = $request->user(); + $userId = $user?->id ?? 0; + $order = BargainOrder::with(['logs', 'logs.userInfo']) + ->where([ + 'sku_id' => $id, + 'user_id'=> $userId, + ])->where('status', '>', 0) + ->where('expire_at', '>', now()) + ->orderBy('created_at', 'desc')->first(); + if ($order) { + return BargainOrderResource::make($order); + } + return response()->noContent(); + } + + /** + * 通过订单ID获取当前砍价进度(看别人的) + * + * @param Request $request + * @return void + */ + public function bargainOrderById($id, Request $request) + { + $order = BargainOrder::with('logs') + ->where([ + 'id' => $id, + ])->where('status', '>', 0) + ->where('expire_at', '>', now()) + ->orderBy('created_at', 'desc')->first(); + if ($order) { + return BargainOrderResource::make($order); + } + return response()->noContent(); + } + + /** + * 发起砍价 + * + * @param [type] $id + * @param Request $request + * @return void + */ + public function createBargainOrder(ProductSku $sku, Request $request) + { + if (!$sku->isBargaing()) { + throw new BizException('活动已结束'); + } + //判断是否已经有正在进行的砍价单, 直接返回 + $order = BargainOrder::where([ + 'sku_id' => $sku->id, + 'user_id'=> $request->user()->id, + ])->where('status', '>', 0) + ->where('expire_at', '>', now()) + ->orderBy('created_at', 'desc')->first(); + + if (!$order) { + //创建新的砍价单 + $bargainService = new BargainService(); + try { + DB::beginTransaction(); + $order = $bargainService->createBargainOrder($request->user(), $sku); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + report($th); + throw new BizException($th->getMessage()); + } + } + + $order->load(['logs', 'logs.userInfo']); + return BargainOrderResource::make($order); + } + + /** + * 帮人砍价 + * + * @param BargainOrder $order + * @param Request $request + * @return void + */ + public function bargain(BargainOrder $order, Request $request) + { + $bargainService = new BargainService(); + try { + DB::beginTransaction(); + $bargainService->bargain($request->user(), $order); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + report($th); + throw new BizException($th->getMessage()); + } + + $order->load(['logs', 'logs.userInfo']); + return BargainOrderResource::make($order); + } + + /** + * 通过砍价订单创建待支付商城订单 + * + * @param BargainOrder $bargainOrder + * @param Request $request + * @return void + */ + public function createMallOrderByBargainOrder(BargainOrder $bargainOrder, Request $request) + { + $rules = [ + 'shipping_address_id' => ['bail', 'required', 'int'], + 'note' => ['bail', 'nullable', 'string', 'max:255'], + ]; + $input = $request->validate($rules, [], [ + 'shipping_address_id' => '收货地址', + 'note' => '订单备注', + ]); + $user = $request->user(); + if ($user->id != $bargainOrder->user_id) { + throw new BizException('您不能替别人下单'); + } + + $orderService = new OrderService(); + try { + DB::beginTransaction(); + $bargainOrder->lockForUpdate();//下单的时候不允许砍价了 + + //已下单 + if ($bargainOrder->order_id > 0) { + throw new BizException('您已下单,无需重复下单'); + } + + //砍价超时 + if ($bargainOrder->expire_at > now()) { + throw new BizException('当前砍价已结束,无法下单'); + } + + //如果砍价活动结束了,也不能砍了 + $activity = $bargainOrder->sku->isBargaing(); + if (!$activity) { + throw new BizException('当前砍价已结束,无法下单'); + } + + $order = $orderService->createQuickOrder( + $user, + $bargainOrder->sku_id, + 1, + $input['shipping_address_id'], + null, + $input['note'] ?? null, + $bargainOrder + ); + $bargainOrder->update([ + 'order_id' => $order->id, + ]); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + report($th); + throw new BizException($th->getMessage()); + } + + OrderPaid::dispatchIf($order->isPaid(), $order); + + return OrderResource::make($order); + } +} diff --git a/app/Endpoint/Api/Http/Resources/BargainActivityResource.php b/app/Endpoint/Api/Http/Resources/BargainActivityResource.php new file mode 100644 index 00000000..cba46222 --- /dev/null +++ b/app/Endpoint/Api/Http/Resources/BargainActivityResource.php @@ -0,0 +1,26 @@ + $this->name, + 'images' => $this->images, + 'description' => $this->description, + 'skus' => ProductSkuSimpleResource::collection($this->whenLoaded('skus')), + 'share_image'=> $this->share_image ?? '', + 'share_title'=> $this->share_title ?? '', + ]; + } +} diff --git a/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php b/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php new file mode 100644 index 00000000..eb7102aa --- /dev/null +++ b/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php @@ -0,0 +1,27 @@ + (string) $this->whenLoaded('userInfo', function () { + return $this->userInfo->nickname; + }, ''), + 'avatar'=> (string) $this->whenLoaded('userInfo', function () { + return $this->userInfo->avatar; + }, ''), + 'bargain_amount' => $this->bargain_amount_format, + ]; + } +} diff --git a/app/Endpoint/Api/Http/Resources/BargainOrderResource.php b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php new file mode 100644 index 00000000..b13634a7 --- /dev/null +++ b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php @@ -0,0 +1,27 @@ +user(); + $userId = $user?->id ?? 0; + return [ + 'id' => $this->id, + 'logs' => BargainOrderLogResource::collection($this->whenLoaded('logs')), + 'expire_at'=> $this->expire_at->format('Y-m-d H:i:s'), + 'status' => $this->status, + 'is_owner' => $this->user_id == $userId ? true : false, + ]; + } +} diff --git a/app/Endpoint/Api/Http/Resources/ProduckSkuResource.php b/app/Endpoint/Api/Http/Resources/ProduckSkuResource.php index f6a87f1a..5c3ad62a 100644 --- a/app/Endpoint/Api/Http/Resources/ProduckSkuResource.php +++ b/app/Endpoint/Api/Http/Resources/ProduckSkuResource.php @@ -35,6 +35,7 @@ class ProduckSkuResource extends JsonResource }), 'growth_value' => (int) $this->growth_value, 'sales_value' => (int) $this->sales_value, + 'is_bargaing' => $this->isBargaing() ? true : false, ]; } } diff --git a/app/Endpoint/Api/routes.php b/app/Endpoint/Api/routes.php index 4d70178d..e39c1f7b 100644 --- a/app/Endpoint/Api/routes.php +++ b/app/Endpoint/Api/routes.php @@ -89,6 +89,13 @@ Route::group([ Route::get('configs', [SettingController::class, 'index']); Route::get('configs-custom', [SettingController::class, 'custom']); + //砍价 + Route::get('bargains/{activity}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'activityDetail']); + Route::get('bargain-sku/{sku}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'bargainSku']); + Route::get('bargain-order/sku/{sku}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'barginaOrderBySku']); + Route::get('bargain-order/order/{order}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'bargainOrderById']); + + //三方登录聚合 Route::group([ 'prefix' =>'socialite', @@ -196,7 +203,10 @@ Route::group([ Route::get('users/{phone}', [\App\Endpoint\Api\Http\Controllers\UserController::class, 'show']); - Route::get('bargains/{bargain}', [\App\Endpoint\Api\Http\Controllers\BargainActivityController::class, 'detail']); + //砍价 + Route::post('bargains/create-order/{sku}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'createBargainOrder']); + Route::post('bargains/bargain/{order}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'bargain']); + Route::post('bargains/create-mall-order/{bargainOrder}', [\App\Endpoint\Api\Http\Controllers\BargainController::class, 'createMallOrderByBargainOrder']); }); Route::group([ diff --git a/app/Models/BargainActivity.php b/app/Models/BargainActivity.php index 9b14ccb9..4356972f 100644 --- a/app/Models/BargainActivity.php +++ b/app/Models/BargainActivity.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Casts\JsonArray; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -11,6 +12,10 @@ class BargainActivity extends Model use HasFactory; use HasDateTimeFormatter; + protected $casts = [ + 'images' => JsonArray::class, + ]; + public static $enabledText = [ 0=>'禁用', 1=>'启用', diff --git a/app/Models/BargainOrder.php b/app/Models/BargainOrder.php index debe69f5..b50a802e 100644 --- a/app/Models/BargainOrder.php +++ b/app/Models/BargainOrder.php @@ -2,10 +2,39 @@ namespace App\Models; +use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class BargainOrder extends Model { use HasFactory; + use HasDateTimeFormatter; + + protected $casts = [ + 'expire_at'=> 'datetime', + ]; + + protected $fillable = [ + 'order_id', 'remark', + ]; + + public const ORDER_STATUS_WAIT = 0; + public const ORDER_STATUS_START = 1; + public const ORDER_STATUS_FINISHED = 2; + + public function logs() + { + return $this->hasMany(BargainOrderLog::class, 'order_id'); + } + + public function sku() + { + return $this->hasOne(ProductSku::class, 'id', 'sku_id'); + } + + public function isFinished() + { + return $this->status == static::ORDER_STATUS_FINISHED; + } } diff --git a/app/Models/BargainOrderLog.php b/app/Models/BargainOrderLog.php index 0682b5f5..f9ac40e3 100644 --- a/app/Models/BargainOrderLog.php +++ b/app/Models/BargainOrderLog.php @@ -2,10 +2,26 @@ namespace App\Models; +use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class BargainOrderLog extends Model { use HasFactory; + use HasDateTimeFormatter; + + protected $fillable = [ + 'user_id', 'bargain_amount', + ]; + + public function userInfo() + { + return $this->hasOne(UserInfo::class, 'user_id', 'user_id'); + } + + public function getBargainAmountFormatAttribute() + { + return bcdiv($this->attributes['bargain_amount'], 100, 2); + } } diff --git a/app/Models/BargainSku.php b/app/Models/BargainSku.php index f1cf2a79..d6019936 100644 --- a/app/Models/BargainSku.php +++ b/app/Models/BargainSku.php @@ -10,4 +10,14 @@ class BargainSku extends Model use HasFactory; protected $timestamp = false; + + public function activity() + { + return $this->belongsTo(BargainActivity::class, 'activity_id'); + } + + public function sku() + { + return $this->belongsTo(ProductSku::class, 'sku_id'); + } } diff --git a/app/Models/Order.php b/app/Models/Order.php index fb703acc..f4715a29 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -93,6 +93,7 @@ class Order extends Model 'is_settle', 'sales_value', 'is_settlable', + 'bargain_amount', ]; /** @@ -427,4 +428,14 @@ class Order extends Model { return OrderStatus::$statusTexts[$this->order_status] ?? OrderStatus::$statusTexts[OrderStatus::UNKNOWN]; } + + /** + * 获取订单砍价优惠 + * + * @return string + */ + public function getBargainAmountFormatAttribute() + { + return trim_trailing_zeros(bcdiv($this->attributes['bargain_amount'], 100, 2)); + } } diff --git a/app/Models/ProductSku.php b/app/Models/ProductSku.php index 46f943de..db97bac1 100644 --- a/app/Models/ProductSku.php +++ b/app/Models/ProductSku.php @@ -195,4 +195,21 @@ class ProductSku extends Model return bcdiv($price, 100, 2); } + + /** + * 是否正在进行砍价 + * + * @return boolean + */ + public function isBargaing() + { + $bargainSku = BargainSku::with(['activity'=>function ($query) { + return $query->where('is_enable', true)->where('start_at', '<=', now())->where('end_at', '>=', now()); + }])->where('sku_id', $this->id)->first(); + + if ($bargainSku && $bargainSku->activity) { + return $bargainSku->activity; + } + return null; + } } diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php new file mode 100644 index 00000000..19ba02fe --- /dev/null +++ b/app/Services/BargainService.php @@ -0,0 +1,106 @@ +function ($query) { + return $query->where('is_enable', true)->where('start_at', '<=', now())->where('end_at', '>=', now()); + }])->where('sku_id', $productSku->id)->first(); + if (!($bargainSku && $bargainSku->activity)) { + throw new BizException('砍价商品活动已结束'); + } + + $order = new BargainOrder(); + $order->activity_id = $bargainSku->activity_id; + $order->user_id = $user->id; + $order->sku_id = $productSku->id; + $order->sku_price = $productSku->getRealPrice($user); + $order->status = BargainOrder::ORDER_STATUS_START; + $order->expire_at = now()->addHours($bargainSku->activity->expire_hours); + $order->save(); + + return $order; + } + + /** + * 用户砍价 + * + * @param User $user + * @param BargainOrder $order + * @return void + */ + public function bargain(User $user, BargainOrder $order) + { + $order->lockForUpdate(); + $order->load('sku'); + + //不能给自己砍 + if ($user->id == $order->user_id) { + throw new BizException('不能帮自己砍价'); + } + + //已砍完 + if ($order->isFinished()) { + throw new BizException('当前砍价单已完成,无法再砍'); + } + + //已下单 + if ($order->order_id > 0) { + throw new BizException('当前砍价单下单,无法再砍'); + } + + //砍价超时 + if ($order->expire_at > now()) { + throw new BizException('当前砍价已结束,无法再砍'); + } + + //如果砍价活动结束了,也不能砍了 + $activity = $order->sku->isBargaing(); + if (!$activity) { + throw new BizException('当前砍价已结束,无法再砍'); + } + + + //执行砍价动作; + //计算第几次砍价,并获得当前砍价金额 + $nowBargainCount = $order->logs->count(); + + $bargainRules = json_decode($activity->rules, true); + + $log = new BargainOrderLog([ + 'user_id'=>$user->id, + 'bargain_amount'=> bcmul(Arr::get($bargainRules, $nowBargainCount, 0), 100), + ]); + + $order->logs()->save($log); + $order->bargain_price += $log->bargain_amount; + if ($activity->times > 0 && $activity->times <= ($nowBargainCount ++)) { + $order->status = BargainOrder::ORDER_STATUS_FINISHED; + } + $order->save(); + + return $order; + } + + public function createMallOrder(BargainOrder $order) + { + } +} diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index cda3edac..eef62540 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -11,6 +11,7 @@ use App\Enums\WxpayTradeType; use App\Exceptions\BizException; use App\Exceptions\ShippingNotSupportedException; use App\Models\ActivityProductPart; +use App\Models\BargainOrder; use App\Models\DistributionPreIncomeJob; use App\Models\Order; use App\Models\OrderActivity; @@ -38,6 +39,7 @@ class OrderService * @param int $shippingAddressId * @param int|null $couponId * @param string|null $note + * @param BargainOrder|null $bargainOrder * @return \App\Models\Order */ public function createQuickOrder( @@ -46,7 +48,8 @@ class OrderService int $quantity, int $shippingAddressId, ?int $couponId = null, - ?string $note = null + ?string $note = null, + ?BargainOrder $bargainOrder = null, ): Order { $sku = ProductSku::online()->findOrFail($skuId); @@ -55,7 +58,7 @@ class OrderService 'quantity' => $quantity, ]; - return $this->createOrder($user, [$product], $shippingAddressId, $couponId, $note); + return $this->createOrder($user, [$product], $shippingAddressId, $couponId, $note, $bargainOrder); } /** @@ -97,6 +100,7 @@ class OrderService * @param int $shippingAddressId * @param int|null $couponId * @param string|null $note + * @param BargainOrder|null $bargainOrder * @return \App\Models\Order */ protected function createOrder( @@ -105,6 +109,7 @@ class OrderService int $shippingAddressId, ?int $couponId = null, ?string $note = null, + ?BargainOrder $bargainOrder = null, ): Order { foreach ($products as $product) { $sku = $product['sku']; @@ -144,7 +149,8 @@ class OrderService $shippingFee, $salesValue, $note, - $coupon + $coupon, + $bargainOrder,//添加砍价订单逻辑 ); $this->storeOrderProducts($order, $mapProducts); @@ -185,6 +191,7 @@ class OrderService $salesValue, ?string $note = null, ?UserCoupon $coupon = null, + ?BargainOrder $bargainOrder = null, ): Order { // 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费 $totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount; @@ -213,6 +220,8 @@ class OrderService 'consignee_telephone' => $shippingAddress->telephone, 'consignee_zone' => $shippingAddress->zone, 'consignee_address' => $shippingAddress->address, + //砍价订单金额 + 'bargain_amount'=>$bargainOrder?->bargain_price, ]; return $user->orders()->create($attrs); diff --git a/database/migrations/2022_04_06_110305_create_bargain_activities_table.php b/database/migrations/2022_04_06_110305_create_bargain_activities_table.php index 5b865480..7f39628a 100644 --- a/database/migrations/2022_04_06_110305_create_bargain_activities_table.php +++ b/database/migrations/2022_04_06_110305_create_bargain_activities_table.php @@ -17,6 +17,8 @@ class CreateBargainActivitiesTable extends Migration $table->id(); $table->string('name')->comment('活动名称'); $table->text('images')->nullable()->comment('活动图'); + $table->text('share_image')->nullable()->comment('分享图'); + $table->text('share_title')->nullable()->comment('分享文案'); $table->text('description')->nullable()->comment('活动描述'); $table->boolean('is_enable')->nullable()->comment('是否开启'); $table->text('rules')->nullable()->comment('砍价规则'); From 4bbd9f9372723d1b993899e8b5d513994a359c1a Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 8 Apr 2022 16:27:07 +0800 Subject: [PATCH 08/58] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E5=92=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Resources/BargainActivityResource.php | 2 ++ app/Models/BargainActivity.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/Endpoint/Api/Http/Resources/BargainActivityResource.php b/app/Endpoint/Api/Http/Resources/BargainActivityResource.php index cba46222..de65a757 100644 --- a/app/Endpoint/Api/Http/Resources/BargainActivityResource.php +++ b/app/Endpoint/Api/Http/Resources/BargainActivityResource.php @@ -21,6 +21,8 @@ class BargainActivityResource extends JsonResource 'skus' => ProductSkuSimpleResource::collection($this->whenLoaded('skus')), 'share_image'=> $this->share_image ?? '', 'share_title'=> $this->share_title ?? '', + 'start_at' => $this->start_at->rawFormat('Y-m-d H:i:s'), + 'end_at' => $this->end_at->rawFormat('Y-m-d H:i:s'), ]; } } diff --git a/app/Models/BargainActivity.php b/app/Models/BargainActivity.php index 4356972f..387427fd 100644 --- a/app/Models/BargainActivity.php +++ b/app/Models/BargainActivity.php @@ -14,6 +14,8 @@ class BargainActivity extends Model protected $casts = [ 'images' => JsonArray::class, + 'start_at' => 'datetime', + 'end_at' => 'datetime', ]; public static $enabledText = [ From 2deccdff147dd7b05b7b4b1c1ef5983845e3f72f Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 8 Apr 2022 16:38:39 +0800 Subject: [PATCH 09/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E5=8D=95=E4=B8=8B=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index eef62540..a5fd887a 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -196,6 +196,11 @@ class OrderService // 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费 $totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount; + //如果有砍价优惠 + if ($bargainOrder) { + $totalAmount -= $bargainOrder->bargain_price; + } + if ($totalAmount < 0) { $totalAmount = 0; } From 5e10ba236f411219a74605fd2a79dff501dd5311 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 8 Apr 2022 16:41:01 +0800 Subject: [PATCH 10/58] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_04_06_112225_add_bargain_to_orders_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php index 31b56789..d0ae369e 100644 --- a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php +++ b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php @@ -15,7 +15,7 @@ class AddBargainToOrdersTable extends Migration { Schema::table('orders', function (Blueprint $table) { // - $table->unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); + $table->unsignedBigInteger('bargain_amount')->nullable()->default(0)->comment('砍价金额'); // $table->unsignedBigInteger('bargain_order_id')->nullable()->comment('关联砍价单ID'); }); } From 0d3e62305d5667f1b65ad67c4596c6e35f2a1e4e Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 8 Apr 2022 16:45:08 +0800 Subject: [PATCH 11/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E4=BC=98=E6=83=A0=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index a5fd887a..7edea3a3 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -226,7 +226,7 @@ class OrderService 'consignee_zone' => $shippingAddress->zone, 'consignee_address' => $shippingAddress->address, //砍价订单金额 - 'bargain_amount'=>$bargainOrder?->bargain_price, + 'bargain_amount'=>$bargainOrder?->bargain_price ?? 0, ]; return $user->orders()->create($attrs); From d77c7394bcd70c6e2a84b19a64a58d0e704f00e5 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 09:51:19 +0800 Subject: [PATCH 12/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/BargainActivityController.php | 2 +- app/Admin/Controllers/OrderController.php | 3 +++ app/Endpoint/Api/Http/Controllers/BargainController.php | 3 ++- app/Endpoint/Api/Http/Resources/OrderResource.php | 1 + app/Services/BargainService.php | 4 ++-- app/Services/OrderService.php | 2 +- resources/lang/zh_CN/order.php | 1 + 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Admin/Controllers/BargainActivityController.php b/app/Admin/Controllers/BargainActivityController.php index f59eddd1..a11f2bd8 100644 --- a/app/Admin/Controllers/BargainActivityController.php +++ b/app/Admin/Controllers/BargainActivityController.php @@ -130,7 +130,7 @@ class BargainActivityController extends AdminController $form->block(6, function (Form\BlockForm $form) { $form->text('name')->required(); $form->switch('is_enable'); - $form->dateRange('start_at', 'end_at', '活动时间')->required(); + $form->datetimeRange('start_at', 'end_at', '活动时间')->required(); $form->multipleSelectTable('skus') ->from(ProductSkuSimpleTable::make()) ->model(ProductSku::class, 'id', 'name') diff --git a/app/Admin/Controllers/OrderController.php b/app/Admin/Controllers/OrderController.php index 477bbcd9..118ffd03 100644 --- a/app/Admin/Controllers/OrderController.php +++ b/app/Admin/Controllers/OrderController.php @@ -281,6 +281,9 @@ class OrderController extends AdminController $show->field('reduced_amount')->as(function ($v) { return bcdiv($v, 100, 2); })->prepend('- ¥'); + $show->field('bargain_amount')->as(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('- ¥'); $show->field('total_amount')->as(function ($v) { return bcdiv($v, 100, 2); })->prepend('¥'); diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php index bb84b9cb..19e5e74d 100644 --- a/app/Endpoint/Api/Http/Controllers/BargainController.php +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -130,6 +130,7 @@ class BargainController extends Controller 'user_id'=> $request->user()->id, ])->where('status', '>', 0) ->where('expire_at', '>', now()) + ->whereNull('order_id') ->orderBy('created_at', 'desc')->first(); if (!$order) { @@ -207,7 +208,7 @@ class BargainController extends Controller } //砍价超时 - if ($bargainOrder->expire_at > now()) { + if ($bargainOrder->expire_at < now()) { throw new BizException('当前砍价已结束,无法下单'); } diff --git a/app/Endpoint/Api/Http/Resources/OrderResource.php b/app/Endpoint/Api/Http/Resources/OrderResource.php index 8f18d737..42da778e 100644 --- a/app/Endpoint/Api/Http/Resources/OrderResource.php +++ b/app/Endpoint/Api/Http/Resources/OrderResource.php @@ -27,6 +27,7 @@ class OrderResource extends JsonResource 'coupon_discount_amount' => $this->coupon_discount_amount_format, 'vip_discount_amount' => $this->vip_discount_amount_format, 'reduced_amount' => $this->reduced_amount_format, + 'bargain_amount' => $this->bargain_amount_format, 'shipping_fee' => $this->shipping_fee_format, 'products_total_amount' => $this->products_total_amount_format, 'total_amount' => $this->total_amount_format, diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php index 19ba02fe..4dbcc562 100644 --- a/app/Services/BargainService.php +++ b/app/Services/BargainService.php @@ -13,7 +13,7 @@ use Illuminate\Support\Arr; class BargainService { /** - * 创建砍价单-todo + * 创建砍价单 * * @param User $user * @param ProductSku $productSku @@ -68,7 +68,7 @@ class BargainService } //砍价超时 - if ($order->expire_at > now()) { + if ($order->expire_at < now()) { throw new BizException('当前砍价已结束,无法再砍'); } diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 7edea3a3..1ea130cb 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -193,7 +193,7 @@ class OrderService ?UserCoupon $coupon = null, ?BargainOrder $bargainOrder = null, ): Order { - // 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费 + // 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费-砍价金额 $totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount; //如果有砍价优惠 diff --git a/resources/lang/zh_CN/order.php b/resources/lang/zh_CN/order.php index ed1374ac..d1da761c 100644 --- a/resources/lang/zh_CN/order.php +++ b/resources/lang/zh_CN/order.php @@ -20,6 +20,7 @@ return [ 'coupon_discount_amount' => '优惠券金额', 'vip_discount_amount' => '会员优惠', 'reduced_amount' => '减免金额', + 'bargain_amount' => '砍价金额', 'shipping_fee' => '运费', 'products_total_amount' => '商品总额', 'total_amount' => '订单总额', From 0ba1c7b98536fc5f3472dd6e4c6b6a11ab565089 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 14:42:04 +0800 Subject: [PATCH 13/58] =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=8D=95=E5=8F=AA=E8=83=BD=E7=A0=8D=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/BargainService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php index 4dbcc562..ec62fc6d 100644 --- a/app/Services/BargainService.php +++ b/app/Services/BargainService.php @@ -78,6 +78,10 @@ class BargainService throw new BizException('当前砍价已结束,无法再砍'); } + //如果已经砍过了,不能再砍了 + if ($order->logs()->where('user_id', $user->id)->exists()) { + throw new BizException('您已砍价'); + } //执行砍价动作; //计算第几次砍价,并获得当前砍价金额 @@ -99,8 +103,4 @@ class BargainService return $order; } - - public function createMallOrder(BargainOrder $order) - { - } } From 566a39522b5d00b32024f4a654fa5faaa8845adc Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 14:52:28 +0800 Subject: [PATCH 14/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E8=B5=B7?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E4=BA=BA=E7=9A=84=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Controllers/BargainController.php | 2 ++ app/Endpoint/Api/Http/Resources/BargainOrderResource.php | 1 + app/Models/BargainOrder.php | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php index 19e5e74d..89984052 100644 --- a/app/Endpoint/Api/Http/Controllers/BargainController.php +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -85,6 +85,7 @@ class BargainController extends Controller 'user_id'=> $userId, ])->where('status', '>', 0) ->where('expire_at', '>', now()) + ->whereNull('order_id') ->orderBy('created_at', 'desc')->first(); if ($order) { return BargainOrderResource::make($order); @@ -105,6 +106,7 @@ class BargainController extends Controller 'id' => $id, ])->where('status', '>', 0) ->where('expire_at', '>', now()) + ->whereNull('order_id') ->orderBy('created_at', 'desc')->first(); if ($order) { return BargainOrderResource::make($order); diff --git a/app/Endpoint/Api/Http/Resources/BargainOrderResource.php b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php index b13634a7..c69a3a67 100644 --- a/app/Endpoint/Api/Http/Resources/BargainOrderResource.php +++ b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php @@ -21,6 +21,7 @@ class BargainOrderResource extends JsonResource 'logs' => BargainOrderLogResource::collection($this->whenLoaded('logs')), 'expire_at'=> $this->expire_at->format('Y-m-d H:i:s'), 'status' => $this->status, + 'user_nickname'=> $this->user->userInfo->nickname ?? '', 'is_owner' => $this->user_id == $userId ? true : false, ]; } diff --git a/app/Models/BargainOrder.php b/app/Models/BargainOrder.php index b50a802e..d7244ba6 100644 --- a/app/Models/BargainOrder.php +++ b/app/Models/BargainOrder.php @@ -23,6 +23,11 @@ class BargainOrder extends Model public const ORDER_STATUS_START = 1; public const ORDER_STATUS_FINISHED = 2; + public function user() + { + return $this->belongsTo(User::class, 'user_id'); + } + public function logs() { return $this->hasMany(BargainOrderLog::class, 'order_id'); From 27e852f880ca9a36876802b8b281954528613cc0 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 15:02:40 +0800 Subject: [PATCH 15/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E8=B5=B7?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E4=BA=BA=E7=9A=84=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Resources/BargainOrderResource.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Endpoint/Api/Http/Resources/BargainOrderResource.php b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php index c69a3a67..23e69185 100644 --- a/app/Endpoint/Api/Http/Resources/BargainOrderResource.php +++ b/app/Endpoint/Api/Http/Resources/BargainOrderResource.php @@ -22,6 +22,7 @@ class BargainOrderResource extends JsonResource 'expire_at'=> $this->expire_at->format('Y-m-d H:i:s'), 'status' => $this->status, 'user_nickname'=> $this->user->userInfo->nickname ?? '', + 'user_avatar'=> $this->user->userInfo->avatar ?? '', 'is_owner' => $this->user_id == $userId ? true : false, ]; } From a690e597b308ccecfaaf5ab32b26380d27df3406 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 15:34:36 +0800 Subject: [PATCH 16/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E7=A0=8D=E4=BB=B7=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php b/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php index eb7102aa..317910bf 100644 --- a/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php +++ b/app/Endpoint/Api/Http/Resources/BargainOrderLogResource.php @@ -22,6 +22,7 @@ class BargainOrderLogResource extends JsonResource return $this->userInfo->avatar; }, ''), 'bargain_amount' => $this->bargain_amount_format, + 'created_at' => $this->created_at->format('Y-m-d H:i:s'), ]; } } From b9fa29ac14c79b1c8c8d5e34886f20d2bef3bdcb Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 15:43:20 +0800 Subject: [PATCH 17/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Controllers/BargainController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php index 89984052..6c99e645 100644 --- a/app/Endpoint/Api/Http/Controllers/BargainController.php +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -101,7 +101,7 @@ class BargainController extends Controller */ public function bargainOrderById($id, Request $request) { - $order = BargainOrder::with('logs') + $order = BargainOrder::with(['logs', 'logs.userInfo']) ->where([ 'id' => $id, ])->where('status', '>', 0) From 7308a7d663f5749d96512c6a343cfae6a5906976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Mon, 11 Apr 2022 17:27:47 +0800 Subject: [PATCH 18/58] =?UTF-8?q?=E9=93=B6=E8=A1=8C=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/UserBankController.php | 17 +---- app/Enums/Bank.php | 64 +++++++++++++++++++ 2 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 app/Enums/Bank.php diff --git a/app/Endpoint/Api/Http/Controllers/UserBankController.php b/app/Endpoint/Api/Http/Controllers/UserBankController.php index 9cc56a76..9a45f112 100644 --- a/app/Endpoint/Api/Http/Controllers/UserBankController.php +++ b/app/Endpoint/Api/Http/Controllers/UserBankController.php @@ -3,6 +3,7 @@ namespace App\Endpoint\Api\Http\Controllers; use App\Endpoint\Api\Http\Resources\UserBankResource; +use App\Enums\Bank; use App\Models\UserBank; use Illuminate\Http\Request; @@ -11,21 +12,7 @@ class UserBankController extends Controller public function options(Request $request) { return response()->json([ - 'banks' => [ - '中国建设银行', - '中国农业银行', - '中国工商银行', - '中国银行', - '交通银行', - '招商银行', - '民生银行', - '兴业银行', - '中信实业银行', - '上海浦东发展银行', - '光大银行', - '邮政储蓄银行', - '平安银行', - ], + 'banks' => array_values(Bank::banks()), ]); } diff --git a/app/Enums/Bank.php b/app/Enums/Bank.php new file mode 100644 index 00000000..a9fc372e --- /dev/null +++ b/app/Enums/Bank.php @@ -0,0 +1,64 @@ +name]; + } + + /** + * @param string $bankName + * @return static + */ + public static function tryFromBankName(string $bankName): ?static + { + foreach (static::cases() as $enum) { + if ($enum->bankName() === $bankName) { + return $enum; + } + } + + return null; + } + + /** + * @return array + */ + public static function banks(): array + { + return [ + static::CCB->name => '中国建设银行', + static::ABC->name => '中国农业银行', + static::ICBC->name => '中国工商银行', + static::BOC->name => '中国银行', + static::COMM->name => '交通银行', + static::CMB->name => '招商银行', + static::CMBC->name => '民生银行', + static::CIB->name => '兴业银行', + static::CITIC->name => '中信实业银行', + static::SPDB->name => '上海浦东发展银行', + static::CEB->name => '光大银行', + static::PSBC->name => '邮政储蓄银行', + static::PINGANBK->name => '平安银行', + ]; + } +} From f5dbc143348c2d027f137321b3cd3ce88f2dadd8 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 16:30:40 +0800 Subject: [PATCH 19/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=BF=94=E5=9B=9E=E6=B4=BB=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=BB=A5=E5=8F=8A=E5=88=86=E4=BA=AB=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Controllers/BargainController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php index 6c99e645..75a1f50a 100644 --- a/app/Endpoint/Api/Http/Controllers/BargainController.php +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -65,6 +65,9 @@ class BargainController extends Controller 'vip_price' => (string) $bargainSku->sku->vip_price_format, ], 'max_bargain_price'=> array_sum(json_decode($bargainSku->activity->rules)), + 'activity_images' => $bargainSku->activity->images, + 'activity_share_image'=> $bargainSku->activity->share_image, + 'activity_share_title'=> $bargainSku->activity->share_title, ]); } From 9ad18cecef52a062b289bbfad9742bf7afebe633 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 17:29:08 +0800 Subject: [PATCH 20/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=A0=8D=E4=BB=B7=E6=97=A5=E5=BF=97=E6=98=8E?= =?UTF-8?q?=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainActivityController.php | 36 +- .../Controllers/BargainOrderController.php | 177 +++ app/Admin/Repositories/BargainOrder.php | 16 + app/Admin/routes.php | 3 + app/Models/BargainOrder.php | 15 + app/Models/BargainOrderLog.php | 7 +- dcat_admin_ide_helper.php | 1024 +++++++++-------- resources/lang/zh_CN/bargain-order.php | 36 + 8 files changed, 804 insertions(+), 510 deletions(-) create mode 100644 app/Admin/Controllers/BargainOrderController.php create mode 100644 app/Admin/Repositories/BargainOrder.php create mode 100644 resources/lang/zh_CN/bargain-order.php diff --git a/app/Admin/Controllers/BargainActivityController.php b/app/Admin/Controllers/BargainActivityController.php index a11f2bd8..e2cfef92 100644 --- a/app/Admin/Controllers/BargainActivityController.php +++ b/app/Admin/Controllers/BargainActivityController.php @@ -5,6 +5,7 @@ namespace App\Admin\Controllers; use App\Admin\Renderable\ProductSkuSimpleTable; use App\Admin\Repositories\BargainActivity; use App\Models\BargainActivity as BargainActivityModel; +use App\Models\BargainOrder; use App\Models\ProductSku; use Carbon\Carbon; use Dcat\Admin\Admin; @@ -14,6 +15,8 @@ use Dcat\Admin\Grid\Column; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Layout\Row; use Dcat\Admin\Show; +use Dcat\Admin\Widgets\Box; +use Illuminate\Http\Request; class BargainActivityController extends AdminController { @@ -110,7 +113,24 @@ class BargainActivityController extends AdminController })); }); $row->column(6, function ($column) use ($activity) { - //砍价记录-todo + //砍价记录 + $builder = BargainOrder::where('activity_id', $activity->id)->with(['userInfo']); + $bargainOrderGrid = Grid::make($builder, function (Grid $grid) { + $grid->column('id', '序号'); + $grid->column('infos', '明细')->display(function () { + return '【'.$this->userInfo->nickname.'】'.$this->created_at->format('Y-m-d H:i:s').'发起了砍价'; + })->link(function () { + return ''; + // return admin_route('merchant_printers.show', ['merchant_printer' =>$this->id]); + }); + + $grid->model()->orderBy('created_at', 'desc'); + + $grid->disableActions(); + $grid->disableRefreshButton(); + }); + $bargainOrderBox = Box::make('砍价记录', $bargainOrderGrid); + $column->row($bargainOrderBox->collapsable()); }); }; } @@ -182,4 +202,18 @@ class BargainActivityController extends AdminController }); }); } + + public function activities(Request $request) + { + $name = $request->input('q'); + + $query = BargainActivityModel::select('id', 'name as text'); + + if ($name) { + $query->where('name', 'like', "%$name%"); + return $query->paginate(null); + } + + return response()->json($query->get()); + } } diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php new file mode 100644 index 00000000..cc946e66 --- /dev/null +++ b/app/Admin/Controllers/BargainOrderController.php @@ -0,0 +1,177 @@ +column('id')->sortable(); + $grid->column('activity.name'); + $grid->column('user.phone'); + $grid->column('userInfo.nickname'); + $grid->column('sku.name'); + $grid->column('sku_price')->display(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('¥'); + $grid->column('bargain_price')->display(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('¥'); + $grid->column('status'); + $grid->column('expire_at'); + $grid->column('mallOrder.sn'); + $grid->column('remark'); + $grid->column('created_at'); + $grid->column('updated_at')->sortable(); + + $grid->model()->orderBy('id', 'desc'); + + $grid->actions(function (Grid\Displayers\Actions $actions) { + if (Admin::user()->can('dcat.admin.bargain_orders.show')) { + $actions->append(' 显示   '); + } + }); + + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + $filter->equal('activity_id')->select()->ajax(admin_route('api.bargain_activities'))->width(3); + $filter->equal('sku_id')->select()->ajax(admin_route('api.product_skus'))->width(3); + $filter->like('mallOrder.sn')->width(3); + $filter->between('created_at')->dateTime()->width(7); + $filter->like('user.phone')->width(3); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + // return Show::make($id, new BargainOrder(), function (Show $show) { + // $show->field('id'); + // $show->field('activity_id'); + // $show->field('user_id'); + // $show->field('sku_id'); + // $show->field('sku_price'); + // $show->field('bargain_price'); + // $show->field('status'); + // $show->field('expire_at'); + // $show->field('order_id'); + // $show->field('remark'); + // $show->field('created_at'); + // $show->field('updated_at'); + // }); + + return function (Row $row) use ($id) { + $order = BargainOrderModel::with(['activity', 'user', 'userInfo', 'mallOrder', 'sku'])->find($id); + $row->column(6, function ($column) use ($order) { + $column->row(Show::make($order, function (Show $show) { + $show->row(function (Show\Row $show) { + $show->field('id'); + $show->width(6)->field('activity.name'); + $show->field('sku.name'); + $show->field('sku_price')->as(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('¥'); + $show->field('bargain_price')->as(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('¥'); + $show->field('status')->using([ + 0=>'未开始', + 1=>'砍价中', + 2=>'已砍完', + ])->dot([ + 0=>'primary', + 1=>'warning', + 2=>'success', + ]); + + $show->field('mall_order.sn', '关联订单编号')->unescape()->as(function ($value) { + if (Admin::user()->can('dcat.admin.orders.show')) { + return ''.$value.''; + } + return $value; + }); + + $show->field('expire_at'); + $show->field('created_at'); + }); + $show->panel() + ->tools(function (Show\Tools $tools) { + $tools->disableEdit(); + $tools->disableDelete(); + }); + })); + }); + $row->column(6, function ($column) use ($id) { + // 砍价日志列表 + $builder = BargainOrderLog::where('order_id', $id)->with(['user', 'userInfo']); + $logGrid = Grid::make($builder, function (Grid $grid) { + // $grid->column('id', '序号'); + $grid->column('user.phone'); + $grid->column('userInfo.nickname'); + // $grid->column('userInfo.avatar'); + $grid->column('bargain_amount', '砍一刀')->display(function ($v) { + return bcdiv($v, 100, 2); + })->prepend('¥'); + $grid->column('created_at'); + + $grid->model()->orderBy('created_at', 'desc'); + + $grid->disablePagination(); + $grid->disableActions(); + $grid->disableRefreshButton(); + }); + $logBox = Box::make('砍价记录', $logGrid); + $column->row($logBox->collapsable()); + }); + }; + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new BargainOrder(), function (Form $form) { + $form->display('id'); + $form->text('activity_id'); + $form->text('user_id'); + $form->text('sku_id'); + $form->text('sku_price'); + $form->text('bargain_price'); + $form->text('status'); + $form->text('expire_at'); + $form->text('order_id'); + $form->text('remark'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Repositories/BargainOrder.php b/app/Admin/Repositories/BargainOrder.php new file mode 100644 index 00000000..683bf0f9 --- /dev/null +++ b/app/Admin/Repositories/BargainOrder.php @@ -0,0 +1,16 @@ +resource('bargain-activities', 'BargainActivityController')->names('bargain_activities'); + $router->resource('bargain-orders', 'BargainOrderController')->only(['index', 'show'])->names('bargain_orders'); + /** api接口 **/ $router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories'); @@ -227,6 +229,7 @@ Route::group([ $router->get('api/orders', 'OrderController@orders')->name('api.orders'); $router->get('api/order-products', 'OrderController@orderProducts')->name('api.order_products'); $router->get('api/users', 'UserController@users')->name('api.users'); + $router->get('api/bargain-activities', 'BargainActivityController@activities')->name('api.bargain_activities'); /** 调试接口 **/ // $router->get('test', 'HomeController@test'); diff --git a/app/Models/BargainOrder.php b/app/Models/BargainOrder.php index d7244ba6..77e50999 100644 --- a/app/Models/BargainOrder.php +++ b/app/Models/BargainOrder.php @@ -23,11 +23,21 @@ class BargainOrder extends Model public const ORDER_STATUS_START = 1; public const ORDER_STATUS_FINISHED = 2; + public function activity() + { + return $this->belongsTo(BargainActivity::class, 'activity_id'); + } + public function user() { return $this->belongsTo(User::class, 'user_id'); } + public function userInfo() + { + return $this->belongsTo(UserInfo::class, 'user_id', 'user_id'); + } + public function logs() { return $this->hasMany(BargainOrderLog::class, 'order_id'); @@ -38,6 +48,11 @@ class BargainOrder extends Model return $this->hasOne(ProductSku::class, 'id', 'sku_id'); } + public function mallOrder() + { + return $this->belongsTo(Order::class, 'order_id'); + } + public function isFinished() { return $this->status == static::ORDER_STATUS_FINISHED; diff --git a/app/Models/BargainOrderLog.php b/app/Models/BargainOrderLog.php index f9ac40e3..f094771a 100644 --- a/app/Models/BargainOrderLog.php +++ b/app/Models/BargainOrderLog.php @@ -15,9 +15,14 @@ class BargainOrderLog extends Model 'user_id', 'bargain_amount', ]; + public function user() + { + return $this->belongsTo(User::class, 'user_id'); + } + public function userInfo() { - return $this->hasOne(UserInfo::class, 'user_id', 'user_id'); + return $this->belongsTo(UserInfo::class, 'user_id', 'user_id'); } public function getBargainAmountFormatAttribute() diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 33c72eab..d61e4482 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -12,263 +12,265 @@ namespace Dcat\Admin { /** * @property Grid\Column|Collection width - * @property Grid\Column|Collection id - * @property Grid\Column|Collection cover * @property Grid\Column|Collection content + * @property Grid\Column|Collection coupons_rule + * @property Grid\Column|Collection cover + * @property Grid\Column|Collection created_at + * @property Grid\Column|Collection ended_at + * @property Grid\Column|Collection gifts_rule + * @property Grid\Column|Collection id * @property Grid\Column|Collection is_use * @property Grid\Column|Collection started_at - * @property Grid\Column|Collection ended_at - * @property Grid\Column|Collection coupons_rule - * @property Grid\Column|Collection gifts_rule - * @property Grid\Column|Collection created_at * @property Grid\Column|Collection updated_at * @property Grid\Column|Collection activity_id * @property Grid\Column|Collection coupon_id * @property Grid\Column|Collection qty * @property Grid\Column|Collection sku_id * @property Grid\Column|Collection part_id - * @property Grid\Column|Collection key - * @property Grid\Column|Collection name * @property Grid\Column|Collection dimensions * @property Grid\Column|Collection is_show + * @property Grid\Column|Collection key + * @property Grid\Column|Collection name + * @property Grid\Column|Collection detail * @property Grid\Column|Collection type * @property Grid\Column|Collection version - * @property Grid\Column|Collection detail * @property Grid\Column|Collection is_enabled - * @property Grid\Column|Collection parent_id - * @property Grid\Column|Collection order - * @property Grid\Column|Collection icon - * @property Grid\Column|Collection uri * @property Grid\Column|Collection extension - * @property Grid\Column|Collection permission_id + * @property Grid\Column|Collection icon + * @property Grid\Column|Collection order + * @property Grid\Column|Collection parent_id + * @property Grid\Column|Collection uri * @property Grid\Column|Collection menu_id - * @property Grid\Column|Collection slug + * @property Grid\Column|Collection permission_id * @property Grid\Column|Collection http_method * @property Grid\Column|Collection http_path + * @property Grid\Column|Collection slug * @property Grid\Column|Collection role_id * @property Grid\Column|Collection user_id * @property Grid\Column|Collection value - * @property Grid\Column|Collection username - * @property Grid\Column|Collection password * @property Grid\Column|Collection avatar + * @property Grid\Column|Collection password * @property Grid\Column|Collection remember_token + * @property Grid\Column|Collection username * @property Grid\Column|Collection address_id * @property Grid\Column|Collection image - * @property Grid\Column|Collection sort - * @property Grid\Column|Collection jump_type * @property Grid\Column|Collection jump_link + * @property Grid\Column|Collection jump_type * @property Grid\Column|Collection remarks + * @property Grid\Column|Collection sort * @property Grid\Column|Collection after_sale_id * @property Grid\Column|Collection desc * @property Grid\Column|Collection images - * @property Grid\Column|Collection order_id - * @property Grid\Column|Collection sn - * @property Grid\Column|Collection order_product_id - * @property Grid\Column|Collection num * @property Grid\Column|Collection amount + * @property Grid\Column|Collection num + * @property Grid\Column|Collection order_id + * @property Grid\Column|Collection order_product_id + * @property Grid\Column|Collection sales_value + * @property Grid\Column|Collection sn * @property Grid\Column|Collection state * @property Grid\Column|Collection tracking_number - * @property Grid\Column|Collection sales_value * @property Grid\Column|Collection before_agent_level * @property Grid\Column|Collection change_agent_level * @property Grid\Column|Collection remark - * @property Grid\Column|Collection v - * @property Grid\Column|Collection cate - * @property Grid\Column|Collection is_force - * @property Grid\Column|Collection context * @property Grid\Column|Collection apk_link + * @property Grid\Column|Collection cate + * @property Grid\Column|Collection context + * @property Grid\Column|Collection is_force + * @property Grid\Column|Collection v * @property Grid\Column|Collection wgt_link - * @property Grid\Column|Collection is_recommend * @property Grid\Column|Collection _lft * @property Grid\Column|Collection _rgt + * @property Grid\Column|Collection is_recommend * @property Grid\Column|Collection article_id - * @property Grid\Column|Collection category_id * @property Grid\Column|Collection author_name - * @property Grid\Column|Collection subtitle - * @property Grid\Column|Collection points + * @property Grid\Column|Collection category_id * @property Grid\Column|Collection likes - * @property Grid\Column|Collection media_type * @property Grid\Column|Collection media_content - * @property Grid\Column|Collection loggable_type - * @property Grid\Column|Collection loggable_id + * @property Grid\Column|Collection media_type + * @property Grid\Column|Collection points + * @property Grid\Column|Collection subtitle * @property Grid\Column|Collection action * @property Grid\Column|Collection before_balance * @property Grid\Column|Collection change_balance + * @property Grid\Column|Collection loggable_id + * @property Grid\Column|Collection loggable_type * @property Grid\Column|Collection balance + * @property Grid\Column|Collection is_frozen * @property Grid\Column|Collection total_expenses * @property Grid\Column|Collection total_revenue * @property Grid\Column|Collection transferable - * @property Grid\Column|Collection is_frozen + * @property Grid\Column|Collection end_at + * @property Grid\Column|Collection expire_hours * @property Grid\Column|Collection is_enable * @property Grid\Column|Collection rules - * @property Grid\Column|Collection times - * @property Grid\Column|Collection expire_hours + * @property Grid\Column|Collection share_image + * @property Grid\Column|Collection share_title * @property Grid\Column|Collection start_at - * @property Grid\Column|Collection end_at + * @property Grid\Column|Collection times * @property Grid\Column|Collection bargain_amount - * @property Grid\Column|Collection sku_price * @property Grid\Column|Collection bargain_price - * @property Grid\Column|Collection status * @property Grid\Column|Collection expire_at + * @property Grid\Column|Collection sku_price + * @property Grid\Column|Collection status * @property Grid\Column|Collection continue_click_times * @property Grid\Column|Collection last_click_at * @property Grid\Column|Collection ranges * @property Grid\Column|Collection administrator_id * @property Grid\Column|Collection task_id - * @property Grid\Column|Collection threshold * @property Grid\Column|Collection limit * @property Grid\Column|Collection sent * @property Grid\Column|Collection stock + * @property Grid\Column|Collection threshold * @property Grid\Column|Collection use_day - * @property Grid\Column|Collection use_start_at * @property Grid\Column|Collection use_end_at + * @property Grid\Column|Collection use_start_at * @property Grid\Column|Collection lvl - * @property Grid\Column|Collection total_amount * @property Grid\Column|Collection order_completed_at - * @property Grid\Column|Collection shipping_fee + * @property Grid\Column|Collection total_amount + * @property Grid\Column|Collection consignee_address * @property Grid\Column|Collection consignee_name * @property Grid\Column|Collection consignee_telephone * @property Grid\Column|Collection consignee_zone - * @property Grid\Column|Collection consignee_address - * @property Grid\Column|Collection pay_sn - * @property Grid\Column|Collection pay_way * @property Grid\Column|Collection out_trade_no * @property Grid\Column|Collection pay_at + * @property Grid\Column|Collection pay_sn + * @property Grid\Column|Collection pay_way + * @property Grid\Column|Collection shipping_fee * @property Grid\Column|Collection delivery_bill_id * @property Grid\Column|Collection product_id - * @property Grid\Column|Collection earningable_type * @property Grid\Column|Collection earningable_id - * @property Grid\Column|Collection total_earnings + * @property Grid\Column|Collection earningable_type * @property Grid\Column|Collection fee * @property Grid\Column|Collection fee_rate - * @property Grid\Column|Collection payer_id - * @property Grid\Column|Collection pay_info - * @property Grid\Column|Collection settle_at * @property Grid\Column|Collection pay_image + * @property Grid\Column|Collection pay_info + * @property Grid\Column|Collection payer_id + * @property Grid\Column|Collection settle_at + * @property Grid\Column|Collection total_earnings * @property Grid\Column|Collection is_manager - * @property Grid\Column|Collection real_amount * @property Grid\Column|Collection is_settle + * @property Grid\Column|Collection real_amount * @property Grid\Column|Collection sales_volume * @property Grid\Column|Collection last_consignor_id * @property Grid\Column|Collection new_consignor_id + * @property Grid\Column|Collection deposit_qty * @property Grid\Column|Collection price * @property Grid\Column|Collection sale_price - * @property Grid\Column|Collection deposit_qty * @property Grid\Column|Collection reason + * @property Grid\Column|Collection allocated_at * @property Grid\Column|Collection consignor_id - * @property Grid\Column|Collection settle_state - * @property Grid\Column|Collection pay_time + * @property Grid\Column|Collection deposit_status + * @property Grid\Column|Collection local_status * @property Grid\Column|Collection paied_time + * @property Grid\Column|Collection pay_time + * @property Grid\Column|Collection settle_state * @property Grid\Column|Collection shipping_time * @property Grid\Column|Collection shippinged_time - * @property Grid\Column|Collection allocated_at - * @property Grid\Column|Collection local_status - * @property Grid\Column|Collection deposit_status * @property Grid\Column|Collection min_order_amount * @property Grid\Column|Collection price_1st * @property Grid\Column|Collection price_2st * @property Grid\Column|Collection price_3st - * @property Grid\Column|Collection sales_count * @property Grid\Column|Collection is_sale - * @property Grid\Column|Collection unit * @property Grid\Column|Collection manager_subsidy + * @property Grid\Column|Collection sales_count + * @property Grid\Column|Collection unit * @property Grid\Column|Collection path - * @property Grid\Column|Collection total_purchase_amount * @property Grid\Column|Collection subsidy_rate + * @property Grid\Column|Collection total_purchase_amount * @property Grid\Column|Collection total_subsidy - * @property Grid\Column|Collection purchase_subsidy_id - * @property Grid\Column|Collection change_from_purchase_subsidy_id * @property Grid\Column|Collection change_amount + * @property Grid\Column|Collection change_from_purchase_subsidy_id + * @property Grid\Column|Collection purchase_subsidy_id * @property Grid\Column|Collection change_sales_value - * @property Grid\Column|Collection sell_price * @property Grid\Column|Collection dealer_price * @property Grid\Column|Collection quantity + * @property Grid\Column|Collection sell_price * @property Grid\Column|Collection before_lvl * @property Grid\Column|Collection change_lvl - * @property Grid\Column|Collection revoke_id * @property Grid\Column|Collection is_deposit + * @property Grid\Column|Collection revoke_id * @property Grid\Column|Collection deposit_stock + * @property Grid\Column|Collection account_amount * @property Grid\Column|Collection rate * @property Grid\Column|Collection service_amount - * @property Grid\Column|Collection account_amount * @property Grid\Column|Collection withdrawable - * @property Grid\Column|Collection contracted_lvl_at * @property Grid\Column|Collection bonds + * @property Grid\Column|Collection contracted_lvl_at * @property Grid\Column|Collection self_sales_value * @property Grid\Column|Collection team_sales_value - * @property Grid\Column|Collection jobable_type - * @property Grid\Column|Collection jobable_id * @property Grid\Column|Collection failed_reason + * @property Grid\Column|Collection jobable_id + * @property Grid\Column|Collection jobable_type + * @property Grid\Column|Collection change_revenue * @property Grid\Column|Collection pre_income_id * @property Grid\Column|Collection pre_income_job_id - * @property Grid\Column|Collection change_revenue * @property Grid\Column|Collection agent_level - * @property Grid\Column|Collection total_sales_value - * @property Grid\Column|Collection rule * @property Grid\Column|Collection completed_at - * @property Grid\Column|Collection uuid + * @property Grid\Column|Collection rule + * @property Grid\Column|Collection total_sales_value * @property Grid\Column|Collection connection - * @property Grid\Column|Collection queue - * @property Grid\Column|Collection payload * @property Grid\Column|Collection exception * @property Grid\Column|Collection failed_at + * @property Grid\Column|Collection payload + * @property Grid\Column|Collection queue + * @property Grid\Column|Collection uuid * @property Grid\Column|Collection job_id + * @property Grid\Column|Collection fails * @property Grid\Column|Collection file * @property Grid\Column|Collection success - * @property Grid\Column|Collection fails * @property Grid\Column|Collection code * @property Grid\Column|Collection info * @property Grid\Column|Collection ext * @property Grid\Column|Collection is_push * @property Grid\Column|Collection message_id * @property Grid\Column|Collection order_package_id - * @property Grid\Column|Collection shipping_company - * @property Grid\Column|Collection shipping_code - * @property Grid\Column|Collection shipping_number - * @property Grid\Column|Collection is_failed * @property Grid\Column|Collection checked_at + * @property Grid\Column|Collection is_failed * @property Grid\Column|Collection last_news - * @property Grid\Column|Collection spu_id - * @property Grid\Column|Collection specs - * @property Grid\Column|Collection weight - * @property Grid\Column|Collection vip_price - * @property Grid\Column|Collection coupon_discount_amount - * @property Grid\Column|Collection vip_discount_amount - * @property Grid\Column|Collection reduced_amount - * @property Grid\Column|Collection after_sale_state + * @property Grid\Column|Collection shipping_code + * @property Grid\Column|Collection shipping_company + * @property Grid\Column|Collection shipping_number * @property Grid\Column|Collection after_expire_at - * @property Grid\Column|Collection remain_quantity + * @property Grid\Column|Collection after_sale_state + * @property Grid\Column|Collection coupon_discount_amount * @property Grid\Column|Collection gift_for_sku_id * @property Grid\Column|Collection is_gift + * @property Grid\Column|Collection reduced_amount + * @property Grid\Column|Collection remain_quantity + * @property Grid\Column|Collection specs + * @property Grid\Column|Collection spu_id + * @property Grid\Column|Collection vip_discount_amount + * @property Grid\Column|Collection vip_price + * @property Grid\Column|Collection weight * @property Grid\Column|Collection max - * @property Grid\Column|Collection products_total_amount - * @property Grid\Column|Collection note - * @property Grid\Column|Collection user_coupon_id - * @property Grid\Column|Collection shipping_state - * @property Grid\Column|Collection is_change * @property Grid\Column|Collection auto_complete_at + * @property Grid\Column|Collection is_change * @property Grid\Column|Collection is_settlable - * @property Grid\Column|Collection payable_type + * @property Grid\Column|Collection note + * @property Grid\Column|Collection products_total_amount + * @property Grid\Column|Collection shipping_state + * @property Grid\Column|Collection user_coupon_id * @property Grid\Column|Collection payable_id - * @property Grid\Column|Collection tokenable_type - * @property Grid\Column|Collection tokenable_id - * @property Grid\Column|Collection token + * @property Grid\Column|Collection payable_type * @property Grid\Column|Collection abilities * @property Grid\Column|Collection last_used_at + * @property Grid\Column|Collection token + * @property Grid\Column|Collection tokenable_id + * @property Grid\Column|Collection tokenable_type * @property Grid\Column|Collection old_points * @property Grid\Column|Collection gift_sku_id * @property Grid\Column|Collection remaining * @property Grid\Column|Collection attrs * @property Grid\Column|Collection applicant_id * @property Grid\Column|Collection reviewer_id - * @property Grid\Column|Collection market_price - * @property Grid\Column|Collection cost_price - * @property Grid\Column|Collection media - * @property Grid\Column|Collection sales - * @property Grid\Column|Collection release_at - * @property Grid\Column|Collection verify_state * @property Grid\Column|Collection buynote_id + * @property Grid\Column|Collection cost_price + * @property Grid\Column|Collection market_price + * @property Grid\Column|Collection media + * @property Grid\Column|Collection release_at + * @property Grid\Column|Collection sales * @property Grid\Column|Collection shipping_template_id + * @property Grid\Column|Collection verify_state * @property Grid\Column|Collection feature_id * @property Grid\Column|Collection items * @property Grid\Column|Collection view_date @@ -276,317 +278,319 @@ namespace Dcat\Admin { * @property Grid\Column|Collection message_type * @property Grid\Column|Collection change_quota * @property Grid\Column|Collection order_user_id + * @property Grid\Column|Collection size * @property Grid\Column|Collection x * @property Grid\Column|Collection y - * @property Grid\Column|Collection size - * @property Grid\Column|Collection zone_id + * @property Grid\Column|Collection address * @property Grid\Column|Collection consignee + * @property Grid\Column|Collection is_default * @property Grid\Column|Collection telephone * @property Grid\Column|Collection zone - * @property Grid\Column|Collection address - * @property Grid\Column|Collection is_default + * @property Grid\Column|Collection zone_id * @property Grid\Column|Collection rule_id * @property Grid\Column|Collection template_id * @property Grid\Column|Collection zones - * @property Grid\Column|Collection phone * @property Grid\Column|Collection expires_at - * @property Grid\Column|Collection socialite_type + * @property Grid\Column|Collection phone * @property Grid\Column|Collection socialite_id + * @property Grid\Column|Collection socialite_type * @property Grid\Column|Collection tag_id * @property Grid\Column|Collection taggable_id * @property Grid\Column|Collection taggable_type - * @property Grid\Column|Collection real_name - * @property Grid\Column|Collection bank_number - * @property Grid\Column|Collection bank_name * @property Grid\Column|Collection bank_description + * @property Grid\Column|Collection bank_name + * @property Grid\Column|Collection bank_number * @property Grid\Column|Collection is_edited * @property Grid\Column|Collection old_real_name - * @property Grid\Column|Collection u_cid + * @property Grid\Column|Collection real_name * @property Grid\Column|Collection m_cid - * @property Grid\Column|Collection coupon_name - * @property Grid\Column|Collection coupon_type + * @property Grid\Column|Collection u_cid * @property Grid\Column|Collection coupon_amount + * @property Grid\Column|Collection coupon_name * @property Grid\Column|Collection coupon_threshold - * @property Grid\Column|Collection inviter_id - * @property Grid\Column|Collection nickname - * @property Grid\Column|Collection gender + * @property Grid\Column|Collection coupon_type * @property Grid\Column|Collection birthday * @property Grid\Column|Collection bonusable * @property Grid\Column|Collection depth - * @property Grid\Column|Collection quota_v2 - * @property Grid\Column|Collection quota_v1 - * @property Grid\Column|Collection growth_value + * @property Grid\Column|Collection gender * @property Grid\Column|Collection group_sales_value + * @property Grid\Column|Collection growth_value + * @property Grid\Column|Collection inviter_id + * @property Grid\Column|Collection nickname * @property Grid\Column|Collection pre_growth_value + * @property Grid\Column|Collection quota_v1 + * @property Grid\Column|Collection quota_v2 * @property Grid\Column|Collection real_inviter_id * @property Grid\Column|Collection vip_id - * @property Grid\Column|Collection phone_verified_at * @property Grid\Column|Collection email * @property Grid\Column|Collection email_verified_at - * @property Grid\Column|Collection last_login_ip * @property Grid\Column|Collection last_login_at + * @property Grid\Column|Collection last_login_ip + * @property Grid\Column|Collection old_password + * @property Grid\Column|Collection phone_verified_at * @property Grid\Column|Collection register_ip * @property Grid\Column|Collection status_remark - * @property Grid\Column|Collection old_password * * @method Grid\Column|Collection width(string $label = null) - * @method Grid\Column|Collection id(string $label = null) - * @method Grid\Column|Collection cover(string $label = null) * @method Grid\Column|Collection content(string $label = null) + * @method Grid\Column|Collection coupons_rule(string $label = null) + * @method Grid\Column|Collection cover(string $label = null) + * @method Grid\Column|Collection created_at(string $label = null) + * @method Grid\Column|Collection ended_at(string $label = null) + * @method Grid\Column|Collection gifts_rule(string $label = null) + * @method Grid\Column|Collection id(string $label = null) * @method Grid\Column|Collection is_use(string $label = null) * @method Grid\Column|Collection started_at(string $label = null) - * @method Grid\Column|Collection ended_at(string $label = null) - * @method Grid\Column|Collection coupons_rule(string $label = null) - * @method Grid\Column|Collection gifts_rule(string $label = null) - * @method Grid\Column|Collection created_at(string $label = null) * @method Grid\Column|Collection updated_at(string $label = null) * @method Grid\Column|Collection activity_id(string $label = null) * @method Grid\Column|Collection coupon_id(string $label = null) * @method Grid\Column|Collection qty(string $label = null) * @method Grid\Column|Collection sku_id(string $label = null) * @method Grid\Column|Collection part_id(string $label = null) - * @method Grid\Column|Collection key(string $label = null) - * @method Grid\Column|Collection name(string $label = null) * @method Grid\Column|Collection dimensions(string $label = null) * @method Grid\Column|Collection is_show(string $label = null) + * @method Grid\Column|Collection key(string $label = null) + * @method Grid\Column|Collection name(string $label = null) + * @method Grid\Column|Collection detail(string $label = null) * @method Grid\Column|Collection type(string $label = null) * @method Grid\Column|Collection version(string $label = null) - * @method Grid\Column|Collection detail(string $label = null) * @method Grid\Column|Collection is_enabled(string $label = null) - * @method Grid\Column|Collection parent_id(string $label = null) - * @method Grid\Column|Collection order(string $label = null) - * @method Grid\Column|Collection icon(string $label = null) - * @method Grid\Column|Collection uri(string $label = null) * @method Grid\Column|Collection extension(string $label = null) - * @method Grid\Column|Collection permission_id(string $label = null) + * @method Grid\Column|Collection icon(string $label = null) + * @method Grid\Column|Collection order(string $label = null) + * @method Grid\Column|Collection parent_id(string $label = null) + * @method Grid\Column|Collection uri(string $label = null) * @method Grid\Column|Collection menu_id(string $label = null) - * @method Grid\Column|Collection slug(string $label = null) + * @method Grid\Column|Collection permission_id(string $label = null) * @method Grid\Column|Collection http_method(string $label = null) * @method Grid\Column|Collection http_path(string $label = null) + * @method Grid\Column|Collection slug(string $label = null) * @method Grid\Column|Collection role_id(string $label = null) * @method Grid\Column|Collection user_id(string $label = null) * @method Grid\Column|Collection value(string $label = null) - * @method Grid\Column|Collection username(string $label = null) - * @method Grid\Column|Collection password(string $label = null) * @method Grid\Column|Collection avatar(string $label = null) + * @method Grid\Column|Collection password(string $label = null) * @method Grid\Column|Collection remember_token(string $label = null) + * @method Grid\Column|Collection username(string $label = null) * @method Grid\Column|Collection address_id(string $label = null) * @method Grid\Column|Collection image(string $label = null) - * @method Grid\Column|Collection sort(string $label = null) - * @method Grid\Column|Collection jump_type(string $label = null) * @method Grid\Column|Collection jump_link(string $label = null) + * @method Grid\Column|Collection jump_type(string $label = null) * @method Grid\Column|Collection remarks(string $label = null) + * @method Grid\Column|Collection sort(string $label = null) * @method Grid\Column|Collection after_sale_id(string $label = null) * @method Grid\Column|Collection desc(string $label = null) * @method Grid\Column|Collection images(string $label = null) - * @method Grid\Column|Collection order_id(string $label = null) - * @method Grid\Column|Collection sn(string $label = null) - * @method Grid\Column|Collection order_product_id(string $label = null) - * @method Grid\Column|Collection num(string $label = null) * @method Grid\Column|Collection amount(string $label = null) + * @method Grid\Column|Collection num(string $label = null) + * @method Grid\Column|Collection order_id(string $label = null) + * @method Grid\Column|Collection order_product_id(string $label = null) + * @method Grid\Column|Collection sales_value(string $label = null) + * @method Grid\Column|Collection sn(string $label = null) * @method Grid\Column|Collection state(string $label = null) * @method Grid\Column|Collection tracking_number(string $label = null) - * @method Grid\Column|Collection sales_value(string $label = null) * @method Grid\Column|Collection before_agent_level(string $label = null) * @method Grid\Column|Collection change_agent_level(string $label = null) * @method Grid\Column|Collection remark(string $label = null) - * @method Grid\Column|Collection v(string $label = null) - * @method Grid\Column|Collection cate(string $label = null) - * @method Grid\Column|Collection is_force(string $label = null) - * @method Grid\Column|Collection context(string $label = null) * @method Grid\Column|Collection apk_link(string $label = null) + * @method Grid\Column|Collection cate(string $label = null) + * @method Grid\Column|Collection context(string $label = null) + * @method Grid\Column|Collection is_force(string $label = null) + * @method Grid\Column|Collection v(string $label = null) * @method Grid\Column|Collection wgt_link(string $label = null) - * @method Grid\Column|Collection is_recommend(string $label = null) * @method Grid\Column|Collection _lft(string $label = null) * @method Grid\Column|Collection _rgt(string $label = null) + * @method Grid\Column|Collection is_recommend(string $label = null) * @method Grid\Column|Collection article_id(string $label = null) - * @method Grid\Column|Collection category_id(string $label = null) * @method Grid\Column|Collection author_name(string $label = null) - * @method Grid\Column|Collection subtitle(string $label = null) - * @method Grid\Column|Collection points(string $label = null) + * @method Grid\Column|Collection category_id(string $label = null) * @method Grid\Column|Collection likes(string $label = null) - * @method Grid\Column|Collection media_type(string $label = null) * @method Grid\Column|Collection media_content(string $label = null) - * @method Grid\Column|Collection loggable_type(string $label = null) - * @method Grid\Column|Collection loggable_id(string $label = null) + * @method Grid\Column|Collection media_type(string $label = null) + * @method Grid\Column|Collection points(string $label = null) + * @method Grid\Column|Collection subtitle(string $label = null) * @method Grid\Column|Collection action(string $label = null) * @method Grid\Column|Collection before_balance(string $label = null) * @method Grid\Column|Collection change_balance(string $label = null) + * @method Grid\Column|Collection loggable_id(string $label = null) + * @method Grid\Column|Collection loggable_type(string $label = null) * @method Grid\Column|Collection balance(string $label = null) + * @method Grid\Column|Collection is_frozen(string $label = null) * @method Grid\Column|Collection total_expenses(string $label = null) * @method Grid\Column|Collection total_revenue(string $label = null) * @method Grid\Column|Collection transferable(string $label = null) - * @method Grid\Column|Collection is_frozen(string $label = null) + * @method Grid\Column|Collection end_at(string $label = null) + * @method Grid\Column|Collection expire_hours(string $label = null) * @method Grid\Column|Collection is_enable(string $label = null) * @method Grid\Column|Collection rules(string $label = null) - * @method Grid\Column|Collection times(string $label = null) - * @method Grid\Column|Collection expire_hours(string $label = null) + * @method Grid\Column|Collection share_image(string $label = null) + * @method Grid\Column|Collection share_title(string $label = null) * @method Grid\Column|Collection start_at(string $label = null) - * @method Grid\Column|Collection end_at(string $label = null) + * @method Grid\Column|Collection times(string $label = null) * @method Grid\Column|Collection bargain_amount(string $label = null) - * @method Grid\Column|Collection sku_price(string $label = null) * @method Grid\Column|Collection bargain_price(string $label = null) - * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection expire_at(string $label = null) + * @method Grid\Column|Collection sku_price(string $label = null) + * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection continue_click_times(string $label = null) * @method Grid\Column|Collection last_click_at(string $label = null) * @method Grid\Column|Collection ranges(string $label = null) * @method Grid\Column|Collection administrator_id(string $label = null) * @method Grid\Column|Collection task_id(string $label = null) - * @method Grid\Column|Collection threshold(string $label = null) * @method Grid\Column|Collection limit(string $label = null) * @method Grid\Column|Collection sent(string $label = null) * @method Grid\Column|Collection stock(string $label = null) + * @method Grid\Column|Collection threshold(string $label = null) * @method Grid\Column|Collection use_day(string $label = null) - * @method Grid\Column|Collection use_start_at(string $label = null) * @method Grid\Column|Collection use_end_at(string $label = null) + * @method Grid\Column|Collection use_start_at(string $label = null) * @method Grid\Column|Collection lvl(string $label = null) - * @method Grid\Column|Collection total_amount(string $label = null) * @method Grid\Column|Collection order_completed_at(string $label = null) - * @method Grid\Column|Collection shipping_fee(string $label = null) + * @method Grid\Column|Collection total_amount(string $label = null) + * @method Grid\Column|Collection consignee_address(string $label = null) * @method Grid\Column|Collection consignee_name(string $label = null) * @method Grid\Column|Collection consignee_telephone(string $label = null) * @method Grid\Column|Collection consignee_zone(string $label = null) - * @method Grid\Column|Collection consignee_address(string $label = null) - * @method Grid\Column|Collection pay_sn(string $label = null) - * @method Grid\Column|Collection pay_way(string $label = null) * @method Grid\Column|Collection out_trade_no(string $label = null) * @method Grid\Column|Collection pay_at(string $label = null) + * @method Grid\Column|Collection pay_sn(string $label = null) + * @method Grid\Column|Collection pay_way(string $label = null) + * @method Grid\Column|Collection shipping_fee(string $label = null) * @method Grid\Column|Collection delivery_bill_id(string $label = null) * @method Grid\Column|Collection product_id(string $label = null) - * @method Grid\Column|Collection earningable_type(string $label = null) * @method Grid\Column|Collection earningable_id(string $label = null) - * @method Grid\Column|Collection total_earnings(string $label = null) + * @method Grid\Column|Collection earningable_type(string $label = null) * @method Grid\Column|Collection fee(string $label = null) * @method Grid\Column|Collection fee_rate(string $label = null) - * @method Grid\Column|Collection payer_id(string $label = null) - * @method Grid\Column|Collection pay_info(string $label = null) - * @method Grid\Column|Collection settle_at(string $label = null) * @method Grid\Column|Collection pay_image(string $label = null) + * @method Grid\Column|Collection pay_info(string $label = null) + * @method Grid\Column|Collection payer_id(string $label = null) + * @method Grid\Column|Collection settle_at(string $label = null) + * @method Grid\Column|Collection total_earnings(string $label = null) * @method Grid\Column|Collection is_manager(string $label = null) - * @method Grid\Column|Collection real_amount(string $label = null) * @method Grid\Column|Collection is_settle(string $label = null) + * @method Grid\Column|Collection real_amount(string $label = null) * @method Grid\Column|Collection sales_volume(string $label = null) * @method Grid\Column|Collection last_consignor_id(string $label = null) * @method Grid\Column|Collection new_consignor_id(string $label = null) + * @method Grid\Column|Collection deposit_qty(string $label = null) * @method Grid\Column|Collection price(string $label = null) * @method Grid\Column|Collection sale_price(string $label = null) - * @method Grid\Column|Collection deposit_qty(string $label = null) * @method Grid\Column|Collection reason(string $label = null) + * @method Grid\Column|Collection allocated_at(string $label = null) * @method Grid\Column|Collection consignor_id(string $label = null) - * @method Grid\Column|Collection settle_state(string $label = null) - * @method Grid\Column|Collection pay_time(string $label = null) + * @method Grid\Column|Collection deposit_status(string $label = null) + * @method Grid\Column|Collection local_status(string $label = null) * @method Grid\Column|Collection paied_time(string $label = null) + * @method Grid\Column|Collection pay_time(string $label = null) + * @method Grid\Column|Collection settle_state(string $label = null) * @method Grid\Column|Collection shipping_time(string $label = null) * @method Grid\Column|Collection shippinged_time(string $label = null) - * @method Grid\Column|Collection allocated_at(string $label = null) - * @method Grid\Column|Collection local_status(string $label = null) - * @method Grid\Column|Collection deposit_status(string $label = null) * @method Grid\Column|Collection min_order_amount(string $label = null) * @method Grid\Column|Collection price_1st(string $label = null) * @method Grid\Column|Collection price_2st(string $label = null) * @method Grid\Column|Collection price_3st(string $label = null) - * @method Grid\Column|Collection sales_count(string $label = null) * @method Grid\Column|Collection is_sale(string $label = null) - * @method Grid\Column|Collection unit(string $label = null) * @method Grid\Column|Collection manager_subsidy(string $label = null) + * @method Grid\Column|Collection sales_count(string $label = null) + * @method Grid\Column|Collection unit(string $label = null) * @method Grid\Column|Collection path(string $label = null) - * @method Grid\Column|Collection total_purchase_amount(string $label = null) * @method Grid\Column|Collection subsidy_rate(string $label = null) + * @method Grid\Column|Collection total_purchase_amount(string $label = null) * @method Grid\Column|Collection total_subsidy(string $label = null) - * @method Grid\Column|Collection purchase_subsidy_id(string $label = null) - * @method Grid\Column|Collection change_from_purchase_subsidy_id(string $label = null) * @method Grid\Column|Collection change_amount(string $label = null) + * @method Grid\Column|Collection change_from_purchase_subsidy_id(string $label = null) + * @method Grid\Column|Collection purchase_subsidy_id(string $label = null) * @method Grid\Column|Collection change_sales_value(string $label = null) - * @method Grid\Column|Collection sell_price(string $label = null) * @method Grid\Column|Collection dealer_price(string $label = null) * @method Grid\Column|Collection quantity(string $label = null) + * @method Grid\Column|Collection sell_price(string $label = null) * @method Grid\Column|Collection before_lvl(string $label = null) * @method Grid\Column|Collection change_lvl(string $label = null) - * @method Grid\Column|Collection revoke_id(string $label = null) * @method Grid\Column|Collection is_deposit(string $label = null) + * @method Grid\Column|Collection revoke_id(string $label = null) * @method Grid\Column|Collection deposit_stock(string $label = null) + * @method Grid\Column|Collection account_amount(string $label = null) * @method Grid\Column|Collection rate(string $label = null) * @method Grid\Column|Collection service_amount(string $label = null) - * @method Grid\Column|Collection account_amount(string $label = null) * @method Grid\Column|Collection withdrawable(string $label = null) - * @method Grid\Column|Collection contracted_lvl_at(string $label = null) * @method Grid\Column|Collection bonds(string $label = null) + * @method Grid\Column|Collection contracted_lvl_at(string $label = null) * @method Grid\Column|Collection self_sales_value(string $label = null) * @method Grid\Column|Collection team_sales_value(string $label = null) - * @method Grid\Column|Collection jobable_type(string $label = null) - * @method Grid\Column|Collection jobable_id(string $label = null) * @method Grid\Column|Collection failed_reason(string $label = null) + * @method Grid\Column|Collection jobable_id(string $label = null) + * @method Grid\Column|Collection jobable_type(string $label = null) + * @method Grid\Column|Collection change_revenue(string $label = null) * @method Grid\Column|Collection pre_income_id(string $label = null) * @method Grid\Column|Collection pre_income_job_id(string $label = null) - * @method Grid\Column|Collection change_revenue(string $label = null) * @method Grid\Column|Collection agent_level(string $label = null) - * @method Grid\Column|Collection total_sales_value(string $label = null) - * @method Grid\Column|Collection rule(string $label = null) * @method Grid\Column|Collection completed_at(string $label = null) - * @method Grid\Column|Collection uuid(string $label = null) + * @method Grid\Column|Collection rule(string $label = null) + * @method Grid\Column|Collection total_sales_value(string $label = null) * @method Grid\Column|Collection connection(string $label = null) - * @method Grid\Column|Collection queue(string $label = null) - * @method Grid\Column|Collection payload(string $label = null) * @method Grid\Column|Collection exception(string $label = null) * @method Grid\Column|Collection failed_at(string $label = null) + * @method Grid\Column|Collection payload(string $label = null) + * @method Grid\Column|Collection queue(string $label = null) + * @method Grid\Column|Collection uuid(string $label = null) * @method Grid\Column|Collection job_id(string $label = null) + * @method Grid\Column|Collection fails(string $label = null) * @method Grid\Column|Collection file(string $label = null) * @method Grid\Column|Collection success(string $label = null) - * @method Grid\Column|Collection fails(string $label = null) * @method Grid\Column|Collection code(string $label = null) * @method Grid\Column|Collection info(string $label = null) * @method Grid\Column|Collection ext(string $label = null) * @method Grid\Column|Collection is_push(string $label = null) * @method Grid\Column|Collection message_id(string $label = null) * @method Grid\Column|Collection order_package_id(string $label = null) - * @method Grid\Column|Collection shipping_company(string $label = null) - * @method Grid\Column|Collection shipping_code(string $label = null) - * @method Grid\Column|Collection shipping_number(string $label = null) - * @method Grid\Column|Collection is_failed(string $label = null) * @method Grid\Column|Collection checked_at(string $label = null) + * @method Grid\Column|Collection is_failed(string $label = null) * @method Grid\Column|Collection last_news(string $label = null) - * @method Grid\Column|Collection spu_id(string $label = null) - * @method Grid\Column|Collection specs(string $label = null) - * @method Grid\Column|Collection weight(string $label = null) - * @method Grid\Column|Collection vip_price(string $label = null) - * @method Grid\Column|Collection coupon_discount_amount(string $label = null) - * @method Grid\Column|Collection vip_discount_amount(string $label = null) - * @method Grid\Column|Collection reduced_amount(string $label = null) - * @method Grid\Column|Collection after_sale_state(string $label = null) + * @method Grid\Column|Collection shipping_code(string $label = null) + * @method Grid\Column|Collection shipping_company(string $label = null) + * @method Grid\Column|Collection shipping_number(string $label = null) * @method Grid\Column|Collection after_expire_at(string $label = null) - * @method Grid\Column|Collection remain_quantity(string $label = null) + * @method Grid\Column|Collection after_sale_state(string $label = null) + * @method Grid\Column|Collection coupon_discount_amount(string $label = null) * @method Grid\Column|Collection gift_for_sku_id(string $label = null) * @method Grid\Column|Collection is_gift(string $label = null) + * @method Grid\Column|Collection reduced_amount(string $label = null) + * @method Grid\Column|Collection remain_quantity(string $label = null) + * @method Grid\Column|Collection specs(string $label = null) + * @method Grid\Column|Collection spu_id(string $label = null) + * @method Grid\Column|Collection vip_discount_amount(string $label = null) + * @method Grid\Column|Collection vip_price(string $label = null) + * @method Grid\Column|Collection weight(string $label = null) * @method Grid\Column|Collection max(string $label = null) - * @method Grid\Column|Collection products_total_amount(string $label = null) - * @method Grid\Column|Collection note(string $label = null) - * @method Grid\Column|Collection user_coupon_id(string $label = null) - * @method Grid\Column|Collection shipping_state(string $label = null) - * @method Grid\Column|Collection is_change(string $label = null) * @method Grid\Column|Collection auto_complete_at(string $label = null) + * @method Grid\Column|Collection is_change(string $label = null) * @method Grid\Column|Collection is_settlable(string $label = null) - * @method Grid\Column|Collection payable_type(string $label = null) + * @method Grid\Column|Collection note(string $label = null) + * @method Grid\Column|Collection products_total_amount(string $label = null) + * @method Grid\Column|Collection shipping_state(string $label = null) + * @method Grid\Column|Collection user_coupon_id(string $label = null) * @method Grid\Column|Collection payable_id(string $label = null) - * @method Grid\Column|Collection tokenable_type(string $label = null) - * @method Grid\Column|Collection tokenable_id(string $label = null) - * @method Grid\Column|Collection token(string $label = null) + * @method Grid\Column|Collection payable_type(string $label = null) * @method Grid\Column|Collection abilities(string $label = null) * @method Grid\Column|Collection last_used_at(string $label = null) + * @method Grid\Column|Collection token(string $label = null) + * @method Grid\Column|Collection tokenable_id(string $label = null) + * @method Grid\Column|Collection tokenable_type(string $label = null) * @method Grid\Column|Collection old_points(string $label = null) * @method Grid\Column|Collection gift_sku_id(string $label = null) * @method Grid\Column|Collection remaining(string $label = null) * @method Grid\Column|Collection attrs(string $label = null) * @method Grid\Column|Collection applicant_id(string $label = null) * @method Grid\Column|Collection reviewer_id(string $label = null) - * @method Grid\Column|Collection market_price(string $label = null) - * @method Grid\Column|Collection cost_price(string $label = null) - * @method Grid\Column|Collection media(string $label = null) - * @method Grid\Column|Collection sales(string $label = null) - * @method Grid\Column|Collection release_at(string $label = null) - * @method Grid\Column|Collection verify_state(string $label = null) * @method Grid\Column|Collection buynote_id(string $label = null) + * @method Grid\Column|Collection cost_price(string $label = null) + * @method Grid\Column|Collection market_price(string $label = null) + * @method Grid\Column|Collection media(string $label = null) + * @method Grid\Column|Collection release_at(string $label = null) + * @method Grid\Column|Collection sales(string $label = null) * @method Grid\Column|Collection shipping_template_id(string $label = null) + * @method Grid\Column|Collection verify_state(string $label = null) * @method Grid\Column|Collection feature_id(string $label = null) * @method Grid\Column|Collection items(string $label = null) * @method Grid\Column|Collection view_date(string $label = null) @@ -594,58 +598,58 @@ namespace Dcat\Admin { * @method Grid\Column|Collection message_type(string $label = null) * @method Grid\Column|Collection change_quota(string $label = null) * @method Grid\Column|Collection order_user_id(string $label = null) + * @method Grid\Column|Collection size(string $label = null) * @method Grid\Column|Collection x(string $label = null) * @method Grid\Column|Collection y(string $label = null) - * @method Grid\Column|Collection size(string $label = null) - * @method Grid\Column|Collection zone_id(string $label = null) + * @method Grid\Column|Collection address(string $label = null) * @method Grid\Column|Collection consignee(string $label = null) + * @method Grid\Column|Collection is_default(string $label = null) * @method Grid\Column|Collection telephone(string $label = null) * @method Grid\Column|Collection zone(string $label = null) - * @method Grid\Column|Collection address(string $label = null) - * @method Grid\Column|Collection is_default(string $label = null) + * @method Grid\Column|Collection zone_id(string $label = null) * @method Grid\Column|Collection rule_id(string $label = null) * @method Grid\Column|Collection template_id(string $label = null) * @method Grid\Column|Collection zones(string $label = null) - * @method Grid\Column|Collection phone(string $label = null) * @method Grid\Column|Collection expires_at(string $label = null) - * @method Grid\Column|Collection socialite_type(string $label = null) + * @method Grid\Column|Collection phone(string $label = null) * @method Grid\Column|Collection socialite_id(string $label = null) + * @method Grid\Column|Collection socialite_type(string $label = null) * @method Grid\Column|Collection tag_id(string $label = null) * @method Grid\Column|Collection taggable_id(string $label = null) * @method Grid\Column|Collection taggable_type(string $label = null) - * @method Grid\Column|Collection real_name(string $label = null) - * @method Grid\Column|Collection bank_number(string $label = null) - * @method Grid\Column|Collection bank_name(string $label = null) * @method Grid\Column|Collection bank_description(string $label = null) + * @method Grid\Column|Collection bank_name(string $label = null) + * @method Grid\Column|Collection bank_number(string $label = null) * @method Grid\Column|Collection is_edited(string $label = null) * @method Grid\Column|Collection old_real_name(string $label = null) - * @method Grid\Column|Collection u_cid(string $label = null) + * @method Grid\Column|Collection real_name(string $label = null) * @method Grid\Column|Collection m_cid(string $label = null) - * @method Grid\Column|Collection coupon_name(string $label = null) - * @method Grid\Column|Collection coupon_type(string $label = null) + * @method Grid\Column|Collection u_cid(string $label = null) * @method Grid\Column|Collection coupon_amount(string $label = null) + * @method Grid\Column|Collection coupon_name(string $label = null) * @method Grid\Column|Collection coupon_threshold(string $label = null) - * @method Grid\Column|Collection inviter_id(string $label = null) - * @method Grid\Column|Collection nickname(string $label = null) - * @method Grid\Column|Collection gender(string $label = null) + * @method Grid\Column|Collection coupon_type(string $label = null) * @method Grid\Column|Collection birthday(string $label = null) * @method Grid\Column|Collection bonusable(string $label = null) * @method Grid\Column|Collection depth(string $label = null) - * @method Grid\Column|Collection quota_v2(string $label = null) - * @method Grid\Column|Collection quota_v1(string $label = null) - * @method Grid\Column|Collection growth_value(string $label = null) + * @method Grid\Column|Collection gender(string $label = null) * @method Grid\Column|Collection group_sales_value(string $label = null) + * @method Grid\Column|Collection growth_value(string $label = null) + * @method Grid\Column|Collection inviter_id(string $label = null) + * @method Grid\Column|Collection nickname(string $label = null) * @method Grid\Column|Collection pre_growth_value(string $label = null) + * @method Grid\Column|Collection quota_v1(string $label = null) + * @method Grid\Column|Collection quota_v2(string $label = null) * @method Grid\Column|Collection real_inviter_id(string $label = null) * @method Grid\Column|Collection vip_id(string $label = null) - * @method Grid\Column|Collection phone_verified_at(string $label = null) * @method Grid\Column|Collection email(string $label = null) * @method Grid\Column|Collection email_verified_at(string $label = null) - * @method Grid\Column|Collection last_login_ip(string $label = null) * @method Grid\Column|Collection last_login_at(string $label = null) + * @method Grid\Column|Collection last_login_ip(string $label = null) + * @method Grid\Column|Collection old_password(string $label = null) + * @method Grid\Column|Collection phone_verified_at(string $label = null) * @method Grid\Column|Collection register_ip(string $label = null) * @method Grid\Column|Collection status_remark(string $label = null) - * @method Grid\Column|Collection old_password(string $label = null) */ class Grid {} @@ -653,263 +657,265 @@ namespace Dcat\Admin { /** * @property Show\Field|Collection width - * @property Show\Field|Collection id - * @property Show\Field|Collection cover * @property Show\Field|Collection content + * @property Show\Field|Collection coupons_rule + * @property Show\Field|Collection cover + * @property Show\Field|Collection created_at + * @property Show\Field|Collection ended_at + * @property Show\Field|Collection gifts_rule + * @property Show\Field|Collection id * @property Show\Field|Collection is_use * @property Show\Field|Collection started_at - * @property Show\Field|Collection ended_at - * @property Show\Field|Collection coupons_rule - * @property Show\Field|Collection gifts_rule - * @property Show\Field|Collection created_at * @property Show\Field|Collection updated_at * @property Show\Field|Collection activity_id * @property Show\Field|Collection coupon_id * @property Show\Field|Collection qty * @property Show\Field|Collection sku_id * @property Show\Field|Collection part_id - * @property Show\Field|Collection key - * @property Show\Field|Collection name * @property Show\Field|Collection dimensions * @property Show\Field|Collection is_show + * @property Show\Field|Collection key + * @property Show\Field|Collection name + * @property Show\Field|Collection detail * @property Show\Field|Collection type * @property Show\Field|Collection version - * @property Show\Field|Collection detail * @property Show\Field|Collection is_enabled - * @property Show\Field|Collection parent_id - * @property Show\Field|Collection order - * @property Show\Field|Collection icon - * @property Show\Field|Collection uri * @property Show\Field|Collection extension - * @property Show\Field|Collection permission_id + * @property Show\Field|Collection icon + * @property Show\Field|Collection order + * @property Show\Field|Collection parent_id + * @property Show\Field|Collection uri * @property Show\Field|Collection menu_id - * @property Show\Field|Collection slug + * @property Show\Field|Collection permission_id * @property Show\Field|Collection http_method * @property Show\Field|Collection http_path + * @property Show\Field|Collection slug * @property Show\Field|Collection role_id * @property Show\Field|Collection user_id * @property Show\Field|Collection value - * @property Show\Field|Collection username - * @property Show\Field|Collection password * @property Show\Field|Collection avatar + * @property Show\Field|Collection password * @property Show\Field|Collection remember_token + * @property Show\Field|Collection username * @property Show\Field|Collection address_id * @property Show\Field|Collection image - * @property Show\Field|Collection sort - * @property Show\Field|Collection jump_type * @property Show\Field|Collection jump_link + * @property Show\Field|Collection jump_type * @property Show\Field|Collection remarks + * @property Show\Field|Collection sort * @property Show\Field|Collection after_sale_id * @property Show\Field|Collection desc * @property Show\Field|Collection images - * @property Show\Field|Collection order_id - * @property Show\Field|Collection sn - * @property Show\Field|Collection order_product_id - * @property Show\Field|Collection num * @property Show\Field|Collection amount + * @property Show\Field|Collection num + * @property Show\Field|Collection order_id + * @property Show\Field|Collection order_product_id + * @property Show\Field|Collection sales_value + * @property Show\Field|Collection sn * @property Show\Field|Collection state * @property Show\Field|Collection tracking_number - * @property Show\Field|Collection sales_value * @property Show\Field|Collection before_agent_level * @property Show\Field|Collection change_agent_level * @property Show\Field|Collection remark - * @property Show\Field|Collection v - * @property Show\Field|Collection cate - * @property Show\Field|Collection is_force - * @property Show\Field|Collection context * @property Show\Field|Collection apk_link + * @property Show\Field|Collection cate + * @property Show\Field|Collection context + * @property Show\Field|Collection is_force + * @property Show\Field|Collection v * @property Show\Field|Collection wgt_link - * @property Show\Field|Collection is_recommend * @property Show\Field|Collection _lft * @property Show\Field|Collection _rgt + * @property Show\Field|Collection is_recommend * @property Show\Field|Collection article_id - * @property Show\Field|Collection category_id * @property Show\Field|Collection author_name - * @property Show\Field|Collection subtitle - * @property Show\Field|Collection points + * @property Show\Field|Collection category_id * @property Show\Field|Collection likes - * @property Show\Field|Collection media_type * @property Show\Field|Collection media_content - * @property Show\Field|Collection loggable_type - * @property Show\Field|Collection loggable_id + * @property Show\Field|Collection media_type + * @property Show\Field|Collection points + * @property Show\Field|Collection subtitle * @property Show\Field|Collection action * @property Show\Field|Collection before_balance * @property Show\Field|Collection change_balance + * @property Show\Field|Collection loggable_id + * @property Show\Field|Collection loggable_type * @property Show\Field|Collection balance + * @property Show\Field|Collection is_frozen * @property Show\Field|Collection total_expenses * @property Show\Field|Collection total_revenue * @property Show\Field|Collection transferable - * @property Show\Field|Collection is_frozen + * @property Show\Field|Collection end_at + * @property Show\Field|Collection expire_hours * @property Show\Field|Collection is_enable * @property Show\Field|Collection rules - * @property Show\Field|Collection times - * @property Show\Field|Collection expire_hours + * @property Show\Field|Collection share_image + * @property Show\Field|Collection share_title * @property Show\Field|Collection start_at - * @property Show\Field|Collection end_at + * @property Show\Field|Collection times * @property Show\Field|Collection bargain_amount - * @property Show\Field|Collection sku_price * @property Show\Field|Collection bargain_price - * @property Show\Field|Collection status * @property Show\Field|Collection expire_at + * @property Show\Field|Collection sku_price + * @property Show\Field|Collection status * @property Show\Field|Collection continue_click_times * @property Show\Field|Collection last_click_at * @property Show\Field|Collection ranges * @property Show\Field|Collection administrator_id * @property Show\Field|Collection task_id - * @property Show\Field|Collection threshold * @property Show\Field|Collection limit * @property Show\Field|Collection sent * @property Show\Field|Collection stock + * @property Show\Field|Collection threshold * @property Show\Field|Collection use_day - * @property Show\Field|Collection use_start_at * @property Show\Field|Collection use_end_at + * @property Show\Field|Collection use_start_at * @property Show\Field|Collection lvl - * @property Show\Field|Collection total_amount * @property Show\Field|Collection order_completed_at - * @property Show\Field|Collection shipping_fee + * @property Show\Field|Collection total_amount + * @property Show\Field|Collection consignee_address * @property Show\Field|Collection consignee_name * @property Show\Field|Collection consignee_telephone * @property Show\Field|Collection consignee_zone - * @property Show\Field|Collection consignee_address - * @property Show\Field|Collection pay_sn - * @property Show\Field|Collection pay_way * @property Show\Field|Collection out_trade_no * @property Show\Field|Collection pay_at + * @property Show\Field|Collection pay_sn + * @property Show\Field|Collection pay_way + * @property Show\Field|Collection shipping_fee * @property Show\Field|Collection delivery_bill_id * @property Show\Field|Collection product_id - * @property Show\Field|Collection earningable_type * @property Show\Field|Collection earningable_id - * @property Show\Field|Collection total_earnings + * @property Show\Field|Collection earningable_type * @property Show\Field|Collection fee * @property Show\Field|Collection fee_rate - * @property Show\Field|Collection payer_id - * @property Show\Field|Collection pay_info - * @property Show\Field|Collection settle_at * @property Show\Field|Collection pay_image + * @property Show\Field|Collection pay_info + * @property Show\Field|Collection payer_id + * @property Show\Field|Collection settle_at + * @property Show\Field|Collection total_earnings * @property Show\Field|Collection is_manager - * @property Show\Field|Collection real_amount * @property Show\Field|Collection is_settle + * @property Show\Field|Collection real_amount * @property Show\Field|Collection sales_volume * @property Show\Field|Collection last_consignor_id * @property Show\Field|Collection new_consignor_id + * @property Show\Field|Collection deposit_qty * @property Show\Field|Collection price * @property Show\Field|Collection sale_price - * @property Show\Field|Collection deposit_qty * @property Show\Field|Collection reason + * @property Show\Field|Collection allocated_at * @property Show\Field|Collection consignor_id - * @property Show\Field|Collection settle_state - * @property Show\Field|Collection pay_time + * @property Show\Field|Collection deposit_status + * @property Show\Field|Collection local_status * @property Show\Field|Collection paied_time + * @property Show\Field|Collection pay_time + * @property Show\Field|Collection settle_state * @property Show\Field|Collection shipping_time * @property Show\Field|Collection shippinged_time - * @property Show\Field|Collection allocated_at - * @property Show\Field|Collection local_status - * @property Show\Field|Collection deposit_status * @property Show\Field|Collection min_order_amount * @property Show\Field|Collection price_1st * @property Show\Field|Collection price_2st * @property Show\Field|Collection price_3st - * @property Show\Field|Collection sales_count * @property Show\Field|Collection is_sale - * @property Show\Field|Collection unit * @property Show\Field|Collection manager_subsidy + * @property Show\Field|Collection sales_count + * @property Show\Field|Collection unit * @property Show\Field|Collection path - * @property Show\Field|Collection total_purchase_amount * @property Show\Field|Collection subsidy_rate + * @property Show\Field|Collection total_purchase_amount * @property Show\Field|Collection total_subsidy - * @property Show\Field|Collection purchase_subsidy_id - * @property Show\Field|Collection change_from_purchase_subsidy_id * @property Show\Field|Collection change_amount + * @property Show\Field|Collection change_from_purchase_subsidy_id + * @property Show\Field|Collection purchase_subsidy_id * @property Show\Field|Collection change_sales_value - * @property Show\Field|Collection sell_price * @property Show\Field|Collection dealer_price * @property Show\Field|Collection quantity + * @property Show\Field|Collection sell_price * @property Show\Field|Collection before_lvl * @property Show\Field|Collection change_lvl - * @property Show\Field|Collection revoke_id * @property Show\Field|Collection is_deposit + * @property Show\Field|Collection revoke_id * @property Show\Field|Collection deposit_stock + * @property Show\Field|Collection account_amount * @property Show\Field|Collection rate * @property Show\Field|Collection service_amount - * @property Show\Field|Collection account_amount * @property Show\Field|Collection withdrawable - * @property Show\Field|Collection contracted_lvl_at * @property Show\Field|Collection bonds + * @property Show\Field|Collection contracted_lvl_at * @property Show\Field|Collection self_sales_value * @property Show\Field|Collection team_sales_value - * @property Show\Field|Collection jobable_type - * @property Show\Field|Collection jobable_id * @property Show\Field|Collection failed_reason + * @property Show\Field|Collection jobable_id + * @property Show\Field|Collection jobable_type + * @property Show\Field|Collection change_revenue * @property Show\Field|Collection pre_income_id * @property Show\Field|Collection pre_income_job_id - * @property Show\Field|Collection change_revenue * @property Show\Field|Collection agent_level - * @property Show\Field|Collection total_sales_value - * @property Show\Field|Collection rule * @property Show\Field|Collection completed_at - * @property Show\Field|Collection uuid + * @property Show\Field|Collection rule + * @property Show\Field|Collection total_sales_value * @property Show\Field|Collection connection - * @property Show\Field|Collection queue - * @property Show\Field|Collection payload * @property Show\Field|Collection exception * @property Show\Field|Collection failed_at + * @property Show\Field|Collection payload + * @property Show\Field|Collection queue + * @property Show\Field|Collection uuid * @property Show\Field|Collection job_id + * @property Show\Field|Collection fails * @property Show\Field|Collection file * @property Show\Field|Collection success - * @property Show\Field|Collection fails * @property Show\Field|Collection code * @property Show\Field|Collection info * @property Show\Field|Collection ext * @property Show\Field|Collection is_push * @property Show\Field|Collection message_id * @property Show\Field|Collection order_package_id - * @property Show\Field|Collection shipping_company - * @property Show\Field|Collection shipping_code - * @property Show\Field|Collection shipping_number - * @property Show\Field|Collection is_failed * @property Show\Field|Collection checked_at + * @property Show\Field|Collection is_failed * @property Show\Field|Collection last_news - * @property Show\Field|Collection spu_id - * @property Show\Field|Collection specs - * @property Show\Field|Collection weight - * @property Show\Field|Collection vip_price - * @property Show\Field|Collection coupon_discount_amount - * @property Show\Field|Collection vip_discount_amount - * @property Show\Field|Collection reduced_amount - * @property Show\Field|Collection after_sale_state + * @property Show\Field|Collection shipping_code + * @property Show\Field|Collection shipping_company + * @property Show\Field|Collection shipping_number * @property Show\Field|Collection after_expire_at - * @property Show\Field|Collection remain_quantity + * @property Show\Field|Collection after_sale_state + * @property Show\Field|Collection coupon_discount_amount * @property Show\Field|Collection gift_for_sku_id * @property Show\Field|Collection is_gift + * @property Show\Field|Collection reduced_amount + * @property Show\Field|Collection remain_quantity + * @property Show\Field|Collection specs + * @property Show\Field|Collection spu_id + * @property Show\Field|Collection vip_discount_amount + * @property Show\Field|Collection vip_price + * @property Show\Field|Collection weight * @property Show\Field|Collection max - * @property Show\Field|Collection products_total_amount - * @property Show\Field|Collection note - * @property Show\Field|Collection user_coupon_id - * @property Show\Field|Collection shipping_state - * @property Show\Field|Collection is_change * @property Show\Field|Collection auto_complete_at + * @property Show\Field|Collection is_change * @property Show\Field|Collection is_settlable - * @property Show\Field|Collection payable_type + * @property Show\Field|Collection note + * @property Show\Field|Collection products_total_amount + * @property Show\Field|Collection shipping_state + * @property Show\Field|Collection user_coupon_id * @property Show\Field|Collection payable_id - * @property Show\Field|Collection tokenable_type - * @property Show\Field|Collection tokenable_id - * @property Show\Field|Collection token + * @property Show\Field|Collection payable_type * @property Show\Field|Collection abilities * @property Show\Field|Collection last_used_at + * @property Show\Field|Collection token + * @property Show\Field|Collection tokenable_id + * @property Show\Field|Collection tokenable_type * @property Show\Field|Collection old_points * @property Show\Field|Collection gift_sku_id * @property Show\Field|Collection remaining * @property Show\Field|Collection attrs * @property Show\Field|Collection applicant_id * @property Show\Field|Collection reviewer_id - * @property Show\Field|Collection market_price - * @property Show\Field|Collection cost_price - * @property Show\Field|Collection media - * @property Show\Field|Collection sales - * @property Show\Field|Collection release_at - * @property Show\Field|Collection verify_state * @property Show\Field|Collection buynote_id + * @property Show\Field|Collection cost_price + * @property Show\Field|Collection market_price + * @property Show\Field|Collection media + * @property Show\Field|Collection release_at + * @property Show\Field|Collection sales * @property Show\Field|Collection shipping_template_id + * @property Show\Field|Collection verify_state * @property Show\Field|Collection feature_id * @property Show\Field|Collection items * @property Show\Field|Collection view_date @@ -917,317 +923,319 @@ namespace Dcat\Admin { * @property Show\Field|Collection message_type * @property Show\Field|Collection change_quota * @property Show\Field|Collection order_user_id + * @property Show\Field|Collection size * @property Show\Field|Collection x * @property Show\Field|Collection y - * @property Show\Field|Collection size - * @property Show\Field|Collection zone_id + * @property Show\Field|Collection address * @property Show\Field|Collection consignee + * @property Show\Field|Collection is_default * @property Show\Field|Collection telephone * @property Show\Field|Collection zone - * @property Show\Field|Collection address - * @property Show\Field|Collection is_default + * @property Show\Field|Collection zone_id * @property Show\Field|Collection rule_id * @property Show\Field|Collection template_id * @property Show\Field|Collection zones - * @property Show\Field|Collection phone * @property Show\Field|Collection expires_at - * @property Show\Field|Collection socialite_type + * @property Show\Field|Collection phone * @property Show\Field|Collection socialite_id + * @property Show\Field|Collection socialite_type * @property Show\Field|Collection tag_id * @property Show\Field|Collection taggable_id * @property Show\Field|Collection taggable_type - * @property Show\Field|Collection real_name - * @property Show\Field|Collection bank_number - * @property Show\Field|Collection bank_name * @property Show\Field|Collection bank_description + * @property Show\Field|Collection bank_name + * @property Show\Field|Collection bank_number * @property Show\Field|Collection is_edited * @property Show\Field|Collection old_real_name - * @property Show\Field|Collection u_cid + * @property Show\Field|Collection real_name * @property Show\Field|Collection m_cid - * @property Show\Field|Collection coupon_name - * @property Show\Field|Collection coupon_type + * @property Show\Field|Collection u_cid * @property Show\Field|Collection coupon_amount + * @property Show\Field|Collection coupon_name * @property Show\Field|Collection coupon_threshold - * @property Show\Field|Collection inviter_id - * @property Show\Field|Collection nickname - * @property Show\Field|Collection gender + * @property Show\Field|Collection coupon_type * @property Show\Field|Collection birthday * @property Show\Field|Collection bonusable * @property Show\Field|Collection depth - * @property Show\Field|Collection quota_v2 - * @property Show\Field|Collection quota_v1 - * @property Show\Field|Collection growth_value + * @property Show\Field|Collection gender * @property Show\Field|Collection group_sales_value + * @property Show\Field|Collection growth_value + * @property Show\Field|Collection inviter_id + * @property Show\Field|Collection nickname * @property Show\Field|Collection pre_growth_value + * @property Show\Field|Collection quota_v1 + * @property Show\Field|Collection quota_v2 * @property Show\Field|Collection real_inviter_id * @property Show\Field|Collection vip_id - * @property Show\Field|Collection phone_verified_at * @property Show\Field|Collection email * @property Show\Field|Collection email_verified_at - * @property Show\Field|Collection last_login_ip * @property Show\Field|Collection last_login_at + * @property Show\Field|Collection last_login_ip + * @property Show\Field|Collection old_password + * @property Show\Field|Collection phone_verified_at * @property Show\Field|Collection register_ip * @property Show\Field|Collection status_remark - * @property Show\Field|Collection old_password * * @method Show\Field|Collection width(string $label = null) - * @method Show\Field|Collection id(string $label = null) - * @method Show\Field|Collection cover(string $label = null) * @method Show\Field|Collection content(string $label = null) + * @method Show\Field|Collection coupons_rule(string $label = null) + * @method Show\Field|Collection cover(string $label = null) + * @method Show\Field|Collection created_at(string $label = null) + * @method Show\Field|Collection ended_at(string $label = null) + * @method Show\Field|Collection gifts_rule(string $label = null) + * @method Show\Field|Collection id(string $label = null) * @method Show\Field|Collection is_use(string $label = null) * @method Show\Field|Collection started_at(string $label = null) - * @method Show\Field|Collection ended_at(string $label = null) - * @method Show\Field|Collection coupons_rule(string $label = null) - * @method Show\Field|Collection gifts_rule(string $label = null) - * @method Show\Field|Collection created_at(string $label = null) * @method Show\Field|Collection updated_at(string $label = null) * @method Show\Field|Collection activity_id(string $label = null) * @method Show\Field|Collection coupon_id(string $label = null) * @method Show\Field|Collection qty(string $label = null) * @method Show\Field|Collection sku_id(string $label = null) * @method Show\Field|Collection part_id(string $label = null) - * @method Show\Field|Collection key(string $label = null) - * @method Show\Field|Collection name(string $label = null) * @method Show\Field|Collection dimensions(string $label = null) * @method Show\Field|Collection is_show(string $label = null) + * @method Show\Field|Collection key(string $label = null) + * @method Show\Field|Collection name(string $label = null) + * @method Show\Field|Collection detail(string $label = null) * @method Show\Field|Collection type(string $label = null) * @method Show\Field|Collection version(string $label = null) - * @method Show\Field|Collection detail(string $label = null) * @method Show\Field|Collection is_enabled(string $label = null) - * @method Show\Field|Collection parent_id(string $label = null) - * @method Show\Field|Collection order(string $label = null) - * @method Show\Field|Collection icon(string $label = null) - * @method Show\Field|Collection uri(string $label = null) * @method Show\Field|Collection extension(string $label = null) - * @method Show\Field|Collection permission_id(string $label = null) + * @method Show\Field|Collection icon(string $label = null) + * @method Show\Field|Collection order(string $label = null) + * @method Show\Field|Collection parent_id(string $label = null) + * @method Show\Field|Collection uri(string $label = null) * @method Show\Field|Collection menu_id(string $label = null) - * @method Show\Field|Collection slug(string $label = null) + * @method Show\Field|Collection permission_id(string $label = null) * @method Show\Field|Collection http_method(string $label = null) * @method Show\Field|Collection http_path(string $label = null) + * @method Show\Field|Collection slug(string $label = null) * @method Show\Field|Collection role_id(string $label = null) * @method Show\Field|Collection user_id(string $label = null) * @method Show\Field|Collection value(string $label = null) - * @method Show\Field|Collection username(string $label = null) - * @method Show\Field|Collection password(string $label = null) * @method Show\Field|Collection avatar(string $label = null) + * @method Show\Field|Collection password(string $label = null) * @method Show\Field|Collection remember_token(string $label = null) + * @method Show\Field|Collection username(string $label = null) * @method Show\Field|Collection address_id(string $label = null) * @method Show\Field|Collection image(string $label = null) - * @method Show\Field|Collection sort(string $label = null) - * @method Show\Field|Collection jump_type(string $label = null) * @method Show\Field|Collection jump_link(string $label = null) + * @method Show\Field|Collection jump_type(string $label = null) * @method Show\Field|Collection remarks(string $label = null) + * @method Show\Field|Collection sort(string $label = null) * @method Show\Field|Collection after_sale_id(string $label = null) * @method Show\Field|Collection desc(string $label = null) * @method Show\Field|Collection images(string $label = null) - * @method Show\Field|Collection order_id(string $label = null) - * @method Show\Field|Collection sn(string $label = null) - * @method Show\Field|Collection order_product_id(string $label = null) - * @method Show\Field|Collection num(string $label = null) * @method Show\Field|Collection amount(string $label = null) + * @method Show\Field|Collection num(string $label = null) + * @method Show\Field|Collection order_id(string $label = null) + * @method Show\Field|Collection order_product_id(string $label = null) + * @method Show\Field|Collection sales_value(string $label = null) + * @method Show\Field|Collection sn(string $label = null) * @method Show\Field|Collection state(string $label = null) * @method Show\Field|Collection tracking_number(string $label = null) - * @method Show\Field|Collection sales_value(string $label = null) * @method Show\Field|Collection before_agent_level(string $label = null) * @method Show\Field|Collection change_agent_level(string $label = null) * @method Show\Field|Collection remark(string $label = null) - * @method Show\Field|Collection v(string $label = null) - * @method Show\Field|Collection cate(string $label = null) - * @method Show\Field|Collection is_force(string $label = null) - * @method Show\Field|Collection context(string $label = null) * @method Show\Field|Collection apk_link(string $label = null) + * @method Show\Field|Collection cate(string $label = null) + * @method Show\Field|Collection context(string $label = null) + * @method Show\Field|Collection is_force(string $label = null) + * @method Show\Field|Collection v(string $label = null) * @method Show\Field|Collection wgt_link(string $label = null) - * @method Show\Field|Collection is_recommend(string $label = null) * @method Show\Field|Collection _lft(string $label = null) * @method Show\Field|Collection _rgt(string $label = null) + * @method Show\Field|Collection is_recommend(string $label = null) * @method Show\Field|Collection article_id(string $label = null) - * @method Show\Field|Collection category_id(string $label = null) * @method Show\Field|Collection author_name(string $label = null) - * @method Show\Field|Collection subtitle(string $label = null) - * @method Show\Field|Collection points(string $label = null) + * @method Show\Field|Collection category_id(string $label = null) * @method Show\Field|Collection likes(string $label = null) - * @method Show\Field|Collection media_type(string $label = null) * @method Show\Field|Collection media_content(string $label = null) - * @method Show\Field|Collection loggable_type(string $label = null) - * @method Show\Field|Collection loggable_id(string $label = null) + * @method Show\Field|Collection media_type(string $label = null) + * @method Show\Field|Collection points(string $label = null) + * @method Show\Field|Collection subtitle(string $label = null) * @method Show\Field|Collection action(string $label = null) * @method Show\Field|Collection before_balance(string $label = null) * @method Show\Field|Collection change_balance(string $label = null) + * @method Show\Field|Collection loggable_id(string $label = null) + * @method Show\Field|Collection loggable_type(string $label = null) * @method Show\Field|Collection balance(string $label = null) + * @method Show\Field|Collection is_frozen(string $label = null) * @method Show\Field|Collection total_expenses(string $label = null) * @method Show\Field|Collection total_revenue(string $label = null) * @method Show\Field|Collection transferable(string $label = null) - * @method Show\Field|Collection is_frozen(string $label = null) + * @method Show\Field|Collection end_at(string $label = null) + * @method Show\Field|Collection expire_hours(string $label = null) * @method Show\Field|Collection is_enable(string $label = null) * @method Show\Field|Collection rules(string $label = null) - * @method Show\Field|Collection times(string $label = null) - * @method Show\Field|Collection expire_hours(string $label = null) + * @method Show\Field|Collection share_image(string $label = null) + * @method Show\Field|Collection share_title(string $label = null) * @method Show\Field|Collection start_at(string $label = null) - * @method Show\Field|Collection end_at(string $label = null) + * @method Show\Field|Collection times(string $label = null) * @method Show\Field|Collection bargain_amount(string $label = null) - * @method Show\Field|Collection sku_price(string $label = null) * @method Show\Field|Collection bargain_price(string $label = null) - * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection expire_at(string $label = null) + * @method Show\Field|Collection sku_price(string $label = null) + * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection continue_click_times(string $label = null) * @method Show\Field|Collection last_click_at(string $label = null) * @method Show\Field|Collection ranges(string $label = null) * @method Show\Field|Collection administrator_id(string $label = null) * @method Show\Field|Collection task_id(string $label = null) - * @method Show\Field|Collection threshold(string $label = null) * @method Show\Field|Collection limit(string $label = null) * @method Show\Field|Collection sent(string $label = null) * @method Show\Field|Collection stock(string $label = null) + * @method Show\Field|Collection threshold(string $label = null) * @method Show\Field|Collection use_day(string $label = null) - * @method Show\Field|Collection use_start_at(string $label = null) * @method Show\Field|Collection use_end_at(string $label = null) + * @method Show\Field|Collection use_start_at(string $label = null) * @method Show\Field|Collection lvl(string $label = null) - * @method Show\Field|Collection total_amount(string $label = null) * @method Show\Field|Collection order_completed_at(string $label = null) - * @method Show\Field|Collection shipping_fee(string $label = null) + * @method Show\Field|Collection total_amount(string $label = null) + * @method Show\Field|Collection consignee_address(string $label = null) * @method Show\Field|Collection consignee_name(string $label = null) * @method Show\Field|Collection consignee_telephone(string $label = null) * @method Show\Field|Collection consignee_zone(string $label = null) - * @method Show\Field|Collection consignee_address(string $label = null) - * @method Show\Field|Collection pay_sn(string $label = null) - * @method Show\Field|Collection pay_way(string $label = null) * @method Show\Field|Collection out_trade_no(string $label = null) * @method Show\Field|Collection pay_at(string $label = null) + * @method Show\Field|Collection pay_sn(string $label = null) + * @method Show\Field|Collection pay_way(string $label = null) + * @method Show\Field|Collection shipping_fee(string $label = null) * @method Show\Field|Collection delivery_bill_id(string $label = null) * @method Show\Field|Collection product_id(string $label = null) - * @method Show\Field|Collection earningable_type(string $label = null) * @method Show\Field|Collection earningable_id(string $label = null) - * @method Show\Field|Collection total_earnings(string $label = null) + * @method Show\Field|Collection earningable_type(string $label = null) * @method Show\Field|Collection fee(string $label = null) * @method Show\Field|Collection fee_rate(string $label = null) - * @method Show\Field|Collection payer_id(string $label = null) - * @method Show\Field|Collection pay_info(string $label = null) - * @method Show\Field|Collection settle_at(string $label = null) * @method Show\Field|Collection pay_image(string $label = null) + * @method Show\Field|Collection pay_info(string $label = null) + * @method Show\Field|Collection payer_id(string $label = null) + * @method Show\Field|Collection settle_at(string $label = null) + * @method Show\Field|Collection total_earnings(string $label = null) * @method Show\Field|Collection is_manager(string $label = null) - * @method Show\Field|Collection real_amount(string $label = null) * @method Show\Field|Collection is_settle(string $label = null) + * @method Show\Field|Collection real_amount(string $label = null) * @method Show\Field|Collection sales_volume(string $label = null) * @method Show\Field|Collection last_consignor_id(string $label = null) * @method Show\Field|Collection new_consignor_id(string $label = null) + * @method Show\Field|Collection deposit_qty(string $label = null) * @method Show\Field|Collection price(string $label = null) * @method Show\Field|Collection sale_price(string $label = null) - * @method Show\Field|Collection deposit_qty(string $label = null) * @method Show\Field|Collection reason(string $label = null) + * @method Show\Field|Collection allocated_at(string $label = null) * @method Show\Field|Collection consignor_id(string $label = null) - * @method Show\Field|Collection settle_state(string $label = null) - * @method Show\Field|Collection pay_time(string $label = null) + * @method Show\Field|Collection deposit_status(string $label = null) + * @method Show\Field|Collection local_status(string $label = null) * @method Show\Field|Collection paied_time(string $label = null) + * @method Show\Field|Collection pay_time(string $label = null) + * @method Show\Field|Collection settle_state(string $label = null) * @method Show\Field|Collection shipping_time(string $label = null) * @method Show\Field|Collection shippinged_time(string $label = null) - * @method Show\Field|Collection allocated_at(string $label = null) - * @method Show\Field|Collection local_status(string $label = null) - * @method Show\Field|Collection deposit_status(string $label = null) * @method Show\Field|Collection min_order_amount(string $label = null) * @method Show\Field|Collection price_1st(string $label = null) * @method Show\Field|Collection price_2st(string $label = null) * @method Show\Field|Collection price_3st(string $label = null) - * @method Show\Field|Collection sales_count(string $label = null) * @method Show\Field|Collection is_sale(string $label = null) - * @method Show\Field|Collection unit(string $label = null) * @method Show\Field|Collection manager_subsidy(string $label = null) + * @method Show\Field|Collection sales_count(string $label = null) + * @method Show\Field|Collection unit(string $label = null) * @method Show\Field|Collection path(string $label = null) - * @method Show\Field|Collection total_purchase_amount(string $label = null) * @method Show\Field|Collection subsidy_rate(string $label = null) + * @method Show\Field|Collection total_purchase_amount(string $label = null) * @method Show\Field|Collection total_subsidy(string $label = null) - * @method Show\Field|Collection purchase_subsidy_id(string $label = null) - * @method Show\Field|Collection change_from_purchase_subsidy_id(string $label = null) * @method Show\Field|Collection change_amount(string $label = null) + * @method Show\Field|Collection change_from_purchase_subsidy_id(string $label = null) + * @method Show\Field|Collection purchase_subsidy_id(string $label = null) * @method Show\Field|Collection change_sales_value(string $label = null) - * @method Show\Field|Collection sell_price(string $label = null) * @method Show\Field|Collection dealer_price(string $label = null) * @method Show\Field|Collection quantity(string $label = null) + * @method Show\Field|Collection sell_price(string $label = null) * @method Show\Field|Collection before_lvl(string $label = null) * @method Show\Field|Collection change_lvl(string $label = null) - * @method Show\Field|Collection revoke_id(string $label = null) * @method Show\Field|Collection is_deposit(string $label = null) + * @method Show\Field|Collection revoke_id(string $label = null) * @method Show\Field|Collection deposit_stock(string $label = null) + * @method Show\Field|Collection account_amount(string $label = null) * @method Show\Field|Collection rate(string $label = null) * @method Show\Field|Collection service_amount(string $label = null) - * @method Show\Field|Collection account_amount(string $label = null) * @method Show\Field|Collection withdrawable(string $label = null) - * @method Show\Field|Collection contracted_lvl_at(string $label = null) * @method Show\Field|Collection bonds(string $label = null) + * @method Show\Field|Collection contracted_lvl_at(string $label = null) * @method Show\Field|Collection self_sales_value(string $label = null) * @method Show\Field|Collection team_sales_value(string $label = null) - * @method Show\Field|Collection jobable_type(string $label = null) - * @method Show\Field|Collection jobable_id(string $label = null) * @method Show\Field|Collection failed_reason(string $label = null) + * @method Show\Field|Collection jobable_id(string $label = null) + * @method Show\Field|Collection jobable_type(string $label = null) + * @method Show\Field|Collection change_revenue(string $label = null) * @method Show\Field|Collection pre_income_id(string $label = null) * @method Show\Field|Collection pre_income_job_id(string $label = null) - * @method Show\Field|Collection change_revenue(string $label = null) * @method Show\Field|Collection agent_level(string $label = null) - * @method Show\Field|Collection total_sales_value(string $label = null) - * @method Show\Field|Collection rule(string $label = null) * @method Show\Field|Collection completed_at(string $label = null) - * @method Show\Field|Collection uuid(string $label = null) + * @method Show\Field|Collection rule(string $label = null) + * @method Show\Field|Collection total_sales_value(string $label = null) * @method Show\Field|Collection connection(string $label = null) - * @method Show\Field|Collection queue(string $label = null) - * @method Show\Field|Collection payload(string $label = null) * @method Show\Field|Collection exception(string $label = null) * @method Show\Field|Collection failed_at(string $label = null) + * @method Show\Field|Collection payload(string $label = null) + * @method Show\Field|Collection queue(string $label = null) + * @method Show\Field|Collection uuid(string $label = null) * @method Show\Field|Collection job_id(string $label = null) + * @method Show\Field|Collection fails(string $label = null) * @method Show\Field|Collection file(string $label = null) * @method Show\Field|Collection success(string $label = null) - * @method Show\Field|Collection fails(string $label = null) * @method Show\Field|Collection code(string $label = null) * @method Show\Field|Collection info(string $label = null) * @method Show\Field|Collection ext(string $label = null) * @method Show\Field|Collection is_push(string $label = null) * @method Show\Field|Collection message_id(string $label = null) * @method Show\Field|Collection order_package_id(string $label = null) - * @method Show\Field|Collection shipping_company(string $label = null) - * @method Show\Field|Collection shipping_code(string $label = null) - * @method Show\Field|Collection shipping_number(string $label = null) - * @method Show\Field|Collection is_failed(string $label = null) * @method Show\Field|Collection checked_at(string $label = null) + * @method Show\Field|Collection is_failed(string $label = null) * @method Show\Field|Collection last_news(string $label = null) - * @method Show\Field|Collection spu_id(string $label = null) - * @method Show\Field|Collection specs(string $label = null) - * @method Show\Field|Collection weight(string $label = null) - * @method Show\Field|Collection vip_price(string $label = null) - * @method Show\Field|Collection coupon_discount_amount(string $label = null) - * @method Show\Field|Collection vip_discount_amount(string $label = null) - * @method Show\Field|Collection reduced_amount(string $label = null) - * @method Show\Field|Collection after_sale_state(string $label = null) + * @method Show\Field|Collection shipping_code(string $label = null) + * @method Show\Field|Collection shipping_company(string $label = null) + * @method Show\Field|Collection shipping_number(string $label = null) * @method Show\Field|Collection after_expire_at(string $label = null) - * @method Show\Field|Collection remain_quantity(string $label = null) + * @method Show\Field|Collection after_sale_state(string $label = null) + * @method Show\Field|Collection coupon_discount_amount(string $label = null) * @method Show\Field|Collection gift_for_sku_id(string $label = null) * @method Show\Field|Collection is_gift(string $label = null) + * @method Show\Field|Collection reduced_amount(string $label = null) + * @method Show\Field|Collection remain_quantity(string $label = null) + * @method Show\Field|Collection specs(string $label = null) + * @method Show\Field|Collection spu_id(string $label = null) + * @method Show\Field|Collection vip_discount_amount(string $label = null) + * @method Show\Field|Collection vip_price(string $label = null) + * @method Show\Field|Collection weight(string $label = null) * @method Show\Field|Collection max(string $label = null) - * @method Show\Field|Collection products_total_amount(string $label = null) - * @method Show\Field|Collection note(string $label = null) - * @method Show\Field|Collection user_coupon_id(string $label = null) - * @method Show\Field|Collection shipping_state(string $label = null) - * @method Show\Field|Collection is_change(string $label = null) * @method Show\Field|Collection auto_complete_at(string $label = null) + * @method Show\Field|Collection is_change(string $label = null) * @method Show\Field|Collection is_settlable(string $label = null) - * @method Show\Field|Collection payable_type(string $label = null) + * @method Show\Field|Collection note(string $label = null) + * @method Show\Field|Collection products_total_amount(string $label = null) + * @method Show\Field|Collection shipping_state(string $label = null) + * @method Show\Field|Collection user_coupon_id(string $label = null) * @method Show\Field|Collection payable_id(string $label = null) - * @method Show\Field|Collection tokenable_type(string $label = null) - * @method Show\Field|Collection tokenable_id(string $label = null) - * @method Show\Field|Collection token(string $label = null) + * @method Show\Field|Collection payable_type(string $label = null) * @method Show\Field|Collection abilities(string $label = null) * @method Show\Field|Collection last_used_at(string $label = null) + * @method Show\Field|Collection token(string $label = null) + * @method Show\Field|Collection tokenable_id(string $label = null) + * @method Show\Field|Collection tokenable_type(string $label = null) * @method Show\Field|Collection old_points(string $label = null) * @method Show\Field|Collection gift_sku_id(string $label = null) * @method Show\Field|Collection remaining(string $label = null) * @method Show\Field|Collection attrs(string $label = null) * @method Show\Field|Collection applicant_id(string $label = null) * @method Show\Field|Collection reviewer_id(string $label = null) - * @method Show\Field|Collection market_price(string $label = null) - * @method Show\Field|Collection cost_price(string $label = null) - * @method Show\Field|Collection media(string $label = null) - * @method Show\Field|Collection sales(string $label = null) - * @method Show\Field|Collection release_at(string $label = null) - * @method Show\Field|Collection verify_state(string $label = null) * @method Show\Field|Collection buynote_id(string $label = null) + * @method Show\Field|Collection cost_price(string $label = null) + * @method Show\Field|Collection market_price(string $label = null) + * @method Show\Field|Collection media(string $label = null) + * @method Show\Field|Collection release_at(string $label = null) + * @method Show\Field|Collection sales(string $label = null) * @method Show\Field|Collection shipping_template_id(string $label = null) + * @method Show\Field|Collection verify_state(string $label = null) * @method Show\Field|Collection feature_id(string $label = null) * @method Show\Field|Collection items(string $label = null) * @method Show\Field|Collection view_date(string $label = null) @@ -1235,58 +1243,58 @@ namespace Dcat\Admin { * @method Show\Field|Collection message_type(string $label = null) * @method Show\Field|Collection change_quota(string $label = null) * @method Show\Field|Collection order_user_id(string $label = null) + * @method Show\Field|Collection size(string $label = null) * @method Show\Field|Collection x(string $label = null) * @method Show\Field|Collection y(string $label = null) - * @method Show\Field|Collection size(string $label = null) - * @method Show\Field|Collection zone_id(string $label = null) + * @method Show\Field|Collection address(string $label = null) * @method Show\Field|Collection consignee(string $label = null) + * @method Show\Field|Collection is_default(string $label = null) * @method Show\Field|Collection telephone(string $label = null) * @method Show\Field|Collection zone(string $label = null) - * @method Show\Field|Collection address(string $label = null) - * @method Show\Field|Collection is_default(string $label = null) + * @method Show\Field|Collection zone_id(string $label = null) * @method Show\Field|Collection rule_id(string $label = null) * @method Show\Field|Collection template_id(string $label = null) * @method Show\Field|Collection zones(string $label = null) - * @method Show\Field|Collection phone(string $label = null) * @method Show\Field|Collection expires_at(string $label = null) - * @method Show\Field|Collection socialite_type(string $label = null) + * @method Show\Field|Collection phone(string $label = null) * @method Show\Field|Collection socialite_id(string $label = null) + * @method Show\Field|Collection socialite_type(string $label = null) * @method Show\Field|Collection tag_id(string $label = null) * @method Show\Field|Collection taggable_id(string $label = null) * @method Show\Field|Collection taggable_type(string $label = null) - * @method Show\Field|Collection real_name(string $label = null) - * @method Show\Field|Collection bank_number(string $label = null) - * @method Show\Field|Collection bank_name(string $label = null) * @method Show\Field|Collection bank_description(string $label = null) + * @method Show\Field|Collection bank_name(string $label = null) + * @method Show\Field|Collection bank_number(string $label = null) * @method Show\Field|Collection is_edited(string $label = null) * @method Show\Field|Collection old_real_name(string $label = null) - * @method Show\Field|Collection u_cid(string $label = null) + * @method Show\Field|Collection real_name(string $label = null) * @method Show\Field|Collection m_cid(string $label = null) - * @method Show\Field|Collection coupon_name(string $label = null) - * @method Show\Field|Collection coupon_type(string $label = null) + * @method Show\Field|Collection u_cid(string $label = null) * @method Show\Field|Collection coupon_amount(string $label = null) + * @method Show\Field|Collection coupon_name(string $label = null) * @method Show\Field|Collection coupon_threshold(string $label = null) - * @method Show\Field|Collection inviter_id(string $label = null) - * @method Show\Field|Collection nickname(string $label = null) - * @method Show\Field|Collection gender(string $label = null) + * @method Show\Field|Collection coupon_type(string $label = null) * @method Show\Field|Collection birthday(string $label = null) * @method Show\Field|Collection bonusable(string $label = null) * @method Show\Field|Collection depth(string $label = null) - * @method Show\Field|Collection quota_v2(string $label = null) - * @method Show\Field|Collection quota_v1(string $label = null) - * @method Show\Field|Collection growth_value(string $label = null) + * @method Show\Field|Collection gender(string $label = null) * @method Show\Field|Collection group_sales_value(string $label = null) + * @method Show\Field|Collection growth_value(string $label = null) + * @method Show\Field|Collection inviter_id(string $label = null) + * @method Show\Field|Collection nickname(string $label = null) * @method Show\Field|Collection pre_growth_value(string $label = null) + * @method Show\Field|Collection quota_v1(string $label = null) + * @method Show\Field|Collection quota_v2(string $label = null) * @method Show\Field|Collection real_inviter_id(string $label = null) * @method Show\Field|Collection vip_id(string $label = null) - * @method Show\Field|Collection phone_verified_at(string $label = null) * @method Show\Field|Collection email(string $label = null) * @method Show\Field|Collection email_verified_at(string $label = null) - * @method Show\Field|Collection last_login_ip(string $label = null) * @method Show\Field|Collection last_login_at(string $label = null) + * @method Show\Field|Collection last_login_ip(string $label = null) + * @method Show\Field|Collection old_password(string $label = null) + * @method Show\Field|Collection phone_verified_at(string $label = null) * @method Show\Field|Collection register_ip(string $label = null) * @method Show\Field|Collection status_remark(string $label = null) - * @method Show\Field|Collection old_password(string $label = null) */ class Show {} diff --git a/resources/lang/zh_CN/bargain-order.php b/resources/lang/zh_CN/bargain-order.php new file mode 100644 index 00000000..9b435a79 --- /dev/null +++ b/resources/lang/zh_CN/bargain-order.php @@ -0,0 +1,36 @@ + [ + 'BargainOrder' => 'BargainOrder', + 'bargain-order' => 'BargainOrder', + ], + 'fields' => [ + 'activity' => [ + 'name'=> '活动名称', + ], + 'sku' => [ + 'name' => '商品名称', + ], + 'user'=>[ + 'phone'=>'手机号', + ], + 'userInfo'=>[ + 'nickname' => '昵称', + ], + 'mallOrder'=>[ + 'sn'=>'订单编号', + ], + 'activity_id' => '参与活动', + 'user_id' => '发起用户', + 'sku_id' => '砍价商品', + 'sku_price' => '原价', + 'bargain_price' => '已砍价格', + 'status' => '状态', + 'expire_at' => '过期时间', + 'order_id' => '商城订单', + 'remark' => '备注', + ], + 'options' => [ + ], +]; From a376500e22198984bffd73ae0c553bf41760aa3e Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 17:31:36 +0800 Subject: [PATCH 21/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/seeders/AdminPermissionSeeder.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/seeders/AdminPermissionSeeder.php b/database/seeders/AdminPermissionSeeder.php index 746c3e60..cb1648e4 100644 --- a/database/seeders/AdminPermissionSeeder.php +++ b/database/seeders/AdminPermissionSeeder.php @@ -419,6 +419,14 @@ class AdminPermissionSeeder extends Seeder 'name' => '每月统计', 'curd' => ['index'], ], + 'bargain_activities'=>[ + 'name' =>'砍价活动', + 'curd'=> true, + ], + 'bargain_orders'=>[ + 'name' =>'砍价活动记录', + 'curd' => ['index', 'show'], + ], ]; // try { // DB::begintransaction(); From d590a9035059267658c0e102d5a8d7f9b7573924 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 11 Apr 2022 17:34:41 +0800 Subject: [PATCH 22/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=90=8E=E5=8F=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/BargainOrderController.php | 2 +- resources/lang/zh_CN/bargain-order.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index cc946e66..7f2ba2bc 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -110,7 +110,7 @@ class BargainOrderController extends AdminController ]); $show->field('mall_order.sn', '关联订单编号')->unescape()->as(function ($value) { - if (Admin::user()->can('dcat.admin.orders.show')) { + if (Admin::user()->can('dcat.admin.orders.show') && !empty($value)) { return ''.$value.''; } return $value; diff --git a/resources/lang/zh_CN/bargain-order.php b/resources/lang/zh_CN/bargain-order.php index 9b435a79..0bcf72b1 100644 --- a/resources/lang/zh_CN/bargain-order.php +++ b/resources/lang/zh_CN/bargain-order.php @@ -2,8 +2,8 @@ return [ 'labels' => [ - 'BargainOrder' => 'BargainOrder', - 'bargain-order' => 'BargainOrder', + 'BargainOrder' => '砍价记录', + 'bargain-orders' => '砍价记录', ], 'fields' => [ 'activity' => [ From f78debbb37c487cba3268ce319c10a335ae42585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Mon, 11 Apr 2022 17:46:54 +0800 Subject: [PATCH 23/58] =?UTF-8?q?=E4=BD=99=E9=A2=9D=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MonthlyStatisticsController.php | 3 +- .../Controllers/WalletToBankLogController.php | 25 ++++------- app/Admin/Forms/WalletToBankLogVerify.php | 3 +- app/Enums/WalletToBankLogStatus.php | 41 +++++++++++++++++++ app/Models/WalletToBankLog.php | 11 +++-- 5 files changed, 62 insertions(+), 21 deletions(-) create mode 100644 app/Enums/WalletToBankLogStatus.php diff --git a/app/Admin/Controllers/MonthlyStatisticsController.php b/app/Admin/Controllers/MonthlyStatisticsController.php index 425d6ea7..30291d9b 100644 --- a/app/Admin/Controllers/MonthlyStatisticsController.php +++ b/app/Admin/Controllers/MonthlyStatisticsController.php @@ -4,6 +4,7 @@ namespace App\Admin\Controllers; use App\Admin\Widgets\InfoBox; use App\Enums\PayWay; +use App\Enums\WalletToBankLogStatus; use App\Http\Controllers\Controller; use App\Models\Order; use App\Models\WalletLog; @@ -65,7 +66,7 @@ class MonthlyStatisticsController extends Controller ->sum('change_balance'); // 提现总额 - $withdrawAmount = WalletToBankLog::where('status', WalletToBankLog::STATUS_AGREE) + $withdrawAmount = WalletToBankLog::where('status', WalletToBankLogStatus::Completed) ->whereBetween('updated_at', [$start, $end]) ->sum('amount'); diff --git a/app/Admin/Controllers/WalletToBankLogController.php b/app/Admin/Controllers/WalletToBankLogController.php index 7e484fe2..f14326b6 100644 --- a/app/Admin/Controllers/WalletToBankLogController.php +++ b/app/Admin/Controllers/WalletToBankLogController.php @@ -4,7 +4,7 @@ namespace App\Admin\Controllers; use App\Admin\Actions\Grid\WalletToBankLogVerify; use App\Admin\Repositories\WalletToBankLog; -use App\Models\WalletToBankLog as WalletToBankLogModel; +use App\Enums\WalletToBankLogStatus; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; @@ -37,15 +37,12 @@ class WalletToBankLogController extends AdminController $grid->column('account_amount')->display(function ($v) { return bcdiv($v, 100, 2); })->prepend('¥'); - $grid->column('status')->using([ - WalletToBankLogModel::STATUS_PENDING=>'待处理', - WalletToBankLogModel::STATUS_AGREE=>'同意', - WalletToBankLogModel::STATUS_REFUSE=>'拒绝', - ])->dot([ - 0=>'primary', - 1=>'success', - 2=>'danger', - ]); + $grid->column('status')->display(function ($v) { + $text = $v->text(); + $background = $v->color(); + + return "  {$text}"; + }); $grid->column('remarks'); $grid->column('created_at')->sortable(); @@ -54,18 +51,14 @@ class WalletToBankLogController extends AdminController $grid->model()->orderBy('created_at', 'desc'); $grid->actions(function (Grid\Displayers\Actions $actions) { - if ($actions->row->status == 0 && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) { + if ($actions->row->status == WalletToBankLogStatus::Pending && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) { $actions->append(new WalletToBankLogVerify()); } }); $grid->filter(function (Grid\Filter $filter) { $filter->panel(); - $filter->equal('status')->select([ - WalletToBankLogModel::STATUS_PENDING=>'待处理', - WalletToBankLogModel::STATUS_AGREE=>'已同意', - WalletToBankLogModel::STATUS_REFUSE=>'已拒绝', - ])->width(3); + $filter->equal('status')->select(WalletToBankLogStatus::texts())->width(3); $filter->equal('user.phone')->width(3); $filter->equal('username')->width(3); $filter->between('created_at')->dateTime()->width(7); diff --git a/app/Admin/Forms/WalletToBankLogVerify.php b/app/Admin/Forms/WalletToBankLogVerify.php index 6a2d3431..0d3f4134 100644 --- a/app/Admin/Forms/WalletToBankLogVerify.php +++ b/app/Admin/Forms/WalletToBankLogVerify.php @@ -76,9 +76,10 @@ class WalletToBankLogVerify extends Form implements LazyRenderable $this->currency('account_amount')->symbol('¥')->value(bcdiv($log->account_amount, 100, 2))->disable(); $this->radio('status')->options([ - 1 => '成功', + 1 => '通过', 2 => '拒绝', ])->default(1); + $this->text('remarks')->rules('required_if:status,2', ['required_if'=>'拒绝时需要填写备注']); } } diff --git a/app/Enums/WalletToBankLogStatus.php b/app/Enums/WalletToBankLogStatus.php new file mode 100644 index 00000000..916bcb40 --- /dev/null +++ b/app/Enums/WalletToBankLogStatus.php @@ -0,0 +1,41 @@ + '#5b69bc', + static::Completed => '#21b978', + static::Refused => '#b3b9bf', + }; + } + + /** + * @return string + */ + public function text(): string + { + return static::texts()[$this->value]; + } + + /** + * @return array + */ + public static function texts(): array + { + return [ + static::Pending->value => '待处理', + static::Completed->value => '已完成', + static::Refused->value => '已拒绝', + ]; + } +} diff --git a/app/Models/WalletToBankLog.php b/app/Models/WalletToBankLog.php index 99cd4208..86ffa495 100644 --- a/app/Models/WalletToBankLog.php +++ b/app/Models/WalletToBankLog.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Enums\WalletToBankLogStatus; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -11,9 +12,13 @@ class WalletToBankLog extends Model use HasFactory; use HasDateTimeFormatter; - public const STATUS_PENDING = 0;//'待处理' - public const STATUS_AGREE = 1;//'已同意' - public const STATUS_REFUSE = 2;//'已拒绝' + public const STATUS_PENDING = 0; // 待审核 + public const STATUS_AGREE = 1; // 已完成 + public const STATUS_REFUSE = 2; // 已拒绝 + + protected $casts = [ + 'status' => WalletToBankLogStatus::class, + ]; /** * @var array From 8a4cc824563ab2c7bd6030fceddcee0464dd42b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 10:24:49 +0800 Subject: [PATCH 24/58] Update --- app/Admin/Controllers/MonthlyStatisticsController.php | 2 +- app/Enums/WalletToBankLogStatus.php | 8 ++++---- app/Models/WalletToBankLog.php | 4 ---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/Admin/Controllers/MonthlyStatisticsController.php b/app/Admin/Controllers/MonthlyStatisticsController.php index 30291d9b..470cc783 100644 --- a/app/Admin/Controllers/MonthlyStatisticsController.php +++ b/app/Admin/Controllers/MonthlyStatisticsController.php @@ -66,7 +66,7 @@ class MonthlyStatisticsController extends Controller ->sum('change_balance'); // 提现总额 - $withdrawAmount = WalletToBankLog::where('status', WalletToBankLogStatus::Completed) + $withdrawAmount = WalletToBankLog::where('status', WalletToBankLogStatus::Success) ->whereBetween('updated_at', [$start, $end]) ->sum('amount'); diff --git a/app/Enums/WalletToBankLogStatus.php b/app/Enums/WalletToBankLogStatus.php index 916bcb40..9a56a25b 100644 --- a/app/Enums/WalletToBankLogStatus.php +++ b/app/Enums/WalletToBankLogStatus.php @@ -4,7 +4,7 @@ namespace App\Enums; enum WalletToBankLogStatus: int { case Pending = 0; - case Completed = 1; + case Success = 1; case Refused = 2; /** @@ -14,7 +14,7 @@ enum WalletToBankLogStatus: int { { return match ($this) { static::Pending => '#5b69bc', - static::Completed => '#21b978', + static::Success => '#21b978', static::Refused => '#b3b9bf', }; } @@ -34,8 +34,8 @@ enum WalletToBankLogStatus: int { { return [ static::Pending->value => '待处理', - static::Completed->value => '已完成', - static::Refused->value => '已拒绝', + static::Success->value => '成功', + static::Refused->value => '拒绝', ]; } } diff --git a/app/Models/WalletToBankLog.php b/app/Models/WalletToBankLog.php index 86ffa495..ba724a7b 100644 --- a/app/Models/WalletToBankLog.php +++ b/app/Models/WalletToBankLog.php @@ -12,10 +12,6 @@ class WalletToBankLog extends Model use HasFactory; use HasDateTimeFormatter; - public const STATUS_PENDING = 0; // 待审核 - public const STATUS_AGREE = 1; // 已完成 - public const STATUS_REFUSE = 2; // 已拒绝 - protected $casts = [ 'status' => WalletToBankLogStatus::class, ]; From 7cebf43fdf2537ec36f3980dff7e37eb9b3a9983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 11:37:12 +0800 Subject: [PATCH 25/58] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_04_06_112225_add_bargain_to_orders_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php index d0ae369e..47135845 100644 --- a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php +++ b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php @@ -29,7 +29,7 @@ class AddBargainToOrdersTable extends Migration { Schema::table('orders', function (Blueprint $table) { // - $table->dropColumn(['bargain_amount', 'bargain_order_id']); + $table->dropColumn(['bargain_amount']); }); } } From e17a2b9357ae2265db2b7c31f2c9947fd950af5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 14:38:31 +0800 Subject: [PATCH 26/58] =?UTF-8?q?=E4=BB=A3=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WalletToBankLogController.php | 2 +- app/Admin/Forms/WalletToBankLogVerify.php | 56 +++++++++--- app/Console/Commands/WalletToBankCommand.php | 86 +++++++++++++++++++ .../Controllers/YeePayNotifyController.php | 13 +++ app/Endpoint/Callback/routes.php | 3 + app/Enums/WalletToBankLogPayWay.php | 38 ++++++++ app/Enums/WalletToBankLogStatus.php | 9 ++ app/Exceptions/YeePayException.php | 9 ++ app/Models/WalletToBankLog.php | 7 ++ app/Services/YeePayService.php | 82 ++++++++++++++++++ config/services.php | 6 ++ ...y_columns_to_wallet_to_bank_logs_table.php | 38 ++++++++ resources/lang/zh_CN/wallet-to-bank-log.php | 3 + 13 files changed, 339 insertions(+), 13 deletions(-) create mode 100644 app/Console/Commands/WalletToBankCommand.php create mode 100644 app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php create mode 100644 app/Enums/WalletToBankLogPayWay.php create mode 100644 app/Exceptions/YeePayException.php create mode 100644 app/Services/YeePayService.php create mode 100644 database/migrations/2022_04_12_110138_add_pay_columns_to_wallet_to_bank_logs_table.php diff --git a/app/Admin/Controllers/WalletToBankLogController.php b/app/Admin/Controllers/WalletToBankLogController.php index f14326b6..bb42b499 100644 --- a/app/Admin/Controllers/WalletToBankLogController.php +++ b/app/Admin/Controllers/WalletToBankLogController.php @@ -51,7 +51,7 @@ class WalletToBankLogController extends AdminController $grid->model()->orderBy('created_at', 'desc'); $grid->actions(function (Grid\Displayers\Actions $actions) { - if ($actions->row->status == WalletToBankLogStatus::Pending && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) { + if (in_array($actions->row->status, [WalletToBankLogStatus::Pending, WalletToBankLogStatus::Failed]) && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) { $actions->append(new WalletToBankLogVerify()); } }); diff --git a/app/Admin/Forms/WalletToBankLogVerify.php b/app/Admin/Forms/WalletToBankLogVerify.php index 0d3f4134..9ab00ecd 100644 --- a/app/Admin/Forms/WalletToBankLogVerify.php +++ b/app/Admin/Forms/WalletToBankLogVerify.php @@ -2,6 +2,9 @@ namespace App\Admin\Forms; +use App\Enums\WalletToBankLogPayWay; +use App\Enums\WalletToBankLogStatus; +use App\Exceptions\BizException; use App\Models\WalletLog; use App\Models\WalletToBankLog; use App\Services\WalletService; @@ -34,15 +37,37 @@ class WalletToBankLogVerify extends Form implements LazyRenderable */ public function handle(array $input) { - $id = $this->payload['id'] ?? 0; - $log = WalletToBankLog::findOrFail($id); try { DB::beginTransaction(); - $log->update($input); - //如果拒绝,重新添加对应可提金额 - if ($log->status == 2) { - $walletService = new WalletService(); - $walletService->changeBalance($log->user, $log->amount, WalletLog::ACTION_WITHDRAW_FAILED, '提现-失败', $log); + + $log = WalletToBankLog::lockForUpdate()->findOrFail($this->payload['id']); + + if (! in_array($log->status, [WalletToBankLogStatus::Pending, WalletToBankLogStatus::Failed])) { + throw new BizException('提现记录状态异常'); + } + + if ($input['status'] == 1) { + $log->pay_way = $input['pay_way']; + + if ($log->pay_way === WalletToBankLogPayWay::Offline) { + $log->status = WalletToBankLogStatus::Success; + $log->pay_at = now(); + } else { + $log->pay_sn = serial_number(); + $log->status = WalletToBankLogStatus::Passed; + } + + $log->failed_reason = null; + } else { + $log->status = WalletToBankLogStatus::Refused; + } + + $log->remarks = $input['remarks']; + $log->save(); + + // 如果拒绝,退换扣除金额 + if ($log->status === WalletToBankLogStatus::Refused) { + (new WalletService())->changeBalance($log->user, $log->amount, WalletLog::ACTION_WITHDRAW_FAILED, '提现-失败', $log); } DB::commit(); @@ -65,7 +90,6 @@ class WalletToBankLogVerify extends Form implements LazyRenderable $id = $this->payload['id'] ?? 0; $log = WalletToBankLog::findOrFail($id); - $this->text('bank_name')->value($log->bank_name)->disable(); $this->text('bank_number')->value($log->bank_number)->disable(); $this->text('username')->value($log->username)->disable(); @@ -75,11 +99,19 @@ class WalletToBankLogVerify extends Form implements LazyRenderable $this->currency('service_amount')->symbol('¥')->value(bcdiv($log->service_amount, 100, 2))->disable(); $this->currency('account_amount')->symbol('¥')->value(bcdiv($log->account_amount, 100, 2))->disable(); - $this->radio('status')->options([ - 1 => '通过', - 2 => '拒绝', - ])->default(1); + if ($log->status === WalletToBankLogStatus::Failed) { + $this->textarea('failed_reason')->value($log->failed_reason ?: '')->disable(); + } + $this->radio('status') + ->options([ + 1 => '通过', + 2 => '拒绝', + ]) + ->default(1); + $this->select('pay_way') + ->options(WalletToBankLogPayWay::texts()) + ->rules('required_if:status,1', ['required_if'=>'请选择支付方式']); $this->text('remarks')->rules('required_if:status,2', ['required_if'=>'拒绝时需要填写备注']); } } diff --git a/app/Console/Commands/WalletToBankCommand.php b/app/Console/Commands/WalletToBankCommand.php new file mode 100644 index 00000000..850d9dce --- /dev/null +++ b/app/Console/Commands/WalletToBankCommand.php @@ -0,0 +1,86 @@ +chunkById(1, function ($logs) use ($yeePayService) { + foreach ($logs as $log) { + try { + $result = $yeePayService->request('accountpay.behalf.Pay', [ + 'payerOutUserId' => '21102510220227100003' ?: config('services.yeepay.partner_id'), + 'merchOrderNo' => $log->pay_sn, + 'tradeName' => '余额提现', + 'payeeUserName' => $log->username, + 'bankCardNo' => $log->bank_number, + 'bankCode' => Bank::tryFromBankName($log->bank_name)?->name, + 'bankCardType' => 'DEBIT_CARD', + 'amount' => bcdiv($log->account_amount, 100, 2), + 'feeRole' => 'PAYER', + 'tradeMemo' => '商城余额提现', + ]); + + if ($result['orderStatus'] === 'SUCCESS') { + $log->update([ + 'status' => WalletToBankLogStatus::Success, + 'pay_at' => now(), + 'failed_reason' => null, + ]); + } elseif ($result['orderStatus'] === 'FAIL') { + $log->update([ + 'status' => WalletToBankLogStatus::Failed, + 'failed_reason' => '交易失败', + ]); + } else { + $log->update([ + 'status' => WalletToBankLogStatus::Paying, + 'failed_reason' => null, + ]); + } + } catch (YeePayException $e) { + $log->update([ + 'status' => WalletToBankLogStatus::Failed, + 'failed_reason' => $e->getMessage(), + ]); + } catch (Throwable $e) { + throw $e; + } + } + }); + + sleep(60); + } + } +} diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php new file mode 100644 index 00000000..d5e81843 --- /dev/null +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -0,0 +1,13 @@ +debug('yeepay notify', $request->input()); + } +} diff --git a/app/Endpoint/Callback/routes.php b/app/Endpoint/Callback/routes.php index 50d2f0f3..b6679783 100644 --- a/app/Endpoint/Callback/routes.php +++ b/app/Endpoint/Callback/routes.php @@ -3,6 +3,7 @@ use App\Endpoint\Callback\Http\Controllers\AlipayController; use App\Endpoint\Callback\Http\Controllers\Kuaidi100Controller; use App\Endpoint\Callback\Http\Controllers\WxpayController; +use App\Endpoint\Callback\Http\Controllers\YeePayNotifyController; use Illuminate\Support\Facades\Route; //快递100物流推送 @@ -13,3 +14,5 @@ Route::post('wxpay/{payment}/paid-notify', [WxpayController::class, 'paidNotify' Route::post('wxpay/{payment}/order-refund-notify', [WxpayController::class, 'orderRefundedNotify'])->name('wxpay.order_refund_notify'); Route::post('alipay', AlipayController::class)->name('alipay.notify'); + +Route::post('yeepay-notify', YeePayNotifyController::class)->name('yeepay.notify'); diff --git a/app/Enums/WalletToBankLogPayWay.php b/app/Enums/WalletToBankLogPayWay.php new file mode 100644 index 00000000..91e13686 --- /dev/null +++ b/app/Enums/WalletToBankLogPayWay.php @@ -0,0 +1,38 @@ + '#5b69bc', + static::Behalf => '#21b978', + }; + } + + /** + * @return string + */ + public function text(): string + { + return static::texts()[$this->value]; + } + + /** + * @return array + */ + public static function texts(): array + { + return [ + static::Offline->value => '线下', + static::Behalf->value => '代付', + ]; + } +} diff --git a/app/Enums/WalletToBankLogStatus.php b/app/Enums/WalletToBankLogStatus.php index 9a56a25b..c98b5e69 100644 --- a/app/Enums/WalletToBankLogStatus.php +++ b/app/Enums/WalletToBankLogStatus.php @@ -6,6 +6,9 @@ enum WalletToBankLogStatus: int { case Pending = 0; case Success = 1; case Refused = 2; + case Passed = 3; // 审核通过 - 等待付款 + case Paying = 4; // 审核通过 - 付款中 + case Failed = 9; /** * @return string @@ -14,7 +17,10 @@ enum WalletToBankLogStatus: int { { return match ($this) { static::Pending => '#5b69bc', + static::Passed => '#dda451', + static::Paying => '#3085d6', static::Success => '#21b978', + static::Failed => '#ea5455', static::Refused => '#b3b9bf', }; } @@ -34,7 +40,10 @@ enum WalletToBankLogStatus: int { { return [ static::Pending->value => '待处理', + static::Passed->value => '待付款', + static::Paying->value => '付款中', static::Success->value => '成功', + static::Failed->value => '失败', static::Refused->value => '拒绝', ]; } diff --git a/app/Exceptions/YeePayException.php b/app/Exceptions/YeePayException.php new file mode 100644 index 00000000..b3b7c702 --- /dev/null +++ b/app/Exceptions/YeePayException.php @@ -0,0 +1,9 @@ + WalletToBankLogStatus::class, + 'pay_way' => WalletToBankLogPayWay::class, + 'pay_at' => 'datetime', ]; /** @@ -31,6 +34,10 @@ class WalletToBankLog extends Model 'rate', 'service_amount', 'account_amount', + 'pay_sn', + 'pay_way', + 'pay_at', + 'failed_reason', ]; /** diff --git a/app/Services/YeePayService.php b/app/Services/YeePayService.php new file mode 100644 index 00000000..454ecdf9 --- /dev/null +++ b/app/Services/YeePayService.php @@ -0,0 +1,82 @@ + Str::uuid()->getHex()->toString(), + 'service' => $service, + 'partnerId' => $this->config['partner_id'], + 'signType' => 'MD5', + 'notifyUrl' => route('yeepay.notify'), + ], $data); + + $data['sign'] = $this->sign($data); + + $response = Http::asForm()->post($this->config['gateway_url'], $data); + + $response->throw(); + + $result = $response->json(); + + if ($result['success'] && in_array($result['resultCode'], ['EXECUTE_SUCCESS', 'EXECUTE_PROCESSING'])) { + return $result; + } + + $message = $result['resultDetail'] ?? $result['resultMessage']; + + throw new YeePayException($message); + } + + /** + * 生成签名 + * + * @param array $params + * @return string + */ + protected function sign(array $params): string + { + unset($params['sign']); + + ksort($params); + + $str = ''; + + foreach ($params as $key => $value) { + if (blank($value)) { + continue; + } + + if ($str !== '') { + $str .= '&'; + } + + if (is_array($value)) { + $value = json_encode($value); + } + + $str .= "{$key}={$value}"; + } + + $str .= $this->config['secret_key']; + + return md5($str); + } +} diff --git a/config/services.php b/config/services.php index 2a1d616c..0541871e 100644 --- a/config/services.php +++ b/config/services.php @@ -30,4 +30,10 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'yeepay' => [ + 'partner_id' => env('YEEPAY_PARTNER_ID'), + 'secret_key' => env('YEEPAY_SECRET_KEY'), + 'gateway_url' => env('YEEPAY_GATEWAY_URL'), + ], + ]; diff --git a/database/migrations/2022_04_12_110138_add_pay_columns_to_wallet_to_bank_logs_table.php b/database/migrations/2022_04_12_110138_add_pay_columns_to_wallet_to_bank_logs_table.php new file mode 100644 index 00000000..7878fcdc --- /dev/null +++ b/database/migrations/2022_04_12_110138_add_pay_columns_to_wallet_to_bank_logs_table.php @@ -0,0 +1,38 @@ +string('pay_sn')->nullable()->comment('支付单号'); + $table->tinyInteger('pay_way')->default(WalletToBankLogPayWay::Offline->value)->comment('支付方式: 1 线下, 2 代付'); + $table->timestamp('pay_at')->nullable()->comment('支付时间'); + $table->text('failed_reason')->nullable()->comment('失败原因'); + + $table->unique('pay_sn'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('wallet_to_bank_logs', function (Blueprint $table) { + $table->dropColumn(['pay_sn', 'pay_way', 'failed_reason', 'pay_at']); + }); + } +} diff --git a/resources/lang/zh_CN/wallet-to-bank-log.php b/resources/lang/zh_CN/wallet-to-bank-log.php index c98af7bb..5ab0879a 100644 --- a/resources/lang/zh_CN/wallet-to-bank-log.php +++ b/resources/lang/zh_CN/wallet-to-bank-log.php @@ -17,6 +17,9 @@ return [ 'status' => '状态', 'remarks' => '备注', 'created_at'=> '申请时间', + 'pay_way' => '支付方式', + 'pay_at' => '支付时间', + 'failed_reason' => '失败原因', 'user'=>[ 'phone' => '申请人', ], From c09a691ddc73983bce2634acfa8809a53339c907 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 15:50:45 +0800 Subject: [PATCH 27/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/BargainActivityController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Admin/Controllers/BargainActivityController.php b/app/Admin/Controllers/BargainActivityController.php index e2cfef92..42b396c9 100644 --- a/app/Admin/Controllers/BargainActivityController.php +++ b/app/Admin/Controllers/BargainActivityController.php @@ -120,8 +120,7 @@ class BargainActivityController extends AdminController $grid->column('infos', '明细')->display(function () { return '【'.$this->userInfo->nickname.'】'.$this->created_at->format('Y-m-d H:i:s').'发起了砍价'; })->link(function () { - return ''; - // return admin_route('merchant_printers.show', ['merchant_printer' =>$this->id]); + return admin_route('bargain_orders.show', ['bargain_order' =>$this->id]); }); $grid->model()->orderBy('created_at', 'desc'); From 1fb919cafa2ebb9a661a1f3ade6af7925bd70587 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 15:55:44 +0800 Subject: [PATCH 28/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BF=9B=E8=B4=A7?= =?UTF-8?q?=E8=A1=A5=E8=B4=B4=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BD=AE=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/DealerPurchaseLogController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Admin/Controllers/DealerPurchaseLogController.php b/app/Admin/Controllers/DealerPurchaseLogController.php index 569c191e..2f2962b5 100644 --- a/app/Admin/Controllers/DealerPurchaseLogController.php +++ b/app/Admin/Controllers/DealerPurchaseLogController.php @@ -40,6 +40,9 @@ class DealerPurchaseLogController extends AdminController $user = User::where('phone', $phone)->first(); if ($user) { $grid->model()->where('path', 'like', '%-'.$user->id.'-%'); + } else { + //不存的手机号查询数据置为空 + $grid->model()->where('id', 0); } } $grid->model()->orderBy('id', 'desc');//默认ID倒叙 From 602d6f30aa372fd8f11c0aa64ac3f50c969edfda Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 15:56:38 +0800 Subject: [PATCH 29/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85id=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/BargainOrderController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index 7f2ba2bc..b567c93b 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -90,7 +90,7 @@ class BargainOrderController extends AdminController $row->column(6, function ($column) use ($order) { $column->row(Show::make($order, function (Show $show) { $show->row(function (Show\Row $show) { - $show->field('id'); + $show->field('id')->width(10, 1); $show->width(6)->field('activity.name'); $show->field('sku.name'); $show->field('sku_price')->as(function ($v) { From 078a52f2069978d4485ac28379f676e2f4b2c28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 16:11:07 +0800 Subject: [PATCH 30/58] =?UTF-8?q?=E4=BB=A3=E4=BB=98=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E8=B6=85=E6=97=B6,=E9=87=8D=E6=96=B0=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/WalletToBankCommand.php | 6 ++++++ app/Services/YeePayService.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/WalletToBankCommand.php b/app/Console/Commands/WalletToBankCommand.php index 850d9dce..e6293f29 100644 --- a/app/Console/Commands/WalletToBankCommand.php +++ b/app/Console/Commands/WalletToBankCommand.php @@ -50,8 +50,14 @@ class WalletToBankCommand extends Command 'amount' => bcdiv($log->account_amount, 100, 2), 'feeRole' => 'PAYER', 'tradeMemo' => '商城余额提现', + 'context' => json_encode(['type' => 'wallet_to_bank']), ]); + // 如果交易超时,重新发起支付 + if ($result['resultCode'] === 'TIME_OUT') { + continue; + } + if ($result['orderStatus'] === 'SUCCESS') { $log->update([ 'status' => WalletToBankLogStatus::Success, diff --git a/app/Services/YeePayService.php b/app/Services/YeePayService.php index 454ecdf9..2a5eedc8 100644 --- a/app/Services/YeePayService.php +++ b/app/Services/YeePayService.php @@ -36,7 +36,7 @@ class YeePayService $result = $response->json(); - if ($result['success'] && in_array($result['resultCode'], ['EXECUTE_SUCCESS', 'EXECUTE_PROCESSING'])) { + if ($result['success'] && in_array($result['resultCode'], ['EXECUTE_SUCCESS', 'EXECUTE_PROCESSING', 'TIME_OUT'])) { return $result; } @@ -51,7 +51,7 @@ class YeePayService * @param array $params * @return string */ - protected function sign(array $params): string + public function sign(array $params): string { unset($params['sign']); From 4055e850f4d0c0dcb427ad2792ff229f91a24852 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 16:17:15 +0800 Subject: [PATCH 31/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E8=AE=A2=E5=8D=95=E8=AE=B0=E5=BD=95=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainOrderController.php | 16 +++- .../Grid/Filter/BargainOrderSnIn.php | 74 +++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 app/Admin/Renderable/Grid/Filter/BargainOrderSnIn.php diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index b567c93b..addc6771 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -2,6 +2,7 @@ namespace App\Admin\Controllers; +use App\Admin\Renderable\Grid\Filter\BargainOrderSnIn; use App\Admin\Repositories\BargainOrder; use App\Models\BargainOrder as BargainOrderModel; use App\Models\BargainOrderLog; @@ -35,9 +36,20 @@ class BargainOrderController extends AdminController $grid->column('bargain_price')->display(function ($v) { return bcdiv($v, 100, 2); })->prepend('¥'); - $grid->column('status'); + $grid->column('status')->using([ + 0=>'未开始', + 1=>'砍价中', + 2=>'已砍完', + ])->dot([ + 0=>'primary', + 1=>'warning', + 2=>'success', + ]); $grid->column('expire_at'); - $grid->column('mallOrder.sn'); + $grid->column('mallOrder.sn')->filter(BargainOrderSnIn::make([ + 0 => '未下单', + 1 => '已下单', + ])); $grid->column('remark'); $grid->column('created_at'); $grid->column('updated_at')->sortable(); diff --git a/app/Admin/Renderable/Grid/Filter/BargainOrderSnIn.php b/app/Admin/Renderable/Grid/Filter/BargainOrderSnIn.php new file mode 100644 index 00000000..96f4fa6e --- /dev/null +++ b/app/Admin/Renderable/Grid/Filter/BargainOrderSnIn.php @@ -0,0 +1,74 @@ +options = $options; + + $this->class = [ + 'all' => uniqid('column-filter-all-'), + 'item' => uniqid('column-filter-item-'), + ]; + } + + /** + * Add a binding to the query. + * + * @param array $value + * @param Model $model + */ + public function addBinding($value, Model $model) + { + if (empty($value)) { + return; + } + $all = [0, 1]; + + if (array_diff($all, $value)) {//无差别则直接跳过 + //判断查询的状态有哪些; + $model->where(function ($query) use ($value) { + foreach ($value as $status) { + switch ($status) { + case 0: + $query->orWhere(function ($q) { + return $q->whereNull('order_id')->orWhere('order_id', 0); + }); + break; + case 1: + $query->orWhereNotNull('order_id'); + break; + } + } + }); + } + } + + /** + * Render this filter. + * + * @return string + */ + public function render() + { + return $this->renderCheckbox(); + } +} From 051c2452a1cdd71d1771ddcae7485d3d9695b439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 16:25:20 +0800 Subject: [PATCH 32/58] =?UTF-8?q?=E4=BB=A3=E4=BB=98=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/YeePayNotifyController.php | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index d5e81843..a12e96e7 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -2,12 +2,89 @@ namespace App\Endpoint\Callback\Http\Controllers; +use App\Enums\WalletToBankLogStatus; +use App\Exceptions\BizException; +use App\Models\WalletToBankLog; +use App\Services\YeePayService; use Illuminate\Http\Request; +use Illuminate\Support\Arr; +use Illuminate\Support\Carbon; class YeePayNotifyController extends Controller { public function __invoke(Request $request) { logger()->debug('yeepay notify', $request->input()); + + $this->validateSign($request); + + switch ($request->input('service')) { + case 'accountpay.behalf.Pay': + $this->handleBehalfPayNotify($request); + break; + } + + return 'success'; + } + + /** + * 处理代付回调 + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \App\Exceptions\BizException + */ + protected function handleBehalfPayNotify(Request $request) + { + $resultCode = $request->input('resultCode'); + + if ($resultCode === 'EXECUTE_PROCESSING') { + return; + } + + $orderNo = $request->input('merchOrderNo'); + $orderStatus = $request->input('orderStatus'); + $context = (array) json_decode($request->input('contxt'), true); + + if (Arr::get($context, 'type') === 'wallet_to_bank') { + $log = WalletToBankLog::where('pay_sn', $orderNo)->first(); + + if ($log === null) { + return; + } + + if ($orderStatus === 'SUCCESS') { + $log->update([ + 'status' => WalletToBankLogStatus::Success, + 'pay_at' => Carbon::parse($request->input('finishTime')), + 'failed_reason' => null, + ]); + } elseif ($orderStatus === 'FAIL') { + $log->update([ + 'status' => WalletToBankLogStatus::Failed, + 'failed_reason' => $request->input('resultMessage').'#'.$resultCode, + ]); + } + } + } + + /** + * 校验签名 + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \App\Exceptions\BizException + */ + protected function validateSign(Request $request) + { + $yeePayService = new YeePayService(config('services.yeepay')); + + if ($request->input('sign') === $yeePayService->sign($request->input())) { + return; + } + + throw new BizException('签名错误'); } } From 0b1b44af2779eac7469b58e1a319296f2e1cb7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 16:40:04 +0800 Subject: [PATCH 33/58] Update --- .../Callback/Http/Controllers/YeePayNotifyController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index a12e96e7..7275b514 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -3,9 +3,9 @@ namespace App\Endpoint\Callback\Http\Controllers; use App\Enums\WalletToBankLogStatus; -use App\Exceptions\BizException; use App\Models\WalletToBankLog; use App\Services\YeePayService; +use Exception; use Illuminate\Http\Request; use Illuminate\Support\Arr; use Illuminate\Support\Carbon; @@ -54,6 +54,10 @@ class YeePayNotifyController extends Controller return; } + if ($log->status !== WalletToBankLogStatus::Paying) { + return; + } + if ($orderStatus === 'SUCCESS') { $log->update([ 'status' => WalletToBankLogStatus::Success, @@ -85,6 +89,6 @@ class YeePayNotifyController extends Controller return; } - throw new BizException('签名错误'); + throw new Exception('签名错误'); } } From e56ff82385d0b748697675ef36b700aff977ceaf Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 16:43:24 +0800 Subject: [PATCH 34/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=A4=87=E6=B3=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Actions/Show/BargainOrderRemark.php | 32 ++++++++++ .../Controllers/BargainOrderController.php | 4 ++ app/Admin/Forms/BargainOrderRemark.php | 61 +++++++++++++++++++ database/seeders/AdminPermissionSeeder.php | 3 + 4 files changed, 100 insertions(+) create mode 100644 app/Admin/Actions/Show/BargainOrderRemark.php create mode 100644 app/Admin/Forms/BargainOrderRemark.php diff --git a/app/Admin/Actions/Show/BargainOrderRemark.php b/app/Admin/Actions/Show/BargainOrderRemark.php new file mode 100644 index 00000000..375190b9 --- /dev/null +++ b/app/Admin/Actions/Show/BargainOrderRemark.php @@ -0,0 +1,32 @@ + 备注'; + + /** + * 按钮样式定义,默认 btn btn-white waves-effect + * + * @var string + */ + protected $style = 'btn-success'; + + public function render() + { + $form = BargainOrderRemarkForm::make()->payload(['id'=>$this->getKey()]); + return Modal::make() + ->lg() + ->title($this->title) + ->body($form) + ->button("style}\">{$this->title}  "); + } +} diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index addc6771..373cb282 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -2,6 +2,7 @@ namespace App\Admin\Controllers; +use App\Admin\Actions\Show\BargainOrderRemark; use App\Admin\Renderable\Grid\Filter\BargainOrderSnIn; use App\Admin\Repositories\BargainOrder; use App\Models\BargainOrder as BargainOrderModel; @@ -130,11 +131,14 @@ class BargainOrderController extends AdminController $show->field('expire_at'); $show->field('created_at'); + $show->width(12)->field('remark')->width(10, 1); }); $show->panel() ->tools(function (Show\Tools $tools) { $tools->disableEdit(); $tools->disableDelete(); + + $tools->prepend(new BargainOrderRemark()); }); })); }); diff --git a/app/Admin/Forms/BargainOrderRemark.php b/app/Admin/Forms/BargainOrderRemark.php new file mode 100644 index 00000000..a73caec0 --- /dev/null +++ b/app/Admin/Forms/BargainOrderRemark.php @@ -0,0 +1,61 @@ +can('dcat.admin.bargain_orders.remark'); + } + + /** + * Handle the form request. + * + * @param array $input + * + * @return mixed + */ + public function handle(array $input) + { + $orderId = $this->payload['id'] ?? 0; + $order = BargainOrder::findOrFail($orderId); + + $remark = $input['remark'] ?? ''; + + $order->update([ + 'remark'=>$remark, + ]); + + return $this->response() + ->success(__('admin.update_succeeded')) + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $orderId = $this->payload['id'] ?? 0; + $order = BargainOrder::findOrFail($orderId); + + $this->text('remark')->value($order->remark); + + $this->disableResetButton(); + } +} diff --git a/database/seeders/AdminPermissionSeeder.php b/database/seeders/AdminPermissionSeeder.php index cb1648e4..e81859e4 100644 --- a/database/seeders/AdminPermissionSeeder.php +++ b/database/seeders/AdminPermissionSeeder.php @@ -426,6 +426,9 @@ class AdminPermissionSeeder extends Seeder 'bargain_orders'=>[ 'name' =>'砍价活动记录', 'curd' => ['index', 'show'], + 'children'=>[ + 'remark'=>['name' =>'备注'], + ], ], ]; // try { From 8f7ae2600db7f0436272a54b5c9d9f1c4c9c0d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 17:01:05 +0800 Subject: [PATCH 35/58] debug --- .../Callback/Http/Controllers/YeePayNotifyController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index 7275b514..c3ff4115 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -85,6 +85,11 @@ class YeePayNotifyController extends Controller { $yeePayService = new YeePayService(config('services.yeepay')); + logger()->debug('yeepay notify sign------>', [ + 'sign' => $request->input('sign'), + 'sign2' => $yeePayService->sign($request->input()), + ]); + if ($request->input('sign') === $yeePayService->sign($request->input())) { return; } From 7eefc5a7a7c2f4c4a9a33282be2e6b841deb34c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 17:03:23 +0800 Subject: [PATCH 36/58] Fix --- .../Callback/Http/Controllers/YeePayNotifyController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index c3ff4115..ae9b7e0e 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -16,7 +16,7 @@ class YeePayNotifyController extends Controller { logger()->debug('yeepay notify', $request->input()); - $this->validateSign($request); + // $this->validateSign($request); switch ($request->input('service')) { case 'accountpay.behalf.Pay': @@ -45,7 +45,7 @@ class YeePayNotifyController extends Controller $orderNo = $request->input('merchOrderNo'); $orderStatus = $request->input('orderStatus'); - $context = (array) json_decode($request->input('contxt'), true); + $context = (array) json_decode($request->input('context'), true); if (Arr::get($context, 'type') === 'wallet_to_bank') { $log = WalletToBankLog::where('pay_sn', $orderNo)->first(); From 8c1cf2caa2a86c2371014be1810ce3efe7daffb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 17:09:01 +0800 Subject: [PATCH 37/58] Update --- .../Http/Controllers/YeePayNotifyController.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index ae9b7e0e..fedc181a 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -14,9 +14,9 @@ class YeePayNotifyController extends Controller { public function __invoke(Request $request) { - logger()->debug('yeepay notify', $request->input()); + $this->info('request parameters', $request->input()); - // $this->validateSign($request); + $this->validateSign($request); switch ($request->input('service')) { case 'accountpay.behalf.Pay': @@ -85,15 +85,18 @@ class YeePayNotifyController extends Controller { $yeePayService = new YeePayService(config('services.yeepay')); - logger()->debug('yeepay notify sign------>', [ - 'sign' => $request->input('sign'), - 'sign2' => $yeePayService->sign($request->input()), - ]); - if ($request->input('sign') === $yeePayService->sign($request->input())) { return; } throw new Exception('签名错误'); } + + protected function info($message, array $context = []) + { + logger()->build([ + 'driver' => 'daily', + 'path' => storage_path('logs/yeepay-notify.log'), + ])->info('yeepay notify', $context); + } } From 3a0ba59c3fc4ce5517af9da2d9daacf72cf92f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 12 Apr 2022 17:50:56 +0800 Subject: [PATCH 38/58] WIP --- app/Enums/Bank.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Enums/Bank.php b/app/Enums/Bank.php index a9fc372e..076fb6a8 100644 --- a/app/Enums/Bank.php +++ b/app/Enums/Bank.php @@ -7,15 +7,15 @@ enum Bank { case ABC; case ICBC; case BOC; - case COMM; - case CMB; + case BOCO; + case CMBCHINA; case CMBC; case CIB; case CITIC; case SPDB; case CEB; case PSBC; - case PINGANBK; + case SDB; /** * @return string @@ -50,15 +50,15 @@ enum Bank { static::ABC->name => '中国农业银行', static::ICBC->name => '中国工商银行', static::BOC->name => '中国银行', - static::COMM->name => '交通银行', - static::CMB->name => '招商银行', + static::BOCO->name => '交通银行', + static::CMBCHINA->name => '招商银行', static::CMBC->name => '民生银行', static::CIB->name => '兴业银行', static::CITIC->name => '中信实业银行', static::SPDB->name => '上海浦东发展银行', static::CEB->name => '光大银行', static::PSBC->name => '邮政储蓄银行', - static::PINGANBK->name => '平安银行', + static::SDB->name => '平安银行', ]; } } From 7c278507eb811f3a27d6b9afa2e753c93486c995 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 12 Apr 2022 18:05:26 +0800 Subject: [PATCH 39/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=94=AE=E5=90=8E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/OrderProduct.php | 1 + app/Services/OrderService.php | 9 +++-- ...bargain_amount_to_order_products_table.php | 34 +++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2022_04_12_174541_add_bargain_amount_to_order_products_table.php diff --git a/app/Models/OrderProduct.php b/app/Models/OrderProduct.php index 0550c0bc..7c27db2a 100644 --- a/app/Models/OrderProduct.php +++ b/app/Models/OrderProduct.php @@ -41,6 +41,7 @@ class OrderProduct extends Model 'remain_quantity', 'is_gift', 'activity_id', + 'bargain_amount', ]; public function packageProducts() diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 1ea130cb..45067009 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -128,7 +128,7 @@ class OrderService $coupon = $user->coupons()->onlyAvailable()->lockForUpdate()->findOrFail($couponId); } - $mapProducts = $this->mapProducts($user, $products, $coupon); + $mapProducts = $this->mapProducts($user, $products, $coupon, $bargainOrder); // 计算运费 $shippingFee = $this->calculateShippingFee($mapProducts, $shippingAddress); @@ -675,13 +675,14 @@ class OrderService * @param \App\Models\User $user * @param array $products * @param \App\Models\UserCoupon|null $coupon + * @param \App\Models\BargainOrder|null $bargainOrder * @return array * * @throws \App\Exceptions\BizException */ - protected function mapProducts(User $user, array $products, ?UserCoupon $coupon): array + protected function mapProducts(User $user, array $products, ?UserCoupon $coupon, ?BargainOrder $bargainOrder): array { - $_products = collect($products)->map(function ($item) use ($user) { + $_products = collect($products)->map(function ($item) use ($user, $bargainOrder) { $sku = $item['sku']; return array_merge($item, [ @@ -695,6 +696,8 @@ class OrderService 'total_amount' => $sku->sell_price * $item['quantity'], // 总销售值 'total_sales_value' => bcmul($sku->sales_value, $item['quantity'], 2), + //填入砍价金额 + 'bargain_amount'=> $bargainOrder?->bargain_price ?? 0, ]); }); diff --git a/database/migrations/2022_04_12_174541_add_bargain_amount_to_order_products_table.php b/database/migrations/2022_04_12_174541_add_bargain_amount_to_order_products_table.php new file mode 100644 index 00000000..2616e724 --- /dev/null +++ b/database/migrations/2022_04_12_174541_add_bargain_amount_to_order_products_table.php @@ -0,0 +1,34 @@ +unsignedBigInteger('bargain_amount')->nullable()->default(0)->comment('砍价金额'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('order_products', function (Blueprint $table) { + // + $table->dropColumn(['bargain_amount']); + }); + } +} From 82807fdfae432886706a176e225e282ba25dbc8f Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 10:17:13 +0800 Subject: [PATCH 40/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Order/OrderVerifyController.php | 3 + app/Models/User.php | 9 +- app/Services/OrderService.php | 89 ++++++++++++++++--- 3 files changed, 88 insertions(+), 13 deletions(-) diff --git a/app/Endpoint/Api/Http/Controllers/Order/OrderVerifyController.php b/app/Endpoint/Api/Http/Controllers/Order/OrderVerifyController.php index 1ef5c5ed..5da8b8ed 100644 --- a/app/Endpoint/Api/Http/Controllers/Order/OrderVerifyController.php +++ b/app/Endpoint/Api/Http/Controllers/Order/OrderVerifyController.php @@ -20,6 +20,7 @@ class OrderVerifyController extends Controller $rules = [ 'coupon_id' => ['bail', 'nullable', 'int'], 'shipping_address_id' => ['bail', 'nullable', 'int'], + 'baragain_order_id' => ['bail', 'nullable', 'int'], ]; // 快速下单 @@ -40,6 +41,7 @@ class OrderVerifyController extends Controller 'product.quantity' => '数量', 'coupon_id' => '优惠券', 'shipping_address_id' => '收货地址', + 'bargain_order_id'=> '砍价', ]); $user = $request->user(); @@ -52,6 +54,7 @@ class OrderVerifyController extends Controller $request->input('product.quantity'), $request->input('shipping_address_id'), $request->input('coupon_id'), + $request->input('bargain_order_id'), ) : $orderService->verifyShoppingCartOrder( $user, $request->input('shopping_cart'), diff --git a/app/Models/User.php b/app/Models/User.php index c99f856e..ee205250 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,7 +2,6 @@ namespace App\Models; -use App\Exceptions\BizException; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Auth\Authenticatable; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; @@ -410,6 +409,14 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac return $this->belongsToMany(User::class, 'user_infos', 'inviter_id', 'user_id'); } + /** + * 用户的砍价单 + */ + public function bargainOrders() + { + return $this->hasMany(BargainOrder::class); + } + /** * 获取我的粉丝总数 * diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 45067009..efc34f46 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -253,8 +253,8 @@ class OrderService $sku = $product['sku']; $qty = $product['quantity']; - // 支付金额 = 商品总额 - 优惠券折扣金额- 会员折扣金额 - $totalAmount = $product['total_amount'] - $product['coupon_discount_amount'] - $product['vip_discount_amount']; + // 支付金额 = 商品总额 - 优惠券折扣金额- 会员折扣金额 - 砍价金额 + $totalAmount = $product['total_amount'] - $product['coupon_discount_amount'] - $product['vip_discount_amount'] - $product['bargain_amount']; $orderProducts[] = [ 'gift_for_sku_id' => null, @@ -277,6 +277,7 @@ class OrderService 'coupon_discount_amount' => $product['coupon_discount_amount'], 'vip_discount_amount' => $product['vip_discount_amount'], 'total_amount' => $totalAmount, + 'bargain_amount'=> $product['bargain_amount'], 'created_at' => $order->created_at, 'updated_at' => $order->updated_at, ]; @@ -466,6 +467,7 @@ class OrderService 'coupon_discount_amount' => 0, 'vip_discount_amount' => 0, 'total_amount' => 0, + 'bargain_amount'=> 0, 'created_at' => $order->created_at, 'updated_at' => $order->updated_at, 'is_gift'=> true, @@ -495,9 +497,10 @@ class OrderService * @param int $quantity * @param int|null $shippingAddressId * @param int|null $couponId + * @param int|null $bargainOrderId * @return array */ - public function verifyQuickOrder(User $user, int $skuId, int $quantity, ?int $shippingAddressId = null, ?int $couponId = null) + public function verifyQuickOrder(User $user, int $skuId, int $quantity, ?int $shippingAddressId = null, ?int $couponId = null, ?int $bargainOrderId = null) { $sku = ProductSku::online()->findOrFail($skuId); @@ -506,7 +509,7 @@ class OrderService 'quantity' => $quantity, ]; - return $this->verifyOrder($user, [$product], $shippingAddressId, $couponId); + return $this->verifyOrder($user, [$product], $shippingAddressId, $couponId, $bargainOrderId); } /** @@ -533,9 +536,10 @@ class OrderService * @param array $products * @param int|null $shippingAddressId * @param int|null $couponId + * @param int|null $bargainOrderId * @return array */ - protected function verifyOrder(User $user, array $products, ?int $shippingAddressId = null, ?int $couponId = null): array + protected function verifyOrder(User $user, array $products, ?int $shippingAddressId = null, ?int $couponId = null, ?int $bargainOrderId = null): array { // 获取收货地址 $shippingAddress = $this->getShippingAddress($user, $shippingAddressId); @@ -547,7 +551,12 @@ class OrderService $coupon = $user->coupons()->onlyAvailable()->findOrFail($couponId); } - $mapProducts = $this->mapProducts($user, $products, $coupon); + $bargainOrder = null; + if ($bargainOrderId) { + $bargainOrder = $user->bargainOrders()->findOrFail($bargainOrderId); + } + + $mapProducts = $this->mapProducts($user, $products, $coupon, $bargainOrder); // 是否支持配送 $shippingSupported = true; @@ -568,9 +577,10 @@ class OrderService $vipDiscountAmount, $couponDiscountAmount, $salesValue, + $bargainAmount, ) = $this->calculateFees($mapProducts); - $totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount; + $totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount - $bargainAmount; if ($totalAmount < 0) { $totalAmount = 0; @@ -593,6 +603,7 @@ class OrderService 'vip_discount_amount' => trim_trailing_zeros(bcdiv($vipDiscountAmount, 100, 2)), // 会员折扣金额 'coupon_discount_amount' => trim_trailing_zeros(bcdiv($couponDiscountAmount, 100, 2)), // 优惠券折扣金额 'total_amount' => trim_trailing_zeros(bcdiv($totalAmount, 100, 2)), // 实付金额 + 'bargain_amount' => trim_trailing_zeros(bcdiv($bargainAmount, 100, 2)), //砍价金额 ]; } @@ -608,12 +619,14 @@ class OrderService $vipDiscountAmount = 0; $couponDiscountAmount = 0; $salesValue = 0; + $bargainAmount = 0; foreach ($products as $product) { $productsTotalAmount += $product['total_amount']; $vipDiscountAmount += $product['vip_discount_amount']; $couponDiscountAmount += $product['coupon_discount_amount']; $salesValue = bcadd($salesValue, $product['total_sales_value']); + $bargainAmount += $product['bargain_amount']; } return [ @@ -621,6 +634,7 @@ class OrderService $vipDiscountAmount, $couponDiscountAmount, $salesValue, + $bargainAmount, ]; } @@ -675,14 +689,13 @@ class OrderService * @param \App\Models\User $user * @param array $products * @param \App\Models\UserCoupon|null $coupon - * @param \App\Models\BargainOrder|null $bargainOrder * @return array * * @throws \App\Exceptions\BizException */ - protected function mapProducts(User $user, array $products, ?UserCoupon $coupon, ?BargainOrder $bargainOrder): array + protected function mapProducts(User $user, array $products, ?UserCoupon $coupon, ?BargainOrder $bargainOrder = null): array { - $_products = collect($products)->map(function ($item) use ($user, $bargainOrder) { + $_products = collect($products)->map(function ($item) use ($user) { $sku = $item['sku']; return array_merge($item, [ @@ -696,11 +709,20 @@ class OrderService 'total_amount' => $sku->sell_price * $item['quantity'], // 总销售值 'total_sales_value' => bcmul($sku->sales_value, $item['quantity'], 2), - //填入砍价金额 - 'bargain_amount'=> $bargainOrder?->bargain_price ?? 0, + //砍价金额 + 'bargain_amount' => 0, ]); }); + //处理砍价金额 + if ($bargainOrder) { + $bargainDiscountAmount = $this->getBargainDiscountAmount($bargainOrder, $_products->all()); + $_products = $_products->map(function ($item) use ($bargainDiscountAmount) { + $item['bargain_amount'] = $bargainDiscountAmount[$item['sku']->id] ?? 0; + return $item; + }); + } + if ($coupon === null) { return $_products->all(); } @@ -808,6 +830,49 @@ class OrderService return $amounts; } + /** + * + */ + protected function getBargainDiscountAmount(BargainOrder $bargainOrder, array $products): array + { + // 砍价的商品 + $amounts = []; + foreach ($products as $item) { + $sku = $item['sku']; + + $amount = $item['total_amount'] - $item['vip_discount_amount']; + + // 仅保留商品真实总额大于0的商品 + if ($amount > 0) { + $amounts[$sku->id] = $amount; + } + } + + // 全部商品总额 + $totalAmount = array_sum($amounts); + + + $bargainAmount = $bargainOrder->bargain_price ?? 0; + + // 待计算优惠的商品总数 + $i = count($amounts); + + foreach ($amounts as &$amount) { + $i--; + + if ($i > 0) { + $amount = (int) bcdiv(bcmul($bargainAmount, $amount, 0), $totalAmount, 2); + $bargainAmount -= $amount; + } else { + $amount = $bargainAmount; + } + + unset($amount); + } + + return $amounts; + } + /** * 根据购物车获取商品 * From 4c203f4a31711837c7a29af07804fde5495f4d9a Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 10:25:47 +0800 Subject: [PATCH 41/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E6=98=BE=E7=A4=BA=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=9A=84=E7=A0=8D=E4=BB=B7=E4=BC=98=E6=83=A0=E9=87=91?= =?UTF-8?q?=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/OrderController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Admin/Controllers/OrderController.php b/app/Admin/Controllers/OrderController.php index 118ffd03..fc5ab39b 100644 --- a/app/Admin/Controllers/OrderController.php +++ b/app/Admin/Controllers/OrderController.php @@ -345,6 +345,9 @@ class OrderController extends AdminController $grid->column('coupon_discount_amount', '优惠券折扣')->display(function ($value) { return bcdiv($value, 100, 2); })->prepend('¥'); + $grid->column('bargain_amount', '砍价优惠')->display(function ($value) { + return bcdiv($value, 100, 2); + })->prepend('¥'); $grid->column('sales_value', '销售值'); $grid->column('remain_quantity'); From a123a87d1b96619e88b6f47cfeea3ecb10d4307c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 13 Apr 2022 10:36:26 +0800 Subject: [PATCH 42/58] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E4=BB=A3=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Forms/WalletToBankLogVerify.php | 7 ++++--- app/Enums/WalletToBankLogStatus.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Admin/Forms/WalletToBankLogVerify.php b/app/Admin/Forms/WalletToBankLogVerify.php index 9ab00ecd..00b76100 100644 --- a/app/Admin/Forms/WalletToBankLogVerify.php +++ b/app/Admin/Forms/WalletToBankLogVerify.php @@ -109,9 +109,10 @@ class WalletToBankLogVerify extends Form implements LazyRenderable 2 => '拒绝', ]) ->default(1); - $this->select('pay_way') - ->options(WalletToBankLogPayWay::texts()) - ->rules('required_if:status,1', ['required_if'=>'请选择支付方式']); + $this->hidden('pay_way')->value(WalletToBankLogPayWay::Offline->value); + // $this->select('pay_way') + // ->options(WalletToBankLogPayWay::texts()) + // ->rules('required_if:status,1', ['required_if'=>'请选择支付方式']); $this->text('remarks')->rules('required_if:status,2', ['required_if'=>'拒绝时需要填写备注']); } } diff --git a/app/Enums/WalletToBankLogStatus.php b/app/Enums/WalletToBankLogStatus.php index c98b5e69..a5fa6e1e 100644 --- a/app/Enums/WalletToBankLogStatus.php +++ b/app/Enums/WalletToBankLogStatus.php @@ -40,10 +40,10 @@ enum WalletToBankLogStatus: int { { return [ static::Pending->value => '待处理', - static::Passed->value => '待付款', - static::Paying->value => '付款中', + // static::Passed->value => '待付款', + // static::Paying->value => '付款中', static::Success->value => '成功', - static::Failed->value => '失败', + // static::Failed->value => '失败', static::Refused->value => '拒绝', ]; } From 5beec69c39a5016b1d6fe475b4e8d1d888013545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 13 Apr 2022 10:38:51 +0800 Subject: [PATCH 43/58] Update --- app/Admin/Controllers/WalletToBankLogController.php | 9 ++++++++- app/Enums/WalletToBankLogStatus.php | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Admin/Controllers/WalletToBankLogController.php b/app/Admin/Controllers/WalletToBankLogController.php index bb42b499..6ce80e09 100644 --- a/app/Admin/Controllers/WalletToBankLogController.php +++ b/app/Admin/Controllers/WalletToBankLogController.php @@ -10,6 +10,7 @@ use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Show; +use Illuminate\Support\Arr; class WalletToBankLogController extends AdminController { @@ -58,7 +59,13 @@ class WalletToBankLogController extends AdminController $grid->filter(function (Grid\Filter $filter) { $filter->panel(); - $filter->equal('status')->select(WalletToBankLogStatus::texts())->width(3); + $filter->equal('status') + ->select(Arr::except(WalletToBankLogStatus::texts(), [ + WalletToBankLogStatus::Passed->value, + WalletToBankLogStatus::Paying->value, + WalletToBankLogStatus::Failed->value, + ])) + ->width(3); $filter->equal('user.phone')->width(3); $filter->equal('username')->width(3); $filter->between('created_at')->dateTime()->width(7); diff --git a/app/Enums/WalletToBankLogStatus.php b/app/Enums/WalletToBankLogStatus.php index a5fa6e1e..c98b5e69 100644 --- a/app/Enums/WalletToBankLogStatus.php +++ b/app/Enums/WalletToBankLogStatus.php @@ -40,10 +40,10 @@ enum WalletToBankLogStatus: int { { return [ static::Pending->value => '待处理', - // static::Passed->value => '待付款', - // static::Paying->value => '付款中', + static::Passed->value => '待付款', + static::Paying->value => '付款中', static::Success->value => '成功', - // static::Failed->value => '失败', + static::Failed->value => '失败', static::Refused->value => '拒绝', ]; } From d98d31487b79a861b937c8c36c14fc92ce76036e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 13 Apr 2022 10:52:15 +0800 Subject: [PATCH 44/58] =?UTF-8?q?=E6=89=B9=E9=9B=B6=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DealerWalletToBankLogController.php | 53 +++++++------------ app/Admin/Forms/DealerWalletPay.php | 5 +- app/Admin/Forms/DealerWalletRefuse.php | 5 +- app/Enums/DealerWalletToBankLogStatus.php | 50 +++++++++++++++++ app/Models/DealerWalletToBankLog.php | 9 ++-- 5 files changed, 81 insertions(+), 41 deletions(-) create mode 100644 app/Enums/DealerWalletToBankLogStatus.php diff --git a/app/Admin/Controllers/DealerWalletToBankLogController.php b/app/Admin/Controllers/DealerWalletToBankLogController.php index 60072123..1a145466 100644 --- a/app/Admin/Controllers/DealerWalletToBankLogController.php +++ b/app/Admin/Controllers/DealerWalletToBankLogController.php @@ -6,6 +6,7 @@ use App\Admin\Actions\Grid\Exports\DealerWalletWithdraw; use App\Admin\Actions\Show\DealerWalletPay; use App\Admin\Actions\Show\DealerWalletRefuse; use App\Admin\Repositories\DealerWalletToBankLog; +use App\Enums\DealerWalletToBankLogStatus; use App\Models\DealerWalletToBankLog as DealerWalletToBankLogModel; use Box\Spout\Writer\Common\Creator\WriterEntityFactory; use Dcat\Admin\Admin; @@ -14,6 +15,7 @@ use Dcat\Admin\Grid; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Show; use Illuminate\Http\Request; +use Illuminate\Support\Arr; class DealerWalletToBankLogController extends AdminController { @@ -35,19 +37,16 @@ class DealerWalletToBankLogController extends AdminController $grid->column('rate')->append('%'); $grid->column('service_amount')->prepend('¥'); $grid->column('account_amount')->prepend('¥'); - $grid->column('status')->using([ - DealerWalletToBankLogModel::STATUS_PENDING=>'待处理', - DealerWalletToBankLogModel::STATUS_AGREE=>'同意', - DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝', - ])->dot([ - 0=>'primary', - 1=>'success', - 2=>'danger', - ])->filter(Grid\Column\Filter\In::make([ - DealerWalletToBankLogModel::STATUS_PENDING=>'待处理', - DealerWalletToBankLogModel::STATUS_AGREE=>'同意', - DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝', - ])); + $grid->column('status')->display(function ($v) { + $text = $v->text(); + $background = $v->color(); + + return "  {$text}"; + })->filter(Grid\Column\Filter\In::make(Arr::except(DealerWalletToBankLogStatus::texts(), [ + DealerWalletToBankLogStatus::Failed->value, + DealerWalletToBankLogStatus::Passed->value, + DealerWalletToBankLogStatus::Paying->value, + ]))); $grid->column('remarks'); $grid->column('created_at')->sortable(); // $grid->column('updated_at') @@ -62,11 +61,6 @@ class DealerWalletToBankLogController extends AdminController $grid->filter(function (Grid\Filter $filter) { $filter->panel(); - // $filter->equal('status')->select([ - // DealerWalletToBankLogModel::STATUS_PENDING=>'待处理', - // DealerWalletToBankLogModel::STATUS_AGREE=>'已同意', - // DealerWalletToBankLogModel::STATUS_REFUSE=>'已拒绝', - // ])->width(3); $filter->equal('user.phone')->width(3); $filter->between('created_at')->dateTime()->width(7); }); @@ -90,15 +84,12 @@ class DealerWalletToBankLogController extends AdminController $show->field('rate')->append('%'); $show->field('service_amount')->prepend('¥'); $show->field('account_amount')->prepend('¥'); - $show->field('status')->using([ - DealerWalletToBankLogModel::STATUS_PENDING=>'待处理', - DealerWalletToBankLogModel::STATUS_AGREE=>'同意', - DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝', - ])->dot([ - 0=>'primary', - 1=>'success', - 2=>'danger', - ]); + $show->field('status')->as(function ($v) { + $text = $this->status->text(); + $background = $this->status->color(); + + return "  {$text}"; + }); $show->field('pay_image')->image(); $show->field('remarks'); $show->divider('收款信息-银行'); @@ -214,17 +205,13 @@ class DealerWalletToBankLogController extends AdminController break; } } - $statusArr = [ - DealerWalletToBankLogModel::STATUS_PENDING=>'待处理', - DealerWalletToBankLogModel::STATUS_AGREE=>'同意', - DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝', - ]; + foreach ($query->cursor() as $log) { $payInfo = $log->getPayInfo(); $writer->addRow(WriterEntityFactory::createRowFromArray([ $log->user->phone, $log->account_amount, - $statusArr[$log->status], + $log->status->text(), $payInfo ? $payInfo['bank']['user_name'] : '', $payInfo ? $payInfo['bank']['bank_name'] : '', $payInfo ? $payInfo['bank']['bank_number'] : '', diff --git a/app/Admin/Forms/DealerWalletPay.php b/app/Admin/Forms/DealerWalletPay.php index 1435d19c..e3f96381 100644 --- a/app/Admin/Forms/DealerWalletPay.php +++ b/app/Admin/Forms/DealerWalletPay.php @@ -2,6 +2,7 @@ namespace App\Admin\Forms; +use App\Enums\DealerWalletToBankLogStatus; use App\Models\DealerWalletToBankLog; use Carbon\Carbon; use Dcat\Admin\Contracts\LazyRenderable; @@ -40,8 +41,8 @@ class DealerWalletPay extends Form implements LazyRenderable $log = DealerWalletToBankLog::findOrFail($id); $log->update([ 'pay_info' => $log->getPayInfo(), - 'pay_image' => $input['pay_image']??null, - 'status' => DealerWalletToBankLog::STATUS_AGREE, + 'pay_image' => $input['pay_image'] ?? null, + 'status' => DealerWalletToBankLogStatus::Success, ]); DB::commit(); } catch (Throwable $th) { diff --git a/app/Admin/Forms/DealerWalletRefuse.php b/app/Admin/Forms/DealerWalletRefuse.php index d441b990..973d727b 100644 --- a/app/Admin/Forms/DealerWalletRefuse.php +++ b/app/Admin/Forms/DealerWalletRefuse.php @@ -3,6 +3,7 @@ namespace App\Admin\Forms; use App\Enums\DealerWalletAction; +use App\Enums\DealerWalletToBankLogStatus; use App\Models\DealerWalletToBankLog; use App\Services\Dealer\WalletService; use Dcat\Admin\Contracts\LazyRenderable; @@ -40,8 +41,8 @@ class DealerWalletRefuse extends Form implements LazyRenderable DB::beginTransaction(); $log = DealerWalletToBankLog::findOrFail($id); $log->update([ - 'remark' => $input['remark']??'', - 'status' => DealerWalletToBankLog::STATUS_REFUSE, + 'remark' => $input['remark'] ?? '', + 'status' => DealerWalletToBankLogStatus::Refused, ]); //打回余额 $walletService = new WalletService(); diff --git a/app/Enums/DealerWalletToBankLogStatus.php b/app/Enums/DealerWalletToBankLogStatus.php new file mode 100644 index 00000000..ccfc4cb1 --- /dev/null +++ b/app/Enums/DealerWalletToBankLogStatus.php @@ -0,0 +1,50 @@ + '#5b69bc', + static::Passed => '#dda451', + static::Paying => '#3085d6', + static::Success => '#21b978', + static::Failed => '#ea5455', + static::Refused => '#b3b9bf', + }; + } + + /** + * @return string + */ + public function text(): string + { + return static::texts()[$this->value]; + } + + /** + * @return array + */ + public static function texts(): array + { + return [ + static::Pending->value => '待处理', + static::Passed->value => '待付款', + static::Paying->value => '付款中', + static::Success->value => '成功', + static::Failed->value => '失败', + static::Refused->value => '拒绝', + ]; + } +} diff --git a/app/Models/DealerWalletToBankLog.php b/app/Models/DealerWalletToBankLog.php index e440c421..90d3eed6 100644 --- a/app/Models/DealerWalletToBankLog.php +++ b/app/Models/DealerWalletToBankLog.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Enums\DealerWalletToBankLogStatus; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -11,9 +12,9 @@ class DealerWalletToBankLog extends Model use HasFactory; use HasDateTimeFormatter; - public const STATUS_PENDING = 0;//'待处理' - public const STATUS_AGREE = 1;//'已同意' - public const STATUS_REFUSE = 2;//'已拒绝' + protected $casts = [ + 'status' => DealerWalletToBankLogStatus::class, + ]; /** * @var array @@ -49,7 +50,7 @@ class DealerWalletToBankLog extends Model */ public function isPending() { - return $this->status == self::STATUS_PENDING; + return $this->status === DealerWalletToBankLogStatus::Pending; } /** From 704287d550a4ed878201f458d90faa27c8517bf5 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 11:45:42 +0800 Subject: [PATCH 45/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainOrderController.php | 19 +++---------------- app/Admin/Services/OrderService.php | 3 +++ app/Services/BargainService.php | 4 +++- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index 373cb282..e78b311f 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -83,28 +83,15 @@ class BargainOrderController extends AdminController */ protected function detail($id) { - // return Show::make($id, new BargainOrder(), function (Show $show) { - // $show->field('id'); - // $show->field('activity_id'); - // $show->field('user_id'); - // $show->field('sku_id'); - // $show->field('sku_price'); - // $show->field('bargain_price'); - // $show->field('status'); - // $show->field('expire_at'); - // $show->field('order_id'); - // $show->field('remark'); - // $show->field('created_at'); - // $show->field('updated_at'); - // }); - return function (Row $row) use ($id) { $order = BargainOrderModel::with(['activity', 'user', 'userInfo', 'mallOrder', 'sku'])->find($id); $row->column(6, function ($column) use ($order) { $column->row(Show::make($order, function (Show $show) { $show->row(function (Show\Row $show) { $show->field('id')->width(10, 1); - $show->width(6)->field('activity.name'); + $show->width(6)->field('user.phone'); + $show->field('user_info.nickname', '昵称'); + $show->field('activity.name'); $show->field('sku.name'); $show->field('sku_price')->as(function ($v) { return bcdiv($v, 100, 2); diff --git a/app/Admin/Services/OrderService.php b/app/Admin/Services/OrderService.php index 966b2a88..fd2b78b1 100644 --- a/app/Admin/Services/OrderService.php +++ b/app/Admin/Services/OrderService.php @@ -26,6 +26,9 @@ class OrderService if ($res === 0) { throw new BizException('订单已发生改变'); } + + //更新订单商品优惠金额-todo + OrderLog::create([ 'order_id'=>$order->id, 'content'=> '调整订单支付价格为:¥'.bcdiv($reduceAmount, 100, 2), diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php index ec62fc6d..48ad9eea 100644 --- a/app/Services/BargainService.php +++ b/app/Services/BargainService.php @@ -96,7 +96,9 @@ class BargainService $order->logs()->save($log); $order->bargain_price += $log->bargain_amount; - if ($activity->times > 0 && $activity->times <= ($nowBargainCount ++)) { + $nowBargainCount ++; + + if ($activity->times > 0 && $nowBargainCount >= $activity->times) { $order->status = BargainOrder::ORDER_STATUS_FINISHED; } $order->save(); From dcdcfcbf567b511ce3d1979fcffd903753cfbb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 13 Apr 2022 13:54:06 +0800 Subject: [PATCH 46/58] =?UTF-8?q?=E6=89=B9=E9=9B=B6=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E4=BB=A3=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Actions/Show/DealerWalletPay.php | 4 +- app/Admin/Actions/Show/DealerWalletRefuse.php | 4 +- .../DealerWalletToBankLogController.php | 8 +- app/Admin/Forms/DealerWalletPay.php | 31 +++++-- .../Commands/Dealer/WalletToBankCommand.php | 92 +++++++++++++++++++ .../Controllers/YeePayNotifyController.php | 31 ++++++- app/Enums/DealerWalletToBankLogPayWay.php | 38 ++++++++ app/Models/DealerWalletToBankLog.php | 23 ++++- ...ns_to_dealer_wallet_to_bank_logs_table.php | 37 ++++++++ .../lang/zh_CN/dealer-wallet-to-bank-log.php | 2 + 10 files changed, 255 insertions(+), 15 deletions(-) create mode 100644 app/Console/Commands/Dealer/WalletToBankCommand.php create mode 100644 app/Enums/DealerWalletToBankLogPayWay.php create mode 100644 database/migrations/2022_04_13_104039_add_pay_columns_to_dealer_wallet_to_bank_logs_table.php diff --git a/app/Admin/Actions/Show/DealerWalletPay.php b/app/Admin/Actions/Show/DealerWalletPay.php index 32b4f7b6..8ef3873d 100644 --- a/app/Admin/Actions/Show/DealerWalletPay.php +++ b/app/Admin/Actions/Show/DealerWalletPay.php @@ -18,7 +18,7 @@ class DealerWalletPay extends AbstractTool * * @var string */ - protected $style = 'btn-danger'; + protected $style = 'btn-danger mr-1'; public function render() { @@ -27,6 +27,6 @@ class DealerWalletPay extends AbstractTool ->lg() ->title($this->title) ->body($form) - ->button("style}\">{$this->title}  "); + ->button("style}\">{$this->title}"); } } diff --git a/app/Admin/Actions/Show/DealerWalletRefuse.php b/app/Admin/Actions/Show/DealerWalletRefuse.php index 134c99c2..e3a7b6f7 100644 --- a/app/Admin/Actions/Show/DealerWalletRefuse.php +++ b/app/Admin/Actions/Show/DealerWalletRefuse.php @@ -18,7 +18,7 @@ class DealerWalletRefuse extends AbstractTool * * @var string */ - protected $style = 'btn-warning'; + protected $style = 'btn-warning mr-1'; public function render() { @@ -27,6 +27,6 @@ class DealerWalletRefuse extends AbstractTool ->lg() ->title($this->title) ->body($form) - ->button("style}\">{$this->title}  "); + ->button("style}\">{$this->title}"); } } diff --git a/app/Admin/Controllers/DealerWalletToBankLogController.php b/app/Admin/Controllers/DealerWalletToBankLogController.php index 1a145466..9be4f41f 100644 --- a/app/Admin/Controllers/DealerWalletToBankLogController.php +++ b/app/Admin/Controllers/DealerWalletToBankLogController.php @@ -84,7 +84,7 @@ class DealerWalletToBankLogController extends AdminController $show->field('rate')->append('%'); $show->field('service_amount')->prepend('¥'); $show->field('account_amount')->prepend('¥'); - $show->field('status')->as(function ($v) { + $show->field('status')->unescape()->as(function ($v) { $text = $this->status->text(); $background = $this->status->color(); @@ -92,6 +92,9 @@ class DealerWalletToBankLogController extends AdminController }); $show->field('pay_image')->image(); $show->field('remarks'); + if ($show->model()->isFailed()) { + $show->field('failed_reason'); + } $show->divider('收款信息-银行'); $show->field('bank_user_name', '银行-收款人')->as(function () { $payInfo = $this->getPayInfo(); @@ -141,7 +144,8 @@ class DealerWalletToBankLogController extends AdminController ->tools(function (Show\Tools $tools) use ($show) { $tools->disableEdit(); $tools->disableDelete(); - if ($show->model()->isPending() && Admin::user()->can('dcat.admin.dealer_wallet_to_bank_logs.verify')) { + + if (in_array($show->model()->status, [DealerWalletToBankLogStatus::Pending, DealerWalletToBankLogStatus::Failed]) && Admin::user()->can('dcat.admin.dealer_wallet_to_bank_logs.verify')) { $tools->append(new DealerWalletRefuse()); $tools->append(new DealerWalletPay()); } diff --git a/app/Admin/Forms/DealerWalletPay.php b/app/Admin/Forms/DealerWalletPay.php index e3f96381..2cb69eb5 100644 --- a/app/Admin/Forms/DealerWalletPay.php +++ b/app/Admin/Forms/DealerWalletPay.php @@ -2,7 +2,9 @@ namespace App\Admin\Forms; +use App\Enums\DealerWalletToBankLogPayWay; use App\Enums\DealerWalletToBankLogStatus; +use App\Exceptions\BizException; use App\Models\DealerWalletToBankLog; use Carbon\Carbon; use Dcat\Admin\Contracts\LazyRenderable; @@ -38,12 +40,25 @@ class DealerWalletPay extends Form implements LazyRenderable try { DB::beginTransaction(); - $log = DealerWalletToBankLog::findOrFail($id); - $log->update([ - 'pay_info' => $log->getPayInfo(), - 'pay_image' => $input['pay_image'] ?? null, - 'status' => DealerWalletToBankLogStatus::Success, - ]); + + $log = DealerWalletToBankLog::lockForUpdate()->findOrFail($id); + + if (! in_array($log->status, [DealerWalletToBankLogStatus::Pending, DealerWalletToBankLogStatus::Failed])) { + throw new BizException('提现记录状态异常'); + } + + $log->pay_info = $log->user->dealer->pay_info; + $log->pay_image = $input['pay_image'] ?? null; + $log->pay_way = $input['pay_way']; + if ($log->pay_way == DealerWalletToBankLogPayWay::Offline) { + $log->pay_at = now(); + $log->status = DealerWalletToBankLogStatus::Success; + } else { + $log->pay_sn = serial_number(); + $log->status = DealerWalletToBankLogStatus::Passed; + } + $log->save(); + DB::commit(); } catch (Throwable $th) { DB::rollBack(); @@ -61,6 +76,10 @@ class DealerWalletPay extends Form implements LazyRenderable */ public function form() { + $this->hidden('pay_way')->value(DealerWalletToBankLogPayWay::Offline->value); + // $this->select('pay_way') + // ->options(DealerWalletToBankLogPayWay::texts()) + // ->required(); $this->image('pay_image') ->move('dealer-pay/'.Carbon::now()->toDateString()) ->saveFullUrl() diff --git a/app/Console/Commands/Dealer/WalletToBankCommand.php b/app/Console/Commands/Dealer/WalletToBankCommand.php new file mode 100644 index 00000000..4feaeffb --- /dev/null +++ b/app/Console/Commands/Dealer/WalletToBankCommand.php @@ -0,0 +1,92 @@ +chunkById(1, function ($logs) use ($yeePayService) { + foreach ($logs as $log) { + try { + $result = $yeePayService->request('accountpay.behalf.Pay', [ + 'payerOutUserId' => '21102510220227100003' ?: config('services.yeepay.partner_id'), + 'merchOrderNo' => $log->pay_sn, + 'tradeName' => '批零提现', + 'payeeUserName' => data_get($log->pay_info, 'bank.user_name'), + 'bankCardNo' => data_get($log->pay_info, 'bank.bank_number'), + 'bankCode' => Bank::tryFromBankName(data_get($log->pay_info, 'bank.bank_name'))?->name, + 'bankCardType' => 'DEBIT_CARD', + 'amount' => $log->account_amount, + 'feeRole' => 'PAYER', + 'tradeMemo' => '批零提现', + 'context' => json_encode(['type' => 'dealer_wallet_to_bank']), + ]); + + // 如果交易超时,重新发起支付 + if ($result['resultCode'] === 'TIME_OUT') { + continue; + } + + if ($result['orderStatus'] === 'SUCCESS') { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Success, + 'pay_at' => now(), + 'failed_reason' => null, + ]); + } elseif ($result['orderStatus'] === 'FAIL') { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Failed, + 'failed_reason' => '交易失败', + ]); + } else { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Paying, + 'failed_reason' => null, + ]); + } + } catch (YeePayException $e) { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Failed, + 'failed_reason' => $e->getMessage(), + ]); + } catch (Throwable $e) { + throw $e; + } + } + }); + + sleep(60); + } + } +} diff --git a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php index fedc181a..87739334 100644 --- a/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php +++ b/app/Endpoint/Callback/Http/Controllers/YeePayNotifyController.php @@ -2,7 +2,9 @@ namespace App\Endpoint\Callback\Http\Controllers; +use App\Enums\DealerWalletToBankLogStatus; use App\Enums\WalletToBankLogStatus; +use App\Models\DealerWalletToBankLog; use App\Models\WalletToBankLog; use App\Services\YeePayService; use Exception; @@ -45,9 +47,11 @@ class YeePayNotifyController extends Controller $orderNo = $request->input('merchOrderNo'); $orderStatus = $request->input('orderStatus'); - $context = (array) json_decode($request->input('context'), true); - if (Arr::get($context, 'type') === 'wallet_to_bank') { + $context = (array) json_decode($request->input('context'), true); + $contextType = Arr::get($context, 'type'); + + if ($contextType === 'wallet_to_bank') { $log = WalletToBankLog::where('pay_sn', $orderNo)->first(); if ($log === null) { @@ -70,6 +74,29 @@ class YeePayNotifyController extends Controller 'failed_reason' => $request->input('resultMessage').'#'.$resultCode, ]); } + } elseif ($contextType === 'dealer_wallet_to_bank') { + $log = DealerWalletToBankLog::where('pay_sn', $orderNo)->first(); + + if ($log === null) { + return; + } + + if ($log->status !== DealerWalletToBankLogStatus::Paying) { + return; + } + + if ($orderStatus === 'SUCCESS') { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Success, + 'pay_at' => Carbon::parse($request->input('finishTime')), + 'failed_reason' => null, + ]); + } elseif ($orderStatus === 'FAIL') { + $log->update([ + 'status' => DealerWalletToBankLogStatus::Failed, + 'failed_reason' => $request->input('resultMessage').'#'.$resultCode, + ]); + } } } diff --git a/app/Enums/DealerWalletToBankLogPayWay.php b/app/Enums/DealerWalletToBankLogPayWay.php new file mode 100644 index 00000000..4dc66ea3 --- /dev/null +++ b/app/Enums/DealerWalletToBankLogPayWay.php @@ -0,0 +1,38 @@ + '#5b69bc', + static::Behalf => '#21b978', + }; + } + + /** + * @return string + */ + public function text(): string + { + return static::texts()[$this->value]; + } + + /** + * @return array + */ + public static function texts(): array + { + return [ + static::Offline->value => '线下', + static::Behalf->value => '代付', + ]; + } +} diff --git a/app/Models/DealerWalletToBankLog.php b/app/Models/DealerWalletToBankLog.php index 90d3eed6..52132eed 100644 --- a/app/Models/DealerWalletToBankLog.php +++ b/app/Models/DealerWalletToBankLog.php @@ -2,6 +2,8 @@ namespace App\Models; +use App\Casts\JsonArray; +use App\Enums\DealerWalletToBankLogPayWay; use App\Enums\DealerWalletToBankLogStatus; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -12,7 +14,15 @@ class DealerWalletToBankLog extends Model use HasFactory; use HasDateTimeFormatter; + protected $attributes = [ + 'pay_way' => DealerWalletToBankLogPayWay::Offline, + 'status' => DealerWalletToBankLogStatus::Pending, + ]; + protected $casts = [ + 'pay_info' => JsonArray::class, + 'pay_at' => 'datetime', + 'pay_way' => DealerWalletToBankLogPayWay::class, 'status' => DealerWalletToBankLogStatus::class, ]; @@ -27,6 +37,12 @@ class DealerWalletToBankLog extends Model 'rate', 'service_amount', 'account_amount', + 'pay_info', + 'pay_image', + 'pay_sn', + 'pay_way', + 'pay_at', + 'failed_reason', ]; /** @@ -53,6 +69,11 @@ class DealerWalletToBankLog extends Model return $this->status === DealerWalletToBankLogStatus::Pending; } + public function isFailed() + { + return $this->status === DealerWalletToBankLogStatus::Failed; + } + /** * 获取用户的打款信息 * @@ -60,7 +81,7 @@ class DealerWalletToBankLog extends Model */ public function getPayInfo() { - if ($this->isPending()) {//待打款订单显示发货人收款信息 + if ($this->isPending() || $this->isFailed()) {//待打款订单显示发货人收款信息 $payInfo = $this->user->dealer->pay_info; } else { $payInfo = $this->pay_info; diff --git a/database/migrations/2022_04_13_104039_add_pay_columns_to_dealer_wallet_to_bank_logs_table.php b/database/migrations/2022_04_13_104039_add_pay_columns_to_dealer_wallet_to_bank_logs_table.php new file mode 100644 index 00000000..8bc680ae --- /dev/null +++ b/database/migrations/2022_04_13_104039_add_pay_columns_to_dealer_wallet_to_bank_logs_table.php @@ -0,0 +1,37 @@ +string('pay_sn')->nullable()->comment('支付单号'); + $table->tinyInteger('pay_way')->default(1)->comment('支付方式: 1 线下, 2 代付'); + $table->timestamp('pay_at')->nullable()->comment('支付时间'); + $table->text('failed_reason')->nullable()->comment('失败原因'); + + $table->unique('pay_sn'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('dealer_wallet_to_bank_logs', function (Blueprint $table) { + $table->dropColumn(['pay_sn', 'pay_way', 'failed_reason', 'pay_at']); + }); + } +} diff --git a/resources/lang/zh_CN/dealer-wallet-to-bank-log.php b/resources/lang/zh_CN/dealer-wallet-to-bank-log.php index 22108113..2b959ddc 100644 --- a/resources/lang/zh_CN/dealer-wallet-to-bank-log.php +++ b/resources/lang/zh_CN/dealer-wallet-to-bank-log.php @@ -17,6 +17,8 @@ return [ 'account_amount' => '到账金额', 'status' => '状态', 'remarks' => '备注', + 'failed_reason' => '失败原因', + 'pay_way' => '支付方式', ], 'options' => [ ], From 3c8889138db9da333fdbba7e7de9103babe9f430 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 16:03:07 +0800 Subject: [PATCH 47/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/BargainOrderController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index e78b311f..44bc4c6a 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -51,7 +51,7 @@ class BargainOrderController extends AdminController 0 => '未下单', 1 => '已下单', ])); - $grid->column('remark'); + // $grid->column('remark'); $grid->column('created_at'); $grid->column('updated_at')->sortable(); From aef929bfbabf53b9e774312a738d63d7d150aa5c Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 17:04:01 +0800 Subject: [PATCH 48/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/BargainService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php index 48ad9eea..d29d6e82 100644 --- a/app/Services/BargainService.php +++ b/app/Services/BargainService.php @@ -64,7 +64,7 @@ class BargainService //已下单 if ($order->order_id > 0) { - throw new BizException('当前砍价单下单,无法再砍'); + throw new BizException('当前砍价单已下单,无法再砍'); } //砍价超时 From 9020b9501a4e2bd2264fad859e93eec6cda7250b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Thu, 14 Apr 2022 09:39:43 +0800 Subject: [PATCH 49/58] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=81=E5=88=B8BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/SendCoupons.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Listeners/SendCoupons.php b/app/Listeners/SendCoupons.php index efcf22bf..cbedd670 100644 --- a/app/Listeners/SendCoupons.php +++ b/app/Listeners/SendCoupons.php @@ -42,6 +42,9 @@ class SendCoupons $products = $order->products()->where('is_gift', false)->get()->toArray(); $_products = array_column($products, 'total_amount', 'sku_id'); $partSkus = ProductPartSku::with('part')->whereIn('sku_id', array_keys($_products))->get(); + + $inValidParts = []; + foreach ($partSkus as $partSku) { if ($partSku->part?->is_show) { $inValidParts[$partSku->part_id][$partSku->sku_id] = $_products[$partSku->sku_id] ?? 0; @@ -52,6 +55,7 @@ class SendCoupons // } } } + // dd($inValidParts); //根据分区获取活动 $partActivities = ActivityProductPart::with(['activity', 'activity.coupons'])->whereHas('activity', function (Builder $query) { From b67c53c2c29a06f2b61f676bea9ea936d6cf2b76 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 09:43:16 +0800 Subject: [PATCH 50/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8B=E5=8D=95liste?= =?UTF-8?q?ner=E9=80=9A=E8=BF=87=E6=B4=BB=E5=8A=A8=E5=8F=91=E9=80=81?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/SendCoupons.php | 85 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/app/Listeners/SendCoupons.php b/app/Listeners/SendCoupons.php index cbedd670..195c0051 100644 --- a/app/Listeners/SendCoupons.php +++ b/app/Listeners/SendCoupons.php @@ -55,50 +55,51 @@ class SendCoupons // } } } - - // dd($inValidParts); - //根据分区获取活动 - $partActivities = ActivityProductPart::with(['activity', 'activity.coupons'])->whereHas('activity', function (Builder $query) { - return $query->where('is_use', true)->where('started_at', '<', now())->where('ended_at', '>=', now()); - })->whereIn('part_id', array_keys($inValidParts))->get(); - $activityArr = []; - $partActivities->each(function ($item) use (&$activityArr) { - $activityArr[$item->activity_id][] = $item->part_id; - }); - $sendedActivities = []; - foreach ($partActivities as $partActivity) { - //判断该活动是否已处理 - if (in_array($partActivity->activity_id, $sendedActivities)) { - continue; - } - $sendedActivities[] = $partActivity->activity_id; - //获取活动的赠品赠送规则 - $_couponsRule = $partActivity->activity?->coupons_rule; - //判断是否首单:times=0为仅首单赠送, 1为不限 - if ($_couponsRule['times'] == 0 && UserCoupon::where([ - 'activity_id' => $partActivity->activity_id, - 'user_id' => $order->user_id, - ])->exists()) { - continue;//提前结束本次循环 - } - //判断是否满足门槛 - $inValidGoods = []; - foreach ($inValidParts as $key => $part) { - if (in_array($key, $activityArr[$partActivity->activity_id])) { - $inValidGoods = array_merge($inValidGoods, $part); + //存在有效分区时 + if ($inValidParts) { + //根据分区获取活动 + $partActivities = ActivityProductPart::with(['activity', 'activity.coupons'])->whereHas('activity', function (Builder $query) { + return $query->where('is_use', true)->where('started_at', '<', now())->where('ended_at', '>=', now()); + })->whereIn('part_id', array_keys($inValidParts))->get(); + $activityArr = []; + $partActivities->each(function ($item) use (&$activityArr) { + $activityArr[$item->activity_id][] = $item->part_id; + }); + $sendedActivities = []; + foreach ($partActivities as $partActivity) { + //判断该活动是否已处理 + if (in_array($partActivity->activity_id, $sendedActivities)) { + continue; } - } - if (bcmul($_couponsRule['value'], 100) > array_sum($inValidGoods)) { - continue;//提前结束本次循环 - } - //赠券 - (new CouponService())->receiveActivityCoupons($partActivity->activity, $order->user); + $sendedActivities[] = $partActivity->activity_id; + //获取活动的赠品赠送规则 + $_couponsRule = $partActivity->activity?->coupons_rule; + //判断是否首单:times=0为仅首单赠送, 1为不限 + if ($_couponsRule['times'] == 0 && UserCoupon::where([ + 'activity_id' => $partActivity->activity_id, + 'user_id' => $order->user_id, + ])->exists()) { + continue;//提前结束本次循环 + } + //判断是否满足门槛 + $inValidGoods = []; + foreach ($inValidParts as $key => $part) { + if (in_array($key, $activityArr[$partActivity->activity_id])) { + $inValidGoods = array_merge($inValidGoods, $part); + } + } + if (bcmul($_couponsRule['value'], 100) > array_sum($inValidGoods)) { + continue;//提前结束本次循环 + } + //赠券 + (new CouponService())->receiveActivityCoupons($partActivity->activity, $order->user); - //记录订单参与活动信息 - OrderActivity::firstOrCreate([ - 'order_id'=>$order->id, - 'activity_id'=>$partActivity->activity_id, - ]); + //记录订单参与活动信息 + OrderActivity::firstOrCreate([ + 'order_id'=>$order->id, + 'activity_id'=>$partActivity->activity_id, + ]); + } } DB::commit(); From c22f2afafd2c6bcbc01e4345033d005dd3c730cb Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 09:52:32 +0800 Subject: [PATCH 51/58] =?UTF-8?q?=E6=B7=BB=E5=8A=A0bargain=E2=80=94sku?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9Eactivity=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Controllers/BargainController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Endpoint/Api/Http/Controllers/BargainController.php b/app/Endpoint/Api/Http/Controllers/BargainController.php index 75a1f50a..c5bc3184 100644 --- a/app/Endpoint/Api/Http/Controllers/BargainController.php +++ b/app/Endpoint/Api/Http/Controllers/BargainController.php @@ -65,6 +65,7 @@ class BargainController extends Controller 'vip_price' => (string) $bargainSku->sku->vip_price_format, ], 'max_bargain_price'=> array_sum(json_decode($bargainSku->activity->rules)), + 'activity_id' => $bargainSku->activity->id, 'activity_images' => $bargainSku->activity->images, 'activity_share_image'=> $bargainSku->activity->share_image, 'activity_share_title'=> $bargainSku->activity->share_title, From e58bc41af7ebc049c21306854a9118044d12997b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Thu, 14 Apr 2022 11:54:51 +0800 Subject: [PATCH 52/58] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index efc34f46..4b571251 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -817,9 +817,12 @@ class OrderService foreach ($amounts as &$amount) { $i--; + $originalAmount = $amount; + if ($i > 0) { $amount = (int) bcdiv(bcmul($couponAmount, $amount, 0), $totalAmount, 2); $couponAmount -= $amount; + $totalAmount -= $originalAmount; } else { $amount = $couponAmount; } From 7379446690da1af5f0b725ab6ab1789fa43d149e Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 13:28:26 +0800 Subject: [PATCH 53/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=87=8F=E5=85=8D=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Services/OrderService.php | 34 +++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/app/Admin/Services/OrderService.php b/app/Admin/Services/OrderService.php index fd2b78b1..b4bb07b0 100644 --- a/app/Admin/Services/OrderService.php +++ b/app/Admin/Services/OrderService.php @@ -7,6 +7,7 @@ use App\Events\OrderPaid; use App\Exceptions\BizException; use App\Models\Order; use App\Models\OrderLog; +use App\Models\OrderProduct; use App\Services\OrderService as EndpointOrderService; class OrderService @@ -19,15 +20,44 @@ class OrderService public function adminReduceOrder(Order $order, int $reduceAmount) { if ($order->isPending()) { + $needReduceAmount = $order->total_amount - $reduceAmount + $order->reduced_amount; $res = $order->where('updated_at', $order->updated_at)->update([ - 'reduced_amount' => $order->total_amount - $reduceAmount + $order->reduced_amount, + 'reduced_amount' => $needReduceAmount, 'total_amount' => $reduceAmount, ]); if ($res === 0) { throw new BizException('订单已发生改变'); } - //更新订单商品优惠金额-todo + //更新订单商品优惠金额 + //分解到订单中除赠品外的商品 + $orderProducts = $order->products; + $needReduceOrderProducts = []; + foreach ($orderProducts as $orderProduct) { + if (!$orderProduct->isGift()) { + $needReduceOrderProducts[$orderProduct->id] = $orderProduct->total_amount; + } + } + + $i = count($needReduceOrderProducts); + $totalAmount = array_sum($needReduceOrderProducts); + foreach ($needReduceOrderProducts as $key => $reduceOrderProductAmount) { + $i --; + + if ($i > 0) { + $amount = (int) bcdiv(bcmul($needReduceAmount, $reduceOrderProductAmount, 0), $totalAmount, 2); + $needReduceAmount -= $amount; + $totalAmount -= $reduceOrderProductAmount; + } else { + $amount = $needReduceAmount; + } + + //更新订单商品的金额 + OrderProduct::where('id', $key)->update([ + 'reduced_amount' => $amount, + 'total_amount' => $reduceOrderProductAmount - $amount, + ]); + } OrderLog::create([ 'order_id'=>$order->id, From bbabc71f82ec8194b91f3bfe67f6345951f1634c Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 13:30:51 +0800 Subject: [PATCH 54/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E8=AE=A1=E7=AE=97=E4=BC=98=E6=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 4b571251..dccf3c7e 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -863,9 +863,12 @@ class OrderService foreach ($amounts as &$amount) { $i--; + $originalAmount = $amount; + if ($i > 0) { $amount = (int) bcdiv(bcmul($bargainAmount, $amount, 0), $totalAmount, 2); $bargainAmount -= $amount; + $totalAmount -= $originalAmount; } else { $amount = $bargainAmount; } From 25c401672bf1cecc58cc6f5e735f67b93ee35400 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 14:01:52 +0800 Subject: [PATCH 55/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/OrderController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Admin/Controllers/OrderController.php b/app/Admin/Controllers/OrderController.php index fc5ab39b..364fb8b3 100644 --- a/app/Admin/Controllers/OrderController.php +++ b/app/Admin/Controllers/OrderController.php @@ -345,6 +345,9 @@ class OrderController extends AdminController $grid->column('coupon_discount_amount', '优惠券折扣')->display(function ($value) { return bcdiv($value, 100, 2); })->prepend('¥'); + $grid->column('reduced_amount', '减免金额')->display(function ($value) { + return bcdiv($value, 100, 2); + })->prepend('¥'); $grid->column('bargain_amount', '砍价优惠')->display(function ($value) { return bcdiv($value, 100, 2); })->prepend('¥'); From b8a9bab95d0c3d92f4a0f15441344374db595965 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 14 Apr 2022 14:52:18 +0800 Subject: [PATCH 56/58] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=87=8F=E5=85=8D?= =?UTF-8?q?=E4=BC=98=E6=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Services/OrderService.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/Admin/Services/OrderService.php b/app/Admin/Services/OrderService.php index b4bb07b0..54b1e04b 100644 --- a/app/Admin/Services/OrderService.php +++ b/app/Admin/Services/OrderService.php @@ -7,7 +7,6 @@ use App\Events\OrderPaid; use App\Exceptions\BizException; use App\Models\Order; use App\Models\OrderLog; -use App\Models\OrderProduct; use App\Services\OrderService as EndpointOrderService; class OrderService @@ -33,29 +32,32 @@ class OrderService //分解到订单中除赠品外的商品 $orderProducts = $order->products; $needReduceOrderProducts = []; + $totalAmount = 0; foreach ($orderProducts as $orderProduct) { if (!$orderProduct->isGift()) { - $needReduceOrderProducts[$orderProduct->id] = $orderProduct->total_amount; + $needReduceOrderProducts[] = $orderProduct; + $totalAmount += $orderProduct->total_amount; } } $i = count($needReduceOrderProducts); - $totalAmount = array_sum($needReduceOrderProducts); - foreach ($needReduceOrderProducts as $key => $reduceOrderProductAmount) { + foreach ($needReduceOrderProducts as $reduceOrderProduct) { $i --; if ($i > 0) { - $amount = (int) bcdiv(bcmul($needReduceAmount, $reduceOrderProductAmount, 0), $totalAmount, 2); + $amount = (int) bcdiv(bcmul($needReduceAmount, $reduceOrderProduct->total_amount, 0), $totalAmount, 2); $needReduceAmount -= $amount; - $totalAmount -= $reduceOrderProductAmount; + $totalAmount -= $reduceOrderProduct->total_amount; } else { $amount = $needReduceAmount; } + $newTotalAmount = $reduceOrderProduct->total_amount + $reduceOrderProduct->reduced_amount - $amount; + //更新订单商品的金额 - OrderProduct::where('id', $key)->update([ + $reduceOrderProduct->update([ 'reduced_amount' => $amount, - 'total_amount' => $reduceOrderProductAmount - $amount, + 'total_amount'=> $newTotalAmount, ]); } From 17caae43706d5aa5f13aa949f461c709def3ba7e Mon Sep 17 00:00:00 2001 From: Jing Li Date: Sun, 3 Apr 2022 14:42:43 +0800 Subject: [PATCH 57/58] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/User.php b/app/Models/User.php index ee205250..9b92f2eb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Exceptions\BizException; use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Auth\Authenticatable; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; From d59468ee709b84850e53ad36df9dbb910c21d41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 8 Apr 2022 10:41:53 +0800 Subject: [PATCH 58/58] =?UTF-8?q?=E6=92=A4=E9=94=80=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Actions/Show/AfterSaleRevoke.php | 33 ++++++++++ app/Admin/Controllers/AfterSaleController.php | 6 ++ app/Admin/Forms/AfterSaleRevoke.php | 63 +++++++++++++++++++ app/Models/AfterSale.php | 32 +++++----- database/seeders/AdminPermissionSeeder.php | 1 + 5 files changed, 119 insertions(+), 16 deletions(-) create mode 100644 app/Admin/Actions/Show/AfterSaleRevoke.php create mode 100644 app/Admin/Forms/AfterSaleRevoke.php diff --git a/app/Admin/Actions/Show/AfterSaleRevoke.php b/app/Admin/Actions/Show/AfterSaleRevoke.php new file mode 100644 index 00000000..b56ad8c9 --- /dev/null +++ b/app/Admin/Actions/Show/AfterSaleRevoke.php @@ -0,0 +1,33 @@ + 撤销'; + + /** + * 按钮样式定义,默认 btn btn-white waves-effect + * + * @var string + */ + protected $style = 'btn-danger'; + + public function render() + { + $form = AfterSaleRevokeForm::make()->payload(['id'=>$this->getKey()]); + + return Modal::make() + ->lg() + ->title($this->title) + ->body($form) + ->button("style}\">{$this->title}  "); + } +} diff --git a/app/Admin/Controllers/AfterSaleController.php b/app/Admin/Controllers/AfterSaleController.php index c4c66e9c..b8951156 100644 --- a/app/Admin/Controllers/AfterSaleController.php +++ b/app/Admin/Controllers/AfterSaleController.php @@ -5,6 +5,7 @@ namespace App\Admin\Controllers; use App\Admin\Actions\Grid\AfterSaleSetTag; use App\Admin\Actions\Show\AfterSaleFinance; use App\Admin\Actions\Show\AfterSaleFinanceShipping; +use App\Admin\Actions\Show\AfterSaleRevoke; use App\Admin\Actions\Show\AfterSaleShipping; use App\Admin\Actions\Show\AfterSaleShippingFail; use App\Admin\Actions\Show\AfterSaleShippingFill; @@ -221,6 +222,11 @@ class AfterSaleController extends AdminController $tools->append(new AfterSaleFinanceShipping()); } } + + if (! in_array($show->model()->state, [AfterSaleModel::STATE_FINISH, AfterSaleModel::STATE_CANCEL]) && + Admin::user()->can('dcat.admin.after_sales.revoke')) { + $tools->append(new AfterSaleRevoke()); + } }); })); }); diff --git a/app/Admin/Forms/AfterSaleRevoke.php b/app/Admin/Forms/AfterSaleRevoke.php new file mode 100644 index 00000000..4fd6efd1 --- /dev/null +++ b/app/Admin/Forms/AfterSaleRevoke.php @@ -0,0 +1,63 @@ +can('dcat.admin.after_sales.revoke'); + } + + /** + * Handle the form request. + * + * @param array $input + * + * @return mixed + */ + public function handle(array $input) + { + $afterSale = AfterSale::findOrFail($this->payload['id']); + + if ($afterSale->isCancelled()) { + return $this->response()->error('售后单已取消'); + } + + if ($afterSale->isFinished()) { + return $this->response()->error('售后单已完成'); + } + + $afterSale->update([ + 'state' => AfterSale::STATE_CANCEL, + 'remarks' => $input['remarks'] ?? null, + ]); + + return $this->response() + ->success(__('admin.update_succeeded')) + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $this->text('remarks', '备注'); + $this->confirm('是否关闭售后单?', '该操作不可逆,确认后将取消售后单。'); + } +} diff --git a/app/Models/AfterSale.php b/app/Models/AfterSale.php index e3443f14..d21ea16f 100644 --- a/app/Models/AfterSale.php +++ b/app/Models/AfterSale.php @@ -146,7 +146,17 @@ class AfterSale extends Model */ public function isCancelled(): bool { - return $this->status === static::STATE_CANCEL; + return $this->state === static::STATE_CANCEL; + } + + /** + * 确认此售后单是否已完成 + * + * @return bool + */ + public function isFinished(): bool + { + return $this->state === static::STATE_FINISH; } /** @@ -180,20 +190,6 @@ class AfterSale extends Model ]); } - /** - * 取消售后订单日志 - * - * @return void - */ - protected function createCancelLog() - { - $this->logs()->create([ - 'after_sale_id' => $this->id, - 'name' => '取消申请', - 'desc' => '用户取消售后申请', - ]); - } - /** * 完成售后订单日志 * @@ -222,7 +218,11 @@ class AfterSale extends Model parent::saved(function ($afterSale) { //如果取消订单 if ($afterSale->state == self::STATE_CANCEL) { - $afterSale->createCancelLog(); + $afterSale->logs()->create([ + 'after_sale_id' => $afterSale->id, + 'name' => '取消申请', + 'desc' => $afterSale->remarks, + ]); $afterSale->orderProduct->update([ 'after_sale_state'=>0, ]); diff --git a/database/seeders/AdminPermissionSeeder.php b/database/seeders/AdminPermissionSeeder.php index e81859e4..572fa0f5 100644 --- a/database/seeders/AdminPermissionSeeder.php +++ b/database/seeders/AdminPermissionSeeder.php @@ -255,6 +255,7 @@ class AdminPermissionSeeder extends Seeder 'shipping'=>['name' =>'确认收货'], 'finances'=>['name' =>'售后打款'], 'finance'=>['name' =>'确认打款'], + 'revoke'=>['name' =>'撤销'], 'tags'=>['name' =>'标签设置'], ], ],