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' => [