Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
quxiu
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
冷斌
quxiu
Commits
9d062fa7
Commit
9d062fa7
authored
Apr 13, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
75dfde4d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
11 deletions
+46
-11
api/Appapi/Api/User.php
+3
-2
api/Appapi/Domain/User.php
+2
-2
api/Appapi/Model/User.php
+41
-7
No files found.
api/Appapi/Api/User.php
View file @
9d062fa7
...
@@ -90,6 +90,7 @@ class Api_User extends PhalApi_Api {
...
@@ -90,6 +90,7 @@ class Api_User extends PhalApi_Api {
'uid'
=>
array
(
'name'
=>
'uid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'用户ID'
),
'uid'
=>
array
(
'name'
=>
'uid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'用户ID'
),
'token'
=>
array
(
'name'
=>
'token'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'用户token'
),
'token'
=>
array
(
'name'
=>
'token'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'用户token'
),
'id'
=>
array
(
'name'
=>
'id'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'id'
),
'id'
=>
array
(
'name'
=>
'id'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'id'
),
'source'
=>
array
(
'name'
=>
'source'
,
'type'
=>
'int'
,
'require'
=>
true
,
'desc'
=>
'类型,1主播,2邀请,3家族'
),
),
),
'setCash'
=>
array
(
'setCash'
=>
array
(
...
@@ -920,7 +921,7 @@ class Api_User extends PhalApi_Api {
...
@@ -920,7 +921,7 @@ class Api_User extends PhalApi_Api {
}
}
$domain
=
new
Domain_User
();
$domain
=
new
Domain_User
();
$info
=
$domain
->
rechange
(
$this
->
uid
,
$this
->
id
);
$info
=
$domain
->
rechange
(
$this
->
uid
,
$this
->
id
,
$this
->
source
);
if
(
$info
===
1
){
if
(
$info
===
1
){
$rs
[
'code'
]
=
1001
;
$rs
[
'code'
]
=
1001
;
...
@@ -930,7 +931,7 @@ class Api_User extends PhalApi_Api {
...
@@ -930,7 +931,7 @@ class Api_User extends PhalApi_Api {
if
(
$info
===
2
){
if
(
$info
===
2
){
$rs
[
'code'
]
=
1002
;
$rs
[
'code'
]
=
1002
;
$rs
[
'msg'
]
=
'
积分
不足'
;
$rs
[
'msg'
]
=
'
魅力值
不足'
;
return
$rs
;
return
$rs
;
}
}
...
...
api/Appapi/Domain/User.php
View file @
9d062fa7
...
@@ -92,11 +92,11 @@ class Domain_User {
...
@@ -92,11 +92,11 @@ class Domain_User {
return
$rs
;
return
$rs
;
}
}
public
function
rechange
(
$uid
,
$id
)
{
public
function
rechange
(
$uid
,
$id
,
$source
)
{
$rs
=
array
();
$rs
=
array
();
$model
=
new
Model_User
();
$model
=
new
Model_User
();
$rs
=
$model
->
rechange
(
$uid
,
$id
);
$rs
=
$model
->
rechange
(
$uid
,
$id
,
$source
);
return
$rs
;
return
$rs
;
}
}
...
...
api/Appapi/Model/User.php
View file @
9d062fa7
...
@@ -337,26 +337,60 @@ class Model_User extends PhalApi_Model_NotORM
...
@@ -337,26 +337,60 @@ class Model_User extends PhalApi_Model_NotORM
];
];
}
}
public
function
rechange
(
$uid
,
$id
)
public
function
rechange
(
$uid
,
$id
,
$source
)
{
{
$rechange
=
DI
()
->
notorm
->
recharge_rules
->
where
(
'id=?'
,
$id
)
->
fetchOne
();
$rechange
=
DI
()
->
notorm
->
recharge_rules
->
where
(
'id=?'
,
$id
)
->
fetchOne
();
if
(
empty
(
$rechange
))
{
if
(
empty
(
$rechange
))
{
return
1
;
return
1
;
}
}
$cashvotes
=
$rechange
[
'money'
];
$user
=
DI
()
->
notorm
->
users
->
select
(
'votes'
)
->
where
(
'id=?'
,
$uid
)
->
fetchOne
();
$user
=
DI
()
->
notorm
->
users
->
select
(
'votes'
)
->
where
(
'id=?'
,
$uid
)
->
fetchOne
();
if
(
$rechange
[
'money'
]
>
$user
[
'votes'
])
{
if
(
$source
==
1
&&
$cashvotes
>
$user
[
'votes'
])
{
return
2
;
}
if
(
$source
==
2
&&
$cashvotes
>
$user
[
'i_votes'
])
{
return
2
;
}
if
(
$source
==
3
&&
$cashvotes
>
$user
[
'f_votes'
])
{
return
2
;
return
2
;
}
}
$total
=
$rechange
[
'money'
]
+
$rechange
[
'give'
];
$total
=
$rechange
[
'money'
]
+
$rechange
[
'give'
];
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$uid
)
->
update
([
$ifok
=
0
;
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
),
'votes'
=>
new
NotORM_Literal
(
"votes -
{
$rechange
[
'money'
]
}
"
),
]);
return
0
;
if
(
$source
==
1
)
{
$ifok
=
DI
()
->
notorm
->
users
->
where
(
'id = ? and votes>=?'
,
$uid
,
$cashvotes
)
->
update
([
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
),
'votes'
=>
new
NotORM_Literal
(
"votes -
{
$cashvotes
}
"
)
]);
}
if
(
$source
==
2
)
{
$ifok
=
DI
()
->
notorm
->
users
->
where
(
'id = ? and i_votes>=?'
,
$uid
,
$cashvotes
)
->
update
([
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
),
'i_votes'
=>
new
NotORM_Literal
(
"i_votes -
{
$cashvotes
}
"
)
]);
}
if
(
$source
==
3
)
{
$ifok
=
DI
()
->
notorm
->
users
->
where
(
'id = ? and f_votes>=?'
,
$uid
,
$cashvotes
)
->
update
([
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
),
'f_votes'
=>
new
NotORM_Literal
(
"f_votes -
{
$cashvotes
}
"
)
]);
}
// DI()->notorm->users->where('id = ?', $uid)->update([
// 'coin' => new NotORM_Literal("coin + {$total}"),
// 'votes' => new NotORM_Literal("votes - {$rechange['money']}"),
// ]);
return
!
$ifok
?
2
:
0
;
}
}
/* 关注 */
/* 关注 */
...
...
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