12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace crmeb\services;
- use app\admin\model\wechat\WechatUser;
- use app\admin\model\wechat\StoreService as ServiceModel;
- use app\models\routine\RoutineTemplate;
- use crmeb\interfaces\ProviderInterface;
- use think\facade\Db;
- class SubscribeTemplateService implements ProviderInterface
- {
-
- const ORDER_POSTAGE_SUCCESS = 1128;
-
- const USER_EXTRACT = 1470;
-
- const OREDER_TAKEVER = 1481;
-
- const ORDER_CLONE = 1134;
-
- const ORDER_DELIVER_SUCCESS = 1458;
-
- const PINK_TRUE = 3098;
-
- const BARGAIN_SUCCESS = 2727;
-
- const ORDER_WRITE_OFF = 3116;
-
- const ORDER_NEW = 1476;
-
- const ORDER_REFUND = 1451;
-
- const RECHARGE_SUCCESS = 755;
-
- const ORDER_PAY_SUCCESS = 1927;
-
- const ORDER_REFUND_STATUS = 1468;
-
- const INTEGRAL_ACCOUT = 335;
-
- const PINK_STATUS = 3353;
- public static function getConstants($code = '')
- {
- $oClass = new \ReflectionClass(__CLASS__);
- $stants = $oClass->getConstants();
- if ($code) return isset($stants[$code]) ? $stants[$code] : '';
- else return $stants;
- }
- public function register($config)
- {
- }
-
- public static function setTemplateId($tempKey = '')
- {
- if ($tempKey == '') return '';
- return RoutineTemplate::where('tempkey', $tempKey)->where('type', 0)->where('status', 1)->value('tempid');
- }
-
- public static function sendTemplate(string $tempCode, string $openId, array $dataKey, string $link = '')
- {
- if (!$openId || !$tempCode) return false;
- return MiniProgramService::sendSubscribeTemlate($openId, trim(self::setTemplateId(self::getConstants($tempCode))), $dataKey, $link);
- }
- }
|