правка для статистик по ajax-запросу

parent e4013d8d
...@@ -673,7 +673,7 @@ $(document).ready(function () { ...@@ -673,7 +673,7 @@ $(document).ready(function () {
success: function(res) { success: function(res) {
EnableLoadingState($groupWrap, false); EnableLoadingState($groupWrap, false);
if (res) { if (res) {
if (res.data == null || res.data.stat == null) { if (res.data == null || (res.type == 'stat-common' && res.data.stat == null)) {
if (type == 'stat-common') ShowCommonStatInfo(); if (type == 'stat-common') ShowCommonStatInfo();
if (type == 'stat-sites') ShowSitesStatInfo(); if (type == 'stat-sites') ShowSitesStatInfo();
if (type == 'stat-regions') ShowRegionsStatInfo(); if (type == 'stat-regions') ShowRegionsStatInfo();
......
...@@ -280,12 +280,19 @@ class CabinetAmSystem extends Common ...@@ -280,12 +280,19 @@ class CabinetAmSystem extends Common
$campaign_id = $request->getAttribute('id'); $campaign_id = $request->getAttribute('id');
/** @var \App\Model\AmSystem\Groups $groupsModel */
$groupsModel = $this->container->get(\App\Model\AmSystem\Groups::class);
/** @var \App\Model\AmSystem\Campaigns $campaignsModel */ /** @var \App\Model\AmSystem\Campaigns $campaignsModel */
$campaignsModel = $this->container->get(\App\Model\AmSystem\Campaigns::class); $campaignsModel = $this->container->get(\App\Model\AmSystem\Campaigns::class);
$campaign = $campaignsModel->findById($campaign_id); $campaign = $campaignsModel->findById($campaign_id);
if ($campaign) { if ($campaign) {
if ($campaign->getUserId() == $userId){
$group_id = $campaign->getGroupId();
$group = $groupsModel->findOne(['id' => $group_id]);
if ($group->getUserId() == $userId) {
/** @var \App\Model\Statistics $stats */ /** @var \App\Model\Statistics $stats */
$stats = $this->container->get(\App\Model\Statistics::class); $stats = $this->container->get(\App\Model\Statistics::class);
......
...@@ -528,8 +528,6 @@ if (!$error) { ...@@ -528,8 +528,6 @@ if (!$error) {
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment