调整渠道数据统计
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Merchant\Controllers\Controller;
|
||||
use App\Merchant\Exporters\CensusExport;
|
||||
use App\Models\ActivityRule;
|
||||
use App\Models\Coupon;
|
||||
use App\Models\UserCode;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -21,19 +22,16 @@ class IndexController extends Controller
|
||||
|
||||
$coupons = Coupon::where('user_id', $user->id)
|
||||
->whereYear('created_at', $month[0])
|
||||
->whereMonth('created_at', $month[1])
|
||||
// ->whereMonth('created_at', $month[1])
|
||||
->where('status', 2)
|
||||
->get(['id', 'thirdPartyGoodsId', 'created_at']);
|
||||
|
||||
$rules = ActivityRule::get();
|
||||
$rules = $user->code;
|
||||
|
||||
$coupons = $coupons->groupBy('create_day')->map(function ($items, $key) use ($rules) {
|
||||
$coupons = $coupons->groupBy('create_day')
|
||||
->map(function ($items, $key) use ($rules) {
|
||||
$data = [
|
||||
'day' => $key,
|
||||
// 'ysd10' => $items->where('thirdPartyGoodsId', 'YSD-full100-10')->count(),
|
||||
// 'ysd25' => $items->where('thirdPartyGoodsId', 'YSD-full100-25')->count(),
|
||||
// 'ysd50' => $items->where('thirdPartyGoodsId', 'YSD-full100-50')->count(),
|
||||
// 'ysd100' => $items->where('thirdPartyGoodsId', 'YSD-full200-100')->count(),
|
||||
];
|
||||
foreach ($rules as $rule) {
|
||||
$data[$rule->code] = $items->where('thirdPartyGoodsId', $rule->code)->count();
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
@endsection
|
||||
|
||||
@push('script')
|
||||
<script type="text/javascript" src="{{ asset('assets/merchant/js/plugins/datapicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script type="text/javascript"
|
||||
src="{{ asset('assets/merchant/js/plugins/datapicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$("#time-interval .input-daterange").datepicker({
|
||||
autoclose: true, //自动关闭
|
||||
@@ -36,18 +37,22 @@
|
||||
<div class="ibox">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 m-b">
|
||||
<form action="{{ route('merchant.census')}}" class="form-inline pull-right" method="get" accept-charset="utf-8">
|
||||
<form action="{{ route('merchant.census')}}" class="form-inline pull-right" method="get"
|
||||
accept-charset="utf-8">
|
||||
<div class="form-group" id="time-interval">
|
||||
<div class="input-daterange input-group">
|
||||
<input type="text" class="input-sm form-control" placeholder="核销月份" readonly name="month" value="{{ Request::input('month')??now()->format('Y-m') }}"/>
|
||||
<input type="text" class="input-sm form-control" placeholder="核销月份" readonly name="month"
|
||||
value="{{ Request::input('month')??now()->format('Y-m') }}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<input type="hidden" name="action" value="search">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-action="search"><i class="fa fa-check"></i> 刷新</button>
|
||||
<button type="button" class="btn btn-sm btn-warning confirm" tip='确认要导出当前条件内容?' data-action="excel"><i class="fa fa-paste"></i> 导出</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" data-action="search"><i
|
||||
class="fa fa-check"></i> 刷新</button>
|
||||
<button type="button" class="btn btn-sm btn-warning confirm" tip='确认要导出当前条件内容?'
|
||||
data-action="excel"><i class="fa fa-paste"></i> 导出</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
@@ -60,7 +65,7 @@
|
||||
<tr>
|
||||
<th>日期</th>
|
||||
@foreach ($rules as $rule)
|
||||
<th>{{ $rule->title }}</th>
|
||||
<th>{{ $rule->rule->title }}</th>
|
||||
@endforeach
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@@ -10,4 +10,9 @@ class UserCode extends Model
|
||||
'profit' => 'array',
|
||||
];
|
||||
|
||||
public function rule()
|
||||
{
|
||||
return $this->hasOne(ActivityRule::class, 'code', 'code');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user