\EasyWeChat\CardCard

Class AbstractAPI.

Summary

Methods
Properties
Constants
__construct()
getHttp()
setHttp()
getAccessToken()
setAccessToken()
maxRetries()
parseJSON()
getColors()
create()
QRCode()
showQRCode()
getQRCodeUrl()
getAPITicket()
jsConfigForAssign()
attachExtension()
getSignature()
createLandingPage()
deposit()
getDepositedCount()
checkCode()
getCode()
consume()
decryptCode()
getHtml()
setTestWhitelist()
setTestWhitelistByUsername()
getUserCards()
getCard()
lists()
update()
setPayCell()
increaseStock()
reduceStock()
updateCode()
delete()
disable()
activate()
activateUserForm()
getMemberCardUser()
updateMemberCardUser()
updateGeneralCardUser()
createSubMerchant()
updateSubMerchant()
getSubMerchant()
listSubMerchants()
getCategories()
setCache()
getCache()
setTicketCachePrefix()
setTicketCacheKey()
getTicketCacheKey()
setUrl()
No public properties found
GET
POST
JSON
API_GET_COLORS
API_CREATE_CARD
API_CREATE_QRCODE
API_SHOW_QRCODE
API_GET_CARD_TICKET
API_CREATE_LANDING_PAGE
API_DEPOSIT_CODE
API_GET_DEPOSIT_COUNT
API_CHECK_CODE
API_GET_HTML
API_SET_TEST_WHITE_LIST
API_GET_CODE
API_CONSUME_CARD
API_DECRYPT_CODE
API_GET_CARD_LIST
API_GET_CARD
API_LIST_CARD
API_UPDATE_CARD
API_SET_PAY_CELL
API_MODIFY_STOCK
API_UPDATE_CODE
API_DELETE_CARD
API_DISABLE_CARD
API_ACTIVATE_MEMBER_CARD
API_ACTIVATE_MEMBER_USER_FORM
API_GET_MEMBER_USER_INFO
API_UPDATE_MEMBER_CARD_USER
API_CREATE_SUB_MERCHANT
API_UPDATE_SUB_MERCHANT
API_GET_SUB_MERCHANT
API_LIST_SUB_MERCHANT
API_GET_CATEGORIES
API_ACTIVATE_GENERAL_CARD
API_UPDATE_GENERAL_CARD_USER
registerHttpMiddlewares()
accessTokenMiddleware()
logMiddleware()
retryMiddleware()
checkAndThrow()
updateStock()
$http
$accessToken
$maxRetries
$cache
$ticketCacheKey
$ticketCachePrefix
N/A
No private methods found
No private properties found
N/A

Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_GET_COLORS

API_GET_COLORS = 'https://api.weixin.qq.com/card/getcolors'

API_CREATE_CARD

API_CREATE_CARD = 'https://api.weixin.qq.com/card/create'

API_CREATE_QRCODE

API_CREATE_QRCODE = 'https://api.weixin.qq.com/card/qrcode/create'

API_SHOW_QRCODE

API_SHOW_QRCODE = 'https://mp.weixin.qq.com/cgi-bin/showqrcode'

API_GET_CARD_TICKET

API_GET_CARD_TICKET = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket'

API_CREATE_LANDING_PAGE

API_CREATE_LANDING_PAGE = 'https://api.weixin.qq.com/card/landingpage/create'

API_DEPOSIT_CODE

API_DEPOSIT_CODE = 'https://api.weixin.qq.com/card/code/deposit'

API_GET_DEPOSIT_COUNT

API_GET_DEPOSIT_COUNT = 'https://api.weixin.qq.com/card/code/getdepositcount'

API_CHECK_CODE

API_CHECK_CODE = 'https://api.weixin.qq.com/card/code/checkcode'

API_GET_HTML

API_GET_HTML = 'https://api.weixin.qq.com/card/mpnews/gethtml'

API_SET_TEST_WHITE_LIST

API_SET_TEST_WHITE_LIST = 'https://api.weixin.qq.com/card/testwhitelist/set'

API_GET_CODE

API_GET_CODE = 'https://api.weixin.qq.com/card/code/get'

API_CONSUME_CARD

API_CONSUME_CARD = 'https://api.weixin.qq.com/card/code/consume'

API_DECRYPT_CODE

API_DECRYPT_CODE = 'https://api.weixin.qq.com/card/code/decrypt'

API_GET_CARD_LIST

API_GET_CARD_LIST = 'https://api.weixin.qq.com/card/user/getcardlist'

API_GET_CARD

API_GET_CARD = 'https://api.weixin.qq.com/card/get'

API_LIST_CARD

API_LIST_CARD = 'https://api.weixin.qq.com/card/batchget'

API_UPDATE_CARD

API_UPDATE_CARD = 'https://api.weixin.qq.com/card/update'

API_SET_PAY_CELL

API_SET_PAY_CELL = 'https://api.weixin.qq.com/card/paycell/set'

API_MODIFY_STOCK

API_MODIFY_STOCK = 'https://api.weixin.qq.com/card/modifystock'

API_UPDATE_CODE

API_UPDATE_CODE = 'https://api.weixin.qq.com/card/code/update'

API_DELETE_CARD

API_DELETE_CARD = 'https://api.weixin.qq.com/card/delete'

API_DISABLE_CARD

API_DISABLE_CARD = 'https://api.weixin.qq.com/card/code/unavailable'

API_ACTIVATE_MEMBER_CARD

API_ACTIVATE_MEMBER_CARD = 'https://api.weixin.qq.com/card/membercard/activate'

API_ACTIVATE_MEMBER_USER_FORM

API_ACTIVATE_MEMBER_USER_FORM = 'https://api.weixin.qq.com/card/membercard/activateuserform/set'

API_GET_MEMBER_USER_INFO

API_GET_MEMBER_USER_INFO = 'https://api.weixin.qq.com/card/membercard/userinfo/get'

API_UPDATE_MEMBER_CARD_USER

API_UPDATE_MEMBER_CARD_USER = 'https://api.weixin.qq.com/card/membercard/updateuser'

API_CREATE_SUB_MERCHANT

API_CREATE_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/submit'

API_UPDATE_SUB_MERCHANT

API_UPDATE_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/update'

API_GET_SUB_MERCHANT

API_GET_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/get'

API_LIST_SUB_MERCHANT

API_LIST_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/batchget'

API_GET_CATEGORIES

API_GET_CATEGORIES = 'https://api.weixin.qq.com/card/getapplyprotocol'

API_ACTIVATE_GENERAL_CARD

API_ACTIVATE_GENERAL_CARD = 'https://api.weixin.qq.com/card/generalcard/activate'

API_UPDATE_GENERAL_CARD_USER

API_UPDATE_GENERAL_CARD_USER = 'https://api.weixin.qq.com/card/generalcard/updateuser'

Properties

$maxRetries

$maxRetries : integer

Type

integer

$ticketCacheKey

$ticketCacheKey : string

Ticket cache key.

Type

string

$ticketCachePrefix

$ticketCachePrefix : string

Ticket cache prefix.

Type

string

Methods

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setAccessToken()

setAccessToken(\EasyWeChat\Core\AccessToken  $accessToken) : $this

Set the request token.

Parameters

\EasyWeChat\Core\AccessToken $accessToken

Returns

$this

maxRetries()

maxRetries(integer  $retries) 

Parameters

integer $retries

parseJSON()

parseJSON(string  $method, array  $args) : \EasyWeChat\Support\Collection

Parse JSON from response and check error.

Parameters

string $method
array $args

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

\EasyWeChat\Support\Collection

| null

create()

create(string  $cardType = 'member_card', array  $baseInfo = array(), array  $especial = array(), array  $advancedInfo = array()) : \EasyWeChat\Support\Collection

创建卡券.

Parameters

string $cardType
array $baseInfo
array $especial
array $advancedInfo

Returns

\EasyWeChat\Support\Collection

QRCode()

QRCode(array  $cards = array()) : \EasyWeChat\Support\Collection

创建二维码.

Parameters

array $cards

Returns

\EasyWeChat\Support\Collection

showQRCode()

showQRCode(string  $ticket = null) : array

ticket 换取二维码图片.

Parameters

string $ticket

Returns

array

getQRCodeUrl()

getQRCodeUrl(string  $ticket) : string

通过ticket换取二维码 链接.

Parameters

string $ticket

Returns

string

getAPITicket()

getAPITicket(boolean  $refresh = false) : string

获取 卡券 Api_ticket.

Parameters

boolean $refresh

是否强制刷新

Returns

string —

$apiTicket

jsConfigForAssign()

jsConfigForAssign(array  $cards) : string

微信卡券:JSAPI 卡券发放.

Parameters

array $cards

Returns

string

attachExtension()

attachExtension(string  $cardId, array  $extension = array()) : string

生成 js添加到卡包 需要的 card_list 项.

Parameters

string $cardId
array $extension

Returns

string

getSignature()

getSignature() : string

生成签名.

Returns

string

createLandingPage()

createLandingPage(string  $banner, string  $pageTitle, boolean  $canShare, string  $scene, array  $cardList) : \EasyWeChat\Support\Collection

创建货架接口.

Parameters

string $banner
string $pageTitle
boolean $canShare
string $scene

[SCENE_NEAR_BY 附近,SCENE_MENU 自定义菜单,SCENE_QRCODE 二维码,SCENE_ARTICLE 公众号文章, SCENE_H5 h5页面,SCENE_IVR 自动回复,SCENE_CARD_CUSTOM_CELL 卡券自定义cell]

array $cardList

Returns

\EasyWeChat\Support\Collection

deposit()

deposit(string  $cardId, array  $code) : \EasyWeChat\Support\Collection

导入code接口.

Parameters

string $cardId
array $code

Returns

\EasyWeChat\Support\Collection

getDepositedCount()

getDepositedCount(string  $cardId) : \EasyWeChat\Support\Collection

查询导入code数目.

Parameters

string $cardId

Returns

\EasyWeChat\Support\Collection

checkCode()

checkCode(string  $cardId, array  $code) : \EasyWeChat\Support\Collection

核查code接口.

Parameters

string $cardId
array $code

Returns

\EasyWeChat\Support\Collection

getCode()

getCode(string  $code, boolean  $checkConsume, string  $cardId) : \EasyWeChat\Support\Collection

查询Code接口.

Parameters

string $code
boolean $checkConsume
string $cardId

Returns

\EasyWeChat\Support\Collection

consume()

consume(string  $code, string  $cardId = null) : \EasyWeChat\Support\Collection

核销Code接口.

Parameters

string $code
string $cardId

Returns

\EasyWeChat\Support\Collection

decryptCode()

decryptCode(string  $encryptedCode) : \EasyWeChat\Support\Collection

Code解码接口.

Parameters

string $encryptedCode

Returns

\EasyWeChat\Support\Collection

getHtml()

getHtml(string  $cardId) : \EasyWeChat\Support\Collection

图文消息群发卡券.

Parameters

string $cardId

Returns

\EasyWeChat\Support\Collection

setTestWhitelist()

setTestWhitelist(array  $openids) : \EasyWeChat\Support\Collection

设置测试白名单.

Parameters

array $openids

Returns

\EasyWeChat\Support\Collection

setTestWhitelistByUsername()

setTestWhitelistByUsername(array  $usernames) : \EasyWeChat\Support\Collection

设置测试白名单(by username).

Parameters

array $usernames

Returns

\EasyWeChat\Support\Collection

getUserCards()

getUserCards(string  $openid, string  $cardId = '') : \EasyWeChat\Support\Collection

获取用户已领取卡券接口.

Parameters

string $openid
string $cardId

Returns

\EasyWeChat\Support\Collection

getCard()

getCard(string  $cardId) : \EasyWeChat\Support\Collection

查看卡券详情.

Parameters

string $cardId

Returns

\EasyWeChat\Support\Collection

lists()

lists(integer  $offset, integer  $count = 10, string  $statusList = 'CARD_STATUS_VERIFY_OK') : \EasyWeChat\Support\Collection

批量查询卡列表.

Parameters

integer $offset
integer $count
string $statusList

Returns

\EasyWeChat\Support\Collection

update()

update(string  $cardId, string  $type, array  $baseInfo = array(), array  $especial = array()) : \EasyWeChat\Support\Collection

更改卡券信息接口 and 设置跟随推荐接口.

Parameters

string $cardId
string $type
array $baseInfo
array $especial

Returns

\EasyWeChat\Support\Collection

setPayCell()

setPayCell(string  $cardId, boolean  $isOpen = true) : \EasyWeChat\Support\Collection

设置微信买单接口.

设置买单的 card_id 必须已经配置了门店,否则会报错.

Parameters

string $cardId
boolean $isOpen

Returns

\EasyWeChat\Support\Collection

increaseStock()

increaseStock(string  $cardId, integer  $amount) : \EasyWeChat\Support\Collection

增加库存.

Parameters

string $cardId
integer $amount

Returns

\EasyWeChat\Support\Collection

reduceStock()

reduceStock(string  $cardId, integer  $amount) : \EasyWeChat\Support\Collection

减少库存.

Parameters

string $cardId
integer $amount

Returns

\EasyWeChat\Support\Collection

updateCode()

updateCode(string  $code, string  $newCode, array  $cardId = array()) : \EasyWeChat\Support\Collection

更改Code接口.

Parameters

string $code
string $newCode
array $cardId

Returns

\EasyWeChat\Support\Collection

delete()

delete(string  $cardId) : \EasyWeChat\Support\Collection

删除卡券接口.

Parameters

string $cardId

Returns

\EasyWeChat\Support\Collection

disable()

disable(string  $code, string  $cardId = '') : \EasyWeChat\Support\Collection

设置卡券失效.

Parameters

string $code
string $cardId

Returns

\EasyWeChat\Support\Collection

activate()

activate(array  $info = array(),   $cardType = 'member_card') : \EasyWeChat\Support\Collection

会员卡接口激活.

Parameters

array $info
$cardType

Returns

\EasyWeChat\Support\Collection

activateUserForm()

activateUserForm(string  $cardId, array  $requiredForm = array(), array  $optionalForm = array()) : \EasyWeChat\Support\Collection

设置开卡字段接口.

Parameters

string $cardId
array $requiredForm
array $optionalForm

Returns

\EasyWeChat\Support\Collection

getMemberCardUser()

getMemberCardUser(string  $cardId, string  $code) : \EasyWeChat\Support\Collection

拉取会员信息接口.

Parameters

string $cardId
string $code

Returns

\EasyWeChat\Support\Collection

updateMemberCardUser()

updateMemberCardUser(array  $params = array()) : \EasyWeChat\Support\Collection

更新会员信息.

Parameters

array $params

Returns

\EasyWeChat\Support\Collection

updateGeneralCardUser()

updateGeneralCardUser(array  $params = array()) : \EasyWeChat\Support\Collection

更新通用员信息.

Parameters

array $params

Returns

\EasyWeChat\Support\Collection

createSubMerchant()

createSubMerchant(array  $info = array()) : \EasyWeChat\Support\Collection

添加子商户.

Parameters

array $info

Returns

\EasyWeChat\Support\Collection

updateSubMerchant()

updateSubMerchant(integer  $merchantId, array  $info = array()) : \EasyWeChat\Support\Collection

更新子商户.

Parameters

integer $merchantId
array $info

Returns

\EasyWeChat\Support\Collection

getSubMerchant()

getSubMerchant(integer  $merchantId) : \EasyWeChat\Support\Collection

获取子商户信息.

Parameters

integer $merchantId

Returns

\EasyWeChat\Support\Collection

listSubMerchants()

listSubMerchants(integer  $beginId, integer  $limit = 50, string  $status = 'CHECKING') : \EasyWeChat\Support\Collection

批量获取子商户信息.

Parameters

integer $beginId
integer $limit
string $status

Returns

\EasyWeChat\Support\Collection

setCache()

setCache(\Doctrine\Common\Cache\Cache  $cache) : $this

Set cache manager.

Parameters

\Doctrine\Common\Cache\Cache $cache

Returns

$this

setTicketCachePrefix()

setTicketCachePrefix(string  $prefix) : $this

Set Api_ticket cache prifix.

Parameters

string $prefix

Returns

$this

setTicketCacheKey()

setTicketCacheKey(string  $cacheKey) : $this

Set Api_ticket cache key.

Parameters

string $cacheKey

Returns

$this

getTicketCacheKey()

getTicketCacheKey() : string

Get ApiTicket token cache key.

Returns

string

setUrl()

setUrl(string  $url) : \EasyWeChat\Card\Card

Set current url.

Parameters

string $url

Returns

\EasyWeChat\Card\Card

registerHttpMiddlewares()

registerHttpMiddlewares() 

Register Guzzle middlewares.

accessTokenMiddleware()

accessTokenMiddleware() : \Closure

Attache access token to request query.

Returns

\Closure

logMiddleware()

logMiddleware() : \Closure

Log the request.

Returns

\Closure

retryMiddleware()

retryMiddleware() : \Closure

Return retry middleware.

Returns

\Closure

checkAndThrow()

checkAndThrow(array  $contents) 

Check the array data errors, and Throw exception when the contents contains error.

Parameters

array $contents

Throws

\EasyWeChat\Core\Exceptions\HttpException

updateStock()

updateStock(string  $cardId, integer  $amount, string  $action = 'increase') : \EasyWeChat\Support\Collection

修改库存接口.

Parameters

string $cardId
integer $amount
string $action

Returns

\EasyWeChat\Support\Collection