Compare commits
2 Commits
d5b506b906
...
b7e3be82b4
Author | SHA1 | Date |
---|---|---|
|
b7e3be82b4 | |
|
4ff0dd1d02 |
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Articles;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ArticleController extends Controller {
|
||||
|
||||
|
||||
public function article(Request $request){
|
||||
$typestr = $request->get('type');
|
||||
$lang = $request->get('lang', 'en');
|
||||
$typepArr = [
|
||||
'ann' => 1,
|
||||
'faq' => 2,
|
||||
'tut' => 3,
|
||||
];
|
||||
$type = $typepArr[$typestr] ?? 1;
|
||||
$article = Articles::where(['type' => $type])->where(['lang' => $lang])->orderBy('id', 'desc')->first();
|
||||
if (is_null($article)) {
|
||||
header('Content-type: application/json');
|
||||
$data = [
|
||||
'title' => "暂无内容",
|
||||
'content' => "暂无内容",
|
||||
];
|
||||
echo json_encode(['code' => 0, 'msg' => '','data'=>$data], 256);
|
||||
exit;
|
||||
} else {
|
||||
header('Content-type: application/json');
|
||||
$data = [
|
||||
'title' => $article->title,
|
||||
'content' => $article->content,
|
||||
];
|
||||
echo json_encode(['code' => 0, 'msg' => '', 'data' => $data], 256);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,6 +72,7 @@ Route::group(['middleware' => ['cors']], function () {
|
|||
Route::any('/pushInvite', 'ApiController@pushInvite'); // 提取佣金
|
||||
Route::any('/upBalanceV3', 'ApiController@upBalanceV3'); // 流动性同步余额
|
||||
Route::any('/all', 'ApiController@all'); // 流动领取收益
|
||||
Route::any('/article', 'ArticleController@article'); // 常见问题,教程 公告
|
||||
});
|
||||
|
||||
// 定时
|
||||
|
|
Loading…
Reference in New Issue