| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- // +----------------------------------------------------------------------
- // | Laravel框架 [ Laravel ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 Laravel研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: wesmiler <12345678@qq.com>
- // +----------------------------------------------------------------------
- namespace App\Models;
- use App\Services\UserRoleService;
- use phpDocumentor\Reflection\Types\Parent_;
- /**
- * 人员管理-模型
- * @author wesmiler
- * @since 2020/11/10
- * Class AdminModel
- * @package App\Models
- */
- class UserModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'user';
- /**
- * 获取数据信息
- * @param int $id 用户ID
- * @return array|string
- * @author wesmiler
- * @since 2020/11/10
- */
- public function getInfo($id)
- {
- $info = parent::getInfo($id); // TODO: Change the autogenerated stub
- if ($info) {
- // 头像
- if ($info['avatar']) {
- $info['avatar'] = get_image_url($info['avatar']);
- }
- // 性别
- if ($info['gender']) {
- $info['gender_name'] = config('admin.gender_list')[$info['gender']];
- }
- // 岗位
- if ($info['position_id']) {
- $positionModel = new PositionModel();
- $positionInfo = $positionModel->getInfo($info['position_id']);
- $info['position_name'] = $positionInfo['name'];
- }
- // 职级
- if ($info['level_id']) {
- $levelMod = new LevelModel();
- $levelInfo = $levelMod->getInfo($info['level_id']);
- $info['level_name'] = $levelInfo['name'];
- }
- // 获取用户角色列表
- $userRoleService = new UserRoleService();
- $roleList = $userRoleService->getUserRoleList($id);
- $info['roles'] = $roleList;
- }
- return $info;
- }
- }
|