update 数据之眼-首页-用户总量统计兼容区县/镇街查询
This commit is contained in:
parent
b3f263c57a
commit
58ddee111a
@ -67,21 +67,26 @@ class User extends BaseController
|
|||||||
$endCurrDay1 = $startCurrDay1+ 86399;
|
$endCurrDay1 = $startCurrDay1+ 86399;
|
||||||
$userCountlist[] = $this->getTimeRangeUserCount([$startCurrDay1, $endCurrDay1]);
|
$userCountlist[] = $this->getTimeRangeUserCount([$startCurrDay1, $endCurrDay1]);
|
||||||
|
|
||||||
|
|
||||||
// 地方店铺数量统计
|
// 地方店铺数量统计
|
||||||
|
|
||||||
// 该地区下所有乡镇
|
|
||||||
$geoStreetList = Db::name('geo_street')->where('area_code',$this->areaCode)->select()->toArray();
|
|
||||||
|
|
||||||
// 遍历统计每个乡镇的店铺数
|
// 遍历统计每个乡镇的店铺数
|
||||||
$merchantTotalCount = 0;
|
$merchantTotalCount = 0;
|
||||||
foreach ($geoStreetList as $street) {
|
|
||||||
$temp['street_name'] = $street['street_name'];
|
// 查镇的用户统计不需要查店铺数
|
||||||
$temp['merchant_count'] = Db::name('merchant')->where('street_id', $street['street_code'])->count();
|
if ($this->streetCode != '') {
|
||||||
$merchantTotalCount += $temp['merchant_count'];
|
|
||||||
$merchatCountList[] = $temp;
|
// 该地区下所有乡镇
|
||||||
unset($temp);
|
$geoStreetList = Db::name('geo_street')->where('area_code',$this->areaCode)->select()->toArray();
|
||||||
|
|
||||||
|
foreach ($geoStreetList as $street) {
|
||||||
|
$temp['street_name'] = $street['street_name'];
|
||||||
|
$temp['merchant_count'] = Db::name('merchant')->where('street_id', $street['street_code'])->count();
|
||||||
|
$merchantTotalCount += $temp['merchant_count'];
|
||||||
|
$merchatCountList[] = $temp;
|
||||||
|
unset($temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return app('json')->success(compact('merchantTotalCount' ,'userCountlist', 'merchatCountList'));
|
return app('json')->success(compact('merchantTotalCount' ,'userCountlist', 'merchatCountList'));
|
||||||
}
|
}
|
||||||
public function getTimeRangeUserCount($timeRange=[])
|
public function getTimeRangeUserCount($timeRange=[])
|
||||||
@ -96,7 +101,7 @@ class User extends BaseController
|
|||||||
$query->where('ua.district', $this->areaCode);
|
$query->where('ua.district', $this->areaCode);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->whereTime('u.create_time', 'between', $timeRange)->fetchSql()
|
->whereTime('u.create_time', 'between', $timeRange)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
// 访问
|
// 访问
|
||||||
@ -109,7 +114,7 @@ class User extends BaseController
|
|||||||
$query->where('ua.district', $this->areaCode);
|
$query->where('ua.district', $this->areaCode);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->whereTime('u.last_time', 'between', $timeRange)->fetchSql()
|
->whereTime('u.last_time', 'between', $timeRange)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
// 累计
|
// 累计
|
||||||
@ -122,7 +127,7 @@ class User extends BaseController
|
|||||||
$query->where('ua.district', $this->areaCode);
|
$query->where('ua.district', $this->areaCode);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->whereTime('u.create_time', '<', $timeRange[1])->fetchSql()
|
->whereTime('u.create_time', '<', $timeRange[1])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
return compact('newUserCount', 'viewUserCount', 'totalUserCount');
|
return compact('newUserCount', 'viewUserCount', 'totalUserCount');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user