|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Home\Controller\FileController;
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
|
use Admin\Model\WithdrawModel;
|
|
|
|
use Admin\Model\WithdrawModel;
|
|
|
|
|
|
|
|
|
|
|
@ -123,8 +124,11 @@ class QueryController extends ThinkController
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif ($group == 2) {
|
|
|
|
} elseif ($group == 2) {
|
|
|
|
$map = '1 = 1';
|
|
|
|
$map['_string'] = '1 = 1';
|
|
|
|
$createTime = strtotime(I('create_time', ''));
|
|
|
|
$createTime = strtotime(I('create_time', ''));
|
|
|
|
|
|
|
|
$withdrawNumber = I('widthdraw_number', '');
|
|
|
|
|
|
|
|
$status = intval(I('status', ''));
|
|
|
|
|
|
|
|
$opType = intval(I('op_type', 0));
|
|
|
|
if ($createTime) {
|
|
|
|
if ($createTime) {
|
|
|
|
$createTimeEnd = $createTime + 3600 * 24 - 1;
|
|
|
|
$createTimeEnd = $createTime + 3600 * 24 - 1;
|
|
|
|
$map['create_time'] = ['between', [$createTime, $createTimeEnd]];
|
|
|
|
$map['create_time'] = ['between', [$createTime, $createTimeEnd]];
|
|
|
@ -132,11 +136,27 @@ class QueryController extends ThinkController
|
|
|
|
if ($promoteId) {
|
|
|
|
if ($promoteId) {
|
|
|
|
$map['promote_id'] = $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)) {
|
|
|
|
if (!empty($records)) {
|
|
|
|
foreach ($records as &$record) {
|
|
|
|
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['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['create_time'] = date('Y-m-d H:i:s', $record['create_time']);
|
|
|
|
$record['status_text'] = promoteWithdrawStatus($record['status']);
|
|
|
|
$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->assign('records', $records);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -229,6 +253,8 @@ class QueryController extends ThinkController
|
|
|
|
$add['spend_ids'] = '';
|
|
|
|
$add['spend_ids'] = '';
|
|
|
|
$add['op_id'] = is_login();
|
|
|
|
$add['op_id'] = is_login();
|
|
|
|
$add['op_type'] = 2;
|
|
|
|
$add['op_type'] = 2;
|
|
|
|
|
|
|
|
$add['last_op_id'] = $add['op_id'];
|
|
|
|
|
|
|
|
$add['last_op_type'] = 2;
|
|
|
|
|
|
|
|
|
|
|
|
M()->startTrans();//开启事物
|
|
|
|
M()->startTrans();//开启事物
|
|
|
|
$withdrawId = M('withdraw', 'tab_')->add($add);
|
|
|
|
$withdrawId = M('withdraw', 'tab_')->add($add);
|
|
|
@ -259,6 +285,98 @@ class QueryController extends ThinkController
|
|
|
|
$this->ajaxReturn($data);
|
|
|
|
$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)
|
|
|
|
public function cpsettlement($p = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$page = intval($p);
|
|
|
|
$page = intval($p);
|
|
|
|