diff --git a/admin/controllers/app/licheb/Main.php b/admin/controllers/app/licheb/Main.php index deaf3883..624b1f0a 100644 --- a/admin/controllers/app/licheb/Main.php +++ b/admin/controllers/app/licheb/Main.php @@ -21,6 +21,7 @@ class Main extends HD_Controller $this->load->model('topics/topics_model', 'mdTopics'); $this->load->model('live/Live_polyv_session_model', 'mdPolyvSession'); $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog'); + $this->load->model('app/licheb/syt_live_model', 'mdSytLive'); } public function index() @@ -66,6 +67,14 @@ class Main extends HD_Controller $conditions[] = array('icon' => 'am-icon-home', 'list' => $list); $list = array(); + $value = $this->mdSytLive->count(['status>' => -1]); + $list[] = array( + 'title' => '私域通-直播(个)', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => '/app/licheb/sytlive'), + ), + ); $value = $this->mdTopics->count(array('app_id' => $this->app_id)); $list[] = array( 'title' => '专题(个)', diff --git a/admin/controllers/app/licheb/Sytlive.php b/admin/controllers/app/licheb/Sytlive.php index ef2c9e63..57c8b4da 100644 --- a/admin/controllers/app/licheb/Sytlive.php +++ b/admin/controllers/app/licheb/Sytlive.php @@ -57,7 +57,9 @@ class Sytlive extends HD_Controller { $params = $this->input->get(); $id = intval($params['id']); - $title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = ''; + $title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = $prizes_note = ''; + $img = $share_img = ['value' => '', 'src' => '']; + $prizes_list = []; if ($id > 0) { $re = $this->mdSytLive->get(array('id' => $id)); if (!$re || empty($re)) { @@ -70,19 +72,27 @@ class Sytlive extends HD_Controller $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']); + $img['value'] = $re['img']; + $img['src'] = 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); - $jsondata['share_title'] && $share_title = $jsondata['share_title']; + $jsondata['share_desc'] && $share_desc = $jsondata['share_desc']; if ($jsondata['share_img']) { - $share_img = $jsondata['share_img']; - $share_img_url = build_qiniu_image_url($jsondata['share_img']); + $share_img['value'] = $jsondata['share_img']; + $share_img['src'] = build_qiniu_image_url($jsondata['share_img']); } $jsondata['rule'] && $rule = $jsondata['rule']; } + if ($re['prizes']) {//奖品配置 + $prizes = json_decode($re['prizes'], true); + $prizes_note = $prizes['note']; + foreach ($prizes['list'] as $key => $value) { + $value['img_src'] = $value['img_value'] ? build_qiniu_image_url($value['img_value']) : ''; + $prizes_list[] = $value; + } + } } else { $_title = '新增私域通-直播'; $dataInfo['editType'] = 2; @@ -97,14 +107,14 @@ class Sytlive extends HD_Controller $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['share_desc'] = $share_desc; $dataInfo['share_img'] = $share_img; - $dataInfo['share_img_url'] = $share_img_url; $dataInfo['rule'] = $rule; + $dataInfo['prizes_note'] = $prizes_note; $this->data['info'] = $dataInfo; $this->data['status_list'] = $status_list; + $this->data['prizes_list'] = $prizes_list; $this->data['_title'] = $_title; return $this->show_view('/app/licheb/syt/live_edit', true); } @@ -120,13 +130,20 @@ class Sytlive extends HD_Controller if ($re) { return $this->show_json(SYS_CODE_FAIL, '该直播场次已存在!'); } - //$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE); - $json_data['share_title'] = $info['share_title']; - $json_data['share_img'] = $info['share_img']; + $json_data['share_desc'] = $info['share_desc']; + $json_data['share_img'] = $info['share_img']['value']; $json_data['rule'] = $info['rule']; $jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE); - $addData = array("title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img'], - "jsondata" => $jsondata, "status" => $info['status'], "c_time" => time()); + $prizes['note'] = $info['prizes_note']; + $prizes_list = []; + foreach ($info['prizes_list'] as $key => $value) { + unset($value['img_src']); + $prizes_list[] = $value; + } + $prizes['list'] = $prizes_list; + $prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE); + $addData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'], + "jsondata" => $jsondata, "prizes" => $prizes, "status" => $info['status'], "c_time" => time()]; if ($info['time']) { $time = explode(' ~ ', $info['time']); $addData['s_time'] = $time[0]; @@ -151,32 +168,28 @@ class Sytlive extends HD_Controller if (!$info['id']) { return $this->show_json(SYS_CODE_FAIL, '参数错误!'); } - $jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE); - $json_data['share_title'] = $info['share_title']; - $json_data['remark'] = $info['remark']; + $json_data['share_desc'] = $info['share_desc']; + $json_data['share_img'] = $info['share_img']['value']; $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); - $brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0; - $updateData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img'] - , "jsonkpi" => $jsonkpi, "jsondata" => $jsondata); + $prizes['note'] = $info['prizes_note']; + $prizes_list = []; + foreach ($info['prizes_list'] as $key => $value) { + unset($value['img_src']); + $prizes_list[] = $value; + } + $prizes['list'] = $prizes_list; + $prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE); + $updateData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'], + "jsondata" => $jsondata, "prizes" => $prizes]; if ($info['time']) { $time = explode(' ~ ', $info['time']); $updateData['s_time'] = $time[0]; $updateData['e_time'] = $time[1]; } - $this->mdSytLive->update($updateData, array('id' => $info['id'])); + $this->mdSytLive->update($updateData, ['id' => $info['id']]); $this->data['type'] = 'edit'; - return $this->show_json(SYS_CODE_SUCCESS, '修改活动成功!'); + return $this->show_json(SYS_CODE_SUCCESS, '修改直播成功!'); } /** @@ -285,8 +298,8 @@ class Sytlive extends HD_Controller $msg = '请输入活动标题'; } else if (!$info['img']) { $msg = '请上传头部图片'; - } else if (!$info['session_id']) { - $msg = '请输入直播场次'; +// } else if (!$info['session_id']) { +// $msg = '请输入直播场次'; } else if (!$info['time']) { $msg = '请选择直播时间'; } else if (!$info['rule']) { diff --git a/admin/views/app/licheb/syt/live_edit.php b/admin/views/app/licheb/syt/live_edit.php index 4f18879e..d7f5b167 100644 --- a/admin/views/app/licheb/syt/live_edit.php +++ b/admin/views/app/licheb/syt/live_edit.php @@ -55,15 +55,13 @@
建议尺寸宽度690 - + :src="vue_obj.info.img.src"/>
@@ -89,7 +87,7 @@
- +
@@ -97,15 +95,12 @@
- 建议尺寸宽度690 - + :src="vue_obj.info.share_img.src"/>
@@ -132,28 +127,29 @@ 图片 标题 排序 - 链接 + 价格 - 添加 -