diff --git a/admin/controllers/app/licheb/Sytlive.php b/admin/controllers/app/licheb/Sytlive.php index 733dc394..ef2c9e63 100644 --- a/admin/controllers/app/licheb/Sytlive.php +++ b/admin/controllers/app/licheb/Sytlive.php @@ -57,9 +57,7 @@ class Sytlive extends HD_Controller { $params = $this->input->get(); $id = intval($params['id']); - $status_list = $kpi_list = array(); - $posters = array('imgs_url' => array(), 'imgs' => array()); - $share_title = $remark = $rule = $bg_color = $btn_color = ''; + $title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = ''; if ($id > 0) { $re = $this->mdSytLive->get(array('id' => $id)); if (!$re || empty($re)) { @@ -68,53 +66,45 @@ class Sytlive extends HD_Controller $_title = '编辑私域通-直播'; $dataInfo['editType'] = 0; $dataInfo['edit_url'] = '/app/licheb/sytlive/edit'; - $dataInfo['brand_id'] = $re['brand_id'] ? explode(',', $re['brand_id']) : []; $dataInfo['status'] = $re['status']; - $dataInfo['z_id'] = $re['z_id']; + $re['title'] && $title = $re['title']; + $re['session_id'] && $session_id = $re['session_id']; + if ($re['img']) { + $img = $re['img']; + $img_url = build_qiniu_image_url($re['img']); + } + $re['s_time'] && $time = $re['s_time'] . " ~ " . $re['e_time']; if ($re['jsondata']) { $jsondata = json_decode($re['jsondata'], true); - $share_title = $jsondata['share_title'] ? $jsondata['share_title'] : ''; - $remark = $jsondata['remark'] ? $jsondata['remark'] : ''; - $rule = $jsondata['rule'] ? $jsondata['rule'] : ''; - $bg_color = $jsondata['bg_color'] ? $jsondata['bg_color'] : ''; - $btn_color = $jsondata['btn_color'] ? $jsondata['btn_color'] : ''; - if ($jsondata['posters']) { - foreach ($jsondata['posters'] as $key => $value) { - $posters['imgs_url'][] = array("value" => $value['url'], "src" => build_qiniu_image_url($value['url'])); - $posters['imgs'][] = array("value" => $value['url'], "src" => build_qiniu_image_url($value['url']) - , "width" => $value['width'], "height" => $value['height']); - } + $jsondata['share_title'] && $share_title = $jsondata['share_title']; + if ($jsondata['share_img']) { + $share_img = $jsondata['share_img']; + $share_img_url = build_qiniu_image_url($jsondata['share_img']); } + $jsondata['rule'] && $rule = $jsondata['rule']; } - if ($re['z_id']) { - $re_t = $this->mdTopics->get(array('id' => $re['z_id'])); - $dataInfo['z_title'] = $re_t['title'] ? $re_t['title'] : ''; - } - $dataInfo['title'] = $re['title']; - $dataInfo['img'] = $re['img'] ? $re['img'] : ''; - $dataInfo['img_url'] = $re['img'] ? build_qiniu_image_url($re['img']) : ''; - $dataInfo['time'] = $re['s_time'] . " ~ " . $re['e_time']; } else { $_title = '新增私域通-直播'; $dataInfo['editType'] = 2; $dataInfo['edit_url'] = '/app/licheb/sytlive/add'; - $dataInfo['brand_id'] = []; $dataInfo['status'] = 0; - $dataInfo['z_id'] = 0; } + $status_list = []; foreach ($this->statusAry as $key => $value) { $status_list[] = array("id" => $key, "name" => $value); } - $dataInfo['kpi_list'] = []; $dataInfo['id'] = $id; + $dataInfo['title'] = $title; + $dataInfo['session_id'] = $session_id; + $dataInfo['img'] = $img; + $dataInfo['img_url'] = $img_url; + $dataInfo['time'] = $time; $dataInfo['share_title'] = $share_title; - $dataInfo['remark'] = $remark; + $dataInfo['share_img'] = $share_img; + $dataInfo['share_img_url'] = $share_img_url; $dataInfo['rule'] = $rule; - $dataInfo['bg_color'] = $bg_color; - $dataInfo['btn_color'] = $btn_color; $this->data['info'] = $dataInfo; $this->data['status_list'] = $status_list; - $this->data['posters'] = $posters; $this->data['_title'] = $_title; return $this->show_view('/app/licheb/syt/live_edit', true); } @@ -126,28 +116,17 @@ class Sytlive extends HD_Controller if (!$checkData['code']) { return $this->show_json($checkData['code'], $checkData['msg']); } - $brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0; - $re = $this->mdSytLive->get(array("z_id" => $info['z_id'], "brand_id" => $brand_id)); + $re = $this->mdSytLive->get(array("session_id" => $info['session_id'], "status<>" => -1)); if ($re) { - return $this->show_json(SYS_CODE_FAIL, '该活动已存在!'); + return $this->show_json(SYS_CODE_FAIL, '该直播场次已存在!'); } - $jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE); + //$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE); $json_data['share_title'] = $info['share_title']; - $json_data['remark'] = $info['remark']; + $json_data['share_img'] = $info['share_img']; $json_data['rule'] = $info['rule']; - $json_data['bg_color'] = $info['bg_color']; - $json_data['btn_color'] = $info['btn_color']; - //海报 - $posters = array(); - if ($info['posters']) { - foreach ($info['posters'] as $key => $value) { - $posters[] = array('url' => $value['value'], 'width' => $value['width'], 'height' => $value['height']); - } - } - $json_data['posters'] = $posters; $jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE); - $addData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img'] - , "jsonkpi" => $jsonkpi, "jsondata" => $jsondata, "status" => $info['status'], "c_time" => time()); + $addData = array("title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img'], + "jsondata" => $jsondata, "status" => $info['status'], "c_time" => time()); if ($info['time']) { $time = explode(' ~ ', $info['time']); $addData['s_time'] = $time[0]; @@ -155,11 +134,11 @@ class Sytlive extends HD_Controller } $id = $this->mdSytLive->add($addData); if (!$id) { - return $this->show_json(SYS_CODE_FAIL, '新增活动失败!'); + return $this->show_json(SYS_CODE_FAIL, '新增直播失败!'); } $this->data['type'] = 'add'; $this->data['id'] = $id; - return $this->show_json(SYS_CODE_SUCCESS, '新增活动成功!'); + return $this->show_json(SYS_CODE_SUCCESS, '新增直播成功!'); } public function edit() @@ -302,14 +281,16 @@ class Sytlive extends HD_Controller $code = SYS_CODE_FAIL; if (!$info) { $msg = '非法参数'; - } else if (!$info['brand_id']) { - $msg = '请选择活动品牌'; - } else if (!$info['z_id']) { - $msg = '请选择活动专题'; } else if (!$info['title']) { $msg = '请输入活动标题'; + } else if (!$info['img']) { + $msg = '请上传头部图片'; + } else if (!$info['session_id']) { + $msg = '请输入直播场次'; } else if (!$info['time']) { - $msg = '请选择活动时间'; + $msg = '请选择直播时间'; + } else if (!$info['rule']) { + $msg = '请输入活动规则'; } else { $code = SYS_CODE_SUCCESS; } diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index 69536049..288c287f 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -95,7 +95,7 @@ class Userslog extends HD_Controller $map_biz[$v['biz_id']]['biz_name'] && $biz_name = $map_biz[$v['biz_id']]['biz_name']; $map_biz[$v['biz_id']]['type'] && $biz_type = $typeAry[$map_biz[$v['biz_id']]['type']]; $temp = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'defeats' => $v['defeats'] - , 'c_num' => $v['c_num'], 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'] + , 'c_num' => $v['c_num'], 'a_num' => $v['a_num'], 't_num' => $v['t_num'], 'orders' => $v['orders'], 'bills' => $v['bills'] , 'follows' => $v['follows'], 'qy_adds' => $v['qy_adds'], 'qy_dels' => $v['qy_dels'], 'log_date' => $v['log_date']]; $customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : []; foreach ($offlineSources as $key1 => $value1) { @@ -128,6 +128,8 @@ class Userslog extends HD_Controller $sum_c = $this->mdUsersLog->sum('c_num', $where); $sum = $this->mdUsersLog->sum('a_num', $where); $menus[] = ['title' => "进店人数/进店次数", 'value' => intval($sum_c['c_num']) . '人 / ' . intval($sum['a_num']), 'tag' => '人次']; + $sum = $this->mdUsersLog->sum('t_num', $where); + $menus[] = ['title' => "试驾数", 'value' => intval($sum['t_num']), 'tag' => '次']; $sum = $this->mdUsersLog->sum('follows', $where); $menus[] = ['title' => "跟进数", 'value' => intval($sum['follows']), 'tag' => '个']; $sum = $this->mdUsersLog->sum('orders', $where); @@ -191,6 +193,7 @@ class Userslog extends HD_Controller } $indexs['c_num'] = '进店人数'; $indexs['a_num'] = '进店次数'; + $indexs['t_num'] = '试驾数'; $indexs['follows'] = '跟进数'; $indexs['orders'] = '订单数'; $indexs['defeats'] = '战败数'; diff --git a/admin/views/app/licheb/syt/live_edit.php b/admin/views/app/licheb/syt/live_edit.php index 05af5a53..f1a5729e 100644 --- a/admin/views/app/licheb/syt/live_edit.php +++ b/admin/views/app/licheb/syt/live_edit.php @@ -39,19 +39,19 @@