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
3e213fd2
...
3e213fd27a190ee1094ad44c29c2d6af35a1049e
authored
2022-12-05 20:16:25 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
文件上传
1 parent
a75196cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
1 deletions
app/Services/PropertyTrackService.php
routes/property.php
app/Services/PropertyTrackService.php
View file @
3e213fd
...
...
@@ -7,11 +7,13 @@ use App\Helper\ErrorCode;
use
App\Helper\RedisClient
;
use
App\Helper\Response
;
use
App\Models\Legal\Contract
;
use
App\Models\Legal\FileMap
;
use
App\Models\Legal\PropertyFileType
;
use
App\Models\Legal\PropertyShare
;
use
App\Models\Legal\PropertyShareVerification
;
use
App\Models\Legal\PropertyTrack
;
use
App\Models\Legal\PropertyTrackFile
;
use
App\Models\Legal\PropertyTrackFileType
;
use
App\Models\Legal\StakeholderContract
;
use
App\Models\Legal\Treaty
;
use
App\Models\Legal\User
;
...
...
@@ -20,6 +22,8 @@ use App\Models\Musician\AppCompanyUser;
use
Carbon\Carbon
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
Qcloud\Cos\Client
;
/**
...
...
@@ -238,4 +242,68 @@ class PropertyTrackService extends Service
$res
=
PropertyFileType
::
query
()
->
where
([
'type'
=>
'track'
,
'visible'
=>
1
])
->
orderBy
(
'id'
)
->
get
();
return
Response
::
success
(
$res
);
}
/**
* 歌曲文件存储
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
fileSave
()
{
try
{
$fileTypes
=
$this
->
request
->
input
(
'file_types'
);
DB
::
transaction
(
function
()
use
(
$fileTypes
){
$upload_user
=
''
;
if
(
$this
->
request
->
input
(
'from'
)
==
1
)
{
$upload_user
=
$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'
)
?
$this
->
request
->
get
(
'identifier'
)
->
user_id
:
0
,
'company_id'
=>
$this
->
request
->
get
(
'identifier'
)
?
$this
->
request
->
get
(
'identifier'
)
->
company_id
:
0
,
'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
();
}
}
}
...
...
routes/property.php
View file @
3e213fd
...
...
@@ -32,7 +32,8 @@ Route::group(["prefix"=>"property"], function (){
Route
::
group
([
"prefix"
=>
"property"
,
"middleware"
=>
[
'auth.share'
]],
function
(){
Route
::
get
(
'/track/shareShow'
,
'PropertyTrackController@shareShow'
);
Route
::
get
(
'/track/shareFile'
,
'PropertyTrackController@shareFile'
);
Route
::
get
(
'/track/getCosToken'
,
'PropertyTrackController@getCosToken'
);
Route
::
post
(
'/track/fileSave'
,
'PropertyTrackController@fileSave'
);
});
...
...
Please
register
or
sign in
to post a comment