diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 54df7849f..b9feead09 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -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 diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 0fdb2ba6c..995c4c70e 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -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']; diff --git a/Application/Admin/Model/PromoteCompanyVerifyModel.class.php b/Application/Admin/Model/PromoteCompanyVerifyModel.class.php index 4030406e4..51d18c5c9 100644 --- a/Application/Admin/Model/PromoteCompanyVerifyModel.class.php +++ b/Application/Admin/Model/PromoteCompanyVerifyModel.class.php @@ -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; } } \ No newline at end of file diff --git a/Application/Admin/View/PromoteCompany/edit.html b/Application/Admin/View/PromoteCompany/edit.html index aa27e955f..9d5d14aa1 100644 --- a/Application/Admin/View/PromoteCompany/edit.html +++ b/Application/Admin/View/PromoteCompany/edit.html @@ -413,7 +413,7 @@