|
|
|
@ -216,15 +216,24 @@ class ServerOrder extends Order |
|
|
|
|
$dataTypeFilter = $this->getFilterDataType($dataType); |
|
|
|
|
// 当前用户ID |
|
|
|
|
$userId = UserService::getCurrentLoginUserId(); |
|
|
|
|
// 查询数据 |
|
|
|
|
$query = $this; |
|
|
|
|
// 非店长不带入user_id查询 |
|
|
|
|
if (!UserService::isStore()) { |
|
|
|
|
$query = $query->where('user_id', '=', $userId); |
|
|
|
|
} |
|
|
|
|
return $query->where($dataTypeFilter) |
|
|
|
|
//判断当前用户身份 |
|
|
|
|
if (UserService::isDealerEngineer()) { |
|
|
|
|
//分销商工程师 |
|
|
|
|
return $this->where($dataTypeFilter) |
|
|
|
|
->where('dealer_id', '=', $userId) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->count(); |
|
|
|
|
} elseif (UserService::isStore()) { |
|
|
|
|
// 店主 |
|
|
|
|
return $this->where($dataTypeFilter) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->count(); |
|
|
|
|
} else { |
|
|
|
|
return $this->where($dataTypeFilter) |
|
|
|
|
->where('user_id', '=', $userId) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->count(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|