Properties

$app

$app : \think\App

应用实例

Type

\think\App

$app_id

$app_id : 

Type

$app_secret

$app_secret : 

Type

$grant_type

$grant_type : string

Type

string

$cache

$cache : string

驱动方式

Type

string

Methods

__construct()

__construct(\think\App  $app) 

Service constructor.

Parameters

\think\App $app

instance()

instance(array  $args) : static

静态实例对象

Parameters

array $args

Returns

static

appId()

appId(string  $appId) : $this

Parameters

string $appId

Returns

$this

appSecret()

appSecret(string  $appSecret) : $this

Parameters

string $appSecret

Returns

$this

cache()

cache(string  $cache) : $this

驱动方式

Parameters

string $cache

Returns

$this

getPaidUnionId()

getPaidUnionId(string  $openid) : boolean|mixed|string

用户支付完成后,获取该用户的 UnionId,无需用户授权 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html

Parameters

string $openid

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

createWxaQrCode()

createWxaQrCode(array  $data = array()) : array|boolean|mixed|string

获取小程序二维码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

getWxaCode()

getWxaCode(array  $data = array()) : array|boolean|mixed|string

获取小程序码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

getWxaCodeUnLimit()

getWxaCodeUnLimit(array  $data = array()) : array|boolean|mixed|string

获取小程序码,适用于需要的码数量极多的业务场景。通过该接口生成的小程序码,永久有效,数量暂无限制 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

addTemplate()

addTemplate(array  $data = array()) : boolean|mixed|string

组合模板并添加至帐号下的个人模板库 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.addTemplate.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

deleteTemplate()

deleteTemplate(string  $priTmplId) : boolean|mixed|string

删除帐号下的个人模板 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.deleteTemplate.html

Parameters

string $priTmplId

要删除的模板id

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

getCategory()

getCategory() : boolean|mixed|string

获取小程序账号的类目 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getCategory.html

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

getPubTemplateKeyWordsById()

getPubTemplateKeyWordsById(string  $tid) : boolean|mixed|string

获取模板标题下的关键词列表 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateKeyWordsById.html

Parameters

string $tid

模板标题 id

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

getPubTemplateTitleList()

getPubTemplateTitleList(array  $data = array()) : boolean|mixed|string

获取帐号所属类目下的公共模板标题 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateTitleList.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

getTemplateList()

getTemplateList() : boolean|mixed|string

获取当前帐号下的个人模板列表 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getTemplateList.html

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

subscribeMessageSend()

subscribeMessageSend(array  $data = array()) : boolean|mixed|string

发送订阅消息 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

uniformMessageSend()

uniformMessageSend(array  $data = array()) : boolean|mixed|string

统一服务消息 - 下发小程序和公众号统一的服务消息 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/uniform-message/uniformMessage.send.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

code2Session()

code2Session(string  $js_code) : boolean|mixed|string

登录凭证校验 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html

Parameters

string $js_code

Throws

\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

userInfo()

userInfo(string  $js_code, string  $encrypted_data, string  $iv) : boolean|mixed

检验数据的真实性,并且获取解密后的明文.

Parameters

string $js_code
string $encrypted_data
string $iv

Throws

\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed

userPhone()

userPhone(string  $js_code, string  $encrypted_data, string  $iv) : mixed

数据签名校验,并且获取解密后的明文.

Parameters

string $js_code
string $encrypted_data
string $iv

Throws

\DtApp\ThinkLibrary\exception\DtaException

Returns

mixed

decode()

decode(string  $session_key, string  $encrypted_data, string  $iv) : mixed

数据签名校验,并且获取解密后的明文.

Parameters

string $session_key
string $encrypted_data
string $iv

Returns

mixed

broadcastRoomCreate()

broadcastRoomCreate(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播间管理接口 - 创建直播间 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#1

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGetLiveInfos()

broadcastGetLiveInfos(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播间管理接口 - 获取直播间列表 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#2

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGetLiveInfo()

broadcastGetLiveInfo(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播间管理接口 - 获取直播间回放 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#3

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastRoomAddGoods()

broadcastRoomAddGoods(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播间管理接口 - 直播间导入商品 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#4

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsAdd()

broadcastGoodsAdd(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 商品添加并提审 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#1

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsResetAudit()

broadcastGoodsResetAudit(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 撤回审核 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#2

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsAudit()

broadcastGoodsAudit(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 重新提交审核 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#3

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsDelete()

broadcastGoodsDelete(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 删除商品 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#4

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsUpdate()

broadcastGoodsUpdate(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 更新商品 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#5

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGetGoodsWarehouse()

broadcastGetGoodsWarehouse(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 获取商品状态 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#6

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

broadcastGoodsGetAppRoved()

broadcastGoodsGetAppRoved(array  $data = array()) : array|boolean|mixed|string

【小程序直播】直播商品管理接口 - 获取商品列表 https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html#7

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetDailyRetain()

analysisGetDailyRetain(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取用户访问小程序日留存 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getDailyRetain.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetMonthlyRetain()

analysisGetMonthlyRetain(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取用户访问小程序月留存 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getMonthlyRetain.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetWeeklyRetain()

analysisGetWeeklyRetain(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取用户访问小程序周留存 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getWeeklyRetain.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetDailySummary()

analysisGetDailySummary(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取用户访问小程序数据概况 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getDailySummary.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetUserPortrait()

analysisGetUserPortrait(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取小程序新增或活跃用户的画像分布数据。时间范围支持昨天、最近7天、最近30天。其中,新增用户数为时间范围内首次访问小程序的去重用户数,活跃用户数为时间范围内访问过小程序的去重用户数 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getUserPortrait.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetVisitDistribution()

analysisGetVisitDistribution(array  $data = array()) : array|boolean|mixed|string

数据分析 - 获取用户访问小程序数据概况 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getVisitDistribution.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

analysisGetVisitPage()

analysisGetVisitPage(array  $data = array()) : array|boolean|mixed|string

数据分析 - 访问页面。目前只提供按 page_visit_pv 排序的 top200 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getVisitPage.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

customerServiceMessageGetTempMedia()

customerServiceMessageGetTempMedia(string  $media_id = '') : array|boolean|mixed|string

客服消息 - 获取客服消息内的临时素材。即下载临时的多媒体文件。目前小程序仅支持下载图片文件。 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.getTempMedia.html

Parameters

string $media_id

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

customerServiceMessageSend()

customerServiceMessageSend(array  $data = array()) : array|boolean|mixed|string

客服消息 - 发送客服消息给用户。详细规则见 发送客服消息 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.send.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

customerServiceMessageSetTyping()

customerServiceMessageSetTyping(array  $data = array()) : array|boolean|mixed|string

客服消息 - 下发客服当前输入状态给用户。详见 客服消息输入状态 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.setTyping.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

customerServiceMessageUploadTempMedia()

customerServiceMessageUploadTempMedia(array  $data = array()) : array|boolean|mixed|string

客服消息 - 把媒体文件上传到微信服务器。目前仅支持图片。用于发送客服消息或被动回复用户消息 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.uploadTempMedia.html

Parameters

array $data

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string

accessToken()

accessToken() : boolean|mixed|string

获取小程序全局唯一后台接口调用凭据(access_token) https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

boolean|mixed|string

initialize()

initialize() : $this

初始化服务

Returns

$this

getConfig()

getConfig() : $this

获取配置信息

Returns

$this

getAccessToken()

getAccessToken() : array|boolean|mixed|string|array<mixed,string>

获取access_token信息

Throws

\think\db\exception\DbException
\DtApp\ThinkLibrary\exception\DtaException

Returns

array|boolean|mixed|string|array<mixed,string>