|
|
|
@ -12,6 +12,8 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
{
|
|
|
|
|
public function records()
|
|
|
|
|
{
|
|
|
|
|
$page = I('p', 1);
|
|
|
|
|
$row = I('row', 10);
|
|
|
|
|
$companyType = I('company_type');
|
|
|
|
|
$payType = I('pay_type');
|
|
|
|
|
$status = I('status');
|
|
|
|
@ -48,7 +50,16 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
$query->where(['_string' => implode(' and ', $idStrWhere)]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$promotes = $query->select();
|
|
|
|
|
$promotes = [];
|
|
|
|
|
$count = 0;
|
|
|
|
|
if (I('export', 0) == 1) {
|
|
|
|
|
$promotes = $query->select();
|
|
|
|
|
} else {
|
|
|
|
|
$countQuery = clone $query;
|
|
|
|
|
$promotes = $query->page($page, $row)->select();
|
|
|
|
|
$count = $countQuery->count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']);
|
|
|
|
|
$promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id');
|
|
|
|
|
$relationQuery = M('president_deposit', 'tab_');
|
|
|
|
@ -63,11 +74,85 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
1 => '外团',
|
|
|
|
|
2 => '外团-分发联盟',
|
|
|
|
|
];
|
|
|
|
|
$this->assign('payWays', PresidentDepositService::$payWays);
|
|
|
|
|
$this->assign('payTypes', PresidentDepositService::$payTypes);
|
|
|
|
|
$payWays = PresidentDepositService::$payWays;
|
|
|
|
|
$payTypes = PresidentDepositService::$payTypes;
|
|
|
|
|
$statusList = PresidentDepositService::$statusList;
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
if (count($promotes) > 0) {
|
|
|
|
|
foreach ($promotes as $promote) {
|
|
|
|
|
$record = [
|
|
|
|
|
'id' => $promote['id'],
|
|
|
|
|
'company_name' => $promote['company'] ? $promote['company']['company_name'] : '',
|
|
|
|
|
'account' => $promote['account'],
|
|
|
|
|
'company_belong_text' => $companyTypes[$promote['company_belong']],
|
|
|
|
|
];
|
|
|
|
|
if ($promote['presidentDeposit']) {
|
|
|
|
|
$presidentDeposit = $promote['presidentDeposit'];
|
|
|
|
|
$promoteBelong = $promote['promoteBelong'];
|
|
|
|
|
if ($presidentDeposit['pay_type'] == 3) {
|
|
|
|
|
$record['payer'] = '--';
|
|
|
|
|
$record['pay_account'] = '--';
|
|
|
|
|
$record['amount'] = '--';
|
|
|
|
|
} else {
|
|
|
|
|
$record['payer'] = $presidentDeposit['payer'];
|
|
|
|
|
$record['pay_account'] = $presidentDeposit['pay_account'];
|
|
|
|
|
$record['amount'] = $presidentDeposit['amount'];
|
|
|
|
|
}
|
|
|
|
|
$record['pay_type_text'] = $payTypes[$presidentDeposit['pay_type']];
|
|
|
|
|
$record['pay_way_text'] = $payWays[$presidentDeposit['pay_way']] ?? '--';
|
|
|
|
|
$record['create_time'] = $presidentDeposit['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['create_time']);
|
|
|
|
|
$record['verify_time'] = $promoteBelong && $promoteBelong['verify_time'] != 0 ? date('Y-m-d H:i:s', $promoteBelong['verify_time']) : '--';
|
|
|
|
|
$record['pay_confirm_time'] = $presidentDeposit['pay_confirm_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['pay_confirm_time']);
|
|
|
|
|
$record['status_text'] = $statusList[$presidentDeposit['status']];
|
|
|
|
|
$record['has_record'] = true;
|
|
|
|
|
$record['status'] = $presidentDeposit['status'];
|
|
|
|
|
$record['pay_type'] = $presidentDeposit['pay_type'];
|
|
|
|
|
} else {
|
|
|
|
|
$record['payer'] = '--';
|
|
|
|
|
$record['pay_account'] = '--';
|
|
|
|
|
$record['amount'] = '--';
|
|
|
|
|
$record['pay_type_text'] = '--';
|
|
|
|
|
$record['pay_way_text'] = '--';
|
|
|
|
|
$record['create_time'] = '--';
|
|
|
|
|
$record['verify_time'] = '--';
|
|
|
|
|
$record['pay_confirm_time'] = '--';
|
|
|
|
|
$record['status_text'] = '--';
|
|
|
|
|
$record['has_record'] = false;
|
|
|
|
|
$record['status'] = 0;
|
|
|
|
|
$record['pay_type'] = 0;
|
|
|
|
|
}
|
|
|
|
|
$records[] = $record;
|
|
|
|
|
}
|
|
|
|
|
if (I('export', 0) == 1) {
|
|
|
|
|
$field = [
|
|
|
|
|
'company_name' => '所属推广公司',
|
|
|
|
|
'account' => '会长账号',
|
|
|
|
|
'company_belong_text' => '工会类型',
|
|
|
|
|
'payer' => '付款人',
|
|
|
|
|
'pay_way_text' => '付款方式',
|
|
|
|
|
'pay_account' => '账号',
|
|
|
|
|
'pay_type_text' => '押金类型',
|
|
|
|
|
'create_time' => '审批时间',
|
|
|
|
|
'amount' => '押金金额',
|
|
|
|
|
'verify_time' => '会长申请时间',
|
|
|
|
|
'status_text' => '押金状态',
|
|
|
|
|
'pay_confirm_time' => '押金确认时间',
|
|
|
|
|
];
|
|
|
|
|
data2csv($records, '会长押金记录', $field);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
|
|
if($page) {
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
|
$this->assign('payWays', $payWays);
|
|
|
|
|
$this->assign('payTypes', $payTypes);
|
|
|
|
|
$this->assign('companyTypes', $companyTypes);
|
|
|
|
|
$this->assign('statusList', PresidentDepositService::$statusList);
|
|
|
|
|
$this->assign('promotes', $promotes);
|
|
|
|
|
$this->assign('statusList', $statusList);
|
|
|
|
|
$this->assign('records', $records);
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -110,7 +195,7 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
$payType = I('pay_type', 0);
|
|
|
|
|
$promoteId = I('id', 0);
|
|
|
|
|
$payAccount = I('pay_account', '');
|
|
|
|
|
$amount = floatval(I('amount', 0));
|
|
|
|
|
$amount = I('amount', '');
|
|
|
|
|
$payer = I('payer', '');
|
|
|
|
|
|
|
|
|
|
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
|
|
|
|
@ -123,13 +208,24 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
if ($payWay == 0) {
|
|
|
|
|
return $this->error('请选择付款方式');
|
|
|
|
|
}
|
|
|
|
|
if ($amount !== '') {
|
|
|
|
|
if (!is_numeric($amount)) {
|
|
|
|
|
return $this->error('请输入正确金额');
|
|
|
|
|
}
|
|
|
|
|
if ($amount <= 0) {
|
|
|
|
|
return $this->error('金额必须大于0');
|
|
|
|
|
}
|
|
|
|
|
if ($amount > 100000000) {
|
|
|
|
|
return $this->error('金额过高');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
|
$data['pay_way'] = $payWay;
|
|
|
|
|
$data['pay_type'] = $payType;
|
|
|
|
|
$data['promote_id'] = $promoteId;
|
|
|
|
|
$data['pay_account'] = $payAccount;
|
|
|
|
|
$data['amount'] = $amount;
|
|
|
|
|
$data['amount'] = floatval($amount);
|
|
|
|
|
$data['payer'] = $payer;
|
|
|
|
|
$data['create_time'] = time();
|
|
|
|
|
$data['update_time'] = time();
|
|
|
|
@ -141,9 +237,18 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
return $this->error('该状态下不可编辑/修改');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($amount == 0) {
|
|
|
|
|
if ($amount === '') {
|
|
|
|
|
return $this->error('请输入金额');
|
|
|
|
|
}
|
|
|
|
|
if (!is_numeric($amount)) {
|
|
|
|
|
return $this->error('请输入正确金额');
|
|
|
|
|
}
|
|
|
|
|
if ($amount <= 0) {
|
|
|
|
|
return $this->error('金额必须大于0');
|
|
|
|
|
}
|
|
|
|
|
if ($amount > 100000000) {
|
|
|
|
|
return $this->error('金额过高');
|
|
|
|
|
}
|
|
|
|
|
if ($payer == '') {
|
|
|
|
|
return $this->error('请输入付款人');
|
|
|
|
|
}
|
|
|
|
@ -153,7 +258,7 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
|
$data['pay_account'] = $payAccount;
|
|
|
|
|
$data['amount'] = $amount;
|
|
|
|
|
$data['amount'] = floatval($amount);
|
|
|
|
|
$data['payer'] = $payer;
|
|
|
|
|
$data['update_time'] = time();
|
|
|
|
|
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
|
|
|
|
|