123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\api\controller\hprose;
- use app\api\controller\hprose\util\WechatMpHelper;
- use app\common\model\WechatConfig;
- use EasyWeChat\Factory;
- use think\facade\Log;
- class WechatMp
- {
- /**
- * 发送1条模板消息
- * @param $authInfo,数组,索引值为:code ,time,sign
- * @param $data ,数组,每个元素为1条模板消息
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function templateMessageSend($authInfo, $data)
- {
- Log::record("接收参数:authInfo:" . json_encode($authInfo, JSON_UNESCAPED_UNICODE));
- Log::record("接收参数:data:" . json_encode($data, JSON_UNESCAPED_UNICODE));
- $wechatMpHelper = new WechatMpHelper($authInfo);
- if ($wechatMpHelper->res["code"] != 0) {
- return $wechatMpHelper->res["code"];
- }
- return $wechatMpHelper->templateMessageSend($data);
- }
- }
|