From d0e5d1b648cfd465e7e7b85a52d376357f845001 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 12 Dec 2025 13:25:02 +0800 Subject: [PATCH] =?UTF-8?q?post=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/PostService.php | 9 +++++++-- config/route.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/common/service/PostService.php b/app/common/service/PostService.php index ec43b83..1d5b3d5 100644 --- a/app/common/service/PostService.php +++ b/app/common/service/PostService.php @@ -3,6 +3,7 @@ namespace app\common\service; use app\common\model\PostMedia; +use app\common\model\Sku; use app\common\model\User; use app\common\validate\PostValidate; use app\common\traits\crud\CrudServiceTrait; @@ -111,6 +112,10 @@ class PostService redis::set('PostMedia_'.$data['user_id'],$media,30); unset($data['media']); + $data['category_id'] = Sku::where('id',$data['sku_id'])->value('category_id'); +// $latitude = $data['latitude']; +// $longitude = $data['longitude']; +// $data['geo'] = `ST_SRID(POINT($latitude, $longitude), 4326)`; return $data; } @@ -127,8 +132,8 @@ class PostService foreach ($media as $v) { PostMedia::create([ 'post_id' => $res->id, - 'media_type' => $this->getMediaTypeByUrl($v), - 'url' => $v, + 'media_type' => $this->getMediaTypeByUrl($v['url']), + 'url' => $v['url'], ]); } } diff --git a/config/route.php b/config/route.php index e0f5921..242f8a8 100644 --- a/config/route.php +++ b/config/route.php @@ -58,7 +58,7 @@ Route::group('/common', function () { Route::any('/list', [app\common\controller\PostController::class, 'index']); Route::any('/show', [app\common\controller\PostController::class, 'show']); Route::any('/interaction', [app\common\controller\PostController::class, 'interaction']); - Route::any('/store', [app\admin\controller\PostController::class, 'store']); + Route::any('/store', [app\common\controller\PostController::class, 'store']); // 评论 Route::group('/comment', function () {