作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

... ... @@ -62,7 +62,7 @@ class LoginController extends BaseController
* @time :2023/8/7 9:07
*/
public function getAccessAddress(LoginLogic $logic){
$data = $logic->accessAddress();
$data = $logic->accessAddress($this->manage['id']);
return $this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -8,8 +8,10 @@ use App\Models\Manage\LoginLog;
use App\Models\Manage\Manage;
use App\Models\Manage\ManageHr;
use App\Models\Manage\MenuSpecial;
use App\Models\Project\Project;
use App\Models\Service\Service;
use App\Models\Sms\SmsLog;
use App\Models\User\User;
use App\Utils\EncryptUtils;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
... ... @@ -109,7 +111,7 @@ class LoginLogic extends BaseLogic
* @method :post
* @time :2023/8/7 9:09
*/
public function accessAddress(){
public function accessAddress($manage_id){
$serviceSettingModel = new Service();
$info = $serviceSettingModel->read(['type'=>4]);
if($info === false){
... ... @@ -120,6 +122,16 @@ class LoginLogic extends BaseLogic
'domain'=>$info['values'],
'remark'=>'自动登录地址和code',
];
//演示账号 用自己的号登录
if(!empty($this->param['project_id']) && $this->param['project_id'] == Project::DEMO_PROJECT_ID){
unset($this->param['project_id']);
$mobile = Manage::where('id', $manage_id)->value('mobile');
$user = User::where('mobile', $mobile)->first();
if(!$user){
$this->fail('未在演示项目注册账号');
}
$this->param['user_id'] = $user->id;
}
//获取超级管理员登录
if(isset($this->param['project_id']) && !empty($this->param['project_id'])){
$data['autologin_code'] = $encrypt->lock_url(json_encode(['project_id'=>$this->param['project_id'],'manager_id'=>$this->manager['id']]),$info['values']);
... ...
... ... @@ -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
... ...