This commit is contained in:
dengbw
2022-05-09 16:32:23 +08:00
parent c6f2db4b95
commit 37f4d30b95
8 changed files with 96 additions and 125 deletions
+36 -55
View File
@@ -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;
}
+4 -1
View File
@@ -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'] = '战败数';
+37 -55
View File
@@ -39,19 +39,19 @@
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span style="font-size: 20px">活动信息</span>
<span style="font-size: 20px">直播信息</span>
<span style="float:right;margin-top:5px">
<a href="javascript:" @click="editType(2)"><i class="fa fa-edit"></i></a></span>
</div>
<div class="am-panel-bd am-g">
<div class="am-form-group">
<label class="am-para-label">活动标题:</label>
<label class="am-para-label">标题:</label>
<div class="am-para-input" style="width: 80%">
<input type="text" v-model="info.title">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">活动封面</label>
<label class="am-para-label">头部图片</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
@@ -68,19 +68,22 @@
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">海报图片</label>
<div class="am-para-input">
<p><a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm"
data-file="999" data-type="jpg,png,gif,png,jpeg" data-uptype="qiniu"
data-mark="goods">上传图片</a></p>
<div class="photo-upload">
<div class="photo-upload-item" v-for="(v,i) in goods.imgs_url">
<img :src="v.src" class="img-thumbnail" :data-value="v.value" data-tips-image
style="width:100px;height:100px;">
<span class="photo-upload-item-remove"><i class="fa fa-remove"
@click="removeImgs(i);"></i></span>
</div>
</div>
<label class="am-para-label">直播场次</label>
<div class="am-para-input" style="width: 30%">
<input type="text" v-model="info.session_id">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">直播时间:</label>
<div class="am-para-input" style="width: 30%">
<input id="time_id" value="<?= $info['time'] ?>" type="text" placeholder="开始日期 ~ 结束日期"
autocomplete="off"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">活动规则:</label>
<div class="am-para-input" style="width: 80%">
<textarea rows="3" v-model="info.rule"></textarea>
</div>
</div>
<div class="am-form-group">
@@ -90,38 +93,24 @@
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">活动时间</label>
<div class="am-para-input" style="width: 50%">
<input id="time_id" value="<?= $info['time'] ?>" type="text" placeholder="开始日期 ~ 结束日期"
autocomplete="off"/>
<label class="am-para-label">分享图片</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="share_img"><i class="am-icon-cloud-upload"></i> 上传封面
</button>
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
<input type="hidden" name="share_img" id="share_img_id"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $info['share_img'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $info['share_img_url'] ?>"/>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">备注</label>
<div class="am-para-input" style="width: 80%">
<textarea rows="3" v-model="info.remark"></textarea>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">规则:</label>
<div class="am-para-input" style="width: 80%">
<textarea rows="3" v-model="info.rule"></textarea>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">背景色:</label>
<div class="am-para-input" style="width: 15%">
<input type="text" v-model="info.bg_color">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">按扭色:</label>
<div class="am-para-input" style="width: 15%">
<input type="text" v-model="info.btn_color">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">配置KPI</label>
<label class="am-para-label">配置奖品</label>
<div class="am-para-input">
<div v-for="(v,i) in info.kpi_list" class="am-form-inline" style="padding-bottom: 10px;">
<div class="am-form-group">{{v.title}}</div>
@@ -170,14 +159,12 @@
el: '#vue-edit',
data: {
info: {},
goods: {"imgs_url": [], "imgs": []},
status_list: []
},
mounted() {
var that = this;
that.info = <?=json_encode($info)?>;
that.status_list = <?=json_encode($status_list)?>;
that.goods = <?=json_encode($posters)?>;
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',
@@ -91,6 +91,7 @@
<th width="10%"><span>顾问</span></th>
<th width="20%"><span>客户数</span></th>
<th width="13%"><span>进店人数/进店次数</span></th>
<th width="9%"><span>试驾数</span></th>
<th width="9%"><span>跟进数</span></th>
<th width="9%"><span>订单数</span></th>
<th width="9%"><span>战败数</span></th>
@@ -108,6 +109,7 @@
<td><?= $v['uname'] ?></td>
<td><?= $v['customers'] ?></td>
<td><?= $v['c_num'] ?>/<?= $v['a_num'] ?></td>
<td><?= $v['t_num'] ?></td>
<td><?= $v['follows'] ?></td>
<td><?= $v['orders'] ?></td>
<td><?= $v['defeats'] ?></td>
+4 -1
View File
@@ -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) {
+11 -11
View File
@@ -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 '<br>本次更新完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/users_log_c_num">点击将再次更新>>></a>';
echo '<br><br><a href="/plan/temp/users_log_t_num">点击将再次更新>>></a>';
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 '<br><br>数据库获取:';
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();//输出全部内容到浏览器
}
+1 -1
View File
@@ -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') {//首次到店时间
+1 -1
View File
@@ -190,7 +190,7 @@
//参数开始
var appSecret = "447d5ce803d84f599794a3274177f796";
var appId = "g45uep0s6v";
var channelId = "2904257";
var channelId = "2810581";
//参数结束
var userId = "test-001"
var params = {