diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php
index 9b749034f..3664cde6a 100644
--- a/Application/Admin/Common/function.php
+++ b/Application/Admin/Common/function.php
@@ -775,14 +775,4 @@ function camelize($str, $separator = '_', $littleHump = false)
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 '未知';
}
\ No newline at end of file
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 22631c5e9..ecc99b178 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -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);
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index 3bc44d840..f059ca622 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -45,7 +45,9 @@
-
+
+
+
+
+
+
+
+
+
@@ -149,6 +169,10 @@
推广员账号 |
结算单号 |
结算金额 |
+ 操作人 |
+ 操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
结算开始时间 |
结算截止时间 |
提现时间 |
@@ -161,22 +185,42 @@
- |
- {$record.promote_account} |
- {$record.widthdraw_number} |
- {$record.sum_money} |
- {$record.settlement_begin_time} |
- {$record.settlement_end_time} |
- {$record.create_time} |
- {$record.status_text} |
- {$record.respond} |
- |
+ {$record.promote_account} |
+ {$record.widthdraw_number} |
+ {$record.sum_money} |
+
+
+ {:get_promote_name($record['op_id'])}
+
+ {:getAdminNickname($record['op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($record['op_type'])} |
+
+
+ {:get_promote_name($record['last_op_id'])}
+
+ {:getAdminNickname($record['last_op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($record['last_op_type'])} |
+ {$record.settlement_begin_time} |
+ {$record.settlement_end_time} |
+ {$record.create_time} |
+ {$record.status_text} |
+ {$record.respond} |
+
+
+ 汇款证明
+
+ 重新审核
+
+
+ 撤销提现
+
+ |
-
- 汇总 |
- 当页结算:{$total}元 ; 今日结算:{$ttotal}元 ; 昨日结算:{$ytotal}元 ; 累计结算:{$ztotal}元 |
-
@@ -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});
+ }
+ });
+ });
+ });
diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html
index 204c990a7..326afd8e5 100644
--- a/Application/Admin/View/Query/withdraw.html
+++ b/Application/Admin/View/Query/withdraw.html
@@ -118,6 +118,8 @@
推广员账号 |
操作人 |
操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
结算开始时间 |
结算截止时间 |
申请时间 |
@@ -162,6 +164,14 @@
{:getPromoteWithdrawOpType($data['op_type'])} |
+
+
+ {:get_promote_name($data['last_op_id'])}
+
+ {:getAdminNickname($data['last_op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($data['last_op_type'])} |
{$data.settlement_begin_time|date='Y-m-d H:i:s',###}--- |
{$data.settlement_end_time|date='Y-m-d H:i:s',###}--- |
{$data.create_time|date='Y-m-d H:i:s',###}--- |
diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php
index 30fbe85f3..b45da22c6 100644
--- a/Application/Common/Common/function.php
+++ b/Application/Common/Common/function.php
@@ -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 '未知';
+}
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index c0c245b2e..8b2a1d423 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -414,7 +414,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 +426,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'] = '' . $list['status_name'] . '';
diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html
index 6ab8a8c20..4faee0fe9 100644
--- a/Application/Home/View/default/Finance/withdrawRecord.html
+++ b/Application/Home/View/default/Finance/withdrawRecord.html
@@ -149,7 +149,12 @@
提现订单 |
提现日期 |
+ 结算开始日期 |
结算截止日期 |
+ 操作人 |
+ 操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
收益金额 |
实际提现金额 |
提现状态 |
@@ -168,7 +173,12 @@
{$vo.widthdraw_number} |
{$vo.create_time} |
+ {$vo.settlement_begin_time} |
{$vo.settlement_end_time} |
+ {$vo.op_id} |
+ {$vo.op_type} |
+ {$vo.last_op_id} |
+ {$vo.last_op_type} |
{$vo.sum_money} |
{$vo.sum_money} |
{$vo.status_name} |
diff --git a/Data/update.sql b/Data/update.sql
index 15cae4410..9356224cc 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -924,4 +924,7 @@ ADD COLUMN `settlement_begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算开
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-管理员';
\ No newline at end of file
+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-管理员';
\ No newline at end of file