CRMEB 知识付费模版消息修改教程

模板消息仅用于公众号向用户发送重要的服务通知,只能用于符合其要求的服务场景中,如信用卡刷卡通知,商品购买成功通知等。不支持广告等营销类消息以及其它所有可能对用户造成骚扰的消息。知识付费模版消息功能使用的 easywechat 的模版消息;

notice;

API#
【CRMEB 知识付费模版消息修改教程】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();

那知识付费中模版消息如何修改呢?
第一步:现在选择模版消息并且在知识付费后台添加
见文档公众号 - 模版消息 https://doc.crmeb.com/zsff/cr...
第二步:模版消息类中加新模版消息编号 extend\service\WechatTemplateService
CRMEB 知识付费模版消息修改教程
文章图片

第三步:发送模版消息
$openid : 用户 opendid
$templateId : 模版消息编号
$url : 模版消息点击访问的链接
WechatTemplateService::sendTemplate($openid, $templateId,[//下面的参数以模版消息的详细内容为主;如下图红框的内容 'first' => '.....', 'keyword1' => '', 'keyword2' => '', 'remark' => '备注' ], $url);

CRMEB 知识付费模版消息修改教程
文章图片

这样模版消息就成功了。
源码附件已经打包好上传到百度云了,大家自行下载即可~
链接: https://pan.baidu.com/s/14G-b...
提取码: yu27
百度云链接不稳定,随时可能会失效,大家抓紧保存哈。
如果百度云链接失效了的话,请留言告诉我,我看到后会及时更新~
开源地址
码云地址:https://gitee.com/ZhongBangKe...
开源不易,Star 以表尊重,感兴趣的朋友欢迎 Star,提交 PR,一起维护开源项目,造福更多人!

    推荐阅读