Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uc_card
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
uc_card
Commits
984490f8
Commit
984490f8
authored
Nov 24, 2021
by
顾敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色列表缓存,游戏数据缓存一天
parent
6f911298
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
28 deletions
+11
-28
src/app/Http/Controllers/Card/CardController.php
src/app/Http/Controllers/Card/CardController.php
+3
-23
src/app/Http/Controllers/Platform/AldUserController.php
src/app/Http/Controllers/Platform/AldUserController.php
+8
-5
No files found.
src/app/Http/Controllers/Card/CardController.php
View file @
984490f8
...
...
@@ -2,12 +2,8 @@
namespace
App\Http\Controllers\Card
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
use
Throwable
;
use
Exception
;
use
Illuminate\Http\Request
;;
use
Carbon\Carbon
;
use
Illuminate\Validation\Rule
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
...
...
@@ -15,14 +11,10 @@ use Illuminate\Support\Facades\DB;
use
Illuminate\Support\Facades\Cache
;
use
App\Services\AldGmService
;
use
App\Models\UserExtra
;
use
App\Models\GameUserPvp
;
use
App\Models\GameUserPvpCount
;
use
App\Models\GameUserRoleTime
;
use
App\Models\BaseItem
;
use
App\Models\WxUserImg
;
use
App\Services\UploadServer
;
use
App\Models\User
;
use
Illuminate\Support\Facades\Log
;
class
CardController
extends
Controller
{
...
...
@@ -350,11 +342,6 @@ class CardController extends Controller
$roleId
=
$request
->
input
(
'roleId'
);
$serverId
=
$request
->
input
(
'serverId'
);
if
(
Cache
::
has
(
'card:num:'
.
$userId
.
':'
.
$roleId
)){
$num
=
Cache
::
get
(
'card:num:'
.
$userId
.
':'
.
$roleId
);
if
(
$num
>
3
)
return
exit
(
'页面走丢了,请稍后再试!'
);
}
$data
=
[];
if
(
Cache
::
has
(
'card:info:'
.
$userId
.
':'
.
$roleId
)){
$data
=
Cache
::
get
(
'card:info:'
.
$userId
.
':'
.
$roleId
);
...
...
@@ -476,16 +463,9 @@ class CardController extends Controller
}
else
{
$data
[
'braveTime'
]
=
'00:00'
;
}
Cache
::
put
(
'card:info:'
.
$userId
.
':'
.
$roleId
,
$data
,
300
);
}
if
(
Cache
::
has
(
'card:num:'
.
$userId
.
':'
.
$roleId
)){
$num
=
Cache
::
get
(
'card:num:'
.
$userId
.
':'
.
$roleId
)
+
1
;
Cache
::
forget
(
'card:num:'
.
$userId
.
':'
.
$roleId
);
Cache
::
put
(
'card:num:'
.
$userId
.
':'
.
$roleId
,
$num
,
3
);
}
else
{
Cache
::
put
(
'card:num:'
.
$userId
.
':'
.
$roleId
,
1
,
3
);
Cache
::
put
(
'card:info:'
.
$userId
.
':'
.
$roleId
,
$data
,
86400
);
}
return
view
(
'card.card'
,
$data
);
}
}
\ No newline at end of file
src/app/Http/Controllers/Platform/AldUserController.php
View file @
984490f8
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Platform;
use
App\Http\Controllers\Controller
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\Validator
;
use
App\Services\UtilService
;
use
App\Models\User
;
...
...
@@ -128,9 +129,7 @@ class AldUserController extends Controller
}
$gmService
=
new
AldGmService
();
$aldzn_info
=
json_decode
(
$userExtra
->
aldzn_info
,
true
);
//修补没有serverId的数据
if
(
!
isset
(
$aldzn_info
[
'serverId'
])
||
empty
(
$aldzn_info
[
'serverId'
]))
{
$codeInfo
=
$gmService
->
checkBindCode
(
$userExtra
->
udid
);
...
...
@@ -145,8 +144,12 @@ class AldUserController extends Controller
$userId
=
$aldzn_info
[
'userId'
];
$channel
=
$aldzn_info
[
'channel'
];
if
(
!
in_array
(
$aldzn_info
[
'channel'
],
config
(
'sign.channel'
)))
return
$this
->
jsonReturn
(
80001
,
'您暂未获取活动资格'
);
$roleList
=
$gmService
->
getRoles
(
$serverId
,
$userId
,
$channel
);
$rolesCacheKey
=
"user _roles:"
.
implode
(
"-"
,
[
$channel
,
$serverId
,
$userId
]);
$roleList
=
Cache
::
remember
(
$rolesCacheKey
,
7200
,
function
()
use
(
$gmService
,
$serverId
,
$userId
,
$channel
)
{
return
$gmService
->
getRoles
(
$serverId
,
$userId
,
$channel
);
});
if
(
$roleList
===
false
)
{
return
$this
->
jsonReturn
(
7001
,
"网络异常,请稍后再试"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment