master
ELF 5 years ago
parent 42547128d4
commit 1a14ed8dc7

@ -23,7 +23,7 @@ class PresidentDepositController extends ThinkController
'_string' => '1=1', '_string' => '1=1',
'company_belong' => ['in', [1, 2]] 'company_belong' => ['in', [1, 2]]
]; ];
if ($companyId != '') { if ($companyId != 0) {
$where['id'] = $companyId; $where['id'] = $companyId;
} }
if ($companyType !== '') { if ($companyType !== '') {
@ -43,7 +43,6 @@ class PresidentDepositController extends ThinkController
$depositWhere['status'] = $status; $depositWhere['status'] = $status;
} }
} }
if (I('pay_confirm_time_start', '') != '') { if (I('pay_confirm_time_start', '') != '') {
$depositStrWhere .= ' and pay_confirm_time>=' . strtotime(I('pay_confirm_time_start') . ' 00:00:00'); $depositStrWhere .= ' and pay_confirm_time>=' . strtotime(I('pay_confirm_time_start') . ' 00:00:00');
} }
@ -65,6 +64,7 @@ class PresidentDepositController extends ThinkController
$depositStrWhere .= ' and pay_accept_time<=' . strtotime(I('pay_accept_time_end') . ' 23:59:59'); $depositStrWhere .= ' and pay_accept_time<=' . strtotime(I('pay_accept_time_end') . ' 23:59:59');
} }
$depositWhere['_string'] = $depositStrWhere;
if ($payType !== '') { if ($payType !== '') {
$depositWhere['pay_type'] = $payType; $depositWhere['pay_type'] = $payType;
} }
@ -83,7 +83,7 @@ class PresidentDepositController extends ThinkController
$companies = []; $companies = [];
if (I('export', 0) == 1 || $row == 'all') { if (I('export', 0) == 1 || $row == 'all') {
$companies = $query->select(); $companies = $query->select();
$count = count($promotes); $count = count($companies);
} else { } else {
$countQuery = clone $query; $countQuery = clone $query;
$companies = $query->page($page, $row)->select(); $companies = $query->page($page, $row)->select();
@ -92,7 +92,10 @@ class PresidentDepositController extends ThinkController
// 汇总金额 // 汇总金额
if (count($companies) > 0 || (isset($count) && $count > 0)) { if (count($companies) > 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(); $total = M('president_deposit', 'tab_')
->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount, sum(if(status = 2, amount, 0)) as refundedAmount')
->where(['company_id'=>['in', $totalQuery->getField('id', true)]])
->find();
$total = [ $total = [
'totalamount' => $total['totalamount'] ?? 0, 'confirmedamount' => $total['confirmedamount'] ?? 0, 'refundedamount' => $total['refundedamount'] ?? 0 'totalamount' => $total['totalamount'] ?? 0, 'confirmedamount' => $total['confirmedamount'] ?? 0, 'refundedamount' => $total['refundedamount'] ?? 0
]; ];
@ -121,8 +124,8 @@ class PresidentDepositController extends ThinkController
'company_name' => $company['company_name'], 'company_name' => $company['company_name'],
'company_belong_text' => $companyTypes[$company['company_belong']], 'company_belong_text' => $companyTypes[$company['company_belong']],
]; ];
if ($promote['presidentDeposit']) { if ($company['presidentDeposit']) {
$presidentDeposit = $promote['presidentDeposit']; $presidentDeposit = $company['presidentDeposit'];
if ($presidentDeposit['pay_type'] == PresidentDepositService::PAY_TYPE_NONE) { if ($presidentDeposit['pay_type'] == PresidentDepositService::PAY_TYPE_NONE) {
$record['payer'] = '--'; $record['payer'] = '--';
$record['pay_account'] = '--'; $record['pay_account'] = '--';
@ -228,11 +231,11 @@ class PresidentDepositController extends ThinkController
{ {
$this->meta_title = '编辑会长押金'; $this->meta_title = '编辑会长押金';
$id = I('id', 0); $id = I('id', 0);
$promote = M('promote', 'tab_')->field(['account', 'id'])->where(['id' => $id])->find(); $company = M('promote_company', 'tab_')->field(['company_name', 'id'])->where(['id' => $id])->find();
$record = M('president_deposit', 'tab_')->where(['promote_id' => $id])->find(); $record = M('president_deposit', 'tab_')->where(['company_id' => $id])->find();
$this->assign('payWays', PresidentDepositService::$payWays); $this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes); $this->assign('payTypes', PresidentDepositService::$payTypes);
$this->assign('promote', $promote); $this->assign('company', $company);
$this->assign('record', $record); $this->assign('record', $record);
$this->display('form'); $this->display('form');
} }
@ -241,133 +244,26 @@ class PresidentDepositController extends ThinkController
{ {
$this->meta_title = '查看会长押金'; $this->meta_title = '查看会长押金';
$id = I('id', 0); $id = I('id', 0);
$promote = M('promote', 'tab_')->field(['account', 'id'])->where(['id' => $id])->find(); $company = M('promote_company', 'tab_')->field(['company_name', 'id'])->where(['id' => $id])->find();
$record = M('president_deposit', 'tab_')->where(['promote_id' => $id])->find(); $record = M('president_deposit', 'tab_')->where(['company_id' => $id])->find();
$this->assign('payWays', PresidentDepositService::$payWays); $this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes); $this->assign('payTypes', PresidentDepositService::$payTypes);
$this->assign('promote', $promote); $this->assign('company', $company);
$this->assign('record', $record); $this->assign('record', $record);
$this->display('show'); $this->display('show');
} }
public function save() public function save()
{ {
$payWay = I('pay_way', 0); $params = I('post.');
$payType = I('pay_type', 0); try {
$promoteId = I('id', 0); $record = M('president_deposit', 'tab_')->where(['company_id' => $id])->find();
$payAccount = I('pay_account', ''); $service = new PresidentDepositService();
$amount = I('amount', ''); $service->save($params);
$payer = I('payer', ''); $this->success('保存成功');
$payAcceptTime = I('pay_accept_time', 0) ? strtotime(I('pay_accept_time')): 0; } catch (\Exception $e) {
$refundTime = I('refund_time', 0) ? strtotime(I('refund_time')): 0; $this->error($e->getMessage());
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
$promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find();
// 市场部门无法操作押金退款和收到时间
if ((($record['pay_accept_time'] != $payAcceptTime) || ($record['refund_time'] != $refundTime)) && isMarketAdmin()) {
return $this->error('无法操作记录');
} }
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 (!$record) {
if ($amount !== '') {
if (!is_numeric($amount)) {
return $this->error('请输入正确金额');
}
if ($amount <= 0) {
return $this->error('金额必须大于0');
}
if ($amount > 100000000) {
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;
$data['pay_account'] = $payAccount;
$data['amount'] = floatval($amount);
$data['payer'] = $payer;
$data['create_time'] = time();
$data['update_time'] = time();
$data['pay_accept_time'] = $payAcceptTime;
$data['refund_time'] = $refundTime;
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('records'));
}
/* if ($record['status'] != 0) {
return $this->error('该状态下不可编辑/修改');
} */
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('请输入付款人');
}
if ($payAccount == '') {
return $this->error('请输入付款账号');
} */
$data = [];
// 切换类型
if ($payType != $record['pay_type']) {
$payStatus = 0;
$data['refund_time'] = $data['pay_accept_time'] = $data['pay_confirm_time'] = 0;
} else {
$data['pay_accept_time'] = $payAcceptTime;
$data['refund_time'] = $refundTime;
}
$data['pay_way'] = $payType == 2 ? 4 : $payWay;
$data['pay_type'] = $payType;
$data['pay_account'] = $payAccount;
$data['amount'] = floatval($amount);
$data['status'] = $payStatus ?? $record['status'];
$data['payer'] = $payer;
$data['update_time'] = time();
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
addOperationLog(['op_type'=>1,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']);
return $this->success('保存成功', U('records'));
} }
public function delete() public function delete()
@ -389,163 +285,65 @@ class PresidentDepositController extends ThinkController
]); ]);
} }
/**
* 处理无需押金
*/
public function handleNoDeposit($promoteId)
{
$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['status'] = 1;
$data['pay_confirm_time'] = time();
$data['create_time'] = time();
$data['update_time'] = time();
$data['status'] = 1;
$data['pay_accept_time'] = $data['refund_time'] = 0;
$data['promote_id'] = $promoteId;
if (!$record) {
M('president_deposit', 'tab_')->add($data);
} 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() public function noDeposit()
{ {
$promoteId = I('id', 0); $id = I('id', 0);
$this->handleNoDeposit($promoteId); $company = M('promote_company', 'tab_')->where(['id' => $id])->find();
$this->ajaxReturn([ if (is_null($company)) {
'status' => 1,
'message' => '操作成功'
]);
}
public function refund()
{
if (isMarketAdmin()) {
return $this->error('无法操作记录');
}
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '无选中项' 'message' => '推广公司不存在'
]); ]);
} }
try {
$checkStatus = true; $record = M('president_deposit', 'tab_')->where(['company_id' => $id])->find();
$records = M('president_deposit', 'tab_')->field(['id', 'status'])->where(['promote_id' => ['in', $promoteIds]])->select(); $service = new PresidentDepositService();
foreach ($records as $record) { $service->handleNoDeposit($company, $record);
if ($record['status'] != 1) { $this->ajaxReturn([
$checkStatus = false; 'status' => 1,
break; 'message' => '操作成功'
} ]);
} } catch (\Exception $e) {
if (!$checkStatus) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '含有非已到账状态记录,不可批量操作' 'message' => $e->getMessage()
]); ]);
} }
$promoteData = M('promote','tab_')
->field('account,amount')
->join('left join tab_president_deposit on tab_president_deposit.promote_id=tab_promote.id')
->where(['tab_promote.id'=>['in', $promoteIds]])
->select();
// dump($promoteData);die();
foreach ($promoteData as $key => $value) {
if ($value['amount']) {
addOperationLog(['op_type'=>1,'key'=>$value['account'].'/'.$value['amount'],'op_name'=>'编辑押金已退款','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-押金已退款']);
}
}
M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->save([
'status' => 2,
'refund_time' => time(),
'update_time' => time(),
'pay_accept_time' => 0
]);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
} }
public function payConfirm() public function refund()
{ {
if (isMarketAdmin()) { $ids = I('ids', []);
try {
$service = new PresidentDepositService();
$service->batchRefund($ids);
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 1,
'message' => '无权限操作记录' 'message' => '操作成功'
]); ]);
} } catch (\Exception $e) {
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '无选中项' 'message' => $e->getMessage()
]); ]);
} }
$checkStatus = true; }
$records = M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->select();
foreach ($records as $record) { public function payConfirm()
if ($record['status'] != 0) { {
$checkStatus = false; $ids = I('ids', []);
break; try {
} $service = new PresidentDepositService();
// 如果不是无需押金,并且没有填写收到押金时间 $service->batchPayConfirm($ids);
// if ($record['pay_type'] != PresidentDepositService::PAY_TYPE_NONE && empty($record['pay_accept_time'])) { $this->ajaxReturn([
// $this->ajaxReturn([ 'status' => 1,
// 'status' => 0, 'message' => '操作成功'
// 'message' => '含有待确认收到押金时间记录,不可批量操作' ]);
// ]); } catch (\Exception $e) {
// }
}
if (!$checkStatus) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '含有非待确认状态记录,不可批量操作' 'message' => $e->getMessage()
]); ]);
} }
$promoteData = M('promote','tab_')
->field('account,amount')
->join('left join tab_president_deposit on tab_president_deposit.promote_id=tab_promote.id')
->where(['tab_promote.id'=>['in', $promoteIds]])
->select();
// dump($promoteData);die();
foreach ($promoteData as $key => $value) {
if ($value['amount']) {
addOperationLog(['op_type'=>1,'key'=>$value['account'].'/'.$value['amount'],'op_name'=>'编辑确认押金到账','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-确认押金到账']);
}
}
M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->save([
'status' => 1,
'pay_confirm_time' => time(),
'update_time' => time(),
'pay_accept_time' => strtotime(I('accept_time'))
]);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
} }
} }

@ -402,7 +402,6 @@ class PromoteCompanyController extends ThinkController
'info' => $e->getMessage() 'info' => $e->getMessage()
)); ));
} }
$save['create_time'] = $time; $save['create_time'] = $time;
$save['turnover_ratio'] = $this->setTurnoverRatio($save); $save['turnover_ratio'] = $this->setTurnoverRatio($save);
$res = D("PromoteCompanyVerify")->add_db($save); $res = D("PromoteCompanyVerify")->add_db($save);

@ -82,9 +82,9 @@
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tbody> <tbody>
<tr> <tr>
<td class="l"><i class="mustmark">*</i>会长账号</td> <td class="l"><i class="mustmark">*</i>推广公司</td>
<td class="r table_radio"> <td class="r table_radio">
<span class="form_radio table_btn" style="color: red;">{$promote.account}</span> <span class="form_radio table_btn" style="color: red;">{$company.company_name}</span>
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </tr>
@ -148,7 +148,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<input type="hidden" name="id" id="id" value="{$promote.id}" /> <input type="hidden" name="company_id" id="company_id" value="{$company.id}" />
<div class="form-item cf"> <div class="form-item cf">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal"> <button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
确认 确认

@ -66,10 +66,10 @@
<label>搜索:</label> <label>搜索:</label>
</div> </div>
<div class="input-list input-list-promote search_label_rehab"> <div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" style="width:120px;"> <select id="company_id" name="company_id" class="select_gallery" style="width:120px;">
<option value="0">推广公司</option> <option value="0">推广公司</option>
<?php foreach($allCompanies as $company):?> <?php foreach($allCompanies as $company):?>
<option value="<?=$company['id']?>"><?=$company['id']?></option> <option value="<?=$company['id']?>"><?=$company['company_name']?></option>
<?php endforeach;?> <?php endforeach;?>
</select> </select>
</div> </div>

@ -81,9 +81,9 @@
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tbody> <tbody>
<tr> <tr>
<td class="l">会长账号</td> <td class="l">推广公司</td>
<td class="r table_radio"> <td class="r table_radio">
<span class="form_radio table_btn">{$promote.account}</span> <span class="form_radio table_btn">{$company.company_name}</span>
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </tr>
@ -94,6 +94,7 @@
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </tr>
<?php if($record['pay_type'] != 3):?>
<tr> <tr>
<td class="l">付款方式:</td> <td class="l">付款方式:</td>
<td class="r"> <td class="r">
@ -136,6 +137,7 @@
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </tr>
<?php endif;?>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -62,8 +62,9 @@ class PresidentDepositService
} }
} }
public function save($params, $company) public function save($params, $company = null)
{ {
$companyId = $params['company_id'] ?? 0;
$payWay = $params['pay_way'] ?? 0; $payWay = $params['pay_way'] ?? 0;
$payType = $params['pay_type'] ?? 0; $payType = $params['pay_type'] ?? 0;
$payAccount = $params['pay_account'] ?? ''; $payAccount = $params['pay_account'] ?? '';
@ -75,17 +76,25 @@ class PresidentDepositService
$payAcceptTime = $payAcceptTime ? strtotime($payAcceptTime) : 0; $payAcceptTime = $payAcceptTime ? strtotime($payAcceptTime) : 0;
$refundTime = $refundTime ? strtotime($refundTime) : 0; $refundTime = $refundTime ? strtotime($refundTime) : 0;
if (is_null($company)) {
$company = M('promote_company', 'tab_')->where(['id' => $companyId, 'company_belong' => ['in', [1, 2]]])->find();
if (is_null($company)) {
throw new \Exception('推广公司不存在');
}
}
$record = M('president_deposit', 'tab_')->where(['company_id' => $company['id']])->find(); $record = M('president_deposit', 'tab_')->where(['company_id' => $company['id']])->find();
$this->checkBeforeSave($params, $record);
if ($params['pay_type'] == 3) { if ($params['pay_type'] == 3) {
return $this->handleNoDeposit($company, $record); return $this->handleNoDeposit($company, $record);
} }
if ($record) { if ($record) {
$this->update(); $this->update($params, $company, $record);
addOperationLog(['op_type'=>1,'key'=>$company['company_name'].'/'.$params['amount'],'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$company['id']]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']); addOperationLog(['op_type'=>1,'key'=>$company['company_name'].'/'.$params['amount'],'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$company['id']]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']);
} else { } else {
$this->add(); $this->add($params, $company);
addOperationLog(['op_type'=>0,'key'=>$company['company_name'].'/'.$params['amount'],'op_name'=>'新增会长押金','url'=>U('PresidentDeposit/edit',['id'=>$company['id']]),'menu'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']); addOperationLog(['op_type'=>0,'key'=>$company['company_name'].'/'.$params['amount'],'op_name'=>'新增会长押金','url'=>U('PresidentDeposit/edit',['id'=>$company['id']]),'menu'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']);
} }
} }

@ -130,11 +130,13 @@ class PromoteCompanyService
public function getVerifyingPromotes($exceptId = 0) public function getVerifyingPromotes($exceptId = 0)
{ {
$promotes = []; $promotes = [];
$verifyCompanies = M('promote_company_verify', 'tab_')->field(['company_info'])->where(['status' => 0])->getField('company_info', true); $verifyCompanies = M('promote_company_verify', 'tab_')->field(['company_info'])->where(['verify_status' => ['in', [0, 1]]])->getField('company_info', true);
if ($verifyCompanies) { if ($verifyCompanies) {
foreach ($verifyCompanies as $item) { foreach ($verifyCompanies as $item) {
$row = json_decode($item, true); $row = json_decode($item, true);
$promotes = array_merge($promotes, $row['promotes']); if (isset($row['promotes'])) {
$promotes = array_merge($promotes, $row['promotes']);
}
} }
} }
return $promotes; return $promotes;
@ -195,14 +197,14 @@ class PromoteCompanyService
$data = []; $data = [];
if ($bindRelation['collaborate_way'] == 1) { if ($bindRelation['collaborate_way'] == 1) {
$data['first_company_id'] = $company['id']; $data['first_company_id'] = $company['id'];
$data['first_company_id'] = $company['company_name']; $data['first_company_name'] = $company['company_name'];
$data['first_company_type'] = 2; $data['first_company_type'] = 2;
$data['second_company_id'] = $selfCompany['id']; $data['second_company_id'] = $selfCompany['id'];
$data['second_company_name'] = $selfCompany['partner']; $data['second_company_name'] = $selfCompany['partner'];
$data['second_company_type'] = 0; $data['second_company_type'] = 0;
} else { } else {
$data['first_company_id'] = $selfCompany['id']; $data['first_company_id'] = $selfCompany['id'];
$data['first_company_id'] = $selfCompany['partner']; $data['first_company_name'] = $selfCompany['partner'];
$data['first_company_type'] = 0; $data['first_company_type'] = 0;
$data['second_company_id'] = $company['id']; $data['second_company_id'] = $company['id'];
$data['second_company_name'] = $company['company_name']; $data['second_company_name'] = $company['company_name'];

@ -1041,9 +1041,9 @@ class PromoteService {
public function isPresidentAccess($promote) public function isPresidentAccess($promote)
{ {
$topPromote = $this->getTopPromote($promote); $company = M('promote_company', 'tab_')->field(['id', 'company_belong'])->where(['id' => $promote['company_id']])->find();
if (in_array($topPromote['company_belong'], [1, 2])) { if (in_array($company['company_belong'], [1, 2])) {
$record = M('president_deposit', 'tab_')->where(['promote_id' => $topPromote['id']])->find(); $record = M('president_deposit', 'tab_')->where(['company_id' => $company['id']])->find();
if (!$record) { if (!$record) {
return false; return false;
} }

Loading…
Cancel
Save