This commit is contained in:
mkm 2023-08-17 10:39:05 +08:00
parent b1f54af78d
commit d320eeaba7

View File

@ -46,9 +46,9 @@ class CompanyController extends BaseAdminController
return $this->dataLists(new CompanyLists());
}
public function list_two(){
public function list_two()
{
return $this->success('ok', (new CompanyLists())->list_two());
}
/**
@ -62,9 +62,9 @@ class CompanyController extends BaseAdminController
$params = (new CompanyValidate())->post()->goCheck('add');
$params['other_contacts'] = json_encode($params['other_contacts']);
$params['qualification'] = json_encode($params['qualification']);
$params['area_manager']=$this->adminId;
if(isset($params['responsible_area'])){
$params['responsible_area']=implode(',',$params['responsible_area']);
$params['area_manager'] = $this->adminId;
if (isset($params['responsible_area'])) {
$params['responsible_area'] = implode(',', $params['responsible_area']);
}
$result = CompanyLogic::add($params);
if (true === $result) {
@ -85,8 +85,8 @@ class CompanyController extends BaseAdminController
$params = (new CompanyValidate())->post()->goCheck('edit');
$params['other_contacts'] = json_encode($params['other_contacts']);
$params['qualification'] = json_encode($params['qualification']);
if(isset($params['responsible_area'])){
$params['responsible_area']=implode(',',$params['responsible_area']);
if (isset($params['responsible_area'])) {
$params['responsible_area'] = implode(',', $params['responsible_area']);
}
$result = CompanyLogic::edit($params);
if (true === $result) {
@ -126,13 +126,13 @@ class CompanyController extends BaseAdminController
public function initiate_contract()
{
$params = $this->request->param();
if(isset($params['party_a']) && $params['party_a']>0){
if (isset($params['party_a']) && $params['party_a'] > 0) {
$params['party_a'] = $params['party_a'];
}else{
} else {
$params['party_a'] = $this->adminInfo['company_id'];
}
$params['type'] = 1;
$params['party_b']=$params['id'];
$params['party_b'] = $params['id'];
unset($params['id']);
$result = ContractLogic::initiate_contract($params);
if ($result == true) {
@ -155,8 +155,8 @@ class CompanyController extends BaseAdminController
public function postsms()
{
$params = (new CompanyValidate())->goCheck('detail');
$id=Contract::where('party_b', $params['id'])->value('id');
$res = ContractLogic::postsms(['id'=>$id]);
$id = Contract::where('party_b', $params['id'])->value('id');
$res = ContractLogic::postsms(['id' => $id]);
if ($res == true) {
return $this->success('发送成功', [], 1, 1);
} else {
@ -234,4 +234,47 @@ class CompanyController extends BaseAdminController
$data['lists'] = $result;
return $this->success('success', $data);
}
public function responsible_area()
{
$parmas = $this->request->param();
if (!isset($parmas['key']) && isset($parmas['key']) == '' || !isset($parmas['value']) && isset($parmas['value']) == '') {
return $this->fail('参数错误');
}
if ($parmas['key'] == 'city') {
$where[] = ['area', '=', 0];
}
$where[] = [$parmas['key'], '=', $parmas['value']];
switch ($parmas['key']) {
case 'city':
$where[] = ['area', '=', 0];
break;
case 'area':
$where[] = ['street', '=', 0];
break;
case 'street':
$where[] = ['village', '=', 0];
break;
case 'village':
$where[] = ['brigade', '=', 0];
break;
}
$res = Company::where($where)->column('responsible_area');
foreach($res as $k=>$v){
$res[$k] = explode(',',$v);
}
$data=[];
foreach($res as $k=>$v){
foreach($v as $kk=>$vv){
if($vv != ''){
$data[] = $vv;
}
}
}
return $this->success('success', $data);
}
}