Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh_internal_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
杨培培
wxh_internal_api
Commits
4a7fa487
Commit
4a7fa487
authored
Mar 13, 2019
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增多个红包服务功能
parent
81fbcf37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
5 deletions
+69
-5
ucenter_redpack.php
example/ucenter_redpack.php
+3
-2
ucenter_vip.php
example/ucenter_vip.php
+10
-3
MemberRedpack.php
src/ucenter/MemberRedpack.php
+56
-0
No files found.
example/ucenter_redpack.php
View file @
4a7fa487
...
@@ -10,5 +10,6 @@ use internalApi\ucenter\MemberRedpack;
...
@@ -10,5 +10,6 @@ use internalApi\ucenter\MemberRedpack;
require
__DIR__
.
'/_init.php'
;
require
__DIR__
.
'/_init.php'
;
MemberRedpack
::
setDebug
();
MemberRedpack
::
setDebug
();
$info
=
MemberRedpack
::
getFirstRedpack
(
582
);
//$info = MemberRedpack::createRedpack(18, '12.5', 'test', '测试红包', null, true);
print_r
(
$info
);
$info
=
MemberRedpack
::
unfreeze
([
134
,
136
]);
\ No newline at end of file
print_r
(
$info
);
example/ucenter_vip.php
View file @
4a7fa487
...
@@ -11,8 +11,15 @@ use internalApi\ucenter\Vip;
...
@@ -11,8 +11,15 @@ use internalApi\ucenter\Vip;
require
__DIR__
.
'/_init.php'
;
require
__DIR__
.
'/_init.php'
;
Vip
::
setDebug
();
Vip
::
setDebug
();
$ret
=
Vip
::
getGrades
();
//$ret = Vip::setInviter('844184b4016810002cde5254007c97eb', '0e150e59016910003f4c525400781c54');
try
{
print_r
(
$ret
);
//$ret = Vip::getGrades();
$ret
=
Vip
::
getMembersByWxhuids
(
'worker-74635,0e150e59016910003f4c525400781c54'
);
//$ret = Vip::setInviter('844184b4016810002cde5254007c97eb', '0e150e59016910003f4c525400781c54');
print_r
(
$ret
);
}
catch
(
\internalApi\base\ApiException
$e
)
{
echo
$e
->
getMessage
();
echo
$e
->
getRemoteTraceString
();
}
//Vip::addPending(12, 123, 1);
//Vip::addPending(12, 123, 1);
\ No newline at end of file
src/ucenter/MemberRedpack.php
View file @
4a7fa487
...
@@ -9,6 +9,10 @@ namespace internalApi\ucenter;
...
@@ -9,6 +9,10 @@ namespace internalApi\ucenter;
use
internalApi\base\Client
;
use
internalApi\base\Client
;
/**
* 红包服务
* @package internalApi\ucenter
*/
class
MemberRedpack
extends
Client
class
MemberRedpack
extends
Client
{
{
public
static
function
getFirstRedpack
(
$userId
)
public
static
function
getFirstRedpack
(
$userId
)
...
@@ -16,4 +20,56 @@ class MemberRedpack extends Client
...
@@ -16,4 +20,56 @@ class MemberRedpack extends Client
return
self
::
call
(
'memberRedpack.firstRedpack'
,
compact
(
'userId'
));
return
self
::
call
(
'memberRedpack.firstRedpack'
,
compact
(
'userId'
));
}
}
/**
* 给指定用户创建一个可领红包
*
* @param int $uid
* @param float $amount 金额,最大支持99.99
* @param string $customType 红包类型枚举字符串,最大20个字节,
* @param string $desc 红包描述
* @param string $entityNo 实体编号,相同类型,且实体编号相同将不会重复创建
* @param bool $frozen 红包是否处于冻结状态,冻结状态的红包需使用 unfreeze 解冻后方可提现
* @return array 创建成功后返回数组包含 status 与 id 两个值<br>
* status 为 OK 时代表创建成功,为 ENTITY_EXISTS 代表相同的实体编号重复<br>
* id 为红包的ID<br>
* 正常为情况下不需要要根据返回值进行处理,创建是否成功应该使用 try catch 是否有异常来判断。
* 返回值仅是为了获取红包ID,或区分是否是重复实体编号编号的红包等其它逻辑。
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public
static
function
createRedpack
(
$uid
,
$amount
,
$customType
,
$desc
=
''
,
$entityNo
=
null
,
$frozen
=
false
)
{
$p
=
compact
(
'uid'
,
'amount'
,
'customType'
,
'desc'
,
'entityNo'
,
'frozen'
);
return
self
::
call
(
'memberRedpack.createRedpack'
,
$p
);
}
/**
* 批量创建红包
*
* @param array $data 批量创建红包数据,包含多个字段的二维数组,其中 entity_no 与 desc 可选
* uid, amount, type, entity_no, desc
* 具体参数含义 @see createRedpack
*
* @return array
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public
static
function
createRedpackBatch
(
array
$data
)
{
return
self
::
call
(
'memberRedpack.createRedpack'
,
compact
(
'data'
));
}
/**
* 解冻单个或多个红包
*
* @param array|int $redpackIds 单个红包ID或多个红包ID的数组
* @return int 解冻成功的红包数量
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public
static
function
unfreeze
(
$redpackIds
)
{
return
self
::
call
(
'memberRedpack.unfreeze'
,
compact
(
'redpackIds'
));
}
}
}
\ 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