|
...
|
...
|
@@ -11,6 +11,8 @@ use App\Models\Manage\JobLevel; |
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Manage\ManageHr;
|
|
|
|
use App\Models\Manage\Menu;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\User\User;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
|
|
...
|
...
|
@@ -73,6 +75,10 @@ class HrLogic extends BaseLogic |
|
|
|
$managerModel = new Manage();
|
|
|
|
$this->param['manage_id'] = $managerModel->addReturnId($data);
|
|
|
|
$this->model->add($this->param);
|
|
|
|
|
|
|
|
//同步到B端演示项目
|
|
|
|
$this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']);
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -109,6 +115,10 @@ class HrLogic extends BaseLogic |
|
|
|
//同步更新管理员手机号码
|
|
|
|
$managerModel->edit(['mobile'=>$this->param['mobile']],['id'=>$hrInfo['manage_id']]);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
|
|
|
|
//同步到B端演示项目
|
|
|
|
$this->syncBProjectUser($hrInfo['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']);
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -118,6 +128,37 @@ class HrLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 同步到B端用户
|
|
|
|
* @author zbj
|
|
|
|
* @date 2023/10/23
|
|
|
|
*/
|
|
|
|
public function syncBProjectUser($old_mobile, $mobile, $name, $status){
|
|
|
|
$user = User::where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $old_mobile)->first();
|
|
|
|
//在职
|
|
|
|
if($status == ManageHr::STATUS_ONE){
|
|
|
|
if(!$user){
|
|
|
|
$user = new User();
|
|
|
|
$user->project_id = Project::DEMO_PROJECT_ID;
|
|
|
|
$user->mobile = $mobile;
|
|
|
|
$user->name = $name;
|
|
|
|
$user->password = base64_encode(md5('v6.' . substr($mobile, -6)));
|
|
|
|
$user->type = User::TYPE_ONE;
|
|
|
|
$user->role_id = 38; //技术总部
|
|
|
|
$user->save();
|
|
|
|
}else{
|
|
|
|
$user->mobile = $mobile;
|
|
|
|
$user->name = $name;
|
|
|
|
$user->save();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//离职
|
|
|
|
if($user){
|
|
|
|
$user->delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取详情
|
|
|
|
* @name :getHrInfo
|
|
|
|
* @author :lyh
|
...
|
...
|
|