|
|
|
@ -135,6 +135,11 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
$idStrWhere[] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('admin_id', 0))) {
|
|
|
|
|
$query->where(['admin_id' => I('admin_id', 0)]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($idStrWhere) > 0) {
|
|
|
|
|
$query->where(['_string' => implode(' and ', array_unique($idStrWhere))]);
|
|
|
|
|
}
|
|
|
|
@ -151,7 +156,14 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 汇总金额
|
|
|
|
|
$total = M('president_deposit', 'tab_')->where(['promote_id'=>['in', $totalQuery->getField('id', true)]])->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount, sum(if(status = 2, amount, 0)) as refundedAmount')->find();
|
|
|
|
|
if (count($promotes) > 0 || (isset($count) && $count > 0)) {
|
|
|
|
|
$total = M('president_deposit', 'tab_')->where(['promote_id'=>['in', $totalQuery->getField('id', true)]])->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount, sum(if(status = 2, amount, 0)) as refundedAmount')->find();
|
|
|
|
|
} else {
|
|
|
|
|
$total = [
|
|
|
|
|
'totalamount' => 0, 'confirmedamount' => 0, 'refundedamount' => 0
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']);
|
|
|
|
|
$promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id');
|
|
|
|
@ -346,7 +358,18 @@ class PresidentDepositController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 市场部门无法操作押金退款和收到时间
|
|
|
|
|
if ((($record['pay_accept_time'] != $payAcceptTime) || ($record['refund_time'] != $refundTime)) && isMarketAdmin()) {
|
|
|
|
|
return $this->error('无法操作记录');
|
|
|
|
|
}
|
|
|
|
|
$data = [];
|
|
|
|
|
|
|
|
|
|
// 填写押金到账时间后自动变为押金已确认到账状态,并且状态在待确认时候
|
|
|
|
|
if ($record['pay_accept_time'] != $payAcceptTime && $record['status'] == 0) {
|
|
|
|
|
$data = ['status' => 1,
|
|
|
|
|
'pay_confirm_time' => time()];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['pay_way'] = $payType == 2 ? 4 : $payWay;
|
|
|
|
|
$data['pay_type'] = $payType;
|
|
|
|
|
$data['promote_id'] = $promoteId;
|
|
|
|
|