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
c7c55077
Commit
c7c55077
authored
Nov 25, 2021
by
顾敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
服务器名字里去掉渠道
parent
843c7b77
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
40 deletions
+13
-40
src/app/Http/Controllers/Card/CardController.php
src/app/Http/Controllers/Card/CardController.php
+13
-10
src/app/Models/GameUserPvp.php
src/app/Models/GameUserPvp.php
+0
-10
src/app/Models/GameUserPvpCount.php
src/app/Models/GameUserPvpCount.php
+0
-10
src/app/Models/GameUserRoleTime.php
src/app/Models/GameUserRoleTime.php
+0
-10
No files found.
src/app/Http/Controllers/Card/CardController.php
View file @
c7c55077
...
...
@@ -15,6 +15,7 @@ use App\Models\BaseItem;
use
App\Models\WxUserImg
;
use
App\Services\UploadServer
;
use
App\Models\User
;
use
Illuminate\Support\Optional
;
class
CardController
extends
Controller
{
...
...
@@ -74,21 +75,25 @@ class CardController extends Controller
$userId
=
$request
->
session
()
->
get
(
"uid"
);
$result
=
$this
->
getVerityLogin
(
$userId
);
if
(
$result
[
'code'
]
!=
200
)
return
$this
->
jsonReturn
(
$result
[
'code'
],
$result
[
'msg'
]);
if
(
Cache
::
has
(
$userId
.
':card:bind:role'
))
return
$this
->
jsonReturn
(
10022
,
'绑定角色过于频繁,请稍后再试'
);
$roleId
=
$request
->
input
(
'roleId'
);
$serverId
=
$request
->
input
(
'serverId'
);
$serverName
=
$request
->
input
(
'serverName'
);
if
(
empty
(
$roleId
)
||
empty
(
$serverId
)
||
empty
(
$serverName
))
return
$this
->
jsonReturn
(
7002
,
'参数错误'
);
$lock
=
Cache
::
lock
(
"card:bind:role:"
.
$userId
,
30
);
if
(
!
$lock
->
get
())
{
return
$this
->
jsonReturn
(
10022
,
'绑定角色过于频繁,请稍后再试'
);
}
$tableName
=
'wx_card_role_'
.
$serverId
;
$this
->
getCheckRoleInfoTable
(
$tableName
);
$verity
=
DB
::
connection
(
'wx_mysql'
)
->
table
(
$tableName
)
->
where
(
'uid'
,
$userId
)
->
where
(
'role_id'
,
$roleId
)
->
select
(
'id'
)
->
first
();
if
(
$verity
)
return
$this
->
jsonReturn
(
0
,
'角色绑定成功'
);
Cache
::
put
(
$userId
.
':card:bind:role'
,
1
,
30
);
$insert
=
$this
->
getInsertRoleInfo
(
$userId
,
$roleId
,
$serverId
,
$serverName
,
$tableName
);
optional
(
$lock
)
->
release
();
if
(
$insert
[
'code'
]
==
200
)
return
$this
->
jsonReturn
(
0
,
'角色绑定成功'
);
Cache
::
forget
(
$userId
.
':card:bind:role'
);
return
$this
->
jsonReturn
(
$insert
[
'code'
],
$insert
[
'msg'
]);
}
...
...
@@ -349,15 +354,13 @@ class CardController extends Controller
$result
=
$this
->
getVerityLogin
(
$userId
);
if
(
$result
[
'code'
]
!=
200
)
return
$this
->
jsonReturn
(
$result
[
'code'
],
$result
[
'msg'
]);
if
(
empty
(
$roleId
)
||
empty
(
$serverId
))
return
$this
->
jsonReturn
(
7002
,
'参数错误'
);
if
(
!
Schema
::
connection
(
'wx_mysql'
)
->
hasTable
(
'wx_card_role_'
.
$serverId
))
return
redirect
(
route
(
'index'
));
//
if (!Schema::connection('wx_mysql')->hasTable('wx_card_role_'.$serverId)) return redirect(route('index'));
$info
=
DB
::
connection
(
'wx_mysql'
)
->
table
(
'wx_card_role_'
.
$serverId
)
->
where
(
'uid'
,
$userId
)
->
where
(
'role_id'
,
$roleId
)
->
where
(
'server_id'
,
$serverId
)
->
first
();
if
(
!
$info
)
return
redirect
(
route
(
'index'
));
$serverName
=
$info
->
server_name
;
$splitIndex
=
strpos
(
$info
->
server_name
,
"-"
);
if
(
$splitIndex
!==
false
)
{
$serverName
=
substr
(
$info
->
server_name
,
$splitIndex
+
1
);
}
$filterElems
=
[
'越狱'
,
'IOS'
,
'mg77'
,
'抖音'
,
'硬核'
,
'非硬核'
,
'zy'
,
'915转移'
,
'转移'
,
'小米'
,
'百度'
];
$nameElems
=
explode
(
$info
->
server_name
,
"-"
);
$serverName
=
implode
(
"-"
,
array_diff
(
$nameElems
,
$filterElems
));
$user
=
User
::
where
(
'uid'
,
$userId
)
->
select
(
'uid'
,
'account'
)
->
first
();
$data
[
'userName'
]
=
$user
->
account
??
''
;
...
...
src/app/Models/GameUserPvp.php
deleted
100644 → 0
View file @
843c7b77
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
GameUserPvp
extends
Model
{
protected
$connection
=
'wx_mysql'
;
protected
$table
=
'game_user_pvp'
;
}
\ No newline at end of file
src/app/Models/GameUserPvpCount.php
deleted
100644 → 0
View file @
843c7b77
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
GameUserPvpCount
extends
Model
{
protected
$connection
=
'wx_mysql'
;
protected
$table
=
'game_user_pvp_count'
;
}
\ No newline at end of file
src/app/Models/GameUserRoleTime.php
deleted
100644 → 0
View file @
843c7b77
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
GameUserRoleTime
extends
Model
{
protected
$connection
=
'wx_mysql'
;
protected
$table
=
'game_user_role_time'
;
}
\ No newline at end of file
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