作者 liyuhang

gx

... ... @@ -113,11 +113,13 @@ class ImageController
if ($res === false) {
return $this->fail($image->getError(), 400);
}
var_dump($res);
die();
$data = [
'path' => $url.$filename,
'created_at' => date('Y-m-d H:i:s',time()),
'size' => $res->getSize(),
'hash' => hash(),
'hash' => $res->getHash(),
];
$imageModel = new ImageModel();
$imageModel->add($data);
... ...
... ... @@ -30,11 +30,6 @@ class UserLogic extends BaseLogic
}
//密码加密
$this->param['password'] = base64_encode(md5($this->param['password']));
//上传头像
if(isset($this->param['image'])){
$data = $this->upload();
$this->param['image'] = $data['hash'];
}
$rs = $this->model->add($this->param);
if($rs === false){
$this->fail('error',Code::USER_ERROR);
... ... @@ -55,11 +50,6 @@ class UserLogic extends BaseLogic
if($info !== false){
$this->fail('当前编辑的手机号码已存在',Code::USER_PARAMS_ERROE);
}
//上传头像
if(isset($this->param['image'])){
$data = $this->upload();
$this->param['image'] = $data['hash'];
}
$this->param['operator_id'] = $this->user['id'];
$rs = $this->model->edits($this->param);
if($rs === false){
... ...
... ... @@ -155,6 +155,9 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('file')->group(function () {
Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');
});
Route::prefix('image')->group(function () {
Route::post('/upload', [\App\Http\Controllers\ImageController::class, 'upload'])->name('image_upload');
});
});
//无需登录验证的路由组
... ...