live_507_2

This commit is contained in:
dengbw
2022-05-07 17:11:01 +08:00
parent e306f0d522
commit 07a40f1aa0
4 changed files with 32 additions and 242 deletions
+23 -39
View File
@@ -28,27 +28,20 @@ class Sytlive extends HD_Controller
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = array();
$where = array('status>' => -1);
$count = $this->mdSytActivity->count($where);
$count = $this->mdSytLive->count($where);
if ($count) {
$this->load->library('MyEncryption');
$res = $this->mdSytActivity->select($where, 'id desc', $params['page'], $params['size']);
$res = $this->mdSytLive->select($where, 'id desc', $params['page'], $params['size']);
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['title'] = $value['title'];
$z_title = '';
if ($value['z_id']) {
$re_t = $this->mdTopics->get(array('id' => $value['z_id']));
$re_t['title'] && $z_title = $re_t['title'];
}
$setValue['z_id'] = $value['z_id'];
$setValue['z_title'] = $z_title;
$setValue['session_id'] = $value['session_id'];
$setValue['s_time'] = $value['s_time'];
$setValue['e_time'] = $value['e_time'];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
$setValue['status_name'] = $this->statusAry[$value['status']];
$url = http_host_com('home') . "/h5/syt/special?skey=" . $this->myencryption->base64url_encode("a_id=" . $value['id']);
$url = http_host_com('home') . "/h5/syt/live?skey=" . $this->myencryption->base64url_encode("id=" . $value['id']);
$setValue['url'] = urlencode($url);
$lists[] = $setValue;
}
@@ -68,13 +61,13 @@ class Sytlive extends HD_Controller
$posters = array('imgs_url' => array(), 'imgs' => array());
$share_title = $remark = $rule = $bg_color = $btn_color = '';
if ($id > 0) {
$re = $this->mdSytActivity->get(array('id' => $id));
$re = $this->mdSytLive->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '活动不存在!');
}
$_title = '编辑私域通活动';
$_title = '编辑私域通-直播';
$dataInfo['editType'] = 0;
$dataInfo['edit_url'] = '/app/licheb/sytactivity/edit';
$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'];
@@ -101,27 +94,18 @@ class Sytlive extends HD_Controller
$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'];
$jsonkpi = $re['jsonkpi'] ? json_decode($re['jsonkpi'], true) : '';
foreach ($this->mdSytKpiData->kpiAry() as $key => $value) {
$kpi_list[$key] = array("num" => $jsonkpi[$key]['num'], "score" => $jsonkpi[$key]['score']
, "title" => $value['title1'], "num_tag" => $value['num_tag'], "score_tag" => $value['score_tag']);
}
} else {
$_title = '新增私域通活动';
$_title = '新增私域通-直播';
$dataInfo['editType'] = 2;
$dataInfo['edit_url'] = '/app/licheb/sytactivity/add';
$dataInfo['edit_url'] = '/app/licheb/sytlive/add';
$dataInfo['brand_id'] = [];
$dataInfo['status'] = 0;
$dataInfo['z_id'] = 0;
foreach ($this->mdSytKpiData->kpiAry() as $key => $value) {
$kpi_list[$key] = array("num" => 0, "score" => 0, "title" => $value['title1'], "num_tag" => $value['num_tag']
, "score_tag" => $value['score_tag']);
}
}
foreach ($this->statusAry as $key => $value) {
$status_list[] = array("id" => $key, "name" => $value);
}
$dataInfo['kpi_list'] = $kpi_list;
$dataInfo['kpi_list'] = [];
$dataInfo['id'] = $id;
$dataInfo['share_title'] = $share_title;
$dataInfo['remark'] = $remark;
@@ -132,7 +116,7 @@ class Sytlive extends HD_Controller
$this->data['status_list'] = $status_list;
$this->data['posters'] = $posters;
$this->data['_title'] = $_title;
return $this->show_view('/app/licheb/syt/activity_edit', true);
return $this->show_view('/app/licheb/syt/live_edit', true);
}
public function add()
@@ -143,7 +127,7 @@ class Sytlive extends HD_Controller
return $this->show_json($checkData['code'], $checkData['msg']);
}
$brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0;
$re = $this->mdSytActivity->get(array("z_id" => $info['z_id'], "brand_id" => $brand_id));
$re = $this->mdSytLive->get(array("z_id" => $info['z_id'], "brand_id" => $brand_id));
if ($re) {
return $this->show_json(SYS_CODE_FAIL, '该活动已存在!');
}
@@ -169,7 +153,7 @@ class Sytlive extends HD_Controller
$addData['s_time'] = $time[0];
$addData['e_time'] = $time[1];
}
$id = $this->mdSytActivity->add($addData);
$id = $this->mdSytLive->add($addData);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '新增活动失败!');
}
@@ -211,7 +195,7 @@ class Sytlive extends HD_Controller
$updateData['s_time'] = $time[0];
$updateData['e_time'] = $time[1];
}
$this->mdSytActivity->update($updateData, array('id' => $info['id']));
$this->mdSytLive->update($updateData, array('id' => $info['id']));
$this->data['type'] = 'edit';
return $this->show_json(SYS_CODE_SUCCESS, '修改活动成功!');
}
@@ -228,7 +212,7 @@ class Sytlive extends HD_Controller
if (!$info['id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$this->mdSytActivity->update(array("status" => intval($info['status'])), array('id' => $info['id']));
$this->mdSytLive->update(array("status" => intval($info['status'])), array('id' => $info['id']));
return $this->show_json(SYS_CODE_SUCCESS, '操作成功!');
}
@@ -245,7 +229,7 @@ class Sytlive extends HD_Controller
if (!$params['a_id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$re = $this->mdSytActivity->get(array('id' => $params['a_id']));
$re = $this->mdSytLive->get(array('id' => $params['a_id']));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '活动不存在!');
}
@@ -262,8 +246,8 @@ class Sytlive extends HD_Controller
public function enrollSelect($params)
{
$this->load->model('app/syt/syt_activity_enroll_model', 'mdSytActivityEnroll');
$this->load->model('app/syt/syt_activity_team_model', 'mdSytActivityTeam');
$this->load->model('app/syt/syt_activity_enroll_model', 'mdSytLiveEnroll');
$this->load->model('app/syt/syt_activity_team_model', 'mdSytLiveTeam');
$this->load->model('app/hdy/app_hdy_users_model', 'mdHdyUsers');
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
@@ -276,9 +260,9 @@ class Sytlive extends HD_Controller
if ($params['mobile']) {
$where['mobile LIKE "%' . $params['mobile'] . '%"'] = null;
}
$count = $this->mdSytActivityEnroll->count($where);
$count = $this->mdSytLiveEnroll->count($where);
if ($count) {
$res = $this->mdSytActivityEnroll->select($where, 'id desc', $params['page'], $params['size']);
$res = $this->mdSytLiveEnroll->select($where, 'id desc', $params['page'], $params['size']);
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
@@ -290,7 +274,7 @@ class Sytlive extends HD_Controller
$reUsers = $this->mdHdyUsers->get(array('id' => $value['cf_uid']));
$reUsers['nickname'] && $cf_name = $reUsers['nickname'];
} else {
$re_t = $this->mdSytActivityTeam->get(array('id' => $value['t_id']));
$re_t = $this->mdSytLiveTeam->get(array('id' => $value['t_id']));
$re_t['name'] && $cf_name = $re_t['name'];
}
}
@@ -407,12 +391,12 @@ class Sytlive extends HD_Controller
public function get_kpidata()
{
$this->load->model('app/syt/syt_activity_member_model', 'mdSytActivityMember');
$this->load->model('app/syt/syt_activity_member_model', 'mdSytLiveMember');
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 10;
$where = array('status' => 1);
$res = $this->mdSytActivityMember->select($where, 'id asc', $params['page'], $params['size']);
$res = $this->mdSytLiveMember->select($where, 'id asc', $params['page'], $params['size']);
foreach ($res as $key => $value) {
$this->mdSytKpiData->update(array("t_id" => $value['t_id']), array("a_id" => $value['a_id'], 'cf_uid' => $value['uid']));
}
+1 -1
View File
@@ -127,7 +127,7 @@ class Userslog extends HD_Controller
$menus[] = ['title' => "客户数", 'value' => intval($sum['customers']), 'tag' => '人'];
$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' => '人'];
$menus[] = ['title' => "进店人数/进店次数", 'value' => intval($sum_c['c_num']) . '人 / ' . intval($sum['a_num']), 'tag' => '人'];
$sum = $this->mdUsersLog->sum('follows', $where);
$menus[] = ['title' => "跟进数", 'value' => intval($sum['follows']), 'tag' => '个'];
$sum = $this->mdUsersLog->sum('orders', $where);
+1 -193
View File
@@ -44,33 +44,6 @@
<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>
<div class="am-para-input">
<div class="am-form-inline">
<div class="am-form-group" style="width: 30%">
<input type="text" v-model="info.z_title" disabled="disabled">
</div>
<div class="am-form-group ml10">
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
@click="topicsModal">选择</a>
</div>
<div class="am-form-group">
<span class="f12 clr999 lh-default ml10">注:活动页面只能从现有的专题中选择</span>
</div>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">活动品牌:</label>
<div class="am-para-input">
<div class="am-g" style="margin-left: 3px;">
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in auto_brands">
<input type="checkbox" :value="v.id" v-model="info.brand_id"/> {{v.name}}
</label>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">活动标题:</label>
<div class="am-para-input" style="width: 80%">
@@ -173,75 +146,6 @@
</div>
</div>
</div>
<div id="topics-modal" style="display: none;">
<div class="modal-body">
<div class="header">
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" v-model="topicsName" placeholder="专题名"/>
<div class="input-group-btn">
<a href="javascript:" class="btn btn-primary btn-stroke"
@click="searchByTopicsName()">
<i class="fa fa-search"></i></a></div>
</div>
</div>
</form>
</div>
<div style="padding-top: 10px;">
<div class="vuetable-body-wrapper">
<table class="vuetable table table-middle table-hover fixed">
<colgroup>
<col class="vuetable-col-title" style="width: 50%;">
<col class="vuetable-col-actions text-right">
</colgroup>
<thead>
<tr>
<th class="vuetable-th-slot-title" style="width: 50%;">专题名</th>
<th class="vuetable-th-slot-actions text-right">操作</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody class="vuetable-body">
<tr v-for="(v,i) in topicsList">
<td class="vuetable-slot" style="width: 50%;">
<div>
{{v.title}}
</div>
</td>
<td class="vuetable-slot text-right">
<button type='button' v-if="v.selected==0 || !v.selected"
class="btn btn-sm btn-success"
@click="addTopicsItem(v)">添加
</button>
<button type='button' v-if="v.selected==1" class="btn btn-sm btn-danger"
@click="removeTopicsItem(v)">删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<span class="pull-left text-muted">{{topicsPage.page}}(每页{{topicsPage.pageLimit}},{{topicsPage.pageCount}})</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeTopicsPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="topicsPage.hasNext">
<a href="javascript:void(0);" @click="afterTopicsPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<script>
@@ -267,12 +171,6 @@
data: {
info: {},
goods: {"imgs_url": [], "imgs": []},
status_list: [],
topicsName: '',
topicsList: [],
topicsPage: [],
topicsThPage: 0,
auto_brands: [],
},
mounted() {
var that = this;
@@ -287,24 +185,6 @@
updated: function () {
},
methods: {
init_auto_brands: function () {
var vm = this;
$.ajax({
url: '/auto/brand/json_lists',
type: 'post',
dataType: 'json',
data: {status: 1},
beforeSend: function () {
},
success: function (data) {
if (1 == data.code) {
vm.auto_brands = data.data.list;
}
},
complete: function () {
}
});
},
removeImgs: function (index) {
var vm = this;
vm.goods.imgs_url.splice(index, 1);
@@ -330,78 +210,6 @@
vm.info.editType = 0;
}
},
//选择活动专题
topicsModal: function () {
var that = this;
layer.open({
type: 1,
area: ['45%', '80%'], //宽高
content: $('#topics-modal'),
title: '选择活动专题',
shade: false,
btn: ['选好了'],
yes: function (index) {
layer.close(index);
}
});
$.ajax({
url: '/app/licheb/sytactivity/get_topics',
type: 'post',
dataType: 'json',
data: {
page: that.topicsThPage,
title: that.topicsName,
},
success: function (json) {
var topicsList = json.data.topicsList;
that.topicsPage = json.data.topicsPage;
topicsList.map(function (_item, _index) {
if (that.info.z_id == _item.id) {
topicsList[_index].selected = 1;
} else {
topicsList[_index].selected = 0;
}
})
that.topicsList = topicsList;
}
});
},
beforeTopicsPage: function () {
var vm = this;
if (vm.topicsThPage == 1) {
alert('已经是第一页了');
return;
}
vm.topicsThPage--;
return this.topicsModal();
},
afterTopicsPage: function () {
var vm = this;
vm.topicsThPage++;
return this.topicsModal();
},
addTopicsItem: function (item) {
var vm = this;
vm.info['z_id'] = item.id;
vm.info['z_title'] = item.title;
this.topicsList.map(function (_item, _index) {
if (item.id == _item.id) {
_item.selected = 1;
} else {
_item.selected = 0;
}
})
},
removeTopicsItem: function (item) {
var vm = this;
vm.info['z_id'] = 0;
vm.info['z_title'] = '';
this.topicsList.map(function (_item, _index) {
if (item.id == _item.id) {
vm.topicsList[_index].selected = 0;
}
})
},
saveEdit: function () {
var vm = this;
vm.info.time = $('#time_id').val();
@@ -426,7 +234,7 @@
time: 2000
}, function () {
if (data['data']['type'] == 'add') {
window.location.href = "#/app/licheb/sytactivity/get?id=" + data['data']['id'] + "?spm=<?= $_GET['spm'] ?>";
window.location.href = "#/app/licheb/sytlive/get?id=" + data['data']['id'] + "?spm=<?= $_GET['spm'] ?>";
} else {
$.form.reload();
}
+7 -9
View File
@@ -1,6 +1,6 @@
<div class="coms-table-wrap mt10" id="vue-app">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/app/licheb/sytactivity">
action="/app/licheb/sytlive">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">活动标题:</label>
@@ -13,7 +13,7 @@
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" data-open="/app/licheb/sytactivity/get"
<button type="button" data-open="/app/licheb/sytlive/get"
class="am-btn am-btn-success am-btn-sm w100">新增
</button>
</div>
@@ -26,8 +26,8 @@
<thead>
<tr>
<th width="4%"><span>ID</span></th>
<th width="15%"><span>活动标题</span></th>
<th width="15%"><span>专题</span></th>
<th width="15%"><span>标题</span></th>
<th width="15%"><span>直播场次</span></th>
<th width="10%"><span>开始时间</span></th>
<th width="10%"><span>结束时间</span></th>
<th width="10%"><span>创建时间</span></th>
@@ -39,10 +39,8 @@
foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td align="left"><?= $v['title'] ?></td>
<td align="left"><a href="javascript:void(0);"
data-open="/topics/topics/get?id=<?= $v['z_id'] ?>"><?= $v['z_title'] ?></a>
</td>
<td><?= $v['title'] ?></td>
<td><?= $v['session_id'] ?></td>
<td><?= $v['s_time'] ?></td>
<td><?= $v['e_time'] ?></td>
<td><?= $v['c_time'] ?></td>
@@ -60,7 +58,7 @@
data-modal="/common/share_qrcode?url=<?= $v['url'] ?>"
data-title="分享二维码">分享二维码</a>
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/app/licheb/sytactivity/get?id=<?= $v['id'] ?>">编辑</a>
data-open="/app/licheb/sytlive/get?id=<?= $v['id'] ?>">编辑</a>
</td>
</tr>
<?php }