master
ELF 4 years ago
parent ad2037408d
commit e0bbec0978

@ -312,24 +312,18 @@ class PromoteCompanyController extends ThinkController
public function marketAgree(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = M("PromoteCompanyVerify", 'tab_')->field("id,verify_status,verify_log,company_info")->where("id in ({$ids})")->select();
$records = M("PromoteCompanyVerify", 'tab_')->where("id in ({$ids})")->select();
$service = new PromoteCompanyService();
foreach($dbres as $k=>$v){
if($v['verify_status'] != 0) {
foreach($records as $record){
if($record['verify_status'] != 0) {
continue;
}
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log']['market_user']=$this->admininfo["username"];
$v['verify_log']['market_time']=date("Y-m-d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=1;
M("PromoteCompanyVerify", 'tab_')->save($v);
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]);
$record = $service->marketAgree($record);
$company = json_decode($v['company_info'], true);
$company = json_decode($record['company_info'], true);
if (in_array($company['company_belong'], [1, 2])) {
$service->adminAgree($v, true);
$service->adminAgree($record, true);
}
}
$this->ajaxReturn(array(
@ -419,10 +413,15 @@ class PromoteCompanyController extends ThinkController
}
$save['create_time'] = $time;
$save['turnover_ratio'] = $this->setTurnoverRatio($save);
$res = D("PromoteCompanyVerify")->add_db($save);
if ($res) {
$result = D("PromoteCompanyVerify")->add_db($save);
if ($result) {
addOperationLog(['op_type'=>0,'key'=>$save['company_name'],'op_name'=>'新增推广公司','url'=>U('PromoteCompany/lists')]);
\Think\Log::actionLog('PromoteCompany/add', 'partner', $res);
\Think\Log::actionLog('PromoteCompany/add', 'partner', $result);
if (!in_array($save['company_belong'], [1, 2])) {
$promoteCompanyService->marketAgree($result, true);
}
$array=array(
"info"=>"添加成功,请联系管理员尽快审核",
"status"=>1
@ -603,12 +602,12 @@ class PromoteCompanyController extends ThinkController
$save = I('post.');//前端已经验证
$this->checkData($save);
$promoteCompanyService = new PromoteCompanyService();
try {
/* $presidentDepositService = new PresidentDepositService();
if (in_array($save['company_belong'], [1, 2])) {
$presidentDepositService->checkBeforeSave($save['deposit'] ?? []);
} */
$promoteCompanyService = new PromoteCompanyService();
$promoteCompanyService->checkPromotes($save['promotes'] ?? []);
$promoteCompanyService->checkCompanyRelation($save['relation'] ?? []);
} catch (\Exception $e) {
@ -622,6 +621,11 @@ class PromoteCompanyController extends ThinkController
$res = D("PromoteCompanyVerify")->edit_db($save);
if ($res) {
addOperationLog(['op_type'=>1,'key'=>$_POST['company_name'],'op_name'=>'编辑推广公司','url'=>U('PromoteCompany/lists')]);
if (!in_array($save['company_belong'], [1, 2])) {
$promoteCompanyService->marketAgree($res, true);
}
$array=array(
"info"=>"修改成功,请联系管理员尽快审核",
"status"=>1

@ -424,7 +424,7 @@ class PromoteController extends ThinkController
$use = new UserApi();
$data['password']=think_ucenter_md5($pwd, UC_AUTH_KEY);
$data['second_pwd']=think_ucenter_md5($second_pwd, UC_AUTH_KEY);
$data['email'] = I('post.email');
$data['withdraw_show'] = $_POST['withdraw_show'];
$data['withdraw_done'] = $_POST['withdraw_done'];
$data['can_view_recharge'] = $_POST['can_view_recharge'];

@ -31,7 +31,12 @@ class PromoteCompanyVerifyModel extends Model
if(isset($info['instanceof'])) unset($info['instanceof']);
if(isset($info['turnover'])) unset($info['turnover']);
$verifydata['company_info'] = json_encode($info,JSON_UNESCAPED_UNICODE);
return $this->add($verifydata);
$id = $this->add($verifydata);
if ($id) {
$verifydata['id'] = $id;
return $verifydata;
}
return null;
}
public function edit_db($info)
{
@ -53,14 +58,20 @@ class PromoteCompanyVerifyModel extends Model
//判断是否存在
$has = $this->where("company_id = {$p_id}")->find();
$res = null;
if($has){
//存在
$verifydata['id'] = $has['id'];
$res = $this->save($verifydata);
}else{
$res = $this->add($verifydata);
$verifydata['id'] = $res;
}
if ($res) {
return $verifydata;
} else {
return null;
}
return $res;
}
}

@ -413,7 +413,7 @@
<tr>
<td class="l">开票内容:</td>
<td class="r table_radio">
<input type="text" name="relation[invoice_content]" id="invoice_content" class="input" value="信息服务费"></textarea>
<input type="text" name="relation[invoice_content]" id="invoice_content" class="input" value="<?=$relation['invoice_content']?>"></textarea>
</td>
</tr>
<tr>

@ -152,13 +152,15 @@ class PromoteCompanyService
public function adminAgree($application, $isAuto = false)
{
$adminInfo = $_SESSION['onethink_admin']['user_auth'];
$application['verify_log'] = json_decode($application['verify_log'], true);
$application['verify_log']['admin_user'] = $isAuto ? 'AUOT' : $adminInfo["username"];
$application['verify_log']['admin_time'] = date("Y-m-d H:i:s");
$application['verify_log'] = json_encode($application['verify_log']);
$verifyLog = json_decode($application['verify_log'], true);
$verifyLog['admin_user'] = $isAuto ? 'AUOT' : $adminInfo["username"];
$verifyLog['admin_time'] = date("Y-m-d H:i:s");
$application['verify_log'] = json_encode($verifyLog);
$application['verify_status'] = 2;
$companyInfo = json_decode($application['company_info'], true);
$creator = M('ucenter_member', 'sys_')->field(['id', 'username'])->where(['username' => $verifyLog['create_user']])->find();
$deposit = null;
$bindRelation = $companyInfo['relation'];
$promotes = $companyInfo['promotes'];
@ -181,7 +183,7 @@ class PromoteCompanyService
}
$this->savePromoteCompanyRelation($bindRelation, $companyInfo);
$this->savePromotes($promotes, $companyInfo);
$this->savePromotes($promotes, $companyInfo, $creator);
if ($isNew && in_array($companyInfo['company_belong'], [1, 2])) {
$depositService = new PresidentDepositService();
$depositService->save($deposit, $companyInfo);
@ -247,7 +249,7 @@ class PromoteCompanyService
$isChangeRelation = true;
}
//处理底下所有会长的公会属性
if($isChangeBelong || $isChangeRelation ){
if($isChangeBelong || $isChangeRelation ) {
$data = array(
'company_belong' => $save['company_belong'],
@ -270,7 +272,7 @@ class PromoteCompanyService
}
}
private function savePromotes($records, $company)
private function savePromotes($records, $company, $creator)
{
$promoteService = new PromoteService();
foreach ($records as $record) {
@ -281,7 +283,24 @@ class PromoteCompanyService
'email' => $record['email'],
'mobile_phone' => $record['mobile_phone'],
'can_view_recharge' => $record['can_view_recharge'],
'company_id' => $company['id'],
'company_belong' => $company['company_belong'],
'company_relation' => $company['develop_type'],
'admin_id' => $creator ? $creator['id'] : 0,
]);
}
}
public function marketAgree($application, $isAuto = false)
{
$adminInfo = $_SESSION['onethink_admin']['user_auth'];
$application['verify_log'] = json_decode($application['verify_log'],true);
$application['verify_log']['market_user']= $isAuto ? 'AUOT' : $adminInfo["username"];
$application['verify_log']['market_time'] = date("Y-m-d H:i:s");
$application['verify_log'] = json_encode($application['verify_log']);
$application['verify_status'] = 1;
M('promote_company_verify', 'tab_')->where(['id' => $application['id']])->save($application);
addOperationLog(['op_type'=>1, 'key'=> $application['id'], "op_name"=>"市场部审核", 'url'=>U('index')]);
return $application;
}
}
Loading…
Cancel
Save