{"id":3788,"date":"2024-01-01T09:12:11","date_gmt":"2024-01-01T01:12:11","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=3788"},"modified":"2023-11-29T09:23:00","modified_gmt":"2023-11-29T01:23:00","slug":"%e8%bf%90%e8%be%93%e5%8f%91%e7%a5%a8%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=3788","title":{"rendered":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b"},"content":{"rendered":"\n<p>\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd0\u8f93\u53d1\u7968\u6f14\u7ec3<\/li>\n\n\n\n<li>\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u4ee3\u7801<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u6f14\u7ec3<\/li>\n\n\n\n<li>\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u4ee3\u7801<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u6f14\u7ec3<\/h2>\n\n\n\n<p>\u672c\u8282\u4e2d\u7684\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u5305\u62ec\u6df7\u5408\u4e86\u7684\u4f20\u7edf Salesforce \u529f\u80fd \u4e0e Apex\u3002Apex \u7684\u8bb8\u591a\u53e5\u6cd5\u548c\u8bed\u4e49\u7279\u5f81\uff0c\u4ee5\u53ca\u5e38\u89c1\u7684\u4e60\u8bed\uff0c\u662f \u5728\u6b64\u5e94\u7528\u7a0b\u5e8f\u4e2d\u8fdb\u884c\u4e86\u8bf4\u660e\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u9700\u8981\u81ea\u5b9a\u4e49\u5bf9\u8c61\u3002\u60a8\u53ef\u4ee5 \u60a8\u53ef\u4ee5\u81ea\u884c\u521b\u5efa\u8fd9\u4e9b\u4ee3\u7801\uff0c\u6216\u8005\u5c06\u5bf9\u8c61\u548c Apex \u4ee3\u7801\u4e0b\u8f7d\u4e3a\u975e\u6258\u7ba1\u5305\u3002 Salesforce AppExchange\u3002\u8981\u83b7\u53d6\u7ec4\u7ec7\u4e2d\u7684\u793a\u4f8b\u8d44\u4ea7\uff0c\u8bf7\u5b89\u88c5\u00a0Apex \u6559\u7a0b\u5305\u3002\u6b64\u5957\u9910\u8fd8 \u5305\u542b\u00a0Apex \u5feb\u901f\u5165\u95e8\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u5bf9\u8c61\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u573a\u666f<\/h2>\n\n\n\n<p>\u5728\u6b64\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u7528\u6237 \u521b\u5efa\u65b0\u7684\u88c5\u8fd0\u53d1\u7968\u6216\u8ba2\u5355\uff0c\u7136\u540e\u5c06\u7269\u6599\u6dfb\u52a0\u5230\u53d1\u7968\u4e2d\u3002\u603b\u91d1\u989d \u5bf9\u4e8e\u8ba2\u5355\uff0c\u5305\u62ec\u8fd0\u8d39\uff0c\u662f\u6839\u636e \u5728\u53d1\u7968\u4e2d\u6dfb\u52a0\u6216\u5220\u9664\u7684\u9879\u76ee\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a><\/a>\u6570\u636e\u548c\u4ee3\u7801\u6a21\u578b<\/h2>\n\n\n\n<p>\u6b64\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u4e24\u4e2a\u65b0\u7684 \u5bf9\u8c61\uff1a\u9879\u76ee\u548cShipping_invoice\u3002\u505a\u51fa\u4ee5\u4e0b\u5047\u8bbe\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9879\u76ee A \u4e0d\u80fd\u540c\u65f6\u6309\u987a\u5e8f\u6392\u5217shipping_invoice1\u548cshipping_invoice2\u3002\u4e24\u4e2a\u5ba2\u6237 \u65e0\u6cd5\u83b7\u5f97\u76f8\u540c\u7684\uff08\u7269\u7406\uff09\u4ea7\u54c1\u3002<\/li>\n\n\n\n<li>\u7a0e\u7387\u4e3a9.25%\u3002<\/li>\n\n\n\n<li>\u8fd0\u8d39\u4e3a\u6bcf\u78c5 75 \u7f8e\u5206\u3002<\/li>\n\n\n\n<li>\u4e00\u65e6\u8ba2\u5355\u8d85\u8fc7 100 \u7f8e\u5143\uff0c\u5c06\u5e94\u7528\u8fd0\u8d39\u6298\u6263\uff08\u514d\u8fd0\u8d39\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>Item \u81ea\u5b9a\u4e49\u5bf9\u8c61\u4e2d\u7684\u5b57\u6bb5\u5305\u62ec\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u5b57<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>\u540d\u5b57<\/td><td>\u5b57\u7b26\u4e32<\/td><td>\u9879\u76ee\u7684\u540d\u79f0<\/td><\/tr><tr><td>\u4ef7\u683c<\/td><td>\u8d27\u5e01<\/td><td>\u5546\u54c1\u4ef7\u683c<\/td><\/tr><tr><td>\u6570\u91cf<\/td><td>\u6570<\/td><td>\u8ba2\u5355\u4e2d\u7684\u9879\u76ee\u6570<\/td><\/tr><tr><td>\u91cd\u91cf<\/td><td>\u6570<\/td><td>\u7269\u54c1\u7684\u91cd\u91cf\uff0c\u7528\u4e8e\u8ba1\u7b97\u8fd0\u8d39<\/td><\/tr><tr><td>Shipping_invoice<\/td><td>\u5927\u7eb2-\u7ec6\u8282 \uff08shipping_invoice\uff09<\/td><td>\u4e0e\u6b64\u9879\u76ee\u5173\u8054\u7684\u987a\u5e8f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Shipping_invoice\u81ea\u5b9a\u4e49\u5bf9\u8c61\u4e2d\u7684\u5b57\u6bb5\u5305\u62ec\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u5b57<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>\u540d\u5b57<\/td><td>\u5b57\u7b26\u4e32<\/td><td>\u88c5\u8fd0\u53d1\u7968\/\u8ba2\u5355\u7684\u540d\u79f0<\/td><\/tr><tr><td>\u5c0f\u8ba1<\/td><td>\u8d27\u5e01<\/td><td>\u5c0f\u8ba1<\/td><\/tr><tr><td>\u603b\u8ba1<\/td><td>\u8d27\u5e01<\/td><td>\u603b\u91d1\u989d\uff0c\u5305\u62ec\u7a0e\u8d39\u548c\u8fd0\u8d39<\/td><\/tr><tr><td>\u822a\u8fd0<\/td><td>\u8d27\u5e01<\/td><td>\u6536\u53d6\u7684\u8fd0\u8d39\u91d1\u989d\uff08\u5047\u8bbe\u6bcf\u78c5 0.75 \u7f8e\u5143\uff09<\/td><\/tr><tr><td>\u8fd0\u8d39\u6298\u6263<\/td><td>\u8d27\u5e01<\/td><td>\u5f53\u5c0f\u8ba1\u91d1\u989d\u8fbe\u5230 100 \u7f8e\u5143\u65f6\uff0c\u53ea\u9002\u7528\u4e00\u6b21<\/td><\/tr><tr><td>\u7a0e<\/td><td>\u8d27\u5e01<\/td><td>\u7a0e\u989d\uff08\u5047\u8bbe9.25%\uff09<\/td><\/tr><tr><td>\u603b\u91cd\u91cf<\/td><td>\u6570<\/td><td>\u6240\u6709\u7269\u54c1\u7684\u603b\u91cd\u91cf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6b64\u5e94\u7528\u7a0b\u5e8f\u7684\u6240\u6709 Apex \u90fd\u5305\u542b\u5728\u89e6\u53d1\u5668\u4e2d\u3002\u6b64\u5e94\u7528\u7a0b\u5e8f\u5177\u6709 \u4ee5\u4e0b\u89e6\u53d1\u5668\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5bf9\u8c61<\/th><th>\u89e6\u53d1\u5668\u540d\u79f0<\/th><th>\u8fd0\u884c\u65f6<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>\u9879\u76ee<\/td><td>\u7b97<\/td><td>\u63d2\u5165\u540e\u3001\u66f4\u65b0\u540e\u3001\u5220\u9664\u540e<\/td><td>\u66f4\u65b0\u88c5\u8fd0\u53d1\u7968\uff0c\u8ba1\u7b97\u603b\u8ba1\u548c\u88c5\u8fd0<\/td><\/tr><tr><td>Shipping_invoice<\/td><td>\u8fd0\u8d39\u6298\u6263<\/td><td>\u66f4\u65b0\u540e<\/td><td>\u66f4\u65b0\u88c5\u8fd0\u53d1\u7968\uff0c\u8ba1\u7b97\u662f\u5426\u6709\u88c5\u8fd0\u6298\u6263<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u7528\u6237\u64cd\u4f5c\u7684\u4e00\u822c\u6d41\u7a0b\u4ee5\u53ca\u89e6\u53d1\u5668\u7684\u8fd0\u884c\u65f6\u95f4\uff1a<\/p>\n\n\n\n<p>\u8d2d\u7269\u8f66\u5e94\u7528\u7a0b\u5e8f\u7684\u7528\u6237\u64cd\u4f5c\u548c\u89e6\u53d1\u5668\u6d41<img decoding=\"async\" src=\"https:\/\/developer.salesforce.com\/docs\/resources\/img\/en-us\/246.0?doc_id=dev_guides%2Fapex%2Fimages%2Fshopping_cart_app_flow.png&amp;folder=apexcode\" alt=\"Flow of user action and triggers for shopping cart application\"><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u7528\u6237\u70b9\u51fb<strong>\u8ba2\u5355<\/strong>&nbsp;|<strong>\u65b0\u5efa<\/strong>\uff0c\u547d\u540d\u88c5\u8fd0\u53d1\u7968\uff0c\u7136\u540e\u5355\u51fb<strong>\u4fdd\u5b58<\/strong>\u3002<\/li>\n\n\n\n<li>\u7528\u6237\u5355\u51fb<strong>\u201c\u65b0\u5efa\u9879\u76ee<\/strong>\u201d\uff0c\u586b\u5199\u4fe1\u606f\uff0c\u7136\u540e\u5355\u51fb\u201c<strong>\u4fdd\u5b58<\/strong>\u201d\u3002<\/li>\n\n\n\n<li>\u8ba1\u7b97\u89e6\u53d1\u5668\u8fd0\u884c\u6b21\u6570\u3002\u201c\u8ba1\u7b97\u201d\u89e6\u53d1\u5668\u7684\u4e00\u90e8\u5206\u5c06\u66f4\u65b0\u88c5\u8fd0\u53d1\u7968\u3002<\/li>\n\n\n\n<li>ShippingDiscount \u89e6\u53d1\u5668\u8fd0\u884c\u3002<\/li>\n\n\n\n<li>\u7136\u540e\uff0c\u7528\u6237\u53ef\u4ee5\u6dfb\u52a0\u3001\u5220\u9664\u6216\u66f4\u6539\u53d1\u7968\u4e2d\u7684\u9879\u76ee\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u5728\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u4ee3\u7801\u4e2d\uff0c\u89e6\u53d1\u5668\u548c \u5217\u51fa\u4e86\u6d4b\u8bd5\u7c7b\u3002\u4ee3\u7801\u4e2d\u7684\u6ce8\u91ca\u89e3\u91ca\u4e86\u8be5\u529f\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d4b\u8bd5\u88c5\u8fd0\u53d1\u7968\u5e94\u7528\u7a0b\u5e8f<\/h2>\n\n\n\n<p>\u5728\u5c06\u5e94\u7528\u7a0b\u5e8f\u4f5c\u4e3a\u5305\u7684\u4e00\u90e8\u5206\u5305\u542b\u5728\u5185\u4e4b\u524d\uff0c\u5fc5\u987b\u5c06 75% \u7684\u4ee3\u7801\u8986\u76d6 \u5355\u5143\u6d4b\u8bd5\u3002\u56e0\u6b64\uff0c\u88c5\u8fd0\u53d1\u7968\u5e94\u7528\u7a0b\u5e8f\u7684\u4e00\u4ef6\u662f\u7528\u4e8e\u6d4b\u8bd5\u7684\u7c7b \u89e6\u53d1\u5668\u3002\u6d4b\u8bd5\u7c7b\u9a8c\u8bc1\u4ee5\u4e0b\u64cd\u4f5c\u662f\u5426\u5df2\u6210\u529f\u5b8c\u6210\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u63d2\u5165\u9879\u76ee<\/li>\n\n\n\n<li>\u66f4\u65b0\u9879\u76ee<\/li>\n\n\n\n<li>\u5220\u9664\u9879\u76ee<\/li>\n\n\n\n<li>\u5e94\u7528\u8fd0\u8d39\u6298\u6263<\/li>\n\n\n\n<li>\u8f93\u5165\u4e0d\u826f\u7684\u9634\u6027\u6d4b\u8bd5<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u88c5\u8fd0\u53d1\u7968\u793a\u4f8b\u4ee3\u7801<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u89e6\u53d1\u5668\u548c\u6d4b\u8bd5\u7c7b\u7ec4\u6210\u4e86\u88c5\u8fd0\u53d1\u7968 \u5e94\u7528\u793a\u4f8b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8ba1\u7b97\u89e6\u53d1\u5668<\/li>\n\n\n\n<li>ShippingDiscount \u89e6\u53d1\u5668<\/li>\n\n\n\n<li>\u6d4b\u8bd5\u7c7b<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><a><\/a>\u8ba1\u7b97\u89e6\u53d1\u5668<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>trigger calculate on Item__c (after insert, after update, after delete) {\n\n\/\/ Use a map because it doesn't allow duplicate values\n\nMap&lt;ID, Shipping_Invoice__C&gt; updateMap = new Map&lt;ID, Shipping_Invoice__C&gt;();\n\n\/\/ Set this integer to -1 if we are deleting\nInteger subtract ;\n\n\/\/ Populate the list of items based on trigger type\nList&lt;Item__c&gt; itemList;\n    if(trigger.isInsert || trigger.isUpdate){\n        itemList = Trigger.new;\n        subtract = 1;\n    }\n    else if(trigger.isDelete)\n    {\n        \/\/ Note -- there is no trigger.new in delete\n        itemList = trigger.old;\n        subtract = -1;\n    }\n\n\/\/ Access all the information we need in a single query \n\/\/ rather than querying when we need it.\n\/\/ This is a best practice for bulkifying requests\n\nset&lt;Id&gt; AllItems = new set&lt;id&gt;();\n\nfor(item__c i :itemList){\n\/\/ Assert numbers are not negative.  \n\/\/ None of the fields would make sense with a negative value\n\nSystem.assert(i.quantity__c &gt; 0, 'Quantity must be positive');\nSystem.assert(i.weight__c &gt;= 0, 'Weight must be non-negative');\nSystem.assert(i.price__c &gt;= 0, 'Price must be non-negative');\n\n\/\/ If there is a duplicate Id, it won't get added to a set\nAllItems.add(i.Shipping_Invoice__C);\n}\n\n\/\/ Accessing all shipping invoices associated with the items in the trigger\nList&lt;Shipping_Invoice__C&gt; AllShippingInvoices = &#91;SELECT Id, ShippingDiscount__c, \n                   SubTotal__c, TotalWeight__c, Tax__c, GrandTotal__c \n                   FROM Shipping_Invoice__C WHERE Id IN :AllItems];\n                   \n\/\/ Take the list we just populated and put it into a Map.  \n\/\/ This will make it easier to look up a shipping invoice\n\/\/ because you must iterate a list, but you can use lookup for a map, \nMap&lt;ID, Shipping_Invoice__C&gt; SIMap = new Map&lt;ID, Shipping_Invoice__C&gt;();\n\nfor(Shipping_Invoice__C sc : AllShippingInvoices)\n{\n    SIMap.put(sc.id, sc);\n}\n\n\/\/ Process the list of items\n    if(Trigger.isUpdate)\n    {\n        \/\/ Treat updates like a removal of the old item and addition of the         \n        \/\/ revised item rather than figuring out the differences of each field \n        \/\/ and acting accordingly.\n        \/\/ Note updates have both trigger.new and trigger.old\n        for(Integer x = 0; x &lt; Trigger.old.size(); x++)\n        {\n            Shipping_Invoice__C myOrder;\n            myOrder = SIMap.get(trigger.old&#91;x].Shipping_Invoice__C);\n\n            \/\/ Decrement the previous value from the subtotal and weight.\n            myOrder.SubTotal__c -= (trigger.old&#91;x].price__c * \n                                    trigger.old&#91;x].quantity__c);\n            myOrder.TotalWeight__c -= (trigger.old&#91;x].weight__c * \n                                       trigger.old&#91;x].quantity__c);\n                \n            \/\/ Increment the new subtotal and weight.\n            myOrder.SubTotal__c += (trigger.new&#91;x].price__c * \n                                    trigger.new&#91;x].quantity__c);\n            myOrder.TotalWeight__c += (trigger.new&#91;x].weight__c * \n                                       trigger.new&#91;x].quantity__c);\n        }\n        \n        for(Shipping_Invoice__C myOrder : AllShippingInvoices)\n        {\n            \n            \/\/ Set tax rate to 9.25%  Please note, this is a simple example.  \n            \/\/ Generally, you would never hard code values.\n            \/\/ Leveraging Custom Settings for tax rates is a best practice.  \n            \/\/ See Custom Settings in the Apex Developer Guide \n            \/\/ for more information.\n            myOrder.Tax__c = myOrder.Subtotal__c * .0925;\n            \n            \/\/ Reset the shipping discount\n            myOrder.ShippingDiscount__c = 0;\n    \n            \/\/ Set shipping rate to 75 cents per pound.  \n            \/\/ Generally, you would never hard code values.\n            \/\/ Leveraging Custom Settings for the shipping rate is a best practice.\n            \/\/ See Custom Settings in the Apex Developer Guide \n            \/\/ for more information.\n            myOrder.Shipping__c = (myOrder.totalWeight__c * .75);\n            myOrder.GrandTotal__c = myOrder.SubTotal__c + myOrder.tax__c + \n                                    myOrder.Shipping__c;\n            updateMap.put(myOrder.id, myOrder);\n         }\n    }\n    else\n    { \n        for(Item__c itemToProcess : itemList)\n        {\n            Shipping_Invoice__C myOrder;\n    \n            \/\/ Look up the correct shipping invoice from the ones we got earlier\n            myOrder = SIMap.get(itemToProcess.Shipping_Invoice__C);\n            myOrder.SubTotal__c += (itemToProcess.price__c * \n                                    itemToProcess.quantity__c * subtract);\n            myOrder.TotalWeight__c += (itemToProcess.weight__c * \n                                       itemToProcess.quantity__c * subtract);\n        }\n        \n        for(Shipping_Invoice__C myOrder : AllShippingInvoices)\n        {\n            \n             \/\/ Set tax rate to 9.25%  Please note, this is a simple example.  \n             \/\/ Generally, you would never hard code values.\n             \/\/ Leveraging Custom Settings for tax rates is a best practice.  \n             \/\/ See Custom Settings in the Apex Developer Guide \n             \/\/ for more information.\n             myOrder.Tax__c = myOrder.Subtotal__c * .0925;\n             \n             \/\/ Reset shipping discount\n             myOrder.ShippingDiscount__c = 0;\n    \n            \/\/ Set shipping rate to 75 cents per pound.  \n            \/\/ Generally, you would never hard code values.\n            \/\/ Leveraging Custom Settings for the shipping rate is a best practice.\n            \/\/ See Custom Settings in the Apex Developer Guide \n            \/\/ for more information.\n            myOrder.Shipping__c = (myOrder.totalWeight__c * .75);\n            myOrder.GrandTotal__c = myOrder.SubTotal__c + myOrder.tax__c + \n                                    myOrder.Shipping__c;\n                                       \n            updateMap.put(myOrder.id, myOrder);\n    \n         }\n     }    \n     \n     \/\/ Only use one DML update at the end.\n     \/\/ This minimizes the number of DML requests generated from this trigger.\n     update updateMap.values();\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><a><\/a>\u8fd0\u8d39\u6298\u6263 \u89e6\u53d1<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>trigger ShippingDiscount on Shipping_Invoice__C (before update) {\n    \/\/ Free shipping on all orders greater than $100\n    \n    for(Shipping_Invoice__C myShippingInvoice : Trigger.new)\n    {\n        if((myShippingInvoice.subtotal__c &gt;= 100.00) &amp;&amp; \n           (myShippingInvoice.ShippingDiscount__c == 0))\n        {\n            myShippingInvoice.ShippingDiscount__c = \n                         myShippingInvoice.Shipping__c * -1;\n            myShippingInvoice.GrandTotal__c += myShippingInvoice.ShippingDiscount__c;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><a><\/a>\u8fd0\u8f93\u53d1\u7968 \u6d4b\u8bd5<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>@IsTest\nprivate class TestShippingInvoice{\n\n    \/\/ Test for inserting three items at once\n    public static testmethod void testBulkItemInsert(){\n        \/\/ Create the shipping invoice. It's a best practice to either use defaults\n        \/\/ or to explicitly set all values to zero so as to avoid having\n        \/\/ extraneous data in your test.\n        Shipping_Invoice__C order1 = new Shipping_Invoice__C(subtotal__c = 0, \n                          totalweight__c = 0, grandtotal__c = 0, \n                          ShippingDiscount__c = 0, Shipping__c = 0, tax__c = 0);\n\n        \/\/ Insert the order and populate with items\n        insert Order1;\n        List&lt;Item__c> list1 = new List&lt;Item__c>();\n        Item__c item1 = new Item__C(Price__c = 10, weight__c = 1, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item2 = new Item__C(Price__c = 25, weight__c = 2, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item3 = new Item__C(Price__c = 40, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        list1.add(item1);\n        list1.add(item2);\n        list1.add(item3);\n        insert list1;\n        \n        \/\/ Retrieve the order, then do assertions\n        order1 = &#91;SELECT id, subtotal__c, tax__c, shipping__c, totalweight__c, \n                  grandtotal__c, shippingdiscount__c \n                  FROM Shipping_Invoice__C \n                  WHERE id = :order1.id];\n        \n        System.assert(order1.subtotal__c == 75, \n                'Order subtotal was not $75, but was '+ order1.subtotal__c);\n        System.assert(order1.tax__c == 6.9375, \n                'Order tax was not $6.9375, but was ' + order1.tax__c);\n        System.assert(order1.shipping__c == 4.50, \n                'Order shipping was not $4.50, but was ' + order1.shipping__c);\n        System.assert(order1.totalweight__c == 6.00, \n                'Order weight was not 6 but was ' + order1.totalweight__c);\n        System.assert(order1.grandtotal__c == 86.4375, \n                'Order grand total was not $86.4375 but was ' \n                 + order1.grandtotal__c);\n        System.assert(order1.shippingdiscount__c == 0, \n                'Order shipping discount was not $0 but was ' \n                + order1.shippingdiscount__c);\n    }\n    \n    \/\/ Test for updating three items at once\n    public static testmethod void testBulkItemUpdate(){\n\n        \/\/ Create the shipping invoice. It's a best practice to either use defaults\n        \/\/ or to explicitly set all values to zero so as to avoid having\n        \/\/ extraneous data in your test.\n        Shipping_Invoice__C order1 = new Shipping_Invoice__C(subtotal__c = 0, \n                          totalweight__c = 0, grandtotal__c = 0, \n                          ShippingDiscount__c = 0, Shipping__c = 0, tax__c = 0);\n\n        \/\/ Insert the order and populate with items.\n        insert Order1;\n        List&lt;Item__c> list1 = new List&lt;Item__c>();\n        Item__c item1 = new Item__C(Price__c = 1, weight__c = 1, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item2 = new Item__C(Price__c = 2, weight__c = 2, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item3 = new Item__C(Price__c = 4, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        list1.add(item1);\n        list1.add(item2);\n        list1.add(item3);\n        insert list1;\n        \n        \/\/ Update the prices on the 3 items\n        list1&#91;0].price__c = 10;\n        list1&#91;1].price__c = 25;\n        list1&#91;2].price__c = 40;\n        update list1;\n        \n        \/\/ Access the order and assert items updated\n        order1 = &#91;SELECT id, subtotal__c, tax__c, shipping__c, totalweight__c, \n                  grandtotal__c, shippingdiscount__c \n                  FROM Shipping_Invoice__C \n                  WHERE Id = :order1.Id];\n\n        System.assert(order1.subtotal__c == 75, \n                       'Order subtotal was not $75, but was '+ order1.subtotal__c);\n        System.assert(order1.tax__c == 6.9375, \n                       'Order tax was not $6.9375, but was ' + order1.tax__c);\n        System.assert(order1.shipping__c == 4.50, \n                       'Order shipping was not $4.50, but was ' \n                       + order1.shipping__c);\n        System.assert(order1.totalweight__c == 6.00, \n                       'Order weight was not 6 but was ' + order1.totalweight__c);\n        System.assert(order1.grandtotal__c == 86.4375, \n                       'Order grand total was not $86.4375 but was ' \n                       + order1.grandtotal__c);\n        System.assert(order1.shippingdiscount__c == 0, \n                       'Order shipping discount was not $0 but was ' \n                       + order1.shippingdiscount__c);\n    \n    }\n    \n    \/\/ Test for deleting items\n    public static testmethod void testBulkItemDelete(){\n\n        \/\/ Create the shipping invoice. It's a best practice to either use defaults\n        \/\/ or to explicitly set all values to zero so as to avoid having\n        \/\/ extraneous data in your test.\n        Shipping_Invoice__C order1 = new Shipping_Invoice__C(subtotal__c = 0, \n                          totalweight__c = 0, grandtotal__c = 0, \n                          ShippingDiscount__c = 0, Shipping__c = 0, tax__c = 0);\n\n        \/\/ Insert the order and populate with items\n        insert Order1;\n        List&lt;Item__c> list1 = new List&lt;Item__c>();\n        Item__c item1 = new Item__C(Price__c = 10, weight__c = 1, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item2 = new Item__C(Price__c = 25, weight__c = 2, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item3 = new Item__C(Price__c = 40, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c itemA = new Item__C(Price__c = 1, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c itemB = new Item__C(Price__c = 1, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c itemC = new Item__C(Price__c = 1, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c itemD = new Item__C(Price__c = 1, weight__c = 3, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        list1.add(item1);\n        list1.add(item2);\n        list1.add(item3);\n        list1.add(itemA);\n        list1.add(itemB);\n        list1.add(itemC);\n        list1.add(itemD);\n        insert list1;\n        \n        \/\/ Seven items are now in the shipping invoice. \n       \/\/ The following deletes four of them.\n        List&lt;Item__c> list2 = new List&lt;Item__c>();\n        list2.add(itemA);\n        list2.add(itemB);\n        list2.add(itemC);\n        list2.add(itemD);\n        delete list2;\n        \n        \/\/ Retrieve the order and verify the deletion\n        order1 = &#91;SELECT id, subtotal__c, tax__c, shipping__c, totalweight__c, \n                  grandtotal__c, shippingdiscount__c \n                  FROM Shipping_Invoice__C \n                  WHERE Id = :order1.Id];\n        \n        System.assert(order1.subtotal__c == 75, \n                      'Order subtotal was not $75, but was '+ order1.subtotal__c);\n        System.assert(order1.tax__c == 6.9375, \n                      'Order tax was not $6.9375, but was ' + order1.tax__c);\n        System.assert(order1.shipping__c == 4.50, \n                      'Order shipping was not $4.50, but was ' + order1.shipping__c);\n        System.assert(order1.totalweight__c == 6.00, \n                      'Order weight was not 6 but was ' + order1.totalweight__c);\n        System.assert(order1.grandtotal__c == 86.4375, \n                      'Order grand total was not $86.4375 but was ' \n                      + order1.grandtotal__c);\n        System.assert(order1.shippingdiscount__c == 0, \n                      'Order shipping discount was not $0 but was ' \n                      + order1.shippingdiscount__c);\n    }\n    \/\/ Testing free shipping\n    public static testmethod void testFreeShipping(){\n\n        \/\/ Create the shipping invoice. It's a best practice to either use defaults\n        \/\/ or to explicitly set all values to zero so as to avoid having\n        \/\/ extraneous data in your test.\n        Shipping_Invoice__C order1 = new Shipping_Invoice__C(subtotal__c = 0, \n                          totalweight__c = 0, grandtotal__c = 0, \n                          ShippingDiscount__c = 0, Shipping__c = 0, tax__c = 0);\n\n        \/\/ Insert the order and populate with items.\n        insert Order1;\n        List&lt;Item__c> list1 = new List&lt;Item__c>();\n        Item__c item1 = new Item__C(Price__c = 10, weight__c = 1, \n                                 quantity__c = 1, Shipping_Invoice__C = order1.id);\n        Item__c item2 = new Item__C(Price__c = 25, weight__c = 2, \n                                 quantity__c = 1, Shipping_Invoice__C = order1.id);\n        Item__c item3 = new Item__C(Price__c = 40, weight__c = 3, \n                                 quantity__c = 1, Shipping_Invoice__C = order1.id);\n        list1.add(item1);\n        list1.add(item2);\n        list1.add(item3);\n        insert list1;\n        \n        \/\/ Retrieve the order and verify free shipping not applicable\n        order1 = &#91;SELECT id, subtotal__c, tax__c, shipping__c, totalweight__c, \n                  grandtotal__c, shippingdiscount__c \n                  FROM Shipping_Invoice__C \n                  WHERE Id = :order1.Id];\n        \n        \/\/ Free shipping not available on $75 orders\n        System.assert(order1.subtotal__c == 75, \n                      'Order subtotal was not $75, but was '+ order1.subtotal__c);\n        System.assert(order1.tax__c == 6.9375, \n                      'Order tax was not $6.9375, but was ' + order1.tax__c);\n        System.assert(order1.shipping__c == 4.50, \n                      'Order shipping was not $4.50, but was ' + order1.shipping__c);\n        System.assert(order1.totalweight__c == 6.00, \n                      'Order weight was not 6 but was ' + order1.totalweight__c);\n        System.assert(order1.grandtotal__c == 86.4375, \n                      'Order grand total was not $86.4375 but was ' \n                      + order1.grandtotal__c);\n        System.assert(order1.shippingdiscount__c == 0, \n                      'Order shipping discount was not $0 but was ' \n                      + order1.shippingdiscount__c);\n        \n        \/\/ Add items to increase subtotal\n        item1 = new Item__C(Price__c = 25, weight__c = 20, quantity__c = 1, \n                            Shipping_Invoice__C = order1.id);       \n        insert item1;\n\n        \/\/ Retrieve the order and verify free shipping is applicable\n        order1 = &#91;SELECT id, subtotal__c, tax__c, shipping__c, totalweight__c, \n                  grandtotal__c, shippingdiscount__c \n                  FROM Shipping_Invoice__C \n                  WHERE Id = :order1.Id];\n        \n        \/\/ Order total is now at $100, so free shipping should be enabled\n        System.assert(order1.subtotal__c == 100, \n                      'Order subtotal was not $100, but was '+ order1.subtotal__c);\n        System.assert(order1.tax__c == 9.25, \n                      'Order tax was not $9.25, but was ' + order1.tax__c);\n        System.assert(order1.shipping__c == 19.50, \n                      'Order shipping was not $19.50, but was ' \n                      + order1.shipping__c);\n        System.assert(order1.totalweight__c == 26.00, \n                      'Order weight was not 26 but was ' + order1.totalweight__c);\n        System.assert(order1.grandtotal__c == 109.25, \n                      'Order grand total was not $86.4375 but was ' \n                      + order1.grandtotal__c);\n        System.assert(order1.shippingdiscount__c == -19.50, \n                      'Order shipping discount was not -$19.50 but was ' \n                      + order1.shippingdiscount__c);\n    }\n    \n     \/\/ Negative testing for inserting bad input\n    public static testmethod void testNegativeTests(){\n\n        \/\/ Create the shipping invoice. It's a best practice to either use defaults\n        \/\/ or to explicitly set all values to zero so as to avoid having\n        \/\/ extraneous data in your test.\n        Shipping_Invoice__C order1 = new Shipping_Invoice__C(subtotal__c = 0, \n                          totalweight__c = 0, grandtotal__c = 0, \n                          ShippingDiscount__c = 0, Shipping__c = 0, tax__c = 0);\n\n        \/\/ Insert the order and populate with items. \n        insert Order1;\n        Item__c item1 = new Item__C(Price__c = -10, weight__c = 1, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item2 = new Item__C(Price__c = 25, weight__c = -2, quantity__c = 1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item3 = new Item__C(Price__c = 40, weight__c = 3, quantity__c = -1, \n                                    Shipping_Invoice__C = order1.id);\n        Item__c item4 = new Item__C(Price__c = 40, weight__c = 3, quantity__c = 0, \n                                    Shipping_Invoice__C = order1.id);\n\n        try{\n            insert item1;\n        }\n        catch(Exception e)\n        {\n            system.assert(e.getMessage().contains('Price must be non-negative'), \n                         'Price was negative but was not caught');\n        }\n        \n        try{\n            insert item2;\n        }\n        catch(Exception e)\n        {\n            system.assert(e.getMessage().contains('Weight must be non-negative'), \n                         'Weight was negative but was not caught');\n        }\n\n        try{\n            insert item3;\n        }\n        catch(Exception e)\n        {\n            system.assert(e.getMessage().contains('Quantity must be positive'), \n                         'Quantity was negative but was not caught');\n        }\n        \n        try{\n            insert item4;\n        }\n        catch(Exception e)\n        {\n            system.assert(e.getMessage().contains('Quantity must be positive'), \n                         'Quantity was zero but was not caught');\n        }\n    }\n}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002<\/p>\n","protected":false},"author":1,"featured_media":3789,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[232],"class_list":["post-3788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apex-","tag-232"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14<\/title>\n<meta name=\"description\" content=\"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ponybai.com\/?p=3788\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=3788\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-01T01:12:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-29T01:23:00+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/sample.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1324\" \/>\n\t<meta property=\"og:image:height\" content=\"678\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"ponybai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ponybai\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3788#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3788\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b\",\"datePublished\":\"2024-01-01T01:12:11+00:00\",\"dateModified\":\"2023-11-29T01:23:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3788\"},\"wordCount\":32,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"keywords\":[\"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b\"],\"articleSection\":[\"Apex \u5f00\u53d1\u4eba\u5458\u6307\u5357\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3788\",\"url\":\"http:\/\/www.ponybai.com\/?p=3788\",\"name\":\"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2024-01-01T01:12:11+00:00\",\"dateModified\":\"2023-11-29T01:23:00+00:00\",\"description\":\"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3788#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=3788\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3788#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ponybai.com\/#website\",\"url\":\"http:\/\/www.ponybai.com\/\",\"name\":\"\u767d\u767d\u968f\u7b14\",\"description\":\"Salesforce\u5b98\u65b9\u8bb2\u5e08\",\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ponybai.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\",\"name\":\"ponybai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"contentUrl\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"width\":248,\"height\":248,\"caption\":\"ponybai\"},\"logo\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/121.37.188.161\"],\"url\":\"http:\/\/www.ponybai.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14","description":"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.ponybai.com\/?p=3788","og_locale":"zh_CN","og_type":"article","og_title":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14","og_description":"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002","og_url":"http:\/\/www.ponybai.com\/?p=3788","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2024-01-01T01:12:11+00:00","article_modified_time":"2023-11-29T01:23:00+00:00","og_image":[{"width":1324,"height":678,"url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/sample.png","type":"image\/png"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=3788#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=3788"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b","datePublished":"2024-01-01T01:12:11+00:00","dateModified":"2023-11-29T01:23:00+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=3788"},"wordCount":32,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"keywords":["\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b"],"articleSection":["Apex \u5f00\u53d1\u4eba\u5458\u6307\u5357"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=3788","url":"http:\/\/www.ponybai.com\/?p=3788","name":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2024-01-01T01:12:11+00:00","dateModified":"2023-11-29T01:23:00+00:00","description":"\u672c\u9644\u5f55\u63d0\u4f9b\u4e86 Apex \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\u3002\u8fd9\u662f\u4e00\u4e2a\u6bd4 Hello World \u793a\u4f8b\u3002","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=3788#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=3788"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=3788#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"\u8fd0\u8f93\u53d1\u7968\u793a\u4f8b"}]},{"@type":"WebSite","@id":"http:\/\/www.ponybai.com\/#website","url":"http:\/\/www.ponybai.com\/","name":"\u767d\u767d\u968f\u7b14","description":"Salesforce\u5b98\u65b9\u8bb2\u5e08","publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ponybai.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883","name":"ponybai","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/","url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","contentUrl":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","width":248,"height":248,"caption":"ponybai"},"logo":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/121.37.188.161"],"url":"http:\/\/www.ponybai.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3788"}],"version-history":[{"count":1,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3788\/revisions"}],"predecessor-version":[{"id":3790,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3788\/revisions\/3790"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/media\/3789"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3788"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}