From 37f4d30b9590638e609af0a8164db6a522f7d97f Mon Sep 17 00:00:00 2001 From: dengbw Date: Mon, 9 May 2022 16:32:23 +0800 Subject: [PATCH] live_509 --- admin/controllers/app/licheb/Sytlive.php | 91 +++++++++------------ admin/controllers/app/licheb/Userslog.php | 5 +- admin/views/app/licheb/syt/live_edit.php | 92 +++++++++------------- admin/views/app/licheb/userslog/lists.php | 2 + api/controllers/plan/Licheb.php | 5 +- api/controllers/plan/Temp.php | 22 +++--- api/controllers/wxapp/licheb/Customers.php | 2 +- home/views/h5/syt/live.php | 2 +- 8 files changed, 96 insertions(+), 125 deletions(-) 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 @@
- 活动信息 + 直播信息
- +
- +
- -
-

上传图片

-
-
- - -
-
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
@@ -90,38 +93,24 @@
- -
- + +
+
+ + 建议尺寸宽度690 + + +
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- +
{{v.title}}
@@ -170,14 +159,12 @@ el: '#vue-edit', data: { info: {}, - goods: {"imgs_url": [], "imgs": []}, + status_list: [] }, mounted() { var that = this; that.info = ; that.status_list = ; - that.goods = ; - that.init_auto_brands(); }, computed: {}, created: function () { @@ -185,11 +172,6 @@ updated: function () { }, methods: { - removeImgs: function (index) { - var vm = this; - vm.goods.imgs_url.splice(index, 1); - vm.goods.imgs.splice(index, 1); - }, editType: function (index) { var vm = this; if (index == 1) { @@ -212,9 +194,9 @@ }, saveEdit: function () { var vm = this; - vm.info.time = $('#time_id').val(); vm.info.img = $('#cover_id').val(); - vm.info.posters = vm.goods.imgs; + vm.info.time = $('#time_id').val(); + vm.info.share_img = $('#share_img_id').val(); $.ajax({ url: vm.info.edit_url, type: 'post', diff --git a/admin/views/app/licheb/userslog/lists.php b/admin/views/app/licheb/userslog/lists.php index 0cf71c94..3fa4e953 100644 --- a/admin/views/app/licheb/userslog/lists.php +++ b/admin/views/app/licheb/userslog/lists.php @@ -91,6 +91,7 @@ 顾问 客户数 进店人数/进店次数 + 试驾数 跟进数 订单数 战败数 @@ -108,6 +109,7 @@ / + diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index 30f19bd2..b50cfa0f 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -80,6 +80,9 @@ class Licheb extends HD_Controller $a_num = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type' => 4, 'c_time>=' => $s_time, 'c_time<=' => $e_time, "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null] ); + $t_num = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type' => 5, 'c_time>=' => $s_time, 'c_time<=' => $e_time, + "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null] + ); $follows = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type in(0,1,2)' => null, 'c_time>=' => $s_time, 'c_time<=' => $e_time, "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null], 'distinct(customer_id)' ); @@ -100,7 +103,7 @@ class Licheb extends HD_Controller , 'c_time>=' => $s_time, 'c_time<=' => $e_time]); } $add_item = ['sale_id' => $sale_id, 'biz_id' => $biz_id, 'type' => $type, 'city_id' => $city_id, 'c_num' => $c_num - , 'a_num' => $a_num, 'orders' => $orders, 'bills' => $bills, 'follows' => $follows, 'defeats' => $defeats + , 'a_num' => $a_num, 't_num' => $t_num, 'orders' => $orders, 'bills' => $bills, 'follows' => $follows, 'defeats' => $defeats , 'log_date' => $log_date, 'qy_adds' => $qy_adds, 'qy_dels' => $qy_dels, 'c_time' => time()]; $customer_json = ''; foreach ($offlineSources as $key1 => $value1) { diff --git a/api/controllers/plan/Temp.php b/api/controllers/plan/Temp.php index ebc11b50..f8da015c 100644 --- a/api/controllers/plan/Temp.php +++ b/api/controllers/plan/Temp.php @@ -20,10 +20,10 @@ class Temp extends HD_Controller * Notes:更新战败客户到店 * Created on: 2022/3/09 11:58 * Created by: dengbw - * https://liche-api-dev.xiaoyu.com/plan/temp/users_log_c_num - * https://api.liche.cn/plan/temp/users_log_c_num + * https://liche-api-dev.xiaoyu.com/plan/temp/users_log_t_num + * https://api.liche.cn/plan/temp/users_log_t_num */ - public function users_log_c_num() + public function users_log_t_num() { $this->load->model('receiver/receiver_customer_oplogs_model', 'mdCustomerOplogs'); $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog'); @@ -34,12 +34,12 @@ class Temp extends HD_Controller !$param['page'] && $param['page'] = 1; $counts = intval($param['counts']); ob_start(); //打开缓冲区 - $where = ["a_num>" => 0]; + $where = ["log_date>=" => '2022-04-15', 'a_num>0 OR follows>0' => null]; $res = $this->mdUsersLog->select($where, 'id ASC', $param['page'], $param['size'], 'id,sale_id,biz_id,log_date'); if (!$res) { echo '
本次更新完成了:'; echo '

成功更新 ' . $counts . ' 条'; - echo '

点击将再次更新>>>'; + echo '

点击将再次更新>>>'; exit; } $log = array(); @@ -48,11 +48,11 @@ class Temp extends HD_Controller $biz_id = $value['biz_id']; $s_time = strtotime($value['log_date'] . ' 00:00:00'); $e_time = strtotime($value['log_date'] . ' 23:59:59'); - $c_num = $this->mdCustomerOplogs->count(['uid' => $sale_id, 'type' => 4, 'log' => '客户到店', 'c_time>=' => $s_time, 'c_time<=' => $e_time, - "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null], 'distinct(customer_id)'); - if ($c_num) { - $this->mdUsersLog->update(['c_num' => $c_num], ['id' => $value['id']]); - $log[] = ['id' => $value['id'], 'c_num' => $c_num]; + $t_num = $this->mdCustomerOplogs->count(['uid' => $sale_id, 'type' => 5, 'c_time>=' => $s_time, 'c_time<=' => $e_time, + "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null]); + if ($t_num) { + $this->mdUsersLog->update(['t_num' => $t_num], ['id' => $value['id']]); + $log[] = ['id' => $value['id'], 't_num' => $t_num]; $counts++; } } @@ -60,7 +60,7 @@ class Temp extends HD_Controller $log && print_r($log); echo '

数据库获取:'; echo json_encode($res, JSON_UNESCAPED_UNICODE); - header('refresh:3;url=/plan/temp/users_log_c_num?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); + header('refresh:3;url=/plan/temp/users_log_t_num?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); ob_end_flush();//输出全部内容到浏览器 } diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index ab9f41a8..ab1b1a26 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -386,7 +386,7 @@ class Customers extends Wxapp $t_num && $up_data['t_num = t_num+1'] = null; $level != $row['level'] && $up_data['level'] = $level;//更改客户等级 $log_4 = '';//到店 - if ($status == 1 || $a_num) { + if ($a_num) { $log_4 = $row['status'] == 1 ? '客户再次到店' : '客户到店'; $up_data['cont_time'] = date('Y-m-d H:i:s'); //修改到店状态修改最后联系时间 if ($row['dt_time'] == '0000-00-00 00:00:00') {//首次到店时间 diff --git a/home/views/h5/syt/live.php b/home/views/h5/syt/live.php index e2ea10b0..130fa10a 100644 --- a/home/views/h5/syt/live.php +++ b/home/views/h5/syt/live.php @@ -190,7 +190,7 @@ //参数开始 var appSecret = "447d5ce803d84f599794a3274177f796"; var appId = "g45uep0s6v"; - var channelId = "2904257"; + var channelId = "2810581"; //参数结束 var userId = "test-001" var params = {