新增补链日期及取消补链功能

master
chenzhi 5 years ago
parent 258d1fbc1a
commit 115bafc067

@ -58,9 +58,9 @@ class MendController extends ThinkController {
public function edit($id = null) public function edit($id = null)
{ {
// $promoteService = new PromoteService();
if (IS_POST) { if (IS_POST) {
$promoteService = new PromoteService();
if ($_POST['prmoote_id_to'] == -1){ if ($_POST['prmoote_id_to'] == -1){
$_POST['prmoote_id_to'] = 0; $_POST['prmoote_id_to'] = 0;
} }
@ -70,44 +70,27 @@ class MendController extends ThinkController {
if ($_POST['promote_id'] == $_POST['prmoote_id_to']) { if ($_POST['promote_id'] == $_POST['prmoote_id_to']) {
$this->error('没有变更数据'); $this->error('没有变更数据');
} }
if ($_POST['order_time'] == '') {
$this->error('没有订单日期');
}
$create = $_REQUEST; $create = $_REQUEST;
dump($create); $create['order_time'] = date($create['order_time']);
$map['id'] = $create['user_id']; $params = array(
$map_['user_id'] = $create['user_id']; "from_promote_id"=>$create['promote_id'],
$data['promote_id'] = $create['prmoote_id_to']; "to_promote_id"=>$create['prmoote_id_to'],
$data['promote_account'] = get_promote_name($create['prmoote_id_to']); "order_time"=>$create['order_time'],
// 加入补链时间 "type"=>2,
$data['rebind_time'] = $create['rebind_time']; "shift_ids"=>[$create['user_id']],
dump($data); );
$user_data = $data; if(!empty($create['remark'])){
$promote = M('promote', 'tab_')->where(array("id"=>I('prmoote_id_to')))->find(); $params['remark'] = $create['remark'];
if ($promote['parent_id'] != "0") { }
$ppromote = M('promote', 'tab_')->where(array("id"=>$promote['parent_id']))->find(); $res = $promoteService->addShiftTask($params);
$user_data['parent_id']=$ppromote['id']; if($res['status']){
$this->success('补链成功', U('lists'), 2);
}else{ }else{
$user_data['parent_id'] = 0; $this->error($res['msg']);
} }
$user_data['parent_name']=get_promote_name($user_data['parent_id']);
// $user = M('user', 'tab_')->where($map)->save($user_data);
// $user_ = M('UserPlay', 'tab_')->where($map_)->save($data);
// $puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data);
// $spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据
// $depost = M('Deposit', 'tab_')->where($map_)->save($data);
// $Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data);
// $create['user_account'] = get_user_account($create['user_id']);
// $create['promote_account'] = get_promote_name($create['promote_id']);
// $create['promote_id_to'] = $create['prmoote_id_to'];
// $create['promote_account_to'] = get_promote_name($create['prmoote_id_to']);
// $create['create_time'] = time();
// $create['op_id'] = UID;
// $create['op_account'] = session('user_auth.username');
// $create['bind_type'] = $create['bind_type'];
// $mend = M('mend', 'tab_')->add($create);
// if ($mend) {
// $this->success('补链成功', U('lists'), 2);
// }
} else { } else {
$user = A('User', 'Event'); $user = A('User', 'Event');
$user_data = $user->user_entity($id); $user_data = $user->user_entity($id);
@ -123,6 +106,30 @@ class MendController extends ThinkController {
$this->display(); $this->display();
} }
} }
//补链详情
public function shiftInfo()
{
$id = I('id');
$info = M("shift_task")->where("id = {$id} and status = 0")->find();
if(empty($info)){
$this->error("补链不存在或已处理");
}
$info['user_id'] = json_decode($info['shift_ids'])[0];
$info['order_time'] = date("Y-m-d",$info['order_time']);
$this->assign('data',$info);
$this->display();
}
//取消补链
public function cancelShift()
{
$id = I('id');
$status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]);
if ($status) {
$this->success('取消补链成功', U('lists'), 2);
} else {
$this->error("取消失败,或补链已生效",U('lists'));
}
}
} }

@ -84,6 +84,13 @@
</td> </td>
</tr> </tr>
<tr>
<td class="l noticeinfo">订单日期:</td>
<td class="r table_radio">
<input type="text" name="order_time" class="date" value="{:I('order_time')}" placeholder="订单日期" />
</td>
</tr>
<tr> <tr>
<td class="l noticeinfo">换绑类型</td> <td class="l noticeinfo">换绑类型</td>
<td class="r table_radio"> <td class="r table_radio">
@ -159,7 +166,6 @@ Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"});
$('#submit').click(function(){ $('#submit').click(function(){
$('#form').submit(); $('#form').submit();
}); });
$(function(){ $(function(){
$('.time').datetimepicker({ $('.time').datetimepicker({
format: 'yyyy-mm-dd hh:ii', format: 'yyyy-mm-dd hh:ii',

@ -80,7 +80,14 @@
<else/> <else/>
{:get_promote_name($data['promote_id'])} {:get_promote_name($data['promote_id'])}
</if></td> </if></td>
<td><a style="width:100%;text-align:center" href="{:U('Mend/edit?id='.$data['id'])}">补链</a></td> <td>
<if condition="getIsTask($data['id']) eq 0 ">
<a style="width:100%;text-align:center" href="{:U('Mend/edit?id='.$data['id'])}">补链</a>
<else/>
<a style="width:100%;text-align:center;color: #f00;" href="{:U('Mend/shiftInfo?id='.getIsTask($data['id']))}">补链中</a>
</if>
</td>
</tr> </tr>
</volist> </volist>
</empty> </empty>

@ -0,0 +1,173 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.tabcon1711 .select2-container--default .select2-selection--single{
font-size: 12px;
color: #555;
vertical-align: middle;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
border: 1px solid #ccc;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border linear .2s, box-shadow linear .2s;
-moz-transition: border linear .2s, box-shadow linear .2s;
-o-transition: border linear .2s, box-shadow linear .2s;
transition: border linear .2s, box-shadow linear .2s;height:30px;}
.tabcon1711 .select2-container--default .select2-selection--single .select2-selection__rendered {line-height: 30px;}
.tabcon1711 .select2-container--default .select2-selection--single .select2-selection__arrow {height:30px;}
.tabcon1711 .select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.tabcon1711 .select2-results__option[aria-selected] {font-size:12px;}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">推广补链查看</h3>
<p class="description_text">说明:此处功能用于修改玩家所属推广渠道的功能。</p>
</div>
<div class="tab-content tabcon1711">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l noticeinfo">用户账号</td>
<td class="r table_radio">
<input name="account" value="{:get_promote_name($data['promote_id'])}" disabled readonly type="text" class="">
</td>
</tr>
<tr>
<td class="l noticeinfo">修改前渠道</td>
<td class="r table_radio">
<input name="old_promote_id" value="{:get_promote_name($data['from_promote_id'])}" disabled readonly type="text" class="">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">补链后渠道</td>
<td class="r table_radio">
<input name="old_promote_id" value="{:get_promote_name($data['to_promote_id'])}" disabled readonly type="text" class="">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">订单日期:</td>
<td class="r table_radio">
<input type="text" readonly value="{$data['order_time']}" placeholder="订单日期" />
</td>
</tr>
<tr>
<td class="l noticeinfo">换绑类型</td>
<td class="r table_radio">
<input name="bind_type" value="1" type="radio">In
<input name="bind_type" value="2" type="radio">Out
</td>
</tr>
<tr>
<td class="l noticeinfo">备注</td>
<td class="r table_radio">
<textarea name="remark" readonly class="txt_area1">{$data['remark']}</textarea>
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
<div class="form-item cf">
<button class="submit_btn mlspacing" id="submit" data-id="{$data.id}">
取消补链
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
返回
</a>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Mend/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
var start = $("#bind_time").val();
$('#bind_time').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true
});
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
//导航高亮
highlight_subnav('{:U('Mend/lists')}');
Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"});
$('#submit').click(function(){
//获取id
var taskid = $(this).data("id");
window.location.href = "{:U('Mend/cancelShift')}"+"&id="+taskid;
});
$(function(){
$('.time').datetimepicker({
format: 'yyyy-mm-dd hh:ii',
language:"zh-CN",
minView:2,
autoclose:true
});
$('.date').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true
});
showTab();
});
</script>
</block>

@ -2834,3 +2834,23 @@ function index_by_column($column, $items)
} }
return $records; return $records;
} }
/**
* [获取用户是否补链中]
* @param integer $user_id [description]
* @return bool
*/
function getIsTask($user_id){
$shift = M("shift_task");
$map=array(
"status"=>0,
"shift_ids"=>array("LIKE","%\"{$user_id}\"%")
);
$shiftres = $shift->field("id")->where($map)->find();
if(empty($shiftres)){
return 0;
}else{
return $shiftres['id'];
}
}

@ -339,3 +339,6 @@ CREATE TABLE `tab_spend_user_count` (
-- 2019-11-6 cxj -- 2019-11-6 cxj
ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`; ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`;
ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`; ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`;
INSERT INTO `sys_menu` (`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('补链详情', '192', '0', 'Mend/shiftInfo', '0', '', '推广补链', '0', '1');

Loading…
Cancel
Save