Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
3 个修改的文件
包含
55 行增加
和
2 行删除
| @@ -62,7 +62,7 @@ class LoginController extends BaseController | @@ -62,7 +62,7 @@ class LoginController extends BaseController | ||
| 62 | * @time :2023/8/7 9:07 | 62 | * @time :2023/8/7 9:07 |
| 63 | */ | 63 | */ |
| 64 | public function getAccessAddress(LoginLogic $logic){ | 64 | public function getAccessAddress(LoginLogic $logic){ |
| 65 | - $data = $logic->accessAddress(); | 65 | + $data = $logic->accessAddress($this->manage['id']); |
| 66 | return $this->response('success',Code::SUCCESS,$data); | 66 | return $this->response('success',Code::SUCCESS,$data); |
| 67 | } | 67 | } |
| 68 | 68 |
| @@ -8,8 +8,10 @@ use App\Models\Manage\LoginLog; | @@ -8,8 +8,10 @@ use App\Models\Manage\LoginLog; | ||
| 8 | use App\Models\Manage\Manage; | 8 | use App\Models\Manage\Manage; |
| 9 | use App\Models\Manage\ManageHr; | 9 | use App\Models\Manage\ManageHr; |
| 10 | use App\Models\Manage\MenuSpecial; | 10 | use App\Models\Manage\MenuSpecial; |
| 11 | +use App\Models\Project\Project; | ||
| 11 | use App\Models\Service\Service; | 12 | use App\Models\Service\Service; |
| 12 | use App\Models\Sms\SmsLog; | 13 | use App\Models\Sms\SmsLog; |
| 14 | +use App\Models\User\User; | ||
| 13 | use App\Utils\EncryptUtils; | 15 | use App\Utils\EncryptUtils; |
| 14 | use Illuminate\Support\Facades\Cache; | 16 | use Illuminate\Support\Facades\Cache; |
| 15 | use Illuminate\Support\Facades\Hash; | 17 | use Illuminate\Support\Facades\Hash; |
| @@ -109,7 +111,7 @@ class LoginLogic extends BaseLogic | @@ -109,7 +111,7 @@ class LoginLogic extends BaseLogic | ||
| 109 | * @method :post | 111 | * @method :post |
| 110 | * @time :2023/8/7 9:09 | 112 | * @time :2023/8/7 9:09 |
| 111 | */ | 113 | */ |
| 112 | - public function accessAddress(){ | 114 | + public function accessAddress($manage_id){ |
| 113 | $serviceSettingModel = new Service(); | 115 | $serviceSettingModel = new Service(); |
| 114 | $info = $serviceSettingModel->read(['type'=>4]); | 116 | $info = $serviceSettingModel->read(['type'=>4]); |
| 115 | if($info === false){ | 117 | if($info === false){ |
| @@ -120,6 +122,16 @@ class LoginLogic extends BaseLogic | @@ -120,6 +122,16 @@ class LoginLogic extends BaseLogic | ||
| 120 | 'domain'=>$info['values'], | 122 | 'domain'=>$info['values'], |
| 121 | 'remark'=>'自动登录地址和code', | 123 | 'remark'=>'自动登录地址和code', |
| 122 | ]; | 124 | ]; |
| 125 | + //演示账号 用自己的号登录 | ||
| 126 | + if(!empty($this->param['project_id']) && $this->param['project_id'] == Project::DEMO_PROJECT_ID){ | ||
| 127 | + unset($this->param['project_id']); | ||
| 128 | + $mobile = Manage::where('id', $manage_id)->value('mobile'); | ||
| 129 | + $user = User::where('mobile', $mobile)->first(); | ||
| 130 | + if(!$user){ | ||
| 131 | + $this->fail('未在演示项目注册账号'); | ||
| 132 | + } | ||
| 133 | + $this->param['user_id'] = $user->id; | ||
| 134 | + } | ||
| 123 | //获取超级管理员登录 | 135 | //获取超级管理员登录 |
| 124 | if(isset($this->param['project_id']) && !empty($this->param['project_id'])){ | 136 | if(isset($this->param['project_id']) && !empty($this->param['project_id'])){ |
| 125 | $data['autologin_code'] = $encrypt->lock_url(json_encode(['project_id'=>$this->param['project_id'],'manager_id'=>$this->manager['id']]),$info['values']); | 137 | $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; | @@ -11,6 +11,8 @@ use App\Models\Manage\JobLevel; | ||
| 11 | use App\Models\Manage\Manage; | 11 | use App\Models\Manage\Manage; |
| 12 | use App\Models\Manage\ManageHr; | 12 | use App\Models\Manage\ManageHr; |
| 13 | use App\Models\Manage\Menu; | 13 | use App\Models\Manage\Menu; |
| 14 | +use App\Models\Project\Project; | ||
| 15 | +use App\Models\User\User; | ||
| 14 | use Illuminate\Support\Facades\DB; | 16 | use Illuminate\Support\Facades\DB; |
| 15 | use Illuminate\Support\Facades\Hash; | 17 | use Illuminate\Support\Facades\Hash; |
| 16 | 18 | ||
| @@ -73,6 +75,10 @@ class HrLogic extends BaseLogic | @@ -73,6 +75,10 @@ class HrLogic extends BaseLogic | ||
| 73 | $managerModel = new Manage(); | 75 | $managerModel = new Manage(); |
| 74 | $this->param['manage_id'] = $managerModel->addReturnId($data); | 76 | $this->param['manage_id'] = $managerModel->addReturnId($data); |
| 75 | $this->model->add($this->param); | 77 | $this->model->add($this->param); |
| 78 | + | ||
| 79 | + //同步到B端演示项目 | ||
| 80 | + $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']); | ||
| 81 | + | ||
| 76 | DB::commit(); | 82 | DB::commit(); |
| 77 | }catch (\Exception $e){ | 83 | }catch (\Exception $e){ |
| 78 | DB::rollBack(); | 84 | DB::rollBack(); |
| @@ -109,6 +115,10 @@ class HrLogic extends BaseLogic | @@ -109,6 +115,10 @@ class HrLogic extends BaseLogic | ||
| 109 | //同步更新管理员手机号码 | 115 | //同步更新管理员手机号码 |
| 110 | $managerModel->edit(['mobile'=>$this->param['mobile']],['id'=>$hrInfo['manage_id']]); | 116 | $managerModel->edit(['mobile'=>$this->param['mobile']],['id'=>$hrInfo['manage_id']]); |
| 111 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 117 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 118 | + | ||
| 119 | + //同步到B端演示项目 | ||
| 120 | + $this->syncBProjectUser($hrInfo['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']); | ||
| 121 | + | ||
| 112 | DB::commit(); | 122 | DB::commit(); |
| 113 | }catch (\Exception $e){ | 123 | }catch (\Exception $e){ |
| 114 | DB::rollBack(); | 124 | DB::rollBack(); |
| @@ -118,6 +128,37 @@ class HrLogic extends BaseLogic | @@ -118,6 +128,37 @@ class HrLogic extends BaseLogic | ||
| 118 | } | 128 | } |
| 119 | 129 | ||
| 120 | /** | 130 | /** |
| 131 | + * 同步到B端用户 | ||
| 132 | + * @author zbj | ||
| 133 | + * @date 2023/10/23 | ||
| 134 | + */ | ||
| 135 | + public function syncBProjectUser($old_mobile, $mobile, $name, $status){ | ||
| 136 | + $user = User::where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $old_mobile)->first(); | ||
| 137 | + //在职 | ||
| 138 | + if($status == ManageHr::STATUS_ONE){ | ||
| 139 | + if(!$user){ | ||
| 140 | + $user = new User(); | ||
| 141 | + $user->project_id = Project::DEMO_PROJECT_ID; | ||
| 142 | + $user->mobile = $mobile; | ||
| 143 | + $user->name = $name; | ||
| 144 | + $user->password = base64_encode(md5('v6.' . substr($mobile, -6))); | ||
| 145 | + $user->type = User::TYPE_ONE; | ||
| 146 | + $user->role_id = 38; //技术总部 | ||
| 147 | + $user->save(); | ||
| 148 | + }else{ | ||
| 149 | + $user->mobile = $mobile; | ||
| 150 | + $user->name = $name; | ||
| 151 | + $user->save(); | ||
| 152 | + } | ||
| 153 | + }else{ | ||
| 154 | + //离职 | ||
| 155 | + if($user){ | ||
| 156 | + $user->delete(); | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + /** | ||
| 121 | * @remark :获取详情 | 162 | * @remark :获取详情 |
| 122 | * @name :getHrInfo | 163 | * @name :getHrInfo |
| 123 | * @author :lyh | 164 | * @author :lyh |
-
请 注册 或 登录 后发表评论