{"id":1120,"date":"2023-03-16T21:21:25","date_gmt":"2023-03-16T13:21:25","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1120"},"modified":"2023-04-29T10:17:05","modified_gmt":"2023-04-29T02:17:05","slug":"design-pattern-command-mode","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/16\/design-pattern-command-mode\/","title":{"rendered":"\u8bbe\u8ba1\u6a21\u5f0f\uff0811\uff09\u547d\u4ee4\u6a21\u5f0f"},"content":{"rendered":"<p>\u547d\u4ee4\u6a21\u5f0f\u662f\u884c\u4e3a\u578b\u6a21\u5f0f\u4e4b\u4e00\u3002\u603b\u4f53\u6765\u8bf4\u5e76\u4e0d\u96be\u7406\u89e3\uff0c\u53ea\u662f\u6bd4\u8f83\u7e41\u7410\uff0c\u4ed6\u4f1a\u5c06\u7b80\u5355\u7684\u8c03\u7528\u5173\u7cfb\u89e3\u8026\u6210\u591a\u4e2a\u90e8\u5206\uff0c\u589e\u52a0\u7c7b\u7684\u590d\u6742\u5ea6\uff0c\u4f46\u662f\u5373\u4fbf\u5982\u6b64\uff0c\u547d\u4ee4\u6a21\u5f0f\u7684\u7ed3\u6784\u4f9d\u7136\u6e05\u6670\u3002<\/p>\n<p><!-- more --><\/p>\n<h2>\u5b9a\u4e49<\/h2>\n<p>\u5c06\u4e00\u4e2a\u8bf7\u6c42\u5c01\u88c5\u6210\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4ece\u800c\u8ba9\u7528\u6237\u4f7f\u7528\u4e0d\u540c\u7684\u8bf7\u6c42\u628a\u5ba2\u6237\u7aef\u53c2\u6570\u5316\uff1b\u5bf9\u8bf7\u6c42\u6392\u961f\u6216\u8005\u8bb0\u5f55\u8bf7\u6c42\u65e5\u5fd7\uff0c\u4ee5\u53ca\u652f\u6301\u53ef\u64a4\u9500\u7684\u64cd\u4f5c\u3002<\/p>\n<h2>\u4f7f\u7528\u573a\u666f<\/h2>\n<p>\uff081\uff09\u9700\u8981\u62bd\u51fa\u5f85\u6267\u884c\u7684\u52a8\u4f5c\uff0c\u7136\u540e\u4ee5\u53c2\u6570\u7684\u5f62\u5f0f\u63d0\u4f9b\u51fa\u6765\u3002<br \/>\n\uff082\uff09\u5728\u4e0d\u540c\u7684\u65f6\u523b\u6307\u5b9a\u3001\u6392\u5217\u548c\u6267\u884c\u8bf7\u6c42\u3002\u4e00\u4e2a\u547d\u4ee4\u5bf9\u8c61\u53ef\u4ee5\u6709\u4e0e\u521d\u59cb\u8bf7\u6c42\u65e0\u5173\u7684\u751f\u5b58\u671f\u3002<br \/>\n\uff083\uff09\u9700\u8981\u652f\u6301\u64cd\u4f5c\u53d6\u6d88\u3002<br \/>\n\uff084\uff09\u652f\u6301\u4fee\u6539\u65e5\u5fd7\u529f\u80fd\uff0c\u8fd9\u6837\u5f53\u7cfb\u7edf\u5d29\u6e83\u65f6\uff0c\u8fd9\u4e9b\u4fee\u6539\u53ef\u4ee5\u88ab\u91cd\u505a\u4e00\u904d\u3002<br \/>\n\uff085\uff09\u9700\u8981\u652f\u6301\u4e8b\u52a1\u64cd\u4f5c\u3002<\/p>\n<h2>\u7b80\u5355\u5b9e\u73b0<\/h2>\n<p>\u4ee5\u63a8\u7bb1\u5b50\u6e38\u620f\u4e3a\u4f8b\uff0c\u4e00\u822c\u6e38\u620f\u4e2d\u4f1a\u6709\u4e94\u4e2a\u6309\u94ae\uff0c\u5206\u522b\u662f\u5de6\u79fb\u3001\u53f3\u79fb\u3001\u4e0b\u79fb\u3001\u4e0a\u79fb\u548c\u64a4\u9500\u3002\u90a3\u4e48\u73a9\u6e38\u620f\u7684\u4eba\u5c31\u662f\u5ba2\u6237\u7aef\uff0c\u4e94\u4e2a\u6309\u94ae\u5c31\u662f\u8c03\u7528\u8005\uff0c\u6267\u884c\u5177\u4f53\u6309\u94ae\u547d\u4ee4\u7684\u65b9\u6cd5\u662f\u547d\u4ee4\u89d2\u8272\u3002<\/p>\n<p>\u63a5\u6536\u8005\u89d2\u8272\uff1a\u63a8\u7bb1\u5b50\u6e38\u620f<\/p>\n<pre><code class=\"language-java\">public class PushBox {\n    \/**\n     * \u6267\u884c\u5411\u5de6\u547d\u4ee4 \n     *\/\n    public void toLeft() {\n        System.out.println(&quot;\u5411\u5de6&quot;);\n    }\n\n    \/**\n     * \u6267\u884c\u5411\u53f3\u547d\u4ee4 \n     *\/\n    public void toRight() {\n        System.out.println(&quot;\u5411\u53f3&quot;);\n    }\n\n    \/**\n     * \u6267\u884c\u5411\u4e0b\u547d\u4ee4 \n     *\/\n    public void toDown() {\n        System.out.println(&quot;\u5411\u4e0b&quot;);\n    }\n\n    \/**\n     * \u6267\u884c\u5411\u4e0a\u547d\u4ee4 \n     *\/\n    public void toUp() {\n        System.out.println(&quot;\u5411\u4e0a&quot;);\n    }\n\n    \/**\n     * \u6267\u884c\u64a4\u9500\u547d\u4ee4 \n     *\/\n    public void revoke() {\n        System.out.println(&quot;\u64a4\u9500&quot;);\n    }\n}<\/code><\/pre>\n<p>\u547d\u4ee4\u8005\u62bd\u8c61<\/p>\n<pre><code class=\"language-java\">public interface Command {\n    \/**\n     * \u547d\u4ee4\u6267\u884c\u65b9\u6cd5\n     *\/\n    void execute();\n\n    \/**\n     * \u83b7\u53d6\u547d\u4ee4\u7c7b\u578b\n     *\/\n    void getCommand();\n}<\/code><\/pre>\n<p>\u5177\u4f53\u547d\u4ee4\u8005\uff0c\u5de6\u79fb\u547d\u4ee4\u7c7b<\/p>\n<pre><code class=\"language-java\">public class LeftCommand implements Command {\n\n    \/\/\u6301\u6709\u4e00\u4e2a\u63a5\u53d7\u63a8\u7bb1\u5b50\u6e38\u620f\u5bf9\u8c61\u7684\u5f15\u7528\n    private PushBox pushBox;\n\n    public LeftCommand(PushBox pushBox) {\n        this.pushBox = pushBox;\n    }\n\n    @Override\n    public void execute() {\n        \/\/\u8c03\u7528\u5177\u4f53\u547d\u4ee4\n        pushBox.toLeft();\n    }\n\n    @Override\n    public void getCommand() {\n        System.out.print(&quot;\u5411\u5de6--&gt;&quot;);\n    }\n}<\/code><\/pre>\n<p>\u5177\u4f53\u547d\u4ee4\u8005\uff0c\u53f3\u79fb\u547d\u4ee4\u7c7b<\/p>\n<pre><code class=\"language-java\">public class RightCommand implements Command {\n\n    \/\/\u6301\u6709\u4e00\u4e2a\u63a5\u53d7\u63a8\u7bb1\u5b50\u6e38\u620f\u5bf9\u8c61\u7684\u5f15\u7528\n    private PushBox pushBox;\n\n    public RightCommand(PushBox pushBox){\n        this.pushBox = pushBox;\n    }\n\n    @Override\n    public void execute() {\n        \/\/\u8c03\u7528\u5177\u4f53\u547d\u4ee4\n        pushBox.toRight();\n    }\n\n    @Override\n    public void getCommand() {\n        System.out.print(&quot;\u5411\u53f3--&gt;&quot;);\n    }\n}<\/code><\/pre>\n<p>\u5177\u4f53\u547d\u4ee4\u8005\uff0c\u4e0a\u79fb\u547d\u4ee4\u7c7b<\/p>\n<pre><code class=\"language-java\">public class UpCommand implements Command {\n\n    \/\/\u6301\u6709\u4e00\u4e2a\u63a5\u53d7\u63a8\u7bb1\u5b50\u6e38\u620f\u5bf9\u8c61\u7684\u5f15\u7528\n    private PushBox pushBox;\n\n    public UpCommand(PushBox pushBox){\n        this.pushBox = pushBox;\n    }\n\n    @Override\n    public void execute() {\n        \/\/\u8c03\u7528\u5177\u4f53\u547d\u4ee4\n        pushBox.toUp();\n    }\n\n    @Override\n    public void getCommand() {\n        System.out.print(&quot;\u5411\u4e0a--&gt;&quot;);\n    }\n}<\/code><\/pre>\n<p>\u5177\u4f53\u547d\u4ee4\u8005\uff0c\u4e0b\u79fb\u547d\u4ee4\u7c7b<\/p>\n<pre><code class=\"language-java\">public class DownCommand implements Command {\n\n    \/\/\u6301\u6709\u4e00\u4e2a\u63a5\u53d7\u63a8\u7bb1\u5b50\u6e38\u620f\u5bf9\u8c61\u7684\u5f15\u7528\n    private PushBox pushBox;\n\n    public DownCommand(PushBox pushBox){\n        this.pushBox = pushBox;\n    }\n\n    @Override\n    public void execute() {\n        \/\/\u8c03\u7528\u5177\u4f53\u547d\u4ee4\n        pushBox.toDown();\n    }\n\n    @Override\n    public void getCommand() {\n        System.out.print(&quot;\u5411\u4e0b--&gt;&quot;);\n    }\n}<\/code><\/pre>\n<p>\u5177\u4f53\u547d\u4ee4\u8005\uff0c\u64a4\u9500\u547d\u4ee4\u7c7b<\/p>\n<pre><code class=\"language-java\">public class RevokeCommand implements Command {\n\n    \/\/\u6301\u6709\u4e00\u4e2a\u63a5\u53d7\u63a8\u7bb1\u5b50\u6e38\u620f\u5bf9\u8c61\u7684\u5f15\u7528\n    private PushBox pushBox;\n\n    public RevokeCommand(PushBox pushBox) {\n        this.pushBox = pushBox;\n    }\n\n    @Override\n    public void execute() {\n        \/\/\u8c03\u7528\u5177\u4f53\u547d\u4ee4\n        pushBox.revoke();;\n    }\n    @Override\n    public void getCommand() {\n    }\n}<\/code><\/pre>\n<p>\u8bf7\u6c42\u8005\u7c7b\uff0c\u547d\u4ee4\u7531\u6309\u94ae\u53d1\u8d77<\/p>\n<pre><code class=\"language-java\">public class Buttons {\n\n    private LeftCommand leftCommand; \/\/\u5411\u5de6\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\u5f15\u7528\n    private RightCommand rightCommand; \/\/\u5411\u53f3\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\u5f15\u7528\n    private UpCommand upCommand; \/\/\u5411\u4e0a\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\u5f15\u7528\n    private DownCommand downCommand; \/\/\u5411\u4e0b\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\u5f15\u7528\n    private RevokeCommand revokeCommand; \/\/\u64a4\u9500\u547d\u4ee4\u5bf9\u8c61\u5f15\u7528\n\n    private ArrayList&lt;Command&gt; commandList = new ArrayList&lt;Command&gt;();\/\/\u7528\u4e8e\u8bb0\u5f55\u547d\u4ee4\u52a8\u4f5c\n\n    \/**\n     * \u83b7\u53d6\u6267\u884c\u547d\u4ee4\n     *\/\n    public void getCommandList() {\n        for (Command c : commandList) {\n            c.getCommand();\n        }\n        System.out.println(&quot;&quot;);\n    }\n\n    \/**\n     * \u8bbe\u7f6e\u5411\u5de6\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     * \n     * @param leftCommand \u5411\u5de6\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     *\/\n    public void setLeftCommand(LeftCommand leftCommand) {\n        this.leftCommand = leftCommand;\n    }\n\n    \/**\n     * \u8bbe\u7f6e\u5411\u53f3\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     * \n     * @param rightCommand \u5411\u53f3\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     *\/\n    public void setRightCommand(RightCommand rightCommand) {\n        this.rightCommand = rightCommand;\n    }\n\n    \/**\n     * \u8bbe\u7f6e\u5411\u4e0a\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     * \n     * @param upCommand \u5411\u4e0a\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     *\/\n    public void setUpCommand(UpCommand upCommand) {\n        this.upCommand = upCommand;\n    }\n\n    \/**\n     * \u8bbe\u7f6e\u5411\u4e0b\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     * \n     * @param downCommand \u5411\u4e0b\u79fb\u52a8\u7684\u547d\u4ee4\u5bf9\u8c61\n     *\/\n    public void setDownCommand(DownCommand downCommand) {\n        this.downCommand = downCommand;\n    }\n\n    \/**\n     * \u8bbe\u7f6e\u64a4\u9500\u547d\u4ee4\u5bf9\u8c61\n     * \n     * @param revokeCommand \u64a4\u9500\u547d\u4ee4\u5bf9\u8c61\n     *\/\n    public void setRevokeCommand(RevokeCommand revokeCommand) {\n        this.revokeCommand = revokeCommand;\n    }\n\n    \/**\n     * \u6309\u4e0b\u5411\u5de6\u6309\u94ae \n     *\/\n    public void toLeft() {\n        leftCommand.execute();\n        commandList.add(leftCommand);\n    }\n\n    \/**\n     * \u6309\u4e0b\u5411\u53f3\u6309\u94ae \n     *\/\n    public void toRight() {\n        rightCommand.execute();\n        commandList.add(rightCommand);\n    }\n\n    \/**\n     * \u6309\u4e0b\u5411\u4e0a\u6309\u94ae \n     *\/\n    public void toUp() {\n        upCommand.execute();\n        commandList.add(upCommand);\n    }\n\n    \/**\n     * \u6309\u4e0b\u5411\u4e0b\u6309\u94ae \n     *\/\n    public void toDown() {\n        downCommand.execute();\n        commandList.add(downCommand);\n    }\n\n    \/**\n     * \u6309\u4e0b\u64a4\u9500\u6309\u94ae \n     *\/\n    public void toRevoke() {\n        revokeCommand.execute();\n        commandList.remove(commandList.size()-1);\n    }\n}<\/code><\/pre>\n<p>\u5ba2\u6237\u7aef\u8c03\u7528<\/p>\n<pre><code class=\"language-java\">public class Client {\n\n    public static void main(String[] args) {\n        \/\/\u9996\u5148\u521b\u5efa\u6e38\u620f\n        PushBox pushBox = new PushBox();\n\n        \/\/\u6839\u636e\u6e38\u620f\u6784\u90205\u79cd\u547d\u4ee4\n        LeftCommand leftCommand = new LeftCommand(pushBox);\n        RightCommand rightCommand = new RightCommand(pushBox);\n        UpCommand upCommand = new UpCommand(pushBox);\n        DownCommand downCommand = new DownCommand(pushBox);\n        RevokeCommand revokeCommand = new RevokeCommand(pushBox);\n\n        \/\/\u6309\u94ae\u53ef\u4ee5\u6267\u884c\u4e0d\u540c\u547d\u4ee4\n        Buttons buttons = new Buttons();\n        buttons.setLeftCommand(leftCommand);\n        buttons.setRightCommand(rightCommand);\n        buttons.setUpCommand(upCommand);\n        buttons.setDownCommand(downCommand);\n        buttons.setRevokeCommand(revokeCommand);\n\n        \/\/\u6267\u884c\u64cd\u4f5c\n        buttons.toLeft();\n        buttons.toDown();\n        buttons.toDown();\n        buttons.toRight();\n        buttons.getCommandList();\n        buttons.toRevoke();\n        buttons.toUp();\n        buttons.toLeft();\n        buttons.toDown();\n        buttons.toUp();\n        buttons.getCommandList();\n    }\n}<\/code><\/pre>\n<p>\u6267\u884c\u7ed3\u679c<\/p>\n<pre><code>\u5411\u5de6\n\u5411\u4e0b\n\u5411\u4e0b\n\u5411\u53f3\n\u5411\u5de6--&gt;\u5411\u4e0b--&gt;\u5411\u4e0b--&gt;\u5411\u53f3--&gt;\n\u64a4\u9500\n\u5411\u4e0a\n\u5411\u5de6\n\u5411\u4e0b\n\u5411\u4e0a\n\u5411\u5de6--&gt;\u5411\u4e0b--&gt;\u5411\u4e0b--&gt;\u5411\u4e0a--&gt;\u5411\u5de6--&gt;\u5411\u4e0b--&gt;\u5411\u4e0a--&gt;<\/code><\/pre>\n<p>\u5728\u8fd9\u4e48\u957f\u7684\u4ee3\u7801\u4e4b\u540e\u662f\u4e0d\u662f\u89c9\u5f97\u5f88\u70e6\u7410\uff0c\u660e\u660e\u53ef\u4ee5\u5f88\u7b80\u5355\u7684\u5b9e\u73b0\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-java\">public class Client {\n\n    public static void main(String[] args) {\n        \/\/\u9996\u5148\u521b\u5efa\u6e38\u620f\n        PushBox pushBox = new PushBox();\n\n        pushBox.toDown();\n        pushBox.toRight();\n        pushBox.toUp();\n\n    }\n}<\/code><\/pre>\n<p>\u5176\u5b9e\u8bbe\u8ba1\u6a21\u5f0f\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u539f\u5219\uff1a\u5bf9\u4fee\u6539\u5173\u95ed\u5bf9\u6269\u5c55\u5f00\u653e\u3002\u5982\u679c\u4f7f\u7528\u5982\u4e0a\u7684\u7b80\u5355\u65b9\u5f0f\uff0c\u90a3\u4e48\u4ee5\u540e\u7684\u4fee\u6539\u53ea\u80fd\u53bb\u4fee\u6539PushBox\u7c7b\uff0c\u7136\u540e\u4fee\u6539Client\u7c7b\uff0c\u8fd9\u663e\u7136\u8fdd\u53cd\u4e86\u8fd9\u4e00\u539f\u5219\u3002\u5982\u679c\u4f7f\u7528\u547d\u4ee4\u6a21\u5f0f\uff0c\u90a3\u4e48Client\u7c7b\u65e0\u9700\u4fee\u6539\uff0c\u53ea\u9700\u8981\u4fee\u6539PushBox\u7c7b\u7684\u5185\u90e8\u64cd\u4f5c\uff0cClient\u7c7b\u65e0\u9700\u77e5\u9053\u5177\u4f53\u7684\u5185\u90e8\u5b9e\u73b0\u3002<\/p>\n<p>\u8bbe\u8ba1\u6a21\u5f0f\u7684\u4f7f\u7528\u4e4b\u524d\u4e5f\u6709\u63d0\u5230\uff0c\u4e3b\u8981\u662f\u8981\u770b\u5f53\u524d\u573a\u666f\u7684\u590d\u6742\u5ea6\u548c\u4ee5\u540e\u7684\u9700\u6c42\u8fdb\u884c\u6269\u5c55\u3001\u7ef4\u62a4\u7b49\u65b9\u9762\uff0c\u5b8c\u5168\u4f7f\u7528\u8bbe\u8ba1\u6a21\u5f0f\u4e5f\u662f\u4e0d\u63d0\u5021\u7684\uff0c\u8fd9\u5c31\u9700\u8981\u8bbe\u8ba1\u8005\u6743\u8861\u5229\u5f0a\u4e86\u3002<\/p>\n<h2>Android\u6e90\u7801\u4e2d\u7684\u547d\u4ee4\u6a21\u5f0f\u5b9e\u73b0<\/h2>\n<ul>\n<li>PackageHandler<\/li>\n<\/ul>\n<p><code>PackageManagerService<\/code>\u4e2d\uff0c\u5176\u5bf9\u5305\u7684\u76f8\u5173\u6d88\u606f\u5904\u7406\u7531\u5176\u5185\u90e8\u7c7b<code>PackageHandler<\/code>\u627f\u62c5\uff0c\u5176\u5c06\u9700\u8981\u5904\u7406\u7684\u8bf7\u6c42\u4f5c\u4e3a\u5bf9\u8c61\u901a\u8fc7\u6d88\u606f\u4f20\u9012\u7ed9\u76f8\u5173\u7684\u65b9\u6cd5\uff0c\u800c\u5bf9\u4e8e\u5305\u7684\u5b89\u88c5\u3001\u79fb\u52a8\u4ee5\u53ca\u5305\u5927\u5c0f\u7684\u6d4b\u91cf\u5219\u5206\u522b\u5c01\u88c5\u4e3a<code>HandlerParams<\/code>\u7684\u5177\u4f53\u5b50\u7c7b<code>InstallParams<\/code>\u3001<code>MoveParams<\/code>\u548c<code>MeasureParams<\/code>\u3002\u6e90\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-java\">private abstract class HandlerParams {\n    private static final int MAX_RETRIES = 4;\n\n    \/**\n     * Number of times startCopy() has been attempted and had a non-fatal\n     * error.\n     *\/\n    private int mRetries = 0;\n\n    final boolean startCopy() {\n        boolean res;\n        try {\n            if (DEBUG_INSTALL) Slog.i(TAG, &quot;startCopy&quot;);\n\n            if (++mRetries &gt; MAX_RETRIES) {\n                Slog.w(TAG, &quot;Failed to invoke remote methods on default container service. Giving up&quot;);\n                mHandler.sendEmptyMessage(MCS_GIVE_UP);\n                handleServiceError();\n                return false;\n            } else {\n                handleStartCopy();\n                res = true;\n            }\n        } catch (RemoteException e) {\n            if (DEBUG_INSTALL) Slog.i(TAG, &quot;Posting install MCS_RECONNECT&quot;);\n            mHandler.sendEmptyMessage(MCS_RECONNECT);\n            res = false;\n        }\n        handleReturnCode();\n        return res;\n    }\n\n    final void serviceError() {\n        if (DEBUG_INSTALL) Slog.i(TAG, &quot;serviceError&quot;);\n        handleServiceError();\n        handleReturnCode();\n    }\n\n    abstract void handleStartCopy() throws RemoteException;\n    abstract void handleServiceError();\n    abstract void handleReturnCode();\n}<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa<code>HandlerParams<\/code>\u4e5f\u662f\u4e00\u4e2a\u62bd\u8c61\u547d\u4ee4\u8005\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\uff081\uff09\u4f18\u70b9<\/p>\n<p>\u547d\u4ee4\u6a21\u5f0f\u7684\u5c01\u88c5\u6027\u5f88\u597d\uff0c\u66f4\u5f31\u7684\u8026\u5408\u6027\uff0c\u66f4\u7075\u6d3b\u7684\u63a7\u5236\u6027\u4ee5\u53ca\u66f4\u597d\u7684\u6269\u5c55\u6027\u3002<\/p>\n<p>\uff082\uff09\u7f3a\u70b9<\/p>\n<p>\u7c7b\u7684\u81a8\u80c0\uff0c\u5927\u91cf\u884d\u751f\u7c7b\u7684\u521b\u5efa\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u547d\u4ee4\u6a21\u5f0f\u662f\u884c\u4e3a\u578b\u6a21\u5f0f\u4e4b\u4e00\u3002\u603b\u4f53\u6765\u8bf4\u5e76\u4e0d\u96be\u7406\u89e3\uff0c\u53ea\u662f\u6bd4\u8f83\u7e41\u7410\uff0c\u4ed6\u4f1a\u5c06\u7b80\u5355\u7684\u8c03\u7528\u5173\u7cfb\u89e3\u8026\u6210\u591a\u4e2a\u90e8\u5206\uff0c\u589e\u52a0\u7c7b\u7684\u590d\u6742\u5ea6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[303],"tags":[],"class_list":["post-1120","post","type-post","status-publish","format-standard","hentry","category-design-pattern"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1120"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1120\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}