Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rpc
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lambda
rpc
Commits
76395f16
Commit
76395f16
authored
May 12, 2017
by
TingSong-Syu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement some client side function to shadow Product
parent
5910ebe6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
Product.php
src/pay_center/Product.php
+28
-0
No files found.
src/pay_center/Product.php
View file @
76395f16
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
namespace
neoteched\rpc\pay_center
;
namespace
neoteched\rpc\pay_center
;
use
x2ts\IAssignable
;
use
x2ts\IAssignable
;
use
x2ts\rpc\RPCWrapper
;
class
Product
implements
IAssignable
{
class
Product
implements
IAssignable
{
use
AssignTrait
;
use
AssignTrait
;
...
@@ -26,4 +27,30 @@ class Product implements IAssignable {
...
@@ -26,4 +27,30 @@ class Product implements IAssignable {
public
$ctime
=
0
;
public
$ctime
=
0
;
public
$mtime
=
0
;
public
$mtime
=
0
;
private
static
$userBought
=
[];
public
static
function
userBought
(
int
$userId
)
{
if
(
!
array_key_exists
(
$userId
,
self
::
$userBought
))
{
self
::
$userBought
[
$userId
]
=
RPCWrapper
::
rpc
(
'pay_center'
)
->
call
(
'boughtProductHash'
,
$userId
);
}
return
self
::
$userBought
[
$userId
];
}
public
static
function
boughtProductNames
(
int
$userId
)
:
array
{
return
array_keys
(
self
::
userBought
(
$userId
));
}
public
static
function
boughtProducts
(
int
$userId
)
{
return
RPCWrapper
::
rpc
(
'pay_center'
)
->
call
(
'boughtProducts'
,
$userId
);
}
public
static
function
boughtProductCount
(
int
$userId
)
:
int
{
return
count
(
self
::
userBought
(
$userId
));
}
public
static
function
hasBought
(
string
$name
,
int
$userId
)
:
bool
{
return
array_key_exists
(
$name
,
self
::
userBought
(
$userId
));
}
}
}
\ 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