{"id":1242,"date":"2022-02-21T00:30:49","date_gmt":"2022-02-20T16:30:49","guid":{"rendered":"http:\/\/www.tra56.com\/?p=1242"},"modified":"2022-02-21T00:30:49","modified_gmt":"2022-02-20T16:30:49","slug":"1242","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/1242.html","title":{"rendered":"easyswoole\u5bf9\u63a5\u652f\u4ed8\u5b9d,\u5fae\u4fe1\u652f\u4ed8"},"content":{"rendered":"
\u5728easyswoole\u4e2d,\u5df2\u7ecf\u5f00\u53d1\u597d\u4e86\u76f8\u5173\u7684\u652f\u4ed8\u7ec4\u4ef6,\u53ea\u9700\u8981\u5f15\u5165\u5373\u53ef:<\/p>\n
composer require easyswoole<\/code>\/pay<\/code><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\npay\u7ec4\u4ef6\u652f\u6301\u534f\u7a0b<\/p>\n
\u652f\u4ed8\u5b9d<\/h2>\n\u652f\u4ed8\u65b9\u6cd5<\/h4>\n
\u652f\u4ed8\u5b9d\u652f\u4ed8\u76ee\u524d\u652f\u6301 7 \u79cd\u652f\u4ed8\u65b9\u6cd5\uff0c\u5bf9\u5e94\u7684\u652f\u4ed8 method \u5982\u4e0b\uff1a<\/p>\n
\n\n\nmethod<\/th>\n \u8bf4\u660e<\/th>\n \u53c2\u6570<\/th>\n \u8fd4\u56de\u503c<\/th>\n<\/tr>\n<\/thead>\n \n\nweb<\/td>\n\u7535\u8111\u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\nwap<\/td>\n\u624b\u673a\u7f51\u7ad9\u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\napp<\/td>\nAPP \u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\npos<\/td>\n\u5237\u5361\u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\nscan<\/td>\n\u626b\u7801\u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\ntransfer<\/td>\n\u8d26\u6237\u8f6c\u8d26<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n\nmini<\/td>\n\u5c0f\u7a0b\u5e8f\u652f\u4ed8<\/td>\nRequest<\/td>\nResponse<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\u7535\u8111\u652f\u4ed8<\/h2>\n\n\u7edf\u4e00\u6536\u5355\u4e0b\u5355\u5e76\u652f\u4ed8\u9875\u9762\u63a5\u53e3<\/p>\n<\/blockquote>\n
\n\n\n\n1<\/div>\n2<\/div>\n3<\/div>\n4<\/div>\n5<\/div>\n6<\/div>\n7<\/div>\n8<\/div>\n9<\/div>\n10<\/div>\n11<\/div>\n12<\/div>\n13<\/div>\n14<\/div>\n15<\/div>\n16<\/div>\n17<\/div>\n18<\/div>\n19<\/div>\n20<\/div>\n21<\/div>\n22<\/div>\n23<\/div>\n24<\/div>\n25<\/div>\n26<\/div>\n27<\/div>\n28<\/div>\n<\/td>\n\n$aliConfig<\/code> = <\/code>new<\/code> \\EasySwoole\\Pay\\AliPay\\Config();<\/code><\/div>\n$aliConfig<\/code>->setGateWay(\\EasySwoole\\Pay\\AliPay\\GateWay::NORMAL);<\/code><\/div>\n$aliConfig<\/code>->setAppId(<\/code>'2017082000295641'<\/code>);<\/code><\/div>\n$aliConfig<\/code>->setPublicKey(<\/code>'\u963f\u91cc\u516c\u94a5'<\/code>);<\/code><\/div>\n$aliConfig<\/code>->setPrivateKey(<\/code>'\u963f\u91cc\u79c1\u94a5'<\/code>);<\/code><\/div>\n <\/div>\n$pay<\/code> = <\/code>new<\/code> \\EasySwoole\\Pay\\Pay();<\/code><\/div>\n <\/div>\n## \u5bf9\u8c61\u98ce\u683c<\/code><\/div>\n$order<\/code> = <\/code>new<\/code> \\EasySwoole\\Pay\\AliPay\\RequestBean\\Web();<\/code><\/div>\n$order<\/code>->setSubject(<\/code>'\u6d4b\u8bd5'<\/code>);<\/code><\/div>\n$order<\/code>->setOutTradeNo(time().<\/code>'123456'<\/code>);<\/code><\/div>\n$order<\/code>->setTotalAmount(<\/code>'0.01'<\/code>);<\/code><\/div>\n\/\/ \u672c\u5e93\u53ea\u9884\u7f6e\u4e86\u5e38\u7528\u7684\u8bf7\u6c42\u53c2\u6570\uff0c\u6ca1\u9884\u7f6e\u7684\u53c2\u6570\u4f7f\u7528\uff1a$order->addProperty('\u5176\u4ed6\u5b57\u6bb5','\u5176\u4ed6\u5b57\u6bb5\u503c');<\/code><\/div>\n <\/div>\n## \u6570\u7ec4\u98ce\u683c<\/code><\/div>\n$order<\/code> = <\/code>new<\/code> \\EasySwoole\\Pay\\AliPay\\RequestBean\\App([<\/code><\/div>\n'subject'<\/code>=><\/code>'\u6d4b\u8bd5'<\/code>,<\/code><\/div>\n'out_trade_no'<\/code>=><\/code>'123456'<\/code>,<\/code><\/div>\n'total_amount'<\/code>=><\/code>'0.01'<\/code>,<\/code><\/div>\n'\u989d\u5916\u7684\u5b57\u6bb5\u952e\u503c'<\/code>=><\/code>'\u989d\u5916\u5b57\u6bb5\u503c'<\/code><\/div>\n],true);<\/code><\/div>\n <\/div>\n$res<\/code> = <\/code>$pay<\/code>->aliPay(<\/code>$aliConfig<\/code>)->web(<\/code>$order<\/code>);<\/code><\/div>\nvar_dump(<\/code>$res<\/code>->toArray());<\/code><\/div>\n <\/div>\n$html<\/code> = buildPayHtml(\\EasySwoole\\Pay\\AliPay\\GateWay::NORMAL,<\/code>$res<\/code>->toArray());<\/code><\/div>\nfile_put_contents<\/code>(<\/code>'test.html'<\/code>,<\/code>$html<\/code>);<\/code><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
<\/p>\n
\u8ba2\u5355\u914d\u7f6e\u53c2\u6570<\/h4>\n
\u6240\u6709\u8ba2\u5355\u914d\u7f6e\u4e2d\uff0c\u5ba2\u89c2\u53c2\u6570\u5747\u4e0d\u7528\u914d\u7f6e\uff0c\u6269\u5c55\u5305\u5df2\u7ecf\u4e3a\u5927\u5bb6\u81ea\u52a8\u5904\u7406\u4e86\uff0c\u6bd4\u5982\uff0c<\/span>product_code<\/code> \u7b49\u53c2\u6570\u3002<\/span><\/p>\n\u6240\u6709\u8ba2\u5355\u914d\u7f6e\u53c2\u6570\u548c\u5b98\u65b9\u65e0\u4efb\u4f55\u5dee\u522b\uff0c\u517c\u5bb9\u6240\u6709\u529f\u80fd\uff0c\u6240\u6709\u53c2\u6570\u8bf7\u53c2\u8003\u8fd9\u91cc<\/a>\uff0c\u67e5\u770b\u300c\u8bf7\u6c42\u53c2\u6570\u300d\u4e00\u680f\u3002<\/p>\n