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 () {