今天给大家讲讲账号运营,账号运营里包括账号管理,短视频管理,评论管理,推广词库,D音SEO,发布视频,算数指数等功能,账号管理里可绑定抖音,快手,百家号,西瓜,头条等多个平台,
<style>
.table-select-all-input, .table-select-input {
width: 15px;
height: 15px;
}
</style>
<div class="card shadow mb-4">
<div class="card-header py-3">
<ul class="nav nav-tabs">
<{foreach $platform_list as $platform}>
<li class="<{if $platform['active']}>active<{/if}>"><a
href="<{$platform['url']}>"><{$platform['title']}></a></li>
<{/foreach}>
</ul>
</div>
<div class="card-body">
<div style="margin-bottom: 10px;overflow: hidden;">
<div style="float: left;">
<!--<button class="btn btn-success btn-sm" onclick="addNewScope()">新增授权</button>-->
<a class="btn btn-success btn-sm" href="<{$link_url}>">新增授权</a>
</div>
<div style="float: left;margin-left: 12px;">
<button class="btn btn-primary btn-sm" onclick="toSyncCount()">同步统计数据</button>
<text class="layui-form-mid layui-word-aux" style="float: right;margin-left: 12px;">点击按钮可同步当前账号下详细统计数据,每隔1小时可同步一次</text>
</div>
<div style="float: right;">
<form class="form-inline" role="form">
<div class="form-group" style="margin-right: 10px;">
<label class="" style="margin-right: 10px;">授权时间</label>
<input name="add_time_range" type="text" id="time-range" class="form-control"
placeholder="请选择授权时间" value="<{$time_range}>" style="width: 190px;"
autocomplete="off">
</div>
<button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜索</button>
</form>
</div>
</div>
<table class="table">
<thead>
<tr>
<!--<th>
<input type="checkbox" class="table-select-all-input" value="0">
</th>-->
<th style="text-align: center;">账号信息</th>
<th>基础信息</th>
<th>账号类型</th>
<th>账号分组</th>
<th>基础数据</th>
<th>授权状态</th>
<!--<th>授权作用域</th>-->
<th>操作</th>
</tr>
</thead>
<tbody>
<{foreach $account_list as $user}>
<tr>
<!--<td>
<input type="checkbox" class="table-select-input" value="<{$user['dy_id']}>">
</td>-->
<td style="text-align: center;">
<p><img src="<{$user['da_avatar']}>" alt="logo" style="width: 50px; height: 50px;margin-right: 5px;"></p>
<p><{$user['da_nickname']}></p>
</td>
<td>
<p><{$user['da_province']}>-<{$user['da_city']}></p>
<p>性别:<{$genders[$user['da_gender']]}></p>
</td>
<td><{$account_role[$user['da_account_role']]['name']}></td>
<td>
<p><{if $user['da_group_id']}><{$user['group']['ag_name']}><{else}>--<{/if}></p>
<p><a href="javascript:;" class="btn btn-blue btn-sm btn-set-group" data-id="<{$user['da_id']}>">设置分组</a></p>
</td>
<td>
<{if $user['da_auth_status']}>
<p><span style="color: orangered;">账户取消授权</span></p>
<{else}>
<p>粉丝量:<a href="/dydqtshoppc/account/getDyfansList?da_id=<{$user['da_id']}>&da_account_role=<{$user['da_account_role']}>"><{$user['da_fans_count']}></a></p>
<p>视频数:<{$user['da_video_count']}></p>
<p>曝光量:<{$user['da_visit_count']}></p>
<p>评论数:<{$user['da_comment_count']}></p>
<{/if}>
</td>
<td style="max-width: 160px; word-break: break-all;">
<{if $user['da_auth_status']}>
<p>状态:<span style="color: orangered;">账户取消授权</span></p>
<{else}>
<{if $user['access_status'] eq 1}>
<p>状态:<span style="color: green;">授权未到期</span></p>
<{elseif $user['access_status'] eq 2}>
<p>
<span style="color: red;">授权已到期</span>
<a href="javascript:;" onclick="updateAuth(this)" class="btn btn-green btn-sm" data-id="<{$user['da_id']}>">更新授权</a>
</p>
<{else}>
<p>提示:<span style="color: brown;">refresh_token已过期,请点击右侧重试授权</span></p>
<{/if}>
<p>授权时间:<{date('Y-m-d H:i:s',$user['da_update_time'])}></p>
<p>到期时间:<{if $user['da_access_expire']}><{date('Y-m-d H:i:s',$user['da_access_expire'])}><{else}>已过期<{/if}></p>
<{/if}>
<!--<p>刷新到期时间:<{date('Y-m-d H:i:s',$user['da_refresh_expire'])}></p>-->
</td>
<!--
<td style="max-width: 160px; word-break: break-all;">
<{$user['da_scope']}>
</td>
-->
<td>
<a href="javascript:;" class="btn btn-danger btn-sm " onclick="confirmDelete(this)" data-id="<{$user['da_id']}>">删除</a>
<a href="javascript:;" class="btn btn-warning btn-sm btn-send-log" data-id="<{$user['da_id']}>">视频发送记录</a>
<a href="<{$link_url}>" class="btn btn-info btn-sm">重新授权</a>
</td>
</tr>
<{/foreach}>
</tbody>
</table>
<div>
<{$pageHtml}>
</div>
</div>
</div>
<script>
layui.use(['laydate'], function () {
var laydate = layui.laydate;
//日期范围选择
laydate.render({
elem: '#time-range',
range: '~'
});
});
/**
* 删除账号
*/
function confirmDelete(ele) {
layer.confirm('确定删除当前账号?', {
title:'提示',
btn: ['确定','取消'] //按钮
}, function(){
var id = $(ele).data('id');
if (id.length <1){
layer.msg('请选择要删除账号');
return false;
}
$.ajax({
url: '/dydqtshoppc/account/deleteDy?id=' + id,
type: 'post',
data: {
id
},
dataType: 'json',
success: function (res) {
if (res.ec == 200) {
parent.window.location.reload();
} else {
layer.msg(res.em);
}
},
})
});
}
//设置分组
$('.btn-set-group').on('click', function () {
let id = $(this).data('id');
layer.open({
type: 2,
title: '设置账号所属分组',
content: '/dydqtshoppc/account/setGroup?platform=dou_yin&id='+id,
area: ['400px', '300px']
});
});
/**
* 发送记录
*/
$('.btn-send-log').on('click', function () {
var id = $(this).data('id');
window.location.href = '/dydqtshoppc/account/dySendLog?u_id=' + id;
});
//同步统计数据加载
function toSyncCount(){
var lay_index = layer.load(1, {shade:[0.4, '#000']});
$.ajax({
url: '/dydqtshoppc/account/dyUserList?iscount=1',
type: 'get',
data: {},
dataType: 'json',
success: function (res) {
if (res.ec == 200) {
parent.layer.close(lay_index);
parent.window.location.reload();
} else {
layer.msg(res.em);
}
},
complete:function(){
parent.layer.close(lay_index);
setTimeout(function(){
parent.window.location.reload();
},2000)
}
});
}
let dyurl = "<{$link_url}>";
function addNewScope() {
layer.open({
type: 2,
title: '新增授权账号',
content: dyurl,
area: '800px',
success: function(layero, index) {
//找到当前弹出层的iframe元素
let iframe = layui.$(layero).find('iframe');
//设定iframe的高度为当前iframe内body的高度
let iheight = Math.min(window.innerHeight-50, 750, iframe[0].contentDocument.body.offsetHeight);
iframe.css('height', iheight);
//重新调整弹出层的位置,保证弹出层在当前屏幕的中间位置
$(layero).css('top', (window.innerHeight - iheight -42) / 2);
}
});
}
// 更新授权
function updateAuth(ele) {
let daid = $(ele).data('id');
var loading = layer.load(1, {shade:[0.4, '#000']});
var url = '/dydqtshoppc/account/updateDyAuth?daid='+daid;
$.ajax({
'type' : 'get',
'url' : url,
'dataType' : 'json',
success : function(json_ret){
layer.close(loading);
if(json_ret.em){
layer.msg(json_ret.em);
}
if(json_ret.ec == 200){
window.location.reload();
}
},
complete: function () {
layer.close(loading);
}
});
}
</script>