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
f90266f3
...
f90266f3b3cf5ec8820276a624a33750822e2ba0
authored
2022-12-05 17:30:07 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分享链接页面信息
1 parent
23203efb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
app/Models/Legal/PropertyShare.php
app/Services/PropertyTrackService.php
app/Models/Legal/PropertyShare.php
View file @
f90266f
...
...
@@ -3,6 +3,7 @@
namespace
App\Models\Legal
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
/**
* Class PropertyShare
...
...
@@ -10,6 +11,9 @@ use App\Models\BaseModel;
*/
class
PropertyShare
extends
BaseModel
{
use
SoftDeletes
;
protected
$updated_at
=
false
;
protected
$guarded
=
[];
}
...
...
app/Services/PropertyTrackService.php
View file @
f90266f
...
...
@@ -129,18 +129,25 @@ class PropertyTrackService extends Service
$share_url_hash
=
crc64
(
$share
);
$expire_time
=
time
()
+
$propertyConfig
[
'token_valid'
];
if
(
PropertyShare
::
query
()
->
insertGetId
([
'pf_id'
=>
$this
->
request
->
input
(
'track_id'
),
'phone'
=>
$this
->
request
->
input
(
'phone'
),
'share_url'
=>
$share
,
'share_url_hash'
=>
$share_url_hash
,
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$expire_time
),
'from'
=>
$this
->
request
->
input
(
'from'
),
'user_id'
=>
$this
->
request
->
input
(
'from'
)
?
$this
->
request
->
get
(
'identifier'
)
->
company_id
:
$this
->
request
->
input
(
'user_id'
),
//用户
'created_at'
=>
$this
->
now
,
]))
{
//生成新链接-上一个失效
try
{
//将上一条链接删除
PropertyShare
::
query
()
->
where
([
'pf_id'
=>
$this
->
request
->
input
(
'track_id'
)])
->
orderByDesc
(
'id'
)
->
limit
(
1
)
->
delete
();
//生成新链接
PropertyShare
::
query
()
->
create
([
'pf_id'
=>
$this
->
request
->
input
(
'track_id'
),
'phone'
=>
$this
->
request
->
input
(
'phone'
),
'share_url'
=>
$share
,
'share_url_hash'
=>
$share_url_hash
,
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$expire_time
),
'from'
=>
$this
->
request
->
input
(
'from'
),
'user_id'
=>
$this
->
request
->
input
(
'from'
)
?
$this
->
request
->
get
(
'identifier'
)
->
company_id
:
$this
->
request
->
input
(
'user_id'
),
//用户
]);
return
Response
::
success
([
'url'
=>
$share
]);
}
else
{
}
catch
(
\Throwable
$throwable
)
{
return
Response
::
error
();
}
}
...
...
@@ -150,7 +157,7 @@ class PropertyTrackService extends Service
*/
public
function
shareUser
()
{
$share
=
PropertyShare
::
query
()
->
where
([
'share_url_hash'
=>
crc64
(
$this
->
request
->
input
(
'share_url'
))])
->
first
();
$share
=
PropertyShare
::
withTrashed
()
->
where
([
'share_url_hash'
=>
crc64
(
$this
->
request
->
input
(
'share_url'
))])
->
first
();
if
(
empty
(
$share
))
{
return
Response
::
error
(
ErrorCode
::
URL_FAIL
);}
//找不到此链接
$data
=
[
'from'
=>
$share
->
from
,
'name'
=>
''
];
...
...
Please
register
or
sign in
to post a comment