update
This commit is contained in:
@ -10,6 +10,6 @@ class Config extends AbstractConstants
|
|||||||
{
|
{
|
||||||
public static function getDomain()
|
public static function getDomain()
|
||||||
{
|
{
|
||||||
return env('APP_DOMAIN', '');
|
return env('APP_DOMAIN', 'http://127.0.0.1');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -69,10 +69,10 @@ class UploadController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验类型
|
// 校验类型
|
||||||
$allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
// $allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||||
if (!in_array($file->getClientMediaType(), $allowedTypes)) {
|
// if (!in_array($file->getClientMediaType(), $allowedTypes)) {
|
||||||
return $this->response->json(['code' => 415, 'msg' => '不支持的图片格式']);
|
// return $this->response->json(['code' => 415, 'msg' => '不支持的图片格式']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 限制大小 (例如 5MB)
|
// 限制大小 (例如 5MB)
|
||||||
$maxSize = 5 * 1024 * 1024;
|
$maxSize = 5 * 1024 * 1024;
|
||||||
@ -82,7 +82,7 @@ class UploadController extends AbstractController
|
|||||||
|
|
||||||
// 保存路径
|
// 保存路径
|
||||||
$filename = uniqid() . '.' . pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
|
$filename = uniqid() . '.' . pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
|
||||||
$targetPath = BASE_PATH . '/uploads/' . $filename;
|
$targetPath = BASE_PATH . '/public/uploads/' . $filename;
|
||||||
|
|
||||||
// 确保目录存在
|
// 确保目录存在
|
||||||
if (!is_dir(dirname($targetPath))) {
|
if (!is_dir(dirname($targetPath))) {
|
||||||
@ -98,7 +98,7 @@ class UploadController extends AbstractController
|
|||||||
|
|
||||||
return $this->response->json([
|
return $this->response->json([
|
||||||
'errno' => 0,
|
'errno' => 0,
|
||||||
'msg' => '上传成功!!',
|
'msg' => '上传成功!!~',
|
||||||
'data' => [
|
'data' => [
|
||||||
'url' => Config::getDomain() . $url,
|
'url' => Config::getDomain() . $url,
|
||||||
]
|
]
|
||||||
|
@ -37,6 +37,11 @@ class WebsiteController extends AbstractController
|
|||||||
$model->app_description = $this->request->post('app_description');
|
$model->app_description = $this->request->post('app_description');
|
||||||
$model->app_name = $this->request->post('app_name');
|
$model->app_name = $this->request->post('app_name');
|
||||||
$model->app_domain = $this->request->post('app_domain');
|
$model->app_domain = $this->request->post('app_domain');
|
||||||
|
$model->app_filing = $this->request->post('app_filing');
|
||||||
|
$model->app_filing_url = $this->request->post('app_filing_url');
|
||||||
|
$model->app_logo = $this->request->post('app_logo');
|
||||||
|
$model->app_extra = $this->request->post('app_extra');
|
||||||
|
$model->app_template = $this->request->post('template');
|
||||||
$model->save();
|
$model->save();
|
||||||
|
|
||||||
return $this->response->json([]);
|
return $this->response->json([]);
|
||||||
@ -77,7 +82,7 @@ class WebsiteController extends AbstractController
|
|||||||
if (!$query) {
|
if (!$query) {
|
||||||
return $this->response->json(['code' => 400, 'msg' => 'id 有误']);
|
return $this->response->json(['code' => 400, 'msg' => 'id 有误']);
|
||||||
}
|
}
|
||||||
|
$query['template'] = $query['app_template'];
|
||||||
return $this->response->json(['code' => 0, 'msg' => 'ok', 'data' => $query]);
|
return $this->response->json(['code' => 0, 'msg' => 'ok', 'data' => $query]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +105,11 @@ class WebsiteController extends AbstractController
|
|||||||
$query->app_name = $this->request->post('app_name');
|
$query->app_name = $this->request->post('app_name');
|
||||||
$query->app_domain = $this->request->post('app_domain');
|
$query->app_domain = $this->request->post('app_domain');
|
||||||
$query->app_keywords = $this->request->post('app_keywords');
|
$query->app_keywords = $this->request->post('app_keywords');
|
||||||
|
$query->app_filing = $this->request->post('app_filing');
|
||||||
|
$query->app_filing_url = $this->request->post('app_filing_url');
|
||||||
|
$query->app_logo = $this->request->post('app_logo');
|
||||||
|
$query->app_extra = $this->request->post('app_extra');
|
||||||
|
$query->app_template = $this->request->post('template');
|
||||||
|
|
||||||
$query->save();
|
$query->save();
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@ namespace App\Model;
|
|||||||
* @property string $app_domain
|
* @property string $app_domain
|
||||||
* @property int $is_delete
|
* @property int $is_delete
|
||||||
* @property string $app_keywords
|
* @property string $app_keywords
|
||||||
|
* @property string $app_filing
|
||||||
|
* @property string $app_filing_url
|
||||||
|
* @property string $app_extra
|
||||||
|
* @property string $app_logo
|
||||||
|
* @property int $app_template
|
||||||
*/
|
*/
|
||||||
class AppWebsiteConfig extends Model
|
class AppWebsiteConfig extends Model
|
||||||
{
|
{
|
||||||
@ -34,5 +39,5 @@ class AppWebsiteConfig extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['id' => 'integer', 'created_at' => 'datetime', 'created_by' => 'integer', 'updated_at' => 'datetime', 'updated_by' => 'integer', 'is_delete' => 'integer'];
|
protected array $casts = ['id' => 'integer', 'created_at' => 'datetime', 'created_by' => 'integer', 'updated_at' => 'datetime', 'updated_by' => 'integer', 'is_delete' => 'integer', 'app_template' => 'integer'];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user