Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
xiaozhan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
xiaozhan
Commits
dfa527ed
Commit
dfa527ed
authored
Mar 13, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7df2924f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
46 deletions
+46
-46
application/Appapi/Controller/EquipmentController.class.php
+46
-46
No files found.
application/Appapi/Controller/EquipmentController.class.php
View file @
dfa527ed
...
...
@@ -6,26 +6,26 @@ namespace Appapi\Controller;
use
Common\Controller\HomebaseController
;
class
EquipmentController
extends
HomebaseController
{
function
index
(){
function
index
(){
$uid
=
I
(
"uid"
);
$token
=
I
(
"token"
);
if
(
!
$uid
||
!
$token
||
checkToken
(
$uid
,
$token
)
==
700
){
$this
->
assign
(
"reason"
,
'您的登陆状态失效,请重新登陆!'
);
$this
->
display
(
':error'
);
exit
;
}
}
$this
->
assign
(
"uid"
,
$uid
);
$this
->
assign
(
"token"
,
$token
);
/* 靓号信息 */
$Liang
=
M
(
"liang"
);
$liang_list
=
$Liang
->
where
(
"uid=
{
$uid
}
"
)
->
order
(
"buytime desc"
)
->
select
();
$this
->
assign
(
"liang_list"
,
$liang_list
);
/* 坐骑信息 */
$car_key
=
'carinfo'
;
$car_list
=
getcaches
(
$car_key
);
...
...
@@ -35,11 +35,11 @@ class EquipmentController extends HomebaseController {
setcaches
(
$car_key
,
$car_list
);
}
}
foreach
(
$car_list
as
$k
=>
$v
){
$v
[
'thumb'
]
=
get_upload_path
(
$v
[
'thumb'
]);
$v
[
'swf'
]
=
get_upload_path
(
$v
[
'swf'
]);
$carlist2
[
$v
[
'id'
]]
=
$v
;
}
...
...
@@ -47,7 +47,7 @@ class EquipmentController extends HomebaseController {
$nowtime
=
time
();
$Car_u
=
M
(
"users_car"
);
$user_carlist
=
$Car_u
->
where
(
"uid=
{
$uid
}
and endtime>
{
$nowtime
}
"
)
->
select
();
foreach
(
$user_carlist
as
$k
=>
$v
){
if
(
$carlist2
[
$v
[
'carid'
]]){
$user_carlist
[
$k
][
'carinfo'
]
=
$carlist2
[
$v
[
'carid'
]];
...
...
@@ -59,12 +59,12 @@ class EquipmentController extends HomebaseController {
$this
->
assign
(
"user_carlist"
,
$user_carlist
);
$this
->
display
();
}
/* 设置靓号 */
function
setliang
(){
$rs
=
array
(
'code'
=>
0
,
'info'
=>
array
(),
'msg'
=>
'更换成功'
);
...
...
@@ -73,15 +73,15 @@ class EquipmentController extends HomebaseController {
$liangid
=
I
(
"liangid"
);
$state
=
I
(
"state"
);
if
(
!
$uid
||
!
$token
||
checkToken
(
$uid
,
$token
)
==
700
){
$rs
[
'code'
]
=
700
;
$rs
[
'msg'
]
=
'您的登陆状态失效,请重新登陆!'
;
echo
json_encode
(
$rs
);
exit
;
}
}
$Liang
=
M
(
"liang"
);
$isexist
=
$Liang
->
where
(
"uid=
{
$uid
}
and id=
{
$liangid
}
"
)
->
find
();
if
(
!
$isexist
){
$rs
[
'code'
]
=
1001
;
...
...
@@ -89,55 +89,56 @@ class EquipmentController extends HomebaseController {
echo
json_encode
(
$rs
);
exit
;
}
$Liang
->
where
(
"uid=
{
$uid
}
"
)
->
save
(
array
(
'state'
=>
0
)
);
$setstatus
=
$state
?
0
:
1
;
// $Liang->where("uid={$uid}")->save(array('state'=>0) );
// $setstatus=$state?0:1;
$setstatus
=
0
;
$data
=
array
(
'state'
=>
$setstatus
,
);
$list
=
$Liang
->
where
(
"uid=
{
$uid
}
and id=
{
$liangid
}
"
)
->
save
(
$data
);
$list
=
M
(
"liang"
)
->
where
(
"uid=
{
$uid
}
and id=
{
$liangid
}
"
)
->
save
(
$data
);
$Users
=
M
(
"users"
);
$goodnum
=
$isexist
[
'name'
];
$key
=
'liang_'
.
$uid
;
if
(
$setstatus
==
1
){
$Users
->
where
(
"id=
{
$uid
}
"
)
->
setField
(
"goodnum"
,
$goodnum
);
$isexist
=
M
(
"liang"
)
->
where
(
"uid=
{
$uid
}
and status=1 and state=1"
)
->
find
();
if
(
$isexist
){
setcaches
(
$key
,
$isexist
);
}
}
else
{
$Users
->
where
(
"id=
{
$uid
}
"
)
->
setField
(
"goodnum"
,
0
);
delcache
(
$key
);
}
echo
json_encode
(
$rs
);
exit
;
}
/* 装备坐骑 */
function
setcar
(){
$uid
=
I
(
"uid"
);
$token
=
I
(
"token"
);
$carid
=
I
(
"carid"
);
$status
=
I
(
"status"
);
$rs
=
array
(
'code'
=>
0
,
'info'
=>
array
(),
'msg'
=>
'更换成功'
);
if
(
!
$uid
||
!
$token
||
checkToken
(
$uid
,
$token
)
==
700
){
$rs
[
'code'
]
=
700
;
$rs
[
'msg'
]
=
'您的登陆状态失效,请重新登陆!'
;
echo
json_encode
(
$rs
);
exit
;
}
$setstatus
=
$status
?
0
:
1
;
}
//
$setstatus=$status?0:1;
$setstatus
=
0
;
$Car_u
=
M
(
"users_car"
);
$isexist
=
$Car_u
->
where
(
"uid=
{
$uid
}
and carid=
{
$carid
}
"
)
->
find
();
if
(
!
$isexist
){
$rs
[
'code'
]
=
1001
;
...
...
@@ -146,18 +147,18 @@ class EquipmentController extends HomebaseController {
exit
;
}
$data1
=
array
(
'status'
=>
0
,
);
$Car_u
->
where
(
"uid=
{
$uid
}
"
)
->
save
(
$data1
);
// $data1=array(
// 'status'=>0,
// );
// $Car_u->where("uid={$uid}")->save($data1);
$data
=
array
(
'status'
=>
$setstatus
,
);
$result
=
$Car_u
->
where
(
"uid=
{
$uid
}
and carid=
{
$carid
}
"
)
->
save
(
$data
);
$result
=
M
(
"users_car"
)
->
where
(
"uid=
{
$uid
}
and carid=
{
$carid
}
"
)
->
save
(
$data
);
$key
=
'car_'
.
$uid
;
if
(
$setstatus
){
$isexist
=
M
(
"users_car"
)
->
where
(
"uid=
{
$uid
}
and status=1"
)
->
find
();
...
...
@@ -167,10 +168,10 @@ class EquipmentController extends HomebaseController {
}
else
{
delcache
(
$key
);
}
echo
json_encode
(
$rs
);
exit
;
}
}
\ 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