|
|
|
@ -15,6 +15,7 @@ class FinanceController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
//提现状态
|
|
|
|
|
public static $withdrawStatus = [
|
|
|
|
|
-2 => '已撤销',
|
|
|
|
|
-1 => '审核未通过',
|
|
|
|
|
0 => '待审核',
|
|
|
|
|
1 => '汇款中',
|
|
|
|
@ -200,7 +201,7 @@ class FinanceController extends BaseController
|
|
|
|
|
$map['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_GET['status'])) {
|
|
|
|
|
if ($status == -2) {
|
|
|
|
|
if ($status == -99) {
|
|
|
|
|
$map['selle_status'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$withdrawMap['promote_id'] = $this->loginPromote['id'];
|
|
|
|
@ -277,8 +278,7 @@ class FinanceController extends BaseController
|
|
|
|
|
//是否是会长
|
|
|
|
|
$this->purview();
|
|
|
|
|
//验证安全密码
|
|
|
|
|
$metaTitle = '结算明细';
|
|
|
|
|
$modelList = ['财务管理', $metaTitle];
|
|
|
|
|
$modelList = [];
|
|
|
|
|
$res = $this->verifyPasswordView($modelList, false);
|
|
|
|
|
if ($res == false) {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
@ -329,6 +329,7 @@ class FinanceController extends BaseController
|
|
|
|
|
$add['status'] = 0;
|
|
|
|
|
$add['widthdraw_number'] = $this->produceWithdrawNumber();
|
|
|
|
|
$add['settlement_end_time'] = $thisDay - 1;
|
|
|
|
|
$add['spend_ids'] = '';
|
|
|
|
|
|
|
|
|
|
M()->startTrans();//开启事物
|
|
|
|
|
$withdrawId = M('withdraw', 'tab_')->add($add);
|
|
|
|
@ -399,12 +400,10 @@ class FinanceController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
if (isset($_GET['status']) && $_GET['status'] !== '') {
|
|
|
|
|
$status = intval($_GET['status']);
|
|
|
|
|
if (!isset(FinanceController::$withdrawStatus[$status])) {
|
|
|
|
|
$this->error('参数异常');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset(FinanceController::$withdrawStatus[$status])) {
|
|
|
|
|
$map['status'] = $status;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof')
|
|
|
|
|
->where($map)
|
|
|
|
@ -420,8 +419,15 @@ class FinanceController extends BaseController
|
|
|
|
|
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
|
|
|
|
|
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
|
|
|
|
|
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
|
|
|
|
|
if ($list['status'] == -1) {
|
|
|
|
|
switch ($list['status']) {
|
|
|
|
|
case -2:
|
|
|
|
|
$list['status_name'] = '<span style="color: #bbbaba;">' . $list['status_name'] . '</span>';
|
|
|
|
|
break;
|
|
|
|
|
case -1:
|
|
|
|
|
$list['status_name'] = '<span style="color: red;">' . $list['status_name'] . '</span>';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -572,8 +578,7 @@ class FinanceController extends BaseController
|
|
|
|
|
//是否是会长
|
|
|
|
|
$this->purview();
|
|
|
|
|
//验证安全密码
|
|
|
|
|
$metaTitle = '结算明细';
|
|
|
|
|
$modelList = ['财务管理', $metaTitle];
|
|
|
|
|
$modelList = [];
|
|
|
|
|
$res = $this->verifyPasswordView($modelList, false);
|
|
|
|
|
if ($res == false) {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
@ -606,4 +611,69 @@ class FinanceController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
$this->ajaxReturn($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//撤销提现
|
|
|
|
|
public function cancelWithdraw()
|
|
|
|
|
{
|
|
|
|
|
//是否是会长
|
|
|
|
|
$this->purview();
|
|
|
|
|
//验证安全密码
|
|
|
|
|
$modelList = [];
|
|
|
|
|
$res = $this->verifyPasswordView($modelList, false);
|
|
|
|
|
if ($res == false) {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
|
$data['msg'] = '权限异常';
|
|
|
|
|
$this->ajaxReturn($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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);
|
|
|
|
|
}
|
|
|
|
|
if ($data['promote_id'] != $this->loginPromote['id']) {
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|