正在显示
4 个修改的文件
包含
116 行增加
和
89 行删除
app/Console/Commands/ImportManager.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ImportManager.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/8/7 17:47 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands; | ||
| 11 | + | ||
| 12 | +use App\Models\Manage\EntryPosition; | ||
| 13 | +use App\Models\Manage\JobLevel; | ||
| 14 | +use App\Models\Manage\ManageHr; | ||
| 15 | +use App\Models\Service\Service; | ||
| 16 | +use Illuminate\Console\Command; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 18 | + | ||
| 19 | +class ImportManager extends Command | ||
| 20 | +{ | ||
| 21 | + /** | ||
| 22 | + * @remark :导入5.0管理员数据 | ||
| 23 | + * @name :handle | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2023/8/7 17:49 | ||
| 27 | + */ | ||
| 28 | + public function handle(){ | ||
| 29 | + $model = new Service(); | ||
| 30 | + $info = $model->read(['type'=>5]); | ||
| 31 | + $values = json_decode($info['values']); | ||
| 32 | + foreach ($values as $k => $v){ | ||
| 33 | + $v = (array)$v; | ||
| 34 | + $data = [ | ||
| 35 | + 'name'=>$v['name'], | ||
| 36 | + 'mobile'=>$v['mobile'], | ||
| 37 | + 'password'=>'$2y$10$ZNHxlIddWiQzQbIIzFgYJOsPlQ4n0cwWl8Sea53qvQvDXtu3WeYMC', | ||
| 38 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 39 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 40 | + ]; | ||
| 41 | + $manager_id = DB::table('gl_manage')->insertGetId($data); | ||
| 42 | + if($v['sex'] == '女'){ | ||
| 43 | + $v['sex'] = 2; | ||
| 44 | + }else{ | ||
| 45 | + $v['sex'] = 1; | ||
| 46 | + } | ||
| 47 | + $education = [ | ||
| 48 | + '专科' => 1, | ||
| 49 | + '大专' => 1, | ||
| 50 | + '中专' => 0, | ||
| 51 | + '本科' => 2, | ||
| 52 | + '自考本科'=>0, | ||
| 53 | + '全日制本科'=>2, | ||
| 54 | + '本科在读'=>2, | ||
| 55 | + '大学本科'=>2, | ||
| 56 | + '硕士研究生' => 3, | ||
| 57 | + '硕士'=>3, | ||
| 58 | + '其他' => 0, | ||
| 59 | + ]; | ||
| 60 | + //获取入职岗位 | ||
| 61 | + $entryPositionModel = new EntryPosition(); | ||
| 62 | + $entry_position = $entryPositionModel->read(['name'=>$v['entry_position']]); | ||
| 63 | + if($entry_position !== false){ | ||
| 64 | + $entry_position = $entry_position['id']; | ||
| 65 | + }else{ | ||
| 66 | + $entry_position = ''; | ||
| 67 | + } | ||
| 68 | + //获取级别 | ||
| 69 | + $jobLevelModel = new JobLevel(); | ||
| 70 | + $p_level = $jobLevelModel->read(['name'=>$v['p_level']]); | ||
| 71 | + if($entry_position !== false){ | ||
| 72 | + $p_level = $p_level['id']; | ||
| 73 | + }else{ | ||
| 74 | + $p_level = ''; | ||
| 75 | + } | ||
| 76 | + $manager_data = [ | ||
| 77 | + 'manage_id'=>$manager_id ?? '', | ||
| 78 | + 'name'=>$v['name'], | ||
| 79 | + 'id_card'=>$v['id_card'], | ||
| 80 | + 'mobile'=>$v['mobile'], | ||
| 81 | + 'birthday'=>$v['birthday'], | ||
| 82 | + 'address'=>$v['address'], | ||
| 83 | + 'sex'=>$v['sex'], | ||
| 84 | + 'nationality'=>$v['nationality'], | ||
| 85 | + 'education'=>isset($education[$v['education']]) ?? 0, | ||
| 86 | + 'major'=>$v['major'], | ||
| 87 | + 'graduate_school'=>$v['graduate_school'], | ||
| 88 | + 'english_level'=>$v['english_level'], | ||
| 89 | + 'entry_position'=>$entry_position, | ||
| 90 | + 'p_level'=>$p_level, | ||
| 91 | + 'residential_address'=>$v['residential_address'], | ||
| 92 | + 'emergency_contact'=>$v['emergency_contact'], | ||
| 93 | + 'career_history'=>json_encode((array)$v['career_history']), | ||
| 94 | + 'learning_history'=>json_encode((array)$v['learning_history']), | ||
| 95 | + 'bank_card'=>$v['bank_card'], | ||
| 96 | + 'photo_gallery'=>json_encode((array)$v['photo_gallery']), | ||
| 97 | + 'id_card_gallery'=>json_encode((array)$v['id_card_gallery']), | ||
| 98 | + 'certificate_gallery'=>json_encode((array)$v['certificate_gallery']), | ||
| 99 | + 'dangyuan'=>$v['dangyuan'], | ||
| 100 | + 'dangzhibu'=>$v['dangzhibu'], | ||
| 101 | + 'dang_address'=>$v['dang_address'], | ||
| 102 | + 'join_date'=>$v['join_date'], | ||
| 103 | + 'status'=>($v['status'] == '在职') ? 1 : 2, | ||
| 104 | + 'computer_account'=>$v['computer_account'], | ||
| 105 | + 'qq_account'=>$v['qq_account'] | ||
| 106 | + ]; | ||
| 107 | + $hrModel = new ManageHr(); | ||
| 108 | + $hrModel->add($manager_data); | ||
| 109 | + } | ||
| 110 | + return 1; | ||
| 111 | + } | ||
| 112 | +} |
| @@ -36,9 +36,9 @@ class HrController extends BaseController | @@ -36,9 +36,9 @@ class HrController extends BaseController | ||
| 36 | 'id.required' => 'ID不能为空' | 36 | 'id.required' => 'ID不能为空' |
| 37 | ]); | 37 | ]); |
| 38 | $info = $logic->getHrInfo($this->param['id']); | 38 | $info = $logic->getHrInfo($this->param['id']); |
| 39 | - $info['photo_gallery_link'] = getImageUrl($info['photo_gallery']); | ||
| 40 | - $info['id_card_gallery_link'] = getImageUrl($info['id_card_gallery']); | ||
| 41 | - $info['certificate_gallery_link'] = getImageUrl($info['certificate_gallery']); | 39 | + $info['photo_gallery_link'] = $info['photo_gallery']; |
| 40 | + $info['id_card_gallery_link'] = $info['id_card_gallery']; | ||
| 41 | + $info['certificate_gallery_link'] = $info['certificate_gallery']; | ||
| 42 | return $this->success($info); | 42 | return $this->success($info); |
| 43 | } | 43 | } |
| 44 | 44 |
| @@ -192,90 +192,5 @@ class ComController extends BaseController | @@ -192,90 +192,5 @@ class ComController extends BaseController | ||
| 192 | $this->response('success',Code::SUCCESS,$str); | 192 | $this->response('success',Code::SUCCESS,$str); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | - public function ceshi(){ | ||
| 196 | - $model = new Service(); | ||
| 197 | - $info = $model->read(['type'=>5]); | ||
| 198 | - $values = json_decode($info['values']); | ||
| 199 | - $data = []; | ||
| 200 | - foreach ($values as $k => $v){ | ||
| 201 | - $v = (array)$v; | ||
| 202 | - $data = [ | ||
| 203 | - 'name'=>$v['name'], | ||
| 204 | - 'mobile'=>$v['mobile'], | ||
| 205 | - 'password'=>'$2y$10$ZNHxlIddWiQzQbIIzFgYJOsPlQ4n0cwWl8Sea53qvQvDXtu3WeYMC', | ||
| 206 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 207 | - 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 208 | - ]; | ||
| 209 | - $manager_id = DB::table('gl_manage')->insertGetId($data); | ||
| 210 | - if($v['sex'] == '女'){ | ||
| 211 | - $v['sex'] = 2; | ||
| 212 | - }else{ | ||
| 213 | - $v['sex'] = 1; | ||
| 214 | - } | ||
| 215 | - $education = [ | ||
| 216 | - '专科' => 1, | ||
| 217 | - '大专' => 1, | ||
| 218 | - '中专' => 0, | ||
| 219 | - '本科' => 2, | ||
| 220 | - '自考本科'=>0, | ||
| 221 | - '全日制本科'=>2, | ||
| 222 | - '本科在读'=>2, | ||
| 223 | - '大学本科'=>2, | ||
| 224 | - '硕士研究生' => 3, | ||
| 225 | - '硕士'=>3, | ||
| 226 | - '其他' => 0, | ||
| 227 | - ]; | ||
| 228 | - //获取入职岗位 | ||
| 229 | - $entryPositionModel = new EntryPosition(); | ||
| 230 | - $entry_position = $entryPositionModel->read(['name'=>$v['entry_position']]); | ||
| 231 | - if($entry_position !== false){ | ||
| 232 | - $entry_position = $entry_position['id']; | ||
| 233 | - }else{ | ||
| 234 | - $entry_position = ''; | ||
| 235 | - } | ||
| 236 | - //获取级别 | ||
| 237 | - $jobLevelModel = new JobLevel(); | ||
| 238 | - $p_level = $jobLevelModel->read(['name'=>$v['p_level']]); | ||
| 239 | - if($entry_position !== false){ | ||
| 240 | - $p_level = $p_level['id']; | ||
| 241 | - }else{ | ||
| 242 | - $p_level = ''; | ||
| 243 | - } | ||
| 244 | - $manager_data = [ | ||
| 245 | - 'manage_id'=>$manager_id ?? '', | ||
| 246 | - 'name'=>$v['name'], | ||
| 247 | - 'id_card'=>$v['id_card'], | ||
| 248 | - 'mobile'=>$v['mobile'], | ||
| 249 | - 'birthday'=>$v['birthday'], | ||
| 250 | - 'address'=>$v['address'], | ||
| 251 | - 'sex'=>$v['sex'], | ||
| 252 | - 'nationality'=>$v['nationality'], | ||
| 253 | - 'education'=>isset($education[$v['education']]) ?? 0, | ||
| 254 | - 'major'=>$v['major'], | ||
| 255 | - 'graduate_school'=>$v['graduate_school'], | ||
| 256 | - 'english_level'=>$v['english_level'], | ||
| 257 | - 'entry_position'=>$entry_position, | ||
| 258 | - 'p_level'=>$p_level, | ||
| 259 | - 'residential_address'=>$v['residential_address'], | ||
| 260 | - 'emergency_contact'=>$v['emergency_contact'], | ||
| 261 | - 'career_history'=>json_encode((array)$v['career_history']), | ||
| 262 | - 'learning_history'=>json_encode((array)$v['learning_history']), | ||
| 263 | - 'bank_card'=>$v['bank_card'], | ||
| 264 | - 'photo_gallery'=>json_encode((array)$v['photo_gallery']), | ||
| 265 | - 'id_card_gallery'=>json_encode((array)$v['id_card_gallery']), | ||
| 266 | - 'certificate_gallery'=>json_encode((array)$v['certificate_gallery']), | ||
| 267 | - 'dangyuan'=>$v['dangyuan'], | ||
| 268 | - 'dangzhibu'=>$v['dangzhibu'], | ||
| 269 | - 'dang_address'=>$v['dang_address'], | ||
| 270 | - 'join_date'=>$v['join_date'], | ||
| 271 | - 'status'=>($v['status'] == '在职') ? 1 : 2, | ||
| 272 | - 'computer_account'=>$v['computer_account'], | ||
| 273 | - 'qq_account'=>$v['qq_account'] | ||
| 274 | - ]; | ||
| 275 | - $hrModel = new ManageHr(); | ||
| 276 | - $hrModel->add($manager_data); | ||
| 277 | - } | ||
| 278 | - return 1; | ||
| 279 | - } | ||
| 280 | 195 | ||
| 281 | } | 196 | } |
| @@ -23,7 +23,7 @@ class Mobile implements Rule | @@ -23,7 +23,7 @@ class Mobile implements Rule | ||
| 23 | */ | 23 | */ |
| 24 | public function passes($attribute, $value) | 24 | public function passes($attribute, $value) |
| 25 | { | 25 | { |
| 26 | - $cardReg = '/^1(3|4|5|7|8)\d{9}$/'; | 26 | + $cardReg = '/^1(3|4|5|7|8|9)\d{9}$/'; |
| 27 | return preg_match($cardReg, $value); | 27 | return preg_match($cardReg, $value); |
| 28 | } | 28 | } |
| 29 | 29 |
-
请 注册 或 登录 后发表评论