CRMEB知識付費系統小課堂——模版消息修改

CRMEB知識付費系統是一款方便二開的內容付費+微商城系統;支持講師入駐,通過直播、視頻、音頻、圖文、題庫等多種內容形式,快速實現內容變現。
對于很多開發者在了解我們知識付費系統的時候,想對模版消息進行修改,下面就跟小編一起了解下。
模板消息僅用于公眾號向用戶發送重要的服務通知,只能用于符合其要求的服務場景中,如信用卡刷卡通知,商品購買成功通知等。不支持廣告等營銷類消息以及其它所有可能對用戶造成騷擾的消息。知識付費模版消息功能使用的easywechat的模版消息;
<?php
use EasyWeChat\Foundation\Application;
$app = new Application($options);
$notice = $app->notice;
API#
boolean setIndustry($industryId1, $industryId2) 修改賬號所屬行業;
array getIndustry() 返回所有支持的行業列表,用于做下拉選擇行業可視化更新;
string addTemplate($shortId) 添加模板并獲取模板ID;
collection send($message) 發送模板消息, 返回消息ID;
array getPrivateTemplates() 獲取所有模板列表;
array deletePrivateTemplate($templateId) 刪除指定ID的模板。
非鏈接調用方法:
$messageId = $notice->send([
'touser' => 'user-openid',
'template_id' => 'template-id',
'url' => 'xxxxx',
'data' => [
//...
],
]);
鏈式調用方法:
設置模板ID:template / templateId / uses
設置接收者openId: to / receiver
設置詳情鏈接:url / link / linkTo
設置模板數據: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();
那知識付費中模版消息如何修改呢?
第一步:現在選擇模版消息并且在知識付費后臺添加
第二步:模版消息類中加新模版消息編號extend\service\WechatTemplateService
第三步:發送模版消息
$openid : 用戶opendid
$templateId : 模版消息編號
$url : 模版消息點擊訪問的鏈接
WechatTemplateService::sendTemplate($openid, $templateId,
[
//下面的參數以模版消息的詳細內容為主;如下圖紅框的內容
'first' => '.....',
'keyword1' => '',
'keyword2' => '',
'remark' => '備注'
], $url);
這樣模版消息就成功了。
您如果還想了解更多知識付費的功能技術規則等問題,可以關注CRMEB官網-行業新聞。有更多實用的技術知識為您分享!
