正在显示
2 个修改的文件
包含
6 行增加
和
7 行删除
@@ -62,13 +62,6 @@ class Login extends BaseApi | @@ -62,13 +62,6 @@ class Login extends BaseApi | ||
62 | 'userinfo' => $this->auth->getUserinfo(), | 62 | 'userinfo' => $this->auth->getUserinfo(), |
63 | 'thirdinfo' => $result, | 63 | 'thirdinfo' => $result, |
64 | ]; | 64 | ]; |
65 | - dd($data); | ||
66 | - dd($this->auth->avatar); | ||
67 | - if ($this->auth->avatar != '' && !in_array(substr($this->auth->avatar,-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){ | ||
68 | - $content = file_get_contents($this->auth->avatar); | ||
69 | - file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg', $content); | ||
70 | - model('user')->where('id',$this->auth->id)->update(['avatar'=>'/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg']); | ||
71 | - } | ||
72 | $this->success(__('Logged in successful'), $data); | 65 | $this->success(__('Logged in successful'), $data); |
73 | } | 66 | } |
74 | } | 67 | } |
@@ -126,6 +126,12 @@ class User extends Model | @@ -126,6 +126,12 @@ class User extends Model | ||
126 | //$value = '/assets/img/avatar.png'; | 126 | //$value = '/assets/img/avatar.png'; |
127 | $value = letter_avatar($data['nickname']); | 127 | $value = letter_avatar($data['nickname']); |
128 | } | 128 | } |
129 | + if ($data['avatar'] != '' && !in_array(substr($data['avatar'],-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){ | ||
130 | + $content = file_get_contents($data['avatar']); | ||
131 | + file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$data['id'].'.jpg', $content); | ||
132 | + model('user')->where('id',$data['id'])->update(['avatar'=>'/uploads/user_avatar/user_id_'.$data['id'].'.jpg']); | ||
133 | + $data['avatar'] = '/uploads/user_avatar/user_id_'.$data['id'].'.jpg'; | ||
134 | + } | ||
129 | if (file_exists(cdnurl($value,true))){ | 135 | if (file_exists(cdnurl($value,true))){ |
130 | return cdnurl($value,true); | 136 | return cdnurl($value,true); |
131 | } | 137 | } |
-
请 注册 或 登录 后发表评论