Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
675f174b
...
675f174b4be195c6ccf399932de4e5fa00a67262
authored
2022-12-08 13:17:25 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
保存文件
1 parent
d2aedd35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
9 deletions
app/Services/PropertyTrackService.php
routes/property.php
app/Services/PropertyTrackService.php
View file @
675f174
...
...
@@ -247,10 +247,10 @@ class PropertyTrackService extends Service
}
/**
* 歌曲文件存储
* 歌曲文件存储
(分享页面)
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
f
ileSave
()
public
function
shareF
ileSave
()
{
try
{
...
...
@@ -258,12 +258,7 @@ class PropertyTrackService extends Service
DB
::
transaction
(
function
()
use
(
$fileTypes
){
$upload_user
=
''
;
if
(
$this
->
request
->
input
(
'from'
)
==
1
)
{
$upload_user
=
$this
->
request
->
get
(
'identifier'
)
?
$this
->
request
->
get
(
'identifier'
)
->
user_id
:
''
;
}
elseif
(
$this
->
request
->
input
(
'from'
)
==
2
)
{
$upload_user
=
PropertyShare
::
query
()
->
where
([
'id'
=>
$this
->
request
->
get
(
'id'
)])
->
pluck
(
'phone'
)
->
first
();
}
$upload_user
=
PropertyShare
::
query
()
->
where
([
'id'
=>
$this
->
request
->
get
(
'id'
)])
->
pluck
(
'phone'
)
->
first
();
//property_track_files
$res
=
PropertyTrackFile
::
query
()
->
create
([
...
...
@@ -311,6 +306,65 @@ class PropertyTrackService extends Service
}
/**
* 歌曲文件存储
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
fileSave
()
{
try
{
$fileTypes
=
$this
->
request
->
input
(
'file_types'
);
DB
::
transaction
(
function
()
use
(
$fileTypes
){
$upload_user
=
$this
->
request
->
get
(
'identifier'
)
?
$this
->
request
->
get
(
'identifier'
)
->
user_id
:
''
;
//property_track_files
$res
=
PropertyTrackFile
::
query
()
->
create
([
'pt_id'
=>
$this
->
request
->
get
(
'track_id'
),
'name'
=>
$this
->
request
->
input
(
'name'
),
'size_byte'
=>
$this
->
request
->
input
(
'size'
),
'upload_user'
=>
$upload_user
,
'upload_ip'
=>
$this
->
request
->
input
(
'upload_ip'
),
//上传客户端ip
'from'
=>
$this
->
request
->
input
(
'from'
),
// 0:版权 1:分贝登录用户 2:通过分享
]);
$data
=
[];
foreach
(
$fileTypes
as
$tpye_id
)
{
$data
[]
=
[
'pt_id'
=>
$this
->
request
->
input
(
'track_id'
),
'p_file_id'
=>
$res
->
id
,
'p_type_id'
=>
$tpye_id
,
'created_at'
=>
$this
->
now
,
];
}
//property_track_file_types
PropertyTrackFileType
::
query
()
->
insert
(
$data
);
//file_maps
FileMap
::
query
()
->
create
([
'user_id'
=>
$this
->
request
->
get
(
'identifier'
)
->
user_id
,
'company_id'
=>
$this
->
request
->
get
(
'identifier'
)
->
company_id
,
'name'
=>
$this
->
request
->
input
(
'name'
),
'path'
=>
$this
->
request
->
input
(
'dir'
),
'location'
=>
$this
->
request
->
input
(
'location'
),
'key'
=>
$this
->
request
->
input
(
'url'
),
'mime'
=>
$this
->
request
->
input
(
'mime'
),
'size'
=>
$this
->
request
->
input
(
'size'
),
'link'
=>
'property'
,
'link_id'
=>
$res
->
id
,
]);
});
return
Response
::
success
();
}
catch
(
\Throwable
$throwable
)
{
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$throwable
->
getMessage
()]);
return
Response
::
error
();
}
}
/**
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
getCosToken
()
...
...
routes/property.php
View file @
675f174
...
...
@@ -19,6 +19,7 @@ Route::group(["prefix"=>"property", "middleware"=>['auth.identifier']], function
Route
::
get
(
'/track/pending'
,
'PropertyTrackController@pending'
);
Route
::
get
(
'/track/file'
,
'PropertyTrackController@file'
);
Route
::
post
(
'/track/shareCreate'
,
'PropertyTrackController@shareCreate'
);
Route
::
post
(
'/track/fileSave'
,
'PropertyTrackController@fileSave'
);
});
Route
::
group
([
"prefix"
=>
"property"
],
function
(){
...
...
@@ -33,7 +34,7 @@ Route::group(["prefix"=>"property", "middleware"=>['auth.share']], function (){
Route
::
get
(
'/track/shareShow'
,
'PropertyTrackController@shareShow'
);
Route
::
get
(
'/track/shareFile'
,
'PropertyTrackController@shareFile'
);
Route
::
post
(
'/track/getCosToken'
,
'PropertyTrackController@getCosToken'
);
Route
::
post
(
'/track/
fileSave'
,
'PropertyTrackController@f
ileSave'
);
Route
::
post
(
'/track/
shareFileSave'
,
'PropertyTrackController@shareF
ileSave'
);
});
...
...
Please
register
or
sign in
to post a comment