更新公司删除

This commit is contained in:
mkm 2023-08-18 12:03:56 +08:00
parent 437494071d
commit e606fe2bd3
3 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,7 @@ namespace app\adminapi\controller;
use app\adminapi\lists\CompanyLists;
use app\adminapi\logic\auth\AdminLogic;
use app\common\logic\CompanyLogic;
use app\adminapi\validate\CompanyValidate;
use app\api\controller\JunziqianController;
@ -25,6 +26,7 @@ use app\common\model\Company;
use think\facade\Db;
use app\common\logic\contract\ContractLogic;
use app\common\model\contract\Contract;
use app\common\model\task_scheduling\TaskScheduling;
use app\common\model\user\User;
/**
@ -106,6 +108,10 @@ class CompanyController extends BaseAdminController
public function delete()
{
$params = (new CompanyValidate())->post()->goCheck('delete');
$admin_id=Company::where('id', $params['id'])->value('admin');
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);
}
@ -232,7 +238,7 @@ class CompanyController extends BaseAdminController
{
$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,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone')->select();
$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=[];
}

View File

@ -26,6 +26,7 @@ use think\facade\Db;
use app\api\logic\SmsLogic;
use app\api\controller\JunziqianController;
use app\common\model\Company;
use app\common\model\user\User;
/**
* 合同控制器
@ -120,7 +121,7 @@ class ContractController extends BaseAdminController
if($find['type']==1){
$find['party_b_info'] =Company::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
}else{
$find['party_b_info'] =Db::name('user')->where('id', $find['party_b'])->field('nickname name,mobile phone')->find()->toArray();
$find['party_b_info'] =User::where('id', $find['party_b'])->field('nickname name,mobile phone')->find()->toArray();
}
$a = [
'mobile' => $find['party_a_info']['master_phone'],

View File

@ -188,7 +188,7 @@ class AdminLogic extends BaseLogic
AdminDept::delByUserId($params['id']);
AdminJobs::delByUserId($params['id']);
//修改用户同步信息
Db::name('user')->where(['admin_id'=>$params['id']])->update(['is_disable'=>1]);
Db::name('user')->where(['admin_id'=>$params['id']])->update(['delete_time'=>time()]);
Db::commit();
return true;
} catch (\Exception $e) {