作者 郭宇鹏
1 个管道 的构建 通过 耗费 1 秒

'0041'

... ... @@ -62,13 +62,6 @@ class Login extends BaseApi
'userinfo' => $this->auth->getUserinfo(),
'thirdinfo' => $result,
];
dd($data);
dd($this->auth->avatar);
if ($this->auth->avatar != '' && !in_array(substr($this->auth->avatar,-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){
$content = file_get_contents($this->auth->avatar);
file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg', $content);
model('user')->where('id',$this->auth->id)->update(['avatar'=>'/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg']);
}
$this->success(__('Logged in successful'), $data);
}
}
... ...
... ... @@ -126,6 +126,12 @@ class User extends Model
//$value = '/assets/img/avatar.png';
$value = letter_avatar($data['nickname']);
}
if ($data['avatar'] != '' && !in_array(substr($data['avatar'],-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){
$content = file_get_contents($data['avatar']);
file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$data['id'].'.jpg', $content);
model('user')->where('id',$data['id'])->update(['avatar'=>'/uploads/user_avatar/user_id_'.$data['id'].'.jpg']);
$data['avatar'] = '/uploads/user_avatar/user_id_'.$data['id'].'.jpg';
}
if (file_exists(cdnurl($value,true))){
return cdnurl($value,true);
}
... ...