Browse Source

店铺新用户统计-数据源修改,添加路由,

master
liangyuyan 5 years ago
parent
commit
7d96b5f177
  1. 1
      app/Admin/Controllers/StoreUserReportController.php
  2. 33
      app/Admin/Repositories/StoreUserReport.php
  3. 5
      app/Admin/routes.php
  4. 2
      app/Models/CouponSetting.php
  5. 79
      composer.lock
  6. 3
      resources/lang/zh-CN/coupon-setting.php
  7. 1
      resources/lang/zh-CN/store-user-report.php

1
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');

33
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
);
}
}

5
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');
});

2
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';

79
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"
}

3
resources/lang/zh-CN/coupon-setting.php

@ -1,7 +1,8 @@
<?php
return [
'labels' => [
'CouponSetting' => 'CouponSetting',
'CouponSetting' => '领取方式',
'couponSetting' => '领取方式',
],
'fields' => [
'name' => '名称',

1
resources/lang/zh-CN/store-user-report.php

@ -6,6 +6,7 @@ return [
'fields' => [
'market_id' => '所属市场',
'name' => '商家名称',
'new_user_total' => '新增用户总数',
'mm_user_id' => '所属市场经理',
],
'options' => [

Loading…
Cancel
Save