Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-03-16 19:07:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
115508cfbedbbe4dd1989624689dc562b7c0b799
115508cf
1 parent
61b9ebec
1.新增setting表.
2.后台新增setting功能.
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
14 deletions
app/Console/Commands/ImportPoemDataToMysql.php
app/Http/Controllers/V1/AuthController.php
routes/api.php
routes/web.php
app/Console/Commands/ImportPoemDataToMysql.php
View file @
115508c
...
...
@@ -233,23 +233,33 @@ class ImportPoemDataToMysql extends Command
try
{
$tangauthor
=
json_decode
(
Storage
::
disk
(
'public'
)
->
get
(
'PoemData/authors.tang.json'
),
true
);
foreach
(
$tangauthor
as
$item
)
{
$author
=
new
Author
();
$author
->
name
=
$item
[
'name'
];
$author
->
introduce
=
$item
[
'desc'
];
$author
->
save
();
}
//
foreach ($tangauthor as $item) {
//
$author = new Author();
//
$author->name = $item['name'];
//
$author->introduce = $item['desc'];
//
$author->save();
//
}
$tangshi
=
json_decode
(
Storage
::
disk
(
'public'
)
->
get
(
'PoemData/tangshi.json'
),
true
);
foreach
(
$tangshi
as
$item
)
{
$author
=
Author
::
query
()
->
where
(
'name'
,
$item
[
'author'
])
->
first
();
$author
=
new
Author
();
$author
->
name
=
$item
[
'author'
];
$author
->
introduce
=
''
;
foreach
(
$tangauthor
as
$itemauthor
)
{
if
(
$item
[
'author'
]
==
$itemauthor
[
'name'
]){
$author
->
introduce
=
$itemauthor
[
'desc'
];
}
}
$author
->
save
();
$poetry
=
new
Poetry
();
$poetry
->
name
=
$item
[
'title'
];
$poetry
->
author_id
=
$author
->
id
;
$poetry
->
save
();
foreach
(
$item
[
'paragraphs'
]
as
$value
)
{
$paragraphs
=
explode
(
"
\n
"
,
$item
[
'contents'
]);
foreach
(
$paragraphs
as
$value
)
{
$verse
=
new
Verse
();
$verse
->
poetry_id
=
$poetry
->
id
;
$verse
->
stanza
=
$value
;
...
...
@@ -263,4 +273,34 @@ class ImportPoemDataToMysql extends Command
dd
(
$exception
->
getMessage
()
.
' Line:'
.
$exception
->
getLine
()
.
' name:'
.
$item
[
'title'
]);
}
}
public
function
createDaoDeJingData
()
{
try
{
$author
=
new
Author
();
$author
->
name
=
'老子'
;
$author
->
introduce
=
'老子,姓李名耳,字聃(dān),春秋末期楚国人,中国古代思想家、哲学家、文学家和史学家,道家学派创始人和主要代表人物。老子出生于楚国苦县,早年跟随常枞(zōnɡ)学习知识。周灵王二十一年,老子入周王室任守藏(zàng)室史,后来受到排挤,被免去官职。'
;
$author
->
save
();
$collects
=
DB
::
table
(
'article'
)
->
get
();
foreach
(
$collects
as
$collect
)
{
$poetry
=
new
Poetry
();
$poetry
->
name
=
'道德经 '
.
$collect
->
title
;
$poetry
->
author_id
=
$author
->
id
;
$poetry
->
save
();
$verse
=
new
Verse
();
$verse
->
poetry_id
=
$poetry
->
id
;
$verse
->
stanza
=
$collect
->
body
;
$verse
->
annotate
=
''
;
$verse
->
en
=
''
;
$verse
->
save
();
}
}
catch
(
\Exception
$exception
){
dd
(
$exception
->
getMessage
()
.
' Line:'
.
$exception
->
getLine
()
.
' name:'
.
$collect
->
title
);
}
}
}
...
...
app/Http/Controllers/V1/AuthController.php
View file @
115508c
...
...
@@ -15,11 +15,10 @@ class AuthController extends Controller
{
/**
* web用户先访问这里进行重定向
* @param Request $request
* @param $service
* @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\RedirectResponse
*/
public
function
redirectToProvider
(
Request
$request
,
$service
)
public
function
redirectToProvider
(
$service
)
{
return
Socialite
::
driver
(
$service
)
->
redirect
();
}
...
...
routes/api.php
View file @
115508c
...
...
@@ -16,10 +16,6 @@ use Illuminate\Routing\Router;
Route
::
prefix
(
'v1'
)
->
namespace
(
'App\Http\Controllers\V1'
)
->
group
(
function
(
Router
$api
){
/** web用户跳转登录*/
$api
->
get
(
'auth/{service}'
,
'AuthController@redirectToProvider'
);
$api
->
get
(
'auth/{service}/callback'
,
'AuthController@handleProviderCallback'
);
/** 移动端微信用户登录*/
$api
->
get
(
'login/{service}/callback'
,
'AuthController@apiHandleProviderCallback'
);
});
...
...
routes/web.php
View file @
115508c
...
...
@@ -13,6 +13,13 @@ use Illuminate\Support\Facades\Route;
|
*/
Route
::
namespace
(
'App\Http\Controllers\V1'
)
->
group
(
function
(){
/** web用户跳转登录*/
Route
::
get
(
'auth/{service}'
,
'AuthController@redirectToProvider'
);
Route
::
get
(
'auth/{service}/callback'
,
'AuthController@handleProviderCallback'
);
});
Route
::
get
(
'/'
,
function
()
{
return
view
(
'welcome'
);
});
...
...
Please
register
or
login
to post a comment