123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- namespace addons\weixin\library;
- use app\admin\model\weixin\template\Wechat as WechatTemplateModel;
- class WechatTemplateService
- {
-
- public static function sendTemplate($openid, $templateId, array $data, $url = null, $defaultColor = '')
- {
- $tempid = WechatTemplateModel::where('tempkey', $templateId)->where('status', 1)->value('tempid');
- if (!$tempid) {
- return false;
- }
- try {
- return WechatService::sendTemplate($openid, $tempid, $data, $url, $defaultColor);
- } catch (\Exception $e) {
- return false;
- }
- }
-
- public static function getIndustry()
- {
- return WechatService::noticeService()->getIndustry();
- }
-
- public static function setIndustry($industryId1, $industryId2)
- {
- return WechatService::noticeService()->setIndustry($industryId1, $industryId2);
- }
-
- public static function getPrivateTemplates()
- {
- return WechatService::noticeService()->getPrivateTemplates();
- }
-
- public static function deletePrivateTemplate($templateId)
- {
- return WechatService::noticeService()->deletePrivateTemplate($templateId);
- }
-
- public static function addTemplate($shortId)
- {
- return WechatService::noticeService()->addTemplate($shortId);
- }
- }
|