|
|
@@ -57,14 +57,26 @@ class Stat extends BaseShop
|
|
|
$start_time = input('end_time');
|
|
|
$end_time = input('start_time');
|
|
|
}
|
|
|
- $user_info = $this->user_info;
|
|
|
- $user_id = $user_info['uid'];
|
|
|
- $uwhere['uid'] = $user_id;
|
|
|
- $UgObj = new UserGroup();
|
|
|
|
|
|
- $user_store_list =$UgObj->getUserList($uwhere,'uid,store_id');
|
|
|
+ $store_id_arr = [];
|
|
|
+ $userGroupModel = new UserGroup();
|
|
|
+ $userInfo = $this->user_info;
|
|
|
|
|
|
- $store_id_arr = array_column($user_store_list['data'],'store_id');
|
|
|
+
|
|
|
+ if(!$userInfo['is_admin']){
|
|
|
+ $userGroupWhere['uid'] = $userInfo['uid'];
|
|
|
+ $userGroupList = $userGroupModel->getUserList($userGroupWhere,'uid,store_id');
|
|
|
+ $store_id_arr = array_column($userGroupList['data'],'store_id');
|
|
|
+ }
|
|
|
+
|
|
|
+// $user_info = $this->user_info;
|
|
|
+// $user_id = $user_info['uid'];
|
|
|
+// $uwhere['uid'] = $user_id;
|
|
|
+// $UgObj = new UserGroup();
|
|
|
+//
|
|
|
+// $user_store_list =$UgObj->getUserList($uwhere,'uid,store_id');
|
|
|
+//
|
|
|
+// $store_id_arr = array_column($user_store_list['data'],'store_id');
|
|
|
$stat_model = new StatModel();
|
|
|
|
|
|
$data = $stat_model->getShopStatSum($this->site_id, $start_time, $end_time, $store_id,$store_id_arr);
|
|
|
@@ -86,7 +98,17 @@ class Stat extends BaseShop
|
|
|
$start_time = input('end_time');
|
|
|
$end_time = input('start_time');
|
|
|
}
|
|
|
-
|
|
|
+ if($store_id==0){
|
|
|
+ $store_id_arr = [];
|
|
|
+ $userGroupModel = new UserGroup();
|
|
|
+ $userInfo = $this->user_info;
|
|
|
+ $userGroupWhere['uid'] = $userInfo['uid'];
|
|
|
+ $userGroupList = $userGroupModel->getUserList($userGroupWhere,'uid,store_id');
|
|
|
+ $store_id_arr = array_column($userGroupList['data'],'store_id');
|
|
|
+ if(!empty($store_id_arr) && !$userInfo['is_admin']){
|
|
|
+ $store_id = $store_id_arr;
|
|
|
+ }
|
|
|
+ }
|
|
|
$stat_model = new StatModel();
|
|
|
$fields = $stat_model->getStatField();
|
|
|
$fields[] = 'expected_earnings_total_money';
|
|
|
@@ -129,6 +151,19 @@ class Stat extends BaseShop
|
|
|
$fields = $stat_model->getStatHourField();
|
|
|
$fields[] = 'expected_earnings_total_money';
|
|
|
|
|
|
+ if($store_id==0){
|
|
|
+ $store_id_arr = [];
|
|
|
+ $userGroupModel = new UserGroup();
|
|
|
+ $userInfo = $this->user_info;
|
|
|
+ $userGroupWhere['uid'] = $userInfo['uid'];
|
|
|
+ $userGroupList = $userGroupModel->getUserList($userGroupWhere,'uid,store_id');
|
|
|
+ $store_id_arr = array_column($userGroupList['data'],'store_id');
|
|
|
+ if(!empty($store_id_arr) && !$userInfo['is_admin']){
|
|
|
+ $store_id = $store_id_arr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$stat_list = $stat_model->getShopStatHourList($this->site_id, $carbon->year, $carbon->month, $carbon->day, $store_id)[ 'data' ];
|
|
|
|
|
|
$data = [];
|