master
chenxiaojun 5 years ago
commit 73537c120e

@ -776,13 +776,3 @@ function unCamelize($str, $separator = '_')
{
return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str));
}
//获取管理员账号
function getAdminNickname($adminId)
{
$adminId = intval($adminId);
if ($adminId) {
return M('member')->where(array('id' => $adminId))->getField('nickname');
}
return '未知';
}

@ -1034,4 +1034,11 @@ public function auto_rrdae(){
];
return $ret;
}
//会长提现
public function promoteWithdraw()
{
$promoteMap['level'] = 1;
$promotes = M('promote', 'tab_')->where();
}
}

@ -146,7 +146,7 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
if ($save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) {
if ($promoteGameRatio['status'] == -1 || $save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) {
$promoteId = $promoteGameRatio['promote_id'];
$this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据

@ -2,6 +2,7 @@
namespace Admin\Controller;
use Home\Controller\FileController;
use User\Api\UserApi as UserApi;
use Admin\Model\WithdrawModel;
@ -123,8 +124,11 @@ class QueryController extends ThinkController
$this->display();
}
} elseif ($group == 2) {
$map = '1 = 1';
$map['_string'] = '1 = 1';
$createTime = strtotime(I('create_time', ''));
$withdrawNumber = I('widthdraw_number', '');
$status = intval(I('status', ''));
$opType = intval(I('op_type', 0));
if ($createTime) {
$createTimeEnd = $createTime + 3600 * 24 - 1;
$map['create_time'] = ['between', [$createTime, $createTimeEnd]];
@ -132,11 +136,27 @@ class QueryController extends ThinkController
if ($promoteId) {
$map['promote_id'] = $promoteId;
}
if ($withdrawNumber) {
$map['widthdraw_number'] = ['like', "{$withdrawNumber}%"];
}
if (isset($_REQUEST['status'])) {
$map['status'] = $status;
}
if ($opType) {
$map['op_type'] = $opType;
}
$records = M('withdraw', 'tab_')->where($map)->select();
$records = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
->where($map)
->order('')
->page($page, $row)
->select();
$count = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
->where($map)
->count();
if (!empty($records)) {
foreach ($records as &$record) {
$record['settlement_begin_time'] = date('Y-m-d H:i:s', $record['settlement_begin_time']);
$record['settlement_begin_time'] = $record['settlement_begin_time'] ? date('Y-m-d H:i:s', $record['settlement_begin_time']) : '--';
$record['settlement_end_time'] = date('Y-m-d H:i:s', $record['settlement_end_time']);
$record['create_time'] = date('Y-m-d H:i:s', $record['create_time']);
$record['status_text'] = promoteWithdrawStatus($record['status']);
@ -146,6 +166,10 @@ class QueryController extends ThinkController
}
}
$page = set_pagination($count, $row);
if($page) {
$this->assign('_page', $page);
}
$this->assign('records', $records);
$this->display();
}
@ -229,6 +253,8 @@ class QueryController extends ThinkController
$add['spend_ids'] = '';
$add['op_id'] = is_login();
$add['op_type'] = 2;
$add['last_op_id'] = $add['op_id'];
$add['last_op_type'] = 2;
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
@ -259,6 +285,98 @@ class QueryController extends ThinkController
$this->ajaxReturn($data);
}
public function renewReview()
{
$id = intval(I('id', 0));
$data = M('withdraw', 'tab_')->find($id);
if (empty($data) || $data['status'] != -1) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$save['id'] = $id;
$save['status'] = 0;
$save['last_up_update_time'] = time();
$save['last_op_id'] = is_login();
$save['last_op_type'] = 2;
$res = M('withdraw', 'tab_')->save($save);
if ($res === false) {
$data['status'] = 0;
$data['msg'] = '提交失败';
} else {
$data['status'] = 1;
$data['msg'] = '提交成功';
}
$this->ajaxReturn($data);
}
public function cancelWithdraw()
{
$id = intval(I('id', 0));
$data = M('withdraw', 'tab_')->find($id);
if (empty($data) || !in_array($data['status'], [-1, 0])) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$spendMap['withdraw_id'] = $id;
$spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true);
if (empty($spendIds)) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$spendIds = implode(',', $spendIds);
$time = time();
$withdrawSave['id'] = $id;
$withdrawSave['status'] = -2;
$withdrawSave['spend_ids'] = $spendIds;
$withdrawSave['last_up_update_time'] = $time;
$withdrawSave['last_op_id'] = is_login();
$withdrawSave['last_op_type'] = 2;
M('withdraw', 'tab_')->startTrans();//开启事物
$withdrawRes = M('withdraw', 'tab_')->save($withdrawSave);
if ($withdrawRes === false) {
M('withdraw', 'tab_')->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '撤销失败';
$this->ajaxReturn($data);
}
$spendSave['selle_status'] = 0;
$spendSave['withdraw_id'] = 0;
$spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave);
if ($spendRes === false) {
M('withdraw', 'tab_')->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '撤销失败';
} else {
M('withdraw', 'tab_')->commit();//事物提交
$data['status'] = 1;
$data['msg'] = '撤销成功';
}
$this->ajaxReturn($data);
}
public function downloadProve()
{
$id = intval(I('id', 0));
if ($id) {
$withdraw = M('withdraw', 'tab_')->find($id);
if (empty($withdraw) || $withdraw['status'] != 2 || !$withdraw['transfer_proof']) {
$this->error('网络异常');
}
$file = new FileController();
$file->download($withdraw['transfer_proof']);
} else {
$this->error('参数异常');
}
}
public function cpsettlement($p = 0)
{
$page = intval($p);

@ -45,7 +45,9 @@
<div class="cf top_nav_list">
<div class="fl button_list">
<div class="tools">
<a id="withdraw"><span class="button_icon button_icon10"></span>提 现</a>
<if condition="I('group') eq 1 or $group eq 1">
<a id="withdraw"><span class="button_icon button_icon10"></span>提 现</a>
</if>
</div>
</div>
@ -85,7 +87,25 @@
</div>
</if>
<if condition="I('group') eq 2 or $group eq 2">
<div class="input-list">
<input type="text" name="widthdraw_number" class="" value="{:I('widthdraw_number')}" placeholder="提现单号">
</div>
<div class="input-list">
<select name="status" class="select_gallery">
<option value="">提现状态</option>
<?php foreach (promoteWithdrawStatus() as $key => $value) :?>
<option value="<?=$key?>"><?=$value?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<select name="op_type" class="select_gallery">
<option value="">操作人类型</option>
<?php foreach (getPromoteWithdrawOpType() as $key => $value) :?>
<option value="<?=$key?>"><?=$value?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Query/settlement?group=2','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
@ -149,6 +169,10 @@
<th>推广员账号</th>
<th>结算单号</th>
<th>结算金额</th>
<th>操作人</th>
<th>操作人类型</th>
<th>最后操作人</th>
<th>最后操作人类型</th>
<th>结算开始时间</th>
<th>结算截止时间</th>
<th>提现时间</th>
@ -161,22 +185,42 @@
<tbody>
<volist name="records" id="record">
<tr>
<td></td>
<td>{$record.promote_account}</td>
<td>{$record.widthdraw_number}</td>
<td>{$record.sum_money}</td>
<td>{$record.settlement_begin_time}</td>
<td>{$record.settlement_end_time}</td>
<td>{$record.create_time}</td>
<td>{$record.status_text}</td>
<td>{$record.respond}</td>
<td></td>
<td>{$record.promote_account}</td>
<td>{$record.widthdraw_number}</td>
<td>{$record.sum_money}</td>
<td>
<if condition="$record.op_type eq 1">
{:get_promote_name($record['op_id'])}
<else />
{:getAdminNickname($record['op_id'])}
</if>
</td>
<td>{:getPromoteWithdrawOpType($record['op_type'])}</td>
<td>
<if condition="$record.last_op_type eq 1">
{:get_promote_name($record['last_op_id'])}
<else />
{:getAdminNickname($record['last_op_id'])}
</if>
</td>
<td>{:getPromoteWithdrawOpType($record['last_op_type'])}</td>
<td>{$record.settlement_begin_time}</td>
<td>{$record.settlement_end_time}</td>
<td>{$record.create_time}</td>
<td>{$record.status_text}</td>
<td>{$record.respond}</td>
<td>
<if condition="$record['status'] eq 2">
<a href="{:U('downloadProve', ['id'=>$record['id']])}">汇款证明</a>
<elseif condition="$record['status'] eq -1"/>
<span class="renew-review" data-id="{$record['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>
</if>
<if condition="$record['status'] eq -1 or $record['status'] eq 0">
<span class="cancel-withdraw" data-id="{$record['id']}" style="color: red;cursor: pointer;">撤销提现</span>
</if>
</td>
</tr>
</volist>
<tr class="data_summary">
<td>汇总</td>
<td colspan="10">当页结算:{$total}元 今日结算:{$ttotal}元 昨日结算:{$ytotal}元 累计结算:{$ztotal}元</td>
</tr>
</tbody>
</table>
</if>
@ -239,7 +283,8 @@
var url = $(this).attr('url');
var query = $('.top_nav_list').find('input').serialize();
var promoteId = $('#promote_id').val();
if (promoteId == '') {
var group = parseInt("{$group}");
if (promoteId == '' && group === 1) {
layer.msg('请选择推广员', {time: 1000});
return false;
}
@ -378,5 +423,58 @@
});
});
});
$('.renew-review').click(function () {
var id = parseInt($(this).attr('data-id'));
$.ajax({
type: 'post',
url: '{:U("renewReview")}',
dataType: 'json',
data: {id:id},
success: function (data) {
if (data.status == 1) {
layer.msg(data.msg, {icon: 1});
setTimeout(function(){
window.location.reload();
},2000);
} else {
layer.msg(data.msg, {icon: 5});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
$('.cancel-withdraw').click(function () {
var id = parseInt($(this).attr('data-id'));
var msg = "确定要撤销提现吗?";
layer.confirm(msg, {
title: '提示',
btn: ['确定', '取消'],
}, function () {
$.ajax({
type: 'post',
url: '{:U("cancelWithdraw")}',
dataType: 'json',
data: {id:id},
success: function (data) {
if (data.status == 1) {
layer.msg(data.msg, {icon: 1});
setTimeout(function(){
window.location.reload();
},2000);
} else {
layer.msg(data.msg, {icon: 5});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
});
</script>
</block>

@ -118,6 +118,8 @@
<th>推广员账号</th>
<th>操作人</th>
<th>操作人类型</th>
<th>最后操作人</th>
<th>最后操作人类型</th>
<th>结算开始时间</th>
<th>结算截止时间</th>
<th><a class="paixu" data-order='create_time'>申请时间</a></th>
@ -162,6 +164,14 @@
</if>
</td>
<td>{:getPromoteWithdrawOpType($data['op_type'])}</td>
<td>
<if condition="$data.last_op_type eq 1">
{:get_promote_name($data['last_op_id'])}
<else />
{:getAdminNickname($data['last_op_id'])}
</if>
</td>
<td>{:getPromoteWithdrawOpType($data['last_op_type'])}</td>
<td><notempty name="data.settlement_begin_time">{$data.settlement_begin_time|date='Y-m-d H:i:s',###}<else />---</notempty></td>
<td><notempty name="data.settlement_end_time">{$data.settlement_end_time|date='Y-m-d H:i:s',###}<else />---</notempty></td>
<td><notempty name="data.create_time">{$data.create_time|date='Y-m-d H:i:s',###}<else />---</notempty></td>

@ -1454,3 +1454,12 @@ function getPromoteWithdrawOpType($opType = null)
}
}
//获取管理员账号
function getAdminNickname($adminId)
{
$adminId = intval($adminId);
if ($adminId) {
return M('member')->where(array('id' => $adminId))->getField('nickname');
}
return '未知';
}

@ -284,6 +284,7 @@ class FinanceController extends BaseController
//提现
public function withdraw()
{
$this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码
@ -414,7 +415,7 @@ class FinanceController extends BaseController
}
}
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof')
$data = $model->field('id, widthdraw_number, create_time, settlement_begin_time, settlement_end_time, sum_money, status, respond, transfer_proof, op_id, op_type, last_op_id, last_op_type')
->where($map)
->order('id desc')
->page($page, $row)
@ -426,8 +427,13 @@ class FinanceController extends BaseController
if (!empty($data)) {
foreach ($data as &$list) {
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
$list['settlement_begin_time'] = $list['settlement_begin_time'] ? date('Y-m-d H:i:s', $list['settlement_begin_time']) : '--';
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
$list['op_id'] = ($list['op_type'] == 1) ? get_promote_name($list['op_id']) : getAdminNickname($list['op_id']);
$list['last_op_id'] = ($list['last_op_type'] == 1) ? get_promote_name($list['last_op_id']) : getAdminNickname($list['last_op_id']);
$list['op_type'] = getPromoteWithdrawOpType($list['op_type']);
$list['last_op_type'] = getPromoteWithdrawOpType($list['last_op_type']);
switch ($list['status']) {
case -2:
$list['status_name'] = '<span style="color: #bbbaba;">' . $list['status_name'] . '</span>';
@ -584,6 +590,7 @@ class FinanceController extends BaseController
//审核拒绝 重新审核
public function renewReview()
{
$this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码
@ -624,6 +631,7 @@ class FinanceController extends BaseController
//撤销提现
public function cancelWithdraw()
{
$this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码

@ -35,7 +35,7 @@
</ul>
</div>
<div style="margin-top: 2.4vh;">
<button class="withdraw" id="withdraw">提现</button>
<!-- <button class="withdraw" id="withdraw">提现</button>-->
</div>
<div class="page-list promote-index-list promote-index-list-news">
<div class="trunk-title-main"><span>{$meta_title}</span></div>

@ -149,7 +149,12 @@
<tr class="odd">
<th>提现订单</th>
<th>提现日期</th>
<th>结算开始日期</th>
<th>结算截止日期</th>
<th>操作人</th>
<th>操作人类型</th>
<th>最后操作人</th>
<th>最后操作人类型</th>
<th>收益金额</th>
<th>实际提现金额</th>
<th>提现状态</th>
@ -168,7 +173,12 @@
<tr class="num2">
<td>{$vo.widthdraw_number}</td>
<td>{$vo.create_time}</td>
<td>{$vo.settlement_begin_time}</td>
<td>{$vo.settlement_end_time}</td>
<td>{$vo.op_id}</td>
<td>{$vo.op_type}</td>
<td>{$vo.last_op_id}</td>
<td>{$vo.last_op_type}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.status_name}</td>
@ -178,11 +188,11 @@
<if condition="$vo['status'] eq 2">
<a data-href="{:U('download/Remittancecer',['id'=>$vo['id']])}" class="ajax-get">汇款证明</a>
<elseif condition="$vo['status'] eq -1"/>
<span class="renew-review" data-id="{$vo['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>
<!-- <span class="renew-review" data-id="{$vo['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>-->
</if>
<a href="{:U('settlementOrder', array('id'=>$vo['id']))}">结算单</a>
<if condition="$vo['status'] eq -1 or $vo['status'] eq 0">
<span class="cancel-withdraw" data-id="{$vo['id']}" style="color: red;cursor: pointer;">撤销提现</span>
<!-- <span class="cancel-withdraw" data-id="{$vo['id']}" style="color: red;cursor: pointer;">撤销提现</span>-->
</if>
</td>
</tr>

@ -925,3 +925,6 @@ ALTER TABLE `tab_withdraw`
ADD COLUMN `op_id` int(11) NOT NULL DEFAULT 0 COMMENT '操作id';
ALTER TABLE `tab_withdraw`
ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人1-推广员 2-管理员';
ALTER TABLE `tab_withdraw`
ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id',
ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人1-推广员 2-管理员';
Loading…
Cancel
Save