diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php index 7c22661bc..20aaa4397 100644 --- a/Application/Admin/Controller/PresidentDepositController.class.php +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -218,14 +218,18 @@ class PresidentDepositController extends ThinkController $promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find(); - if (!$record) { + if ($payType == 0) { + return $this->error('请选择押金付款方式'); + } + if ($payType == 3) { + $this->handleNoDeposit($promoteId); + return $this->success('保存成功', U('records')); + } + if ($payType != 2 && $payWay == 0) { + return $this->error('请选择付款方式'); + } - if ($payType == 0) { - return $this->error('请选择押金付款方式'); - } - if ($payType != 2 && $payWay == 0) { - return $this->error('请选择付款方式'); - } + if (!$record) { if ($amount !== '') { if (!is_numeric($amount)) { return $this->error('请输入正确金额'); @@ -250,8 +254,7 @@ class PresidentDepositController extends ThinkController M('president_deposit', 'tab_')->add($data); addOperationLog(['op_type'=>0,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'新增会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']); - - return $this->success('保存成功', U('PresidentDeposit/records')); + return $this->success('保存成功', U('records')); } /* if ($record['status'] != 0) { @@ -278,6 +281,8 @@ class PresidentDepositController extends ThinkController } $data = []; + $data['pay_way'] = $payType == 2 ? 4 : $payWay; + $data['pay_type'] = $payType; $data['pay_account'] = $payAccount; $data['amount'] = floatval($amount); $data['payer'] = $payer; @@ -286,7 +291,7 @@ class PresidentDepositController extends ThinkController addOperationLog(['op_type'=>1,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']); - return $this->success('保存成功'); + return $this->success('保存成功', U('records')); } public function delete() @@ -302,28 +307,34 @@ class PresidentDepositController extends ThinkController ]); } - public function noDeposit() + public function handleNoDeposit($promoteId) { - $promoteId = I('id', 0); $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); + $data = []; + $data['pay_way'] = 0; + $data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE; + $data['pay_account'] = ''; + $data['amount'] = 0; + $data['payer'] = ''; + $data['create_time'] = time(); + $data['update_time'] = time(); + if (!$record) { - $data = []; - $data['pay_way'] = 0; - $data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE; $data['promote_id'] = $promoteId; - $data['pay_account'] = ''; - $data['amount'] = 0; - $data['payer'] = ''; - $data['create_time'] = time(); - $data['update_time'] = time(); M('president_deposit', 'tab_')->add($data); - - $promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find(); - - addOperationLog(['op_type'=>1,'key'=>$promoteData['account'],'op_name'=>'编辑无需押金','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-无需押金']); - + } else { + M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data); } + + $promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find(); + addOperationLog(['op_type'=>1,'key'=>$promoteData['account'],'op_name'=>'编辑无需押金','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-无需押金']); + } + + public function noDeposit() + { + $promoteId = I('id', 0); + $this->handleNoDeposit($promoteId); $this->ajaxReturn([ 'status' => 1, 'message' => '操作成功' diff --git a/Application/Admin/View/PresidentDeposit/form.html b/Application/Admin/View/PresidentDeposit/form.html index 1a014beef..5912f2511 100644 --- a/Application/Admin/View/PresidentDeposit/form.html +++ b/Application/Admin/View/PresidentDeposit/form.html @@ -90,7 +90,7 @@