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
dc59533e
...
dc59533ed75750fdc73ebe974e7a42614f50cd9e
authored
2021-11-15 17:21:54 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
*
1 parent
d79cfd47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
40 deletions
app/Helper/CosHelper.php
app/Services/MusicianAgreementService.php
app/Services/MusicianWithdrawService.php
composer.json
composer.lock
app/Helper/CosHelper.php
0 → 100644
View file @
dc59533
<?php
namespace
App\Helper
;
use
Illuminate\Support\Str
;
use
Qcloud\Cos\Client
;
class
CosHelper
{
protected
$client
;
protected
$bucket
;
public
function
__construct
()
{
$secretId
=
env
(
'COS_SECRET_ID'
);
//"云 API 密钥 SecretId";
$secretKey
=
env
(
'COS_SECRET_KEY'
);
//"云 API 密钥 SecretKey";
$region
=
env
(
'COS_REGION'
);
//设置一个默认的存储桶地域
$cosClient
=
new
Client
(
array
(
'region'
=>
$region
,
'schema'
=>
'https'
,
//协议头部,默认为http
'credentials'
=>
array
(
'secretId'
=>
$secretId
,
'secretKey'
=>
$secretKey
)));
$this
->
client
=
$cosClient
;
$this
->
bucket
=
env
(
'COS_BUCKET'
);
}
/**
* 预览文档 ———— 同步转换为html
* @param string $key
* @param int $expire
* @return string
*/
public
function
getPreviewUrl
(
string
$key
,
int
$expire
=
10
)
:
string
{
$url
=
$this
->
client
->
getObjectUrl
(
$this
->
bucket
,
$key
,
"+
{
$expire
}
minutes"
);
return
$url
;
// return $url . "ci-process=doc-preview&dstType=html";
}
}
app/Services/MusicianAgreementService.php
View file @
dc59533
...
...
@@ -2,10 +2,12 @@
namespace
App\Services
;
use
App\Helper\CosHelper
;
use
App\Helper\Response
;
use
App\Models\Legal\Contract
;
use
App\Models\Legal\StakeholderContract
;
use
App\Models\Legal\Treaty
;
use
Qcloud\Cos\Client
;
/**
* Class MusicianAgreementService
...
...
@@ -18,17 +20,24 @@ class MusicianAgreementService extends Service
*/
public
function
treatyList
()
{
$res
=
Treaty
::
query
()
->
whereIn
(
'party_b'
,
$this
->
stakeholder_ids
)
->
where
(
'deadline_date'
,
'>'
,
$this
->
now
)
->
with
([
'file:id,treaty_id,file_id'
,
'file.fileInfo:id,
location
'
])
$res
=
Treaty
::
query
()
->
whereIn
(
'party_b'
,
$this
->
stakeholder_ids
)
->
where
(
'deadline_date'
,
'>'
,
$this
->
now
)
->
with
([
'file:id,treaty_id,file_id'
,
'file.fileInfo:id,
key
'
])
->
select
([
'id'
,
'treaty_name'
,
'treaty_type'
,
'service_type'
,
'deadline_date'
,
'music_no'
])
->
orderByDesc
(
'created_at'
)
->
paginate
(
$this
->
pageSize
);
$client
=
new
CosHelper
();
foreach
(
$res
as
&
$item
)
{
$item_res
=
$item
->
toArray
();
$files
=
[];
if
(
!
empty
(
$item_res
[
'file'
]))
{
foreach
(
$item_res
[
'file'
]
as
$file_item
)
{
!
empty
(
$file_item
[
'file_info'
][
'
location'
])
&&
$files
[]
=
$file_item
[
'file_info'
][
'location
'
];
!
empty
(
$file_item
[
'file_info'
][
'
key'
])
&&
$files
[]
=
$file_item
[
'file_info'
][
'key
'
];
}
}
foreach
(
$files
as
&
$file
)
{
$file
=
$client
->
getPreviewUrl
(
$file
);
}
$item
->
setAttribute
(
'files'
,
$files
);
unset
(
$item
->
file
);
}
...
...
app/Services/MusicianWithdrawService.php
View file @
dc59533
...
...
@@ -48,43 +48,6 @@ class MusicianWithdrawService extends Service
}
/**
* 修改提现状态
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
changeStatus
()
{
$withdraw_status
=
''
;
$query
=
StakeholderIncomeSyncAppDetails
::
query
()
->
where
([
'sync_status'
=>
1
,
'identifier'
=>
$this
->
identifier
->
identifier
])
->
whereIn
(
'serial_no'
,
$this
->
request
->
input
(
'busi_id'
));
switch
(
$this
->
request
->
input
(
'type'
))
{
case
'confirm'
:
//已确认
$withdraw_status
=
1
;
$query
=
$query
->
where
([
'withdraw_status'
=>
0
]);
break
;
case
'fail'
:
//提现失败 -> 待提现
$withdraw_status
=
1
;
$query
=
$query
->
where
([
'withdraw_status'
=>
2
]);
break
;
case
'advance'
:
//提现中
$withdraw_status
=
2
;
$query
=
$query
->
where
([
'withdraw_status'
=>
1
]);
break
;
case
'success'
:
//提现完成
$withdraw_status
=
3
;
$query
=
$query
->
where
([
'withdraw_status'
=>
2
]);
break
;
}
if
(
$query
->
update
([
'withdraw_status'
=>
$withdraw_status
]))
{
return
Response
::
success
();
}
else
{
return
Response
::
error
();
}
}
/**
* 确认账单
* @return \Illuminate\Http\JsonResponse
*/
...
...
@@ -147,4 +110,22 @@ class MusicianWithdrawService extends Service
}
}
/**
* 修改提现状态
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
changeStatus
()
{
$withdraw_status
=
''
;
$query
=
StakeholderIncomeSyncAppDetails
::
query
()
->
where
([
'sync_status'
=>
1
,
'identifier'
=>
$this
->
identifier
->
identifier
])
->
whereIn
(
'serial_no'
,
$this
->
request
->
input
(
'busi_id'
));
if
(
$query
->
update
([
'withdraw_status'
=>
$withdraw_status
]))
{
return
Response
::
success
();
}
else
{
return
Response
::
error
();
}
}
}
...
...
composer.json
View file @
dc59533
...
...
@@ -14,7 +14,8 @@
"guzzlehttp/guzzle"
:
"^7.0.1"
,
"laravel/framework"
:
"^8.40"
,
"laravel/tinker"
:
"^2.5"
,
"phpseclib/phpseclib"
:
"~3.0"
"phpseclib/phpseclib"
:
"~3.0"
,
"qcloud/vod-sdk-v5"
:
"^2.4"
},
"require-dev"
:
{
"facade/ignition"
:
"^2.5"
,
...
...
composer.lock
View file @
dc59533
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment