From 7d96b5f17744f09a55c9f93c1ded280baa4c6e01 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Tue, 18 Aug 2020 10:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1-=E6=95=B0=E6=8D=AE=E6=BA=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=B7=AF=E7=94=B1=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StoreUserReportController.php | 1 + app/Admin/Repositories/StoreUserReport.php | 33 ++++++++ app/Admin/routes.php | 5 +- app/Models/CouponSetting.php | 2 +- composer.lock | 79 ++++++++++++++++++- resources/lang/zh-CN/coupon-setting.php | 3 +- resources/lang/zh-CN/store-user-report.php | 1 + 7 files changed, 119 insertions(+), 5 deletions(-) diff --git a/app/Admin/Controllers/StoreUserReportController.php b/app/Admin/Controllers/StoreUserReportController.php index 0ab474c..1b7ef23 100644 --- a/app/Admin/Controllers/StoreUserReportController.php +++ b/app/Admin/Controllers/StoreUserReportController.php @@ -22,6 +22,7 @@ class StoreUserReportController extends AdminController $grid->market_id; $grid->name; $grid->mm_user_id; + $grid->new_user_total; $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); diff --git a/app/Admin/Repositories/StoreUserReport.php b/app/Admin/Repositories/StoreUserReport.php index ca24eca..a5ca2fb 100644 --- a/app/Admin/Repositories/StoreUserReport.php +++ b/app/Admin/Repositories/StoreUserReport.php @@ -3,7 +3,9 @@ namespace App\Admin\Repositories; use App\Models\storeUserReport as Model; +use Dcat\Admin\Grid\Model as GridModel; use Dcat\Admin\Repositories\EloquentRepository; +use Illuminate\Support\Facades\DB; class StoreUserReport extends EloquentRepository { @@ -13,4 +15,35 @@ class StoreUserReport extends EloquentRepository * @var string */ protected $eloquentClass = Model::class; + + /** + * 获取统计列表数据 + */ + public function get(GridModel $model) + { + $where = ['2020-06-01','2020-07-01']; + + $list = DB::select(" SELECT + store.id + ,store.market_id + ,store.`name` + ,store.mm_user_id + ,count(distinct orders.user_id) new_user_total + FROM + ims_cjdc_order orders + INNER JOIN ims_cjdc_store store ON orders.store_id = store.id + INNER JOIN ims_cjdc_user users ON orders.user_id = users.id + WHERE + users.join_time BETWEEN UNIX_TIMESTAMP(?) AND UNIX_TIMESTAMP(?) + AND UNIX_TIMESTAMP(orders.pay_time) BETWEEN UNIX_TIMESTAMP(?) AND UNIX_TIMESTAMP(?) + GROUP BY store.id + ORDER BY store.id ASC ", + array_merge($where,$where) + ); + $total = count($list); + return $model->makePaginator( + $total, + $list + ); + } } diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 5cf2b29..dfdb92b 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -28,13 +28,14 @@ Route::group([ $router->any('/api/getMpInfo', 'ImsCjdcMarketController@getMpInfo'); $router->get('/coupon/TieForm', 'CouponTieController@CouponTieForm'); - $router->get('/couponTie', 'CouponTieController@CouponTieList'); + $router->resource('/couponSetting', 'couponSettingController'); //获取所有市场 $router->any('/api/getAllMarket', 'LanzuServiceSpeakerController@getAllMarkets'); //根据市场id,商户名查询商户 $router->any('/api/stores', 'LanzuServiceSpeakerController@getStores'); - + //统计店铺新增用户 + $router->resource('/storeUserReport', 'StoreUserReportController'); }); diff --git a/app/Models/CouponSetting.php b/app/Models/CouponSetting.php index 5e2cdcc..cf3889c 100644 --- a/app/Models/CouponSetting.php +++ b/app/Models/CouponSetting.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; class CouponSetting extends Model { use HasDateTimeFormatter; - use SoftDeletes; + // use SoftDeletes; protected $table = 'ims_system_coupon_setting'; diff --git a/composer.lock b/composer.lock index b7905c0..d8f4dbc 100644 --- a/composer.lock +++ b/composer.lock @@ -2131,6 +2131,12 @@ "wechat", "weibo" ], + "funding": [ + { + "url": "https://www.patreon.com/overtrue", + "type": "patreon" + } + ], "time": "2020-03-04T15:22:25+00:00" }, { @@ -2204,6 +2210,20 @@ "weixin", "weixin-sdk" ], + "funding": [ + { + "url": "https://www.easywechat.com/img/pay/wechat.jpg", + "type": "custom" + }, + { + "url": "https://github.com/overtrue", + "type": "github" + }, + { + "url": "https://www.patreon.com/overtrue", + "type": "patreon" + } + ], "time": "2020-07-29T07:36:50+00:00" }, { @@ -3183,6 +3203,20 @@ "caching", "psr6" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-23T17:22:30+00:00" }, { @@ -3251,6 +3285,20 @@ "interoperability", "standards" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-06T13:23:11+00:00" }, { @@ -4850,6 +4898,20 @@ "psr-17", "psr-7" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-06-25T08:21:47+00:00" }, { @@ -5379,6 +5441,20 @@ "instantiate", "serialize" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-06-07T15:42:22+00:00" }, { @@ -7789,5 +7865,6 @@ "platform": { "php": "^7.2.5" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/resources/lang/zh-CN/coupon-setting.php b/resources/lang/zh-CN/coupon-setting.php index 77709ab..d9068fb 100644 --- a/resources/lang/zh-CN/coupon-setting.php +++ b/resources/lang/zh-CN/coupon-setting.php @@ -1,7 +1,8 @@ [ - 'CouponSetting' => 'CouponSetting', + 'CouponSetting' => '领取方式', + 'couponSetting' => '领取方式', ], 'fields' => [ 'name' => '名称', diff --git a/resources/lang/zh-CN/store-user-report.php b/resources/lang/zh-CN/store-user-report.php index 87dd9a1..8fcde6d 100644 --- a/resources/lang/zh-CN/store-user-report.php +++ b/resources/lang/zh-CN/store-user-report.php @@ -6,6 +6,7 @@ return [ 'fields' => [ 'market_id' => '所属市场', 'name' => '商家名称', + 'new_user_total' => '新增用户总数', 'mm_user_id' => '所属市场经理', ], 'options' => [