HuanMengAdmin/admin-server/MiaoYu.Api.Admin/wwwroot/docs/assets/scheduled-tasks.html-b338f70f.js
2024-07-18 02:27:50 +08:00

10 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as s,o as n,c as a,a as e}from"./app-4f4af2d5.js";const t="/docs/hzy-admin/scheduled-tasks-1.jpg",c={},p=e(`<h1 id="定时任务" tabindex="-1"><a class="header-anchor" href="#定时任务" aria-hidden="true">#</a> 定时任务</h1><h2 id="方式一" tabindex="-1"><a class="header-anchor" href="#方式一" aria-hidden="true">#</a> 方式一</h2><div class="custom-container tip"><p class="custom-container-title">提示</p><p>通过本地 c# 函数任务,实现定时任务</p><p>本地项目中函数任务,函数需要加一个标记即可 [Scheduled(&quot;0/5 * * * * ?&quot;)] ,详情看下面示例</p><p>但是要注意函数只能在依赖注入的class中使用否则无法使用</p></div><div class="language-csharp line-numbers-mode" data-ext="cs"><pre class="language-csharp"><code><span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Test</span> <span class="token punctuation">:</span> <span class="token type-list"><span class="token class-name">ITransientDependency</span></span>
<span class="token punctuation">{</span>
<span class="token punctuation">[</span><span class="token attribute"><span class="token class-name">Scheduled</span><span class="token attribute-arguments"><span class="token punctuation">(</span><span class="token string">&quot;0/5 * * * * ?&quot;</span><span class="token punctuation">)</span></span></span><span class="token punctuation">]</span>
<span class="token keyword">public</span> <span class="token return-type class-name"><span class="token keyword">void</span></span> <span class="token function">Run</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
<span class="token comment">// todo ...</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="方式二" tabindex="-1"><a class="header-anchor" href="#方式二" aria-hidden="true">#</a> 方式二</h2><div class="custom-container tip"><p class="custom-container-title">提示</p><p>通过远端任务 WebApi 接口地址,实现定时任务。也可以调用外部的 api 接口</p></div><p><img src="`+t+'" alt="定时任务"></p>',7),i=[p];function o(l,d){return n(),a("div",null,i)}const r=s(c,[["render",o],["__file","scheduled-tasks.html.vue"]]);export{r as default};