getMessage()); return true; } app()->make(SystemNotificationServices::class)->update(['routine_tempkey' => $key], ['routine_tempid' => $tempid, 'routine_kid' => json_encode($kid)]); return true; } return true; } /** * 同步公众号模版消息 * @param $key * @param $content * @return bool * @author: 吴汐 * @email: 442384644@qq.com * @date: 2023/8/16 */ public function syncWechat($key, $content) { $content = is_array($content) ? $content : explode("\n", $content); $name = []; foreach ($content as $c) { $name[] = explode('{{', $c)[0] ?? ''; } try { $res = WechatService::addTemplateId($key, $name); } catch (\Throwable $e) { Log::error('同步模版消息失败:' . $e->getMessage()); return true; } if (!$res->errcode && $res->template_id) { app()->make(SystemNotificationServices::class)->update(['wechat_tempkey' => $key], ['wechat_tempid' => $res->template_id]); } return true; } }