添加h5文章内容
parent
a51c032a99
commit
5509794ae9
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Endpoint\Wap\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Article;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ArticleController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 文章详情
|
||||||
|
*
|
||||||
|
* @param [type] $id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function show($id, Request $request)
|
||||||
|
{
|
||||||
|
$article = Article::findOrFail($id);
|
||||||
|
|
||||||
|
$view = '';
|
||||||
|
//区分文章分类ID
|
||||||
|
switch ($article->category_id) {
|
||||||
|
case config('settings.article_agreement'): //如果是协议分类
|
||||||
|
$view = 'endpoint.article.agreement';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//区分文章的分类祖先ID
|
||||||
|
switch ($article->category->ancestors->first()?->id) {
|
||||||
|
case config('settings.article_agreement'): //如果是协议
|
||||||
|
$view = 'endpoint.article.agreement';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!$view) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
return view($view, compact('article'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Endpoint\Wap\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests;
|
||||||
|
use DispatchesJobs;
|
||||||
|
use ValidatesRequests;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Endpoint\Wap\Http\Controllers\ArticleController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
//快递100物流推送
|
||||||
|
Route::get('articles/{id}', [ArticleController::class, 'show']);
|
||||||
|
|
@ -50,6 +50,10 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
Route::prefix('callback')
|
Route::prefix('callback')
|
||||||
->namespace($this->namespace)
|
->namespace($this->namespace)
|
||||||
->group(app_path('Endpoint/Callback/routes.php'));
|
->group(app_path('Endpoint/Callback/routes.php'));
|
||||||
|
|
||||||
|
Route::prefix('h5')
|
||||||
|
->namespace($this->namespace)
|
||||||
|
->group(app_path('Endpoint/Wap/routes.php'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{{ $article->title }}</title>
|
||||||
|
<style>
|
||||||
|
/* body{
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
} */
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{!! $article->content !!}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue