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

'0041'

... ... @@ -62,6 +62,11 @@ class Login extends BaseApi
'userinfo' => $this->auth->getUserinfo(),
'thirdinfo' => $result,
];
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);
}
}
... ...
... ... @@ -94,11 +94,6 @@ class Treasured extends BaseApi
if ($this->auth->authlist == '' || $this->auth->authlist == ','){
$this->error('请您先实名认证');
}
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'=>'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg']);
}
//2.获取数据
$data = $this->get_data_array([
['url','域名不能为空'],
... ...
... ... @@ -126,7 +126,14 @@ class User extends Model
//$value = '/assets/img/avatar.png';
$value = letter_avatar($data['nickname']);
}
return cdnurl($value,true);
if (file_exists(cdnurl($value,true))){
return cdnurl($value,true);
}
if (file_exists(ROOT_PATH.$value)){
return this_url().$value;
}
dd(11212);
return this_url()."/uploads/user_avatar/001.jpg";
}
/**
... ...