<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\DwbsUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

class AuthorController extends Controller
{
    //获取代理端用户头像
    public function getUserAvatar(Request $request)
    {
        $search=$request->input('search');
        $avatar=DwbsUser::query()->where('mobile',$search)->value('headimgurl');
        return $this->success($avatar);
    }

    //上传头像
    public function uploadAvatar(Request  $request)
    {
        $file = $request->file('img')->store('avatar/'.date('Y-m-d'));
        if(empty($file)){
            return $this->error();
        }else{
            return $this->success(Storage::url($file));
        }
    }
}
