From 25b12506d66336ca85ac27ed0800485503e1622c Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 28 Feb 2022 10:55:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/UserController.php | 1 - .../Renderable/DealerSubordinateCard.php | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 app/Admin/Renderable/DealerSubordinateCard.php diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php index 888db266..bcd96658 100644 --- a/app/Admin/Controllers/UserController.php +++ b/app/Admin/Controllers/UserController.php @@ -71,7 +71,6 @@ class UserController extends AdminController $modal->title('消费值'); return UserSalesValueLogSimpleTable::make(['id'=>$this->id]); })->setHeaderAttributes(['style' => 'color:#5b69bc']); - ; $grid->column('userInfo.group_sales_value')->filter( Grid\Column\Filter\Between::make() ); diff --git a/app/Admin/Renderable/DealerSubordinateCard.php b/app/Admin/Renderable/DealerSubordinateCard.php new file mode 100644 index 00000000..6f35767f --- /dev/null +++ b/app/Admin/Renderable/DealerSubordinateCard.php @@ -0,0 +1,59 @@ +id; + // dd($id); + $query = DB::table('users') + ->join('user_infos', 'users.id', '=', 'user_infos.user_id') + ->join('dealers', 'users.id', '=', 'dealers.user_id'); + $userInfo = UserInfo::where('user_id', $id)->first(); + // 查询数据逻辑 + $data = [ + 'top'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 6)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(), + 'secondary'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 5)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(), + 'contracted'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 4)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(), + 'special'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 3)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(), + 'gold'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 2)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(), + ]; + + // 这里可以返回内置组件,也可以返回视图文件或HTML字符串 + return + << + +
+

{$data['top']}

+ 一级经销商 +
+
+

{$data['secondary']}

+ 二级经销商 +
+
+

{$data['contracted']}

+ 签约经销商 +
+ +
+
+

{$data['special']}

+ 特邀经销商 +
+
+

{$data['gold']}

+ 金牌经销商 +
+
+HTML; + } +}