修改bug

master
ELF 5 years ago
parent 542ab35cad
commit 055e246f70

@ -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 = [];
$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);

@ -133,34 +133,35 @@
<!-- 列表 -->
<tbody>
<empty name ="promotes">
<empty name ="records">
<td colspan="14" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="promotes" id="data">
<volist name="records" id="data">
<tr data-id="<?=$data['id']?>">
<td>
<?php if($data['presidentDeposit'] && in_array($data['presidentDeposit']['payer'], [0, 1])):?>
<?php if($data['has_record'] && in_array($data['status'], [0, 1])):?>
<input class="ids" type="checkbox" value="{$data['id']}" name="ids[]">
<?php else:?>
<input class="ids disabled" disabled="disabled" type="checkbox" value="{$data['id']}" name="ids[]">
<?php endif;?>
</td>
<td>{$data.company.company_name}</td>
<td>{$data.company_name}</td>
<td>{$data.account}</td>
<td><?=$companyTypes[$data['company_belong']]?></td>
<?php if($data['presidentDeposit']):?>
<td><?=$data['presidentDeposit']['payer']?></td>
<td><?=$payWays[$data['presidentDeposit']['pay_way']] ?? '--'?></td>
<td><?=$data['presidentDeposit']['pay_account']?></td>
<td><?=$payTypes[$data['presidentDeposit']['pay_type']] ?? '--'?></td>
<td><?=date('Y-m-d H:i:s', $data['presidentDeposit']['create_time'])?></td>
<td><?=$data['presidentDeposit']['amount']?></td>
<td><?=date('Y-m-d H:i:s', $data['promoteBelong']['verify_time'])?></td>
<td><?=$statusList[$data['presidentDeposit']['status']]?></td>
<td><?=date('Y-m-d H:i:s', $data['presidentDeposit']['pay_confirm_time'])?></td>
<td>{$data.company_belong_text}</td>
<td>{$data.payer}</td>
<td>{$data.pay_way_text}</td>
<td>{$data.pay_account}</td>
<td>{$data.pay_type_text}</td>
<td>{$data.create_time}</td>
<td>{$data.amount}</td>
<td>{$data.verify_time}</td>
<td>{$data.status_text}</td>
<td>{$data.pay_confirm_time}</td>
<?php if($data['has_record']):?>
<td>
<div class="partakebtn">
<?php if($data['presidentDeposit']['status'] == 0):?>
<?php if($data['status'] == 0):?>
<a href="<?=U('edit', ['id' => $data['id']])?>">编辑</a>
<a class="delete-btn">删除</a>
<?php else:?>
@ -169,15 +170,6 @@
</div>
</td>
<?php else:?>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>
<div class="partakebtn">
<a href="<?=U('edit', ['id' => $data['id']])?>">收取押金</a>

@ -1013,6 +1013,14 @@ class ApplyController extends BaseController
{
if ($_POST['game_id']) {
$loginPromote = $this->getLoginPromote();
$promoteService = new PromoteService();
if (!$promoteService->canPresidentApplyGame($loginPromote)) {
$this->ajaxReturn([
'status' => 0,
'msg' => '请联系市场专员开启',
]);
}
$gameMap['tab_game.id'] = $_POST['game_id'];
$promoteId = I('promote_id');
@ -1614,8 +1622,19 @@ class ApplyController extends BaseController
$this->ajaxReturn($data);
}
function getGameInfo()
public function getGameInfo()
{
$promote = $this->getLoginPromote();
$promoteService = new PromoteService();
if (!$promoteService->canPresidentApplyGame($promote)) {
$this->ajaxReturn([
'status' => 0,
'message' => '请联系市场专员开启',
'data' => [
]
]);
}
$gameId = I('game_id');
$promoteType = I('promote_type');
$gameData = array();
@ -1648,7 +1667,11 @@ class ApplyController extends BaseController
$data['game_data'] = $gameData;
$data['promote_data'] = $newPromoteData;
$this->ajaxReturn($data);
$this->ajaxReturn([
'status' => 1,
'message' => '获取成功',
'data' => $data
]);
}
function addGameToPromote()

@ -678,8 +678,12 @@
url: "__URL__/getGameInfo",
dataType: "json",
data: {'game_id': gameId,'promote_type':promoteType},
success: function (data) {
success: function (res) {
if (res.status == 0) {
layer.msg(res.message, {icon: 2});
return;
}
var data = res.data;
$('#add_game_name').text(data.game_data.game_name);
$('#add_game_id').val(data.game_data.id);
$('#add_game_features').text(data.game_data.features);

Loading…
Cancel
Save