sylive_10111

This commit is contained in:
dengbw
2022-10-11 15:39:42 +08:00
committed by lccsw
parent cb768ff8c2
commit 2738f8b174
2 changed files with 35 additions and 12 deletions
+16 -12
View File
@@ -504,19 +504,23 @@ class Activity extends BaseController
}
$watch_per = number_format_com($watch / $browse * 100, 1, '');
$order_per = number_format_com($order / $browse * 100, 1, '');
if ($order > $subscribe) {
$expected_data = [['name' => "浏览人数(100%)", 'value' => 100], ['name' => "观看人数({$watch_per}%)", 'value' => 66.7], ['name' => "订单数({$order_per}%)", 'value' => 33.3]];
$actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order]];
} else {
$subscribe_per = number_format_com($subscribe / $browse * 100, 1, '');
$expected_data = [['name' => "浏览人数100%", 'value' => 100], ['name' => "预约人数({$subscribe_per}%)", 'value' => $subscribe > $watch ? 75 : 50]
, ['name' => "观看人数({$watch_per}%)", 'value' => $watch > $subscribe ? 75 : 50], ['name' => "订单数({$order_per}%)", 'value' => 25]];
$actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe]
, ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order]];
}
$funnel = ['title' => '活动漏斗', 'expected_data' => $expected_data, 'actual_data' => $actual_data];
$browse_expected_data = [['name' => "浏览人数(100%)", 'value' => 100], ['name' => "观看人数({$watch_per}%)", 'value' => 66.7], ['name' => "订单数({$order_per}%)", 'value' => 33.3]];
$browse_actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order]];
$funnel_browse = ['title' => '浏览转化漏斗', 'expected_data' => $browse_expected_data, 'actual_data' => $browse_actual_data];
$id_in = "id in(select id from lc_market_sylive_activity_kpidata where a_id = {$activityId} AND kpi = 'subscribe')";
$watch_subscribe = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'kpi' => 'watch', $id_in => null]);
$order_subscribe = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'kpi' => 'order', $id_in => null]);
$subscribe_per = number_format_com($subscribe / $browse * 100, 1, '');
$watch_subscribe_per = number_format_com($watch_subscribe / $browse * 100, 1, '');
$order_subscribe_per = number_format_com($order_subscribe / $browse * 100, 1, '');
$subscribe_expected_data = [['name' => "浏览人数100%", 'value' => 100], ['name' => "预约人数({$subscribe_per}%)", 'value' => 75]
, ['name' => "观看人数({$watch_subscribe_per}%)", 'value' => 50], ['name' => "订单数({$order_subscribe_per}%)", 'value' => 25]];
$subscribe_actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe]
, ['name' => '观看人数', 'value' => $watch_subscribe], ['name' => '订单数', 'value' => $order_subscribe]];
$funnel_subscribe = ['title' => '预约转化漏斗', 'expected_data' => $subscribe_expected_data, 'actual_data' => $subscribe_actual_data];
$data = ['activityId' => $activityId, 'title' => $title, 'activityData1' => $activityData1, 'activityData2' => $activityData2, 'areaData' => $areaData
, 'bizData' => $bizData, 'consultantData' => $consultantData, 'funnel' => $funnel];
, 'bizData' => $bizData, 'consultantData' => $consultantData, 'funnelBrowse' => $funnel_browse, 'funnelSubscribe' => $funnel_subscribe];
$this->return_response($data);
}
@@ -32,6 +32,13 @@ class Organization extends BaseController
$res[$k]['organizationId'] = intval($v['organizationId']);
$res[$k]['parentId'] = intval($v['parentId']);
$res[$k]['sortNumber'] = intval($v['sortNumber']);
$city = [];
if ($v['countyId']) {
$city[] = $v['provinceId'];
$city[] = $v['cityId'];
$city[] = $v['countyId'];
}
$res[$k]['city'] = $city;
}
$this->return_response_list($res);
}
@@ -49,6 +56,7 @@ class Organization extends BaseController
$organizationType = $this->input_param('organizationType');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
if (!$organizationName) {
$this->return_json('请输入机构名称');
}
@@ -59,6 +67,11 @@ class Organization extends BaseController
$addDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments
, 'createTime' => date('Y-m-d H:i:s')];
if ($city) {
$addDate['provinceId'] = intval($city[0]);
$addDate['cityId'] = intval($city[1]);
$addDate['countyId'] = intval($city[2]);
}
$id = $this->mdSyliveOrganization->add($addDate);
if (!$id) {
$this->return_json('添加机构失败');
@@ -80,6 +93,7 @@ class Organization extends BaseController
$organizationType = $this->input_param('organizationType');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
!$comments && $comments = '';
if (!$organizationId) {
$this->return_json('参数错误');
@@ -93,6 +107,11 @@ class Organization extends BaseController
!$comments && $comments = '';
$upDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments];
if ($city) {
$upDate['provinceId'] = intval($city[0]);
$upDate['cityId'] = intval($city[1]);
$upDate['countyId'] = intval($city[2]);
}
$this->mdSyliveOrganization->update($upDate, ['organizationId' => $organizationId]);
$this->return_response();
}