public function deleteAvatarOss($object) { $obj = new alioss_sdk(); $bucket = $this->OSS_BUCKET_AVATAR; $response = $obj->delete_object($bucket, $object); if ($response->status == 204) { return true; } return false; }
public function setAvatar($avatarfile, $uid) { if (!is_file($avatarfile)) { $this->setError(ErrorConf::noUploadAvatarfile()); return false; } $obj = new alioss_sdk(); //$obj->set_debug_mode(FALSE); $bucket = 'tutuavatar'; $responseObj = $obj->upload_file_by_file($bucket, $uid, $avatarfile); if ($responseObj->status != 200) { $this->setError(ErrorConf::uploadAvatarfileFail()); } $avatartime = time(); $this->setUserinfo($uid, array('avatartime' => $avatartime)); $this->clearUserCache($uid); // 用户头像审核队列 QueueManager::pushUserAvatarAudit($uid); QueueManager::pushUserToUpdateUserSysFriendLog($uid); return $avatartime; }