1
This commit is contained in:
@@ -123,6 +123,12 @@ class ArticleController extends BaseController
|
|||||||
|
|
||||||
public function edit(Request $request, int $id): Response
|
public function edit(Request $request, int $id): Response
|
||||||
{
|
{
|
||||||
|
$request->setPost('user_id', $request->user['id']);
|
||||||
|
|
||||||
|
$protocol = $request->header('x-forwarded-proto',
|
||||||
|
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http');
|
||||||
|
$domain = $protocol . '://' . $request->host();
|
||||||
|
$request->setPost('domain', $domain);
|
||||||
try {
|
try {
|
||||||
return $this->getService()->edit($request->all(), $id)
|
return $this->getService()->edit($request->all(), $id)
|
||||||
? $this->successResponse()
|
? $this->successResponse()
|
||||||
|
|||||||
@@ -118,6 +118,22 @@ class ArticleService extends BaseService
|
|||||||
$num = $params['num'] ?? 0;
|
$num = $params['num'] ?? 0;
|
||||||
unset($params['num']);
|
unset($params['num']);
|
||||||
|
|
||||||
|
// 将OSS直连地址替换为代理地址
|
||||||
|
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
||||||
|
$proxyPath = $params['domain'].'/console/upload/image/proxy?file=';
|
||||||
|
unset($params['domain']);
|
||||||
|
|
||||||
|
$params['content'] = str_replace(
|
||||||
|
'?Expires=',
|
||||||
|
'&Expires=',
|
||||||
|
$params['content']
|
||||||
|
);
|
||||||
|
$params['content'] = str_replace(
|
||||||
|
$ossDomain,
|
||||||
|
$proxyPath,
|
||||||
|
$params['content']
|
||||||
|
);
|
||||||
|
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
try {
|
try {
|
||||||
$info = $this->update($id, $params);
|
$info = $this->update($id, $params);
|
||||||
|
|||||||
Reference in New Issue
Block a user