更新
This commit is contained in:
parent
8c0dcc669c
commit
09ff53869e
@ -108,10 +108,10 @@ class CompanyController extends BaseAdminController
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CompanyValidate())->post()->goCheck('delete');
|
||||
$admin_id=Company::where('id', $params['id'])->value('admin_id');
|
||||
User::where('company_id',$params['id'])->update(['delete_time'=>time()]);
|
||||
TaskScheduling::where('company_id',$params['id'])->update(['delete_time'=>time()]);
|
||||
AdminLogic::delete(['id'=>$admin_id]);
|
||||
$admin_id = Company::where('id', $params['id'])->value('admin_id');
|
||||
User::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
TaskScheduling::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
AdminLogic::delete(['id' => $admin_id]);
|
||||
CompanyLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
@ -236,11 +236,11 @@ class CompanyController extends BaseAdminController
|
||||
*/
|
||||
public function subordinate($company_id)
|
||||
{
|
||||
$ids=Contract::where('party_a',$company_id)->where('status',1)->where('type',1)->column('party_b');
|
||||
if($ids){
|
||||
$result=Company::where('id','in',$ids)->field('company_name,id,company_type,company_type company_type_name,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone,is_authentication')->select();
|
||||
}else{
|
||||
$result=[];
|
||||
$ids = Contract::where('party_a', $company_id)->where('status', 1)->where('type', 1)->column('party_b');
|
||||
if ($ids) {
|
||||
$result = Company::where('id', 'in', $ids)->field('company_name,id,company_type,company_type company_type_name,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone,is_authentication')->select();
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
$data['lists'] = $result;
|
||||
return $this->success('success', $data);
|
||||
@ -255,36 +255,45 @@ class CompanyController extends BaseAdminController
|
||||
if ($parmas['key'] == 'city') {
|
||||
$where[] = ['area', '=', 0];
|
||||
}
|
||||
if( $parmas['value']==''){
|
||||
if ($parmas['value'] == '') {
|
||||
return $this->fail('参数不能为空');
|
||||
}
|
||||
$where[] = [$parmas['key'], '=', $parmas['value']];
|
||||
switch ($parmas['key']) {
|
||||
case 'city':
|
||||
$where[] = ['area', '=', 0];
|
||||
// $geo_area=Db::name('geo_area')->where('city_code', '=', $parmas['value'])->column('area_code');
|
||||
// $where[] = ['area', 'in', $geo_area];
|
||||
break;
|
||||
case 'area':
|
||||
$where[] = ['street', '=', 0];
|
||||
$street_code = Db::name('geo_street')->where('area_code', '=', $parmas['value'])->column('street_code');
|
||||
$where[] = ['street', 'in', $street_code];
|
||||
$where[] = ['village', '=', 0];
|
||||
break;
|
||||
case 'street':
|
||||
$where[] = ['village', '=', 0];
|
||||
$street_code = Db::name('geo_village')->where('street_code', '=', $parmas['value'])->column('village_code');
|
||||
$where[] = ['village', 'in', $street_code];
|
||||
$where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
case 'village':
|
||||
// $street_code = Db::name('geo_brigade')->where('street_code', '=', $parmas['value'])->column('village_code');
|
||||
$where[] = ['village', '=', $parmas['value']];
|
||||
// $where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
}
|
||||
|
||||
$res = Company::where($where)->column('responsible_area');
|
||||
foreach($res as $k=>$v){
|
||||
$res[$k] = explode(',',$v);
|
||||
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k] = explode(',', $v);
|
||||
}
|
||||
$data=[];
|
||||
foreach($res as $k=>$v){
|
||||
foreach($v as $kk=>$vv){
|
||||
if($vv != ''){
|
||||
$data = [];
|
||||
foreach ($res as $k => $v) {
|
||||
foreach ($v as $kk => $vv) {
|
||||
if ($vv != '') {
|
||||
$data[] = $vv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $this->success('success', $data);
|
||||
return $this->success('success', array_unique($data));
|
||||
}
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ class CompanyLogic extends BaseLogic
|
||||
$arr=[
|
||||
'company_name' => $params['company_name'],
|
||||
'organization_code' => $params['organization_code'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'village' => $params['village'],
|
||||
'brigade' => $params['brigade'],
|
||||
'province' => $params['province']>0?$params['province']:0,
|
||||
'city' => $params['city']>0?$params['city']:0,
|
||||
'area' => $params['area']>0?$params['area']:0,
|
||||
'street' => $params['street']>0?$params['street']:0,
|
||||
'village' => $params['village']>0?$params['village']:0,
|
||||
'brigade' => $params['brigade']>0?$params['brigade']:0,
|
||||
'address' => $params['address'],
|
||||
'company_type' => $params['company_type'],
|
||||
'master_name' => $params['master_name'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user