CRMEB知識(shí)付費(fèi)系統(tǒng)小課堂——模版消息修改

CRMEB知識(shí)付費(fèi)系統(tǒng)是一款方便二開(kāi)的內(nèi)容付費(fèi)+微商城系統(tǒng);支持講師入駐,通過(guò)直播、視頻、音頻、圖文、題庫(kù)等多種內(nèi)容形式,快速實(shí)現(xiàn)內(nèi)容變現(xiàn)。
對(duì)于很多開(kāi)發(fā)者在了解我們知識(shí)付費(fèi)系統(tǒng)的時(shí)候,想對(duì)模版消息進(jìn)行修改,下面就跟小編一起了解下。
模板消息僅用于公眾號(hào)向用戶(hù)發(fā)送重要的服務(wù)通知,只能用于符合其要求的服務(wù)場(chǎng)景中,如信用卡刷卡通知,商品購(gòu)買(mǎi)成功通知等。不支持廣告等營(yíng)銷(xiāo)類(lèi)消息以及其它所有可能對(duì)用戶(hù)造成騷擾的消息。知識(shí)付費(fèi)模版消息功能使用的easywechat的模版消息;
<?php
use EasyWeChat\Foundation\Application;
$app = new Application($options);
$notice = $app->notice;
API#
boolean setIndustry($industryId1, $industryId2) 修改賬號(hào)所屬行業(yè);
array getIndustry() 返回所有支持的行業(yè)列表,用于做下拉選擇行業(yè)可視化更新;
string addTemplate($shortId) 添加模板并獲取模板ID;
collection send($message) 發(fā)送模板消息, 返回消息ID;
array getPrivateTemplates() 獲取所有模板列表;
array deletePrivateTemplate($templateId) 刪除指定ID的模板。
非鏈接調(diào)用方法:
$messageId = $notice->send([
'touser' => 'user-openid',
'template_id' => 'template-id',
'url' => 'xxxxx',
'data' => [
//...
],
]);
鏈?zhǔn)秸{(diào)用方法:
設(shè)置模板ID:template / templateId / uses
設(shè)置接收者openId: to / receiver
設(shè)置詳情鏈接:url / link / linkTo
設(shè)置模板數(shù)據(jù):data / with
$messageId = $notice->to($userOpenId)->uses($templateId)->andUrl($url)->data($data)->send();
// 或者
$messageId=$notice->to($userOpenId)->url($url)->template($templateId)->andData($data)
->send();
// 或者
$messageId=$notice->withTo($userOpenId)->withUrl($url)->withTemplate($templateId)
->withData($data)->send();
// 或者
$messageId = $notice->to($userOpenId)->url($url)->withTemplateId($templateId)->send();
那知識(shí)付費(fèi)中模版消息如何修改呢?
第一步:現(xiàn)在選擇模版消息并且在知識(shí)付費(fèi)后臺(tái)添加
第二步:模版消息類(lèi)中加新模版消息編號(hào)extend\service\WechatTemplateService
第三步:發(fā)送模版消息
$openid : 用戶(hù)opendid
$templateId : 模版消息編號(hào)
$url : 模版消息點(diǎn)擊訪問(wèn)的鏈接
WechatTemplateService::sendTemplate($openid, $templateId,
[
//下面的參數(shù)以模版消息的詳細(xì)內(nèi)容為主;如下圖紅框的內(nèi)容
'first' => '.....',
'keyword1' => '',
'keyword2' => '',
'remark' => '備注'
], $url);
這樣模版消息就成功了。
您如果還想了解更多知識(shí)付費(fèi)的功能技術(shù)規(guī)則等問(wèn)題,可以關(guān)注CRMEB官網(wǎng)-行業(yè)新聞。有更多實(shí)用的技術(shù)知識(shí)為您分享!
[免責(zé)聲明]
原文標(biāo)題: CRMEB知識(shí)付費(fèi)系統(tǒng)小課堂——模版消息修改
本文由作者原創(chuàng)發(fā)布于36氪企服點(diǎn)評(píng);未經(jīng)許可,禁止轉(zhuǎn)載。




