{"id":23570,"date":"2024-12-18T10:24:04","date_gmt":"2024-12-18T02:24:04","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=23570"},"modified":"2024-12-18T10:24:04","modified_gmt":"2024-12-18T02:24:04","slug":"%e7%94%9f%e6%88%90%e5%bc%8f%e4%ba%ba%e5%b7%a5%e6%99%ba%e8%83%bd%e5%a6%82%e4%bd%95%e6%94%b9%e5%8f%98%e8%bd%af%e4%bb%b6%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2024\/12\/18\/23570\/","title":{"rendered":"\u751f\u6210\u5f0f\u4eba\u5de5\u667a\u80fd\u5982\u4f55\u6539\u53d8\u8f6f\u4ef6\u5f00\u53d1"},"content":{"rendered":"<p style=\"font-weight: 400;\">\u91c7\u7528\u4eba\u5de5\u667a\u80fd\u7f16\u7801\u52a9\u624b\u53ef\u4ee5\u5c06\u8f6f\u4ef6\u5f00\u53d1\u56e2\u961f\u7684\u6548\u7387\u63d0\u9ad840%\uff0c\u5176\u4e2d\u5305\u62ec\u4ee3\u7801\u5ba1\u67e5\u81f3\u8c03\u8bd5\u7684\u8fc7\u7a0b\uff0c\u540c\u65f6\u53ef\u4ee5\u6709\u6548\u5e94\u5bf9\u73b0\u5b9e\u4e16\u754c\u7684\u6311\u6218\u5e76\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<p><img data-dominant-color=\"3584b8\" data-has-transparency=\"false\" style=\"--dominant-color: #3584b8;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-23572\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2024\/12\/4dafd5f5-213f-4256-8219-d04a71627638-300x167-1.png\" width=\"300\" height=\"167\" alt=\"\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2024\/12\/4dafd5f5-213f-4256-8219-d04a71627638-300x167-1.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2024\/12\/4dafd5f5-213f-4256-8219-d04a71627638-300x167-1-150x84.png 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u8f6f\u4ef6\u5f00\u53d1\u4e13\u5bb6Igboanugo David Ugochukwu\u8868\u793a\uff0c\u5f53\u4ed6\u5e26\u9886\u7684\u8f6f\u4ef6\u5f00\u53d1\u56e2\u961f\u5728\u53bb\u5e74\u5f00\u59cb\u4f7f\u7528\u4eba\u5de5\u667a\u80fd\u7f16\u7801\u52a9\u624b\u65f6\uff0c\u4ed6\u5bf9\u5176\u80fd\u529b\u6301\u6000\u7591\u6001\u5ea6\u3002\u57fa\u4e8e\u5176\u957f\u8fbe15\u5e74\u7684\u7f16\u7a0b\u7ecf\u9a8c\uff0c\u4ed6\u4e0d\u76f8\u4fe1\u5927\u578b\u8bed\u8a00\u6a21\u578b\u80fd\u591f\u5bf9\u5b9e\u9645\u7684\u5f00\u53d1\u5de5\u4f5c\u63d0\u4f9b\u6709\u610f\u4e49\u7684\u5e2e\u52a9\u3002\u5728\u516d\u4e2a\u6708\u540e\uff0c\u4ed6\u7684\u770b\u6cd5\u53d1\u751f\u4e86\u6839\u672c\u6027\u8f6c\u53d8\uff0c\u5176\u5f00\u53d1\u56e2\u961f\u7684\u5de5\u4f5c\u6548\u7387\u63d0\u9ad8\u4e86\u5927\u7ea640%\uff0c\u540c\u65f6\u4ee3\u7801\u8d28\u91cf\u6307\u6807\u4e5f\u6709\u6240\u63d0\u9ad8\u3002<\/p>\n<p>\u4f46\u5173\u952e\u5728\u4e8e\uff0c\u8fd9\u5e76\u4e0d\u50cf\u201c\u4eba\u5de5\u667a\u80fd\u8ba9\u7f16\u7801\u53d8\u5f97\u66f4\u5bb9\u6613\u201d\u90a3\u4e48\u7b80\u5355\u3002\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u60c5\u51b5\u8fdc\u6bd4\u5e02\u573a\u5ba3\u4f20\u6240\u63cf\u7ed8\u7684\u66f4\u5fae\u5999\u3001\u66f4\u6709\u8da3\uff0c\u5e76\u4e14\u4ece\u5b9e\u7528\u89d2\u5ea6\u6765\u770b\uff0c\u4e5f\u66f4\u5177\u4ef7\u503c\u3002<\/p>\n<h3>\u5b9e\u9645\u5e94\u7528\u60c5\u51b5<\/h3>\n<p>Ugochukwu\u5206\u4eab\u4e86\u8fd1\u65e5\u53d1\u751f\u7684\u4e00\u4ef6\u4e8b\u3002\u4ed6\u6b63\u5728\u8c03\u8bd5Node.js\u540e\u7aef\u4e00\u4e2a\u4e25\u91cd\u7684\u5185\u5b58\u6cc4\u6f0f\u3002\u8fd9\u5728\u4ee5\u5f80\u610f\u5473\u7740\u8981\u82b1\u8d39\u6570\u5c0f\u65f6\u68b3\u7406\u4ee3\u7801\uff0c\u6dfb\u52a0\u63a7\u5236\u53f0\u65e5\u5fd7\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u82b1\u8d39\u66f4\u591a\u7684\u65f6\u95f4\u3002\u7136\u800c\uff0c\u4ed6\u5c06\u76f8\u5173\u4ee3\u7801\u548c\u5185\u5b58\u914d\u7f6e\u6587\u4ef6\u8f93\u5165\u5230\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u4e2d\uff0c\u5e76\u8981\u6c42\u5b83\u5206\u6790\u6a21\u5f0f\u3002<\/p>\n<p>\u5728\u51e0\u5206\u949f\u4e4b\u5185\uff0c\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u5c31\u53d1\u73b0\u4e86\u4e00\u4e9b\u4ed6\u672a\u66fe\u7559\u610f\u7684\u4e00\u5904\u7ec6\u8282\u2014\u2014\u5728\u4e00\u4e2a\u95ed\u5305\u4e2d\u610f\u5916\u5730\u4fdd\u6301\u4e86WebSocket\u8fde\u63a5\u3002\u8fd9\u662f\u4e00\u4e2a\u5fae\u4e0d\u8db3\u9053\u5374\u96be\u4ee5\u5bdf\u89c9\u7684\u9519\u8bef\u3002\u5c3d\u7ba1\u4eba\u5de5\u667a\u80fd\u5e76\u6ca1\u6709\u795e\u5947\u5730\u4fee\u590d\u5b83\uff0c\u4f46\u5b83\u6bd4\u4f20\u7edf\u7684\u8c03\u8bd5\u65b9\u6cd5\u66f4\u5feb\u5730\u6307\u660e\u4e86\u6b63\u786e\u7684\u65b9\u5411\u3002<\/p>\n<h3>\u771f\u6b63\u6709\u6548\u7684\u65b9\u6cd5<\/h3>\n<p>\u6839\u636e\u5176\u56e2\u961f\u5728\u8fc7\u53bb\u4e00\u5e74\u4f7f\u7528\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u7684\u7ecf\u9a8c\uff1a<\/p>\n<h4>1.\u4ee3\u7801\u8bc4\u5ba1<\/h4>\n<p>\u590d\u5236<\/p>\n<p>Python 1 def process_user_data(data): 2 if data[&#8216;status&#8217;] == &#8216;active&#8217;: 3 user = User.objects.get(id=data[&#8216;user_id&#8217;]) 4 if user.subscription: 5 if user.subscription.status == &#8216;valid&#8217;: 6 return handle_active_user(user) 7 else: 8 return handle_inactive_subscription(user) 9 return handle_inactive_user()<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<\/ul>\n<p>\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u53d1\u73b0\u4e86\u8fd9\u4e00\u70b9\uff0c\u5e76\u63d0\u51fa\u4e86\u4ee5\u4e0b\u5efa\u8bae\uff1a<\/p>\n<p>\u91cd\u6784\u7248\u672c\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 def process_user_data(data): 2 if data[&#8216;status&#8217;] != &#8216;active&#8217;: 3 return handle_inactive_user() 4 5 user = User.objects.get(id=data[&#8216;user_id&#8217;]) 6 if not user.subscription: 7 return handle_inactive_user() 8 9 return (handle_active_user(user) 10 if user.subscription.status == &#8216;valid&#8217; 11 else handle_inactive_subscription(user))<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<\/ul>\n<p>\u867d\u7136\u5b83\u5e76\u4e0d\u662f\u9769\u547d\u6027\u7a81\u7834\uff0c\u4f46\u59cb\u7ec8\u6bd4\u4eba\u7c7b\u5ba1\u9605\u8005\u66f4\u5feb\u5730\u53d1\u73b0\u8fd9\u4e9b\u53ef\u8bfb\u6027\u95ee\u9898\u3002<\/p>\n<h4>2.\u6d4b\u8bd5\u751f\u6210<\/h4>\n<p>\u8fd9\u662f\u53e6\u4e00\u4e2a\u610f\u5916\u7684\u53d1\u73b0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u771f\u5b9e\u793a\u4f8b\uff1a<\/p>\n<p>\u6700\u521d\u7684\u529f\u80fd\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 def calculate_order_total(items, discount_code=None): 2 subtotal = sum(item.price * item.quantity for item in items) 3 if discount_code: 4 discount = get_discount_amount(discount_code, subtotal) 5 return subtotal &#8211; discount 6 return subtotal<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<p>\u4eba\u5de5\u667a\u80fd\u751f\u6210\u4e86\u8fd9\u4e9b\u6d4b\u8bd5\u7528\u4f8b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 def test_calculate_order_total(): 2 items = [ 3 Item(price=10.0, quantity=2), 4 Item(price=15.0, quantity=1) 5 ] 6 assert calculate_order_total(items) == 35.0 7 8 def test_calculate_order_total_with_discount(): 9 items = [Item(price=100.0, quantity=1)] 10 assert calculate_order_total(items, &#8216;SAVE20&#8217;) == 80.0 11 12 def test_calculate_order_total_empty(): 13 assert calculate_order_total([]) == 0 14 15 def test_calculate_order_total_invalid_discount(): 16 items = [Item(price=10.0, quantity=1)] 17 assert calculate_order_total(items, &#8216;INVALID&#8217;) == 10.0<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<\/ul>\n<p>\u5b83\u6355\u6349\u5230\u4e86\u5f00\u53d1\u4eba\u5458\u4e00\u5f00\u59cb\u53ef\u80fd\u4f1a\u5ffd\u7565\u7684\u8fb9\u754c\u6848\u4f8b\u3002<\/p>\n<h3>\u4e0d\u9002\u7528\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u7684\u60c5\u51b5<\/h3>\n<h4>1.\u590d\u6742\u7684\u67b6\u6784\u51b3\u7b56<\/h4>\n<p>Ugochukwu\u5e26\u9886\u7684\u5f00\u53d1\u56e2\u961f\u6700\u8fd1\u9700\u8981\u91cd\u65b0\u8bbe\u8ba1\u8eab\u4efd\u9a8c\u8bc1\u7cfb\u7edf\uff0c\u4ee5\u5904\u7406\u591a\u79df\u6237\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\u3002\u4eba\u5de5\u667a\u80fd\u52a9\u624b\u63d0\u4f9b\u7684\u5efa\u8bae\u4ece\u6280\u672f\u4e0a\u6765\u8bf4\u662f\u6b63\u786e\u7684\uff0c\u4f46\u5ffd\u7565\u4e86\u5173\u4e8e\u4e0d\u540c\u5ba2\u6237\u7aef\u7c7b\u578b\u4e4b\u95f4\u4f1a\u8bdd\u7ba1\u7406\u7684\u5173\u952e\u73b0\u5b9e\u56e0\u7d20\u3002<\/p>\n<h4>2.\u573a\u666f\u590d\u6742\u578b\u8c03\u8bd5<\/h4>\n<p>\u5f53\u4e00\u4e2abug\u6d89\u53ca\u591a\u4e2a\u670d\u52a1\u3001\u590d\u6742\u72b6\u6001\u6216\u7ade\u4e89\u6761\u4ef6\u65f6\uff0c\u4eba\u5de5\u667a\u80fd\u5de5\u5177\u4ecd\u7136\u4f1a\u9047\u5230\u56f0\u96be\u3002\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u5206\u6790\u5355\u4e2a\u7ec4\u4ef6\uff0c\u4f46\u5f80\u5f80\u5ffd\u7565\u4e86\u6574\u4f53\u60c5\u51b5\u3002<\/p>\n<h3>\u5bf9\u5f00\u53d1\u5de5\u4f5c\u6d41\u7a0b\u7684\u5b9e\u9645\u5f71\u54cd<\/h3>\n<p>\u4ee5\u4e0b\u662f\u5f00\u53d1\u5de5\u4f5c\u6d41\u7a0b\u7684\u5b9e\u9645\u53d8\u5316\uff1a<\/p>\n<h4>\u5728\u4eba\u5de5\u667a\u80fd\u6574\u5408\u4e4b\u524d<\/h4>\n<p>\u590d\u5236<\/p>\n<p>Plain Text 1 1. Write code (2 hours) 2 2. Write tests (1 hour) 3 3. Debug issues (2 hours) 4 4. Code review (1 hour) 5 6 Total: ~6 hours per feature<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<h4>\u5728\u4eba\u5de5\u667a\u80fd\u6574\u5408\u4e4b\u540e<\/h4>\n<p>\u590d\u5236<\/p>\n<p>Plain Text 1 1. Write code with AI assistance (1 hour) 2 2. AI generates test cases, developer adjusts (30 mins) 3 3. Debug with AI analysis (1 hour) 4 4. AI-assisted code review (30 mins) 5 6 Total: ~3 hours per feature<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<p>\u4f46\u95ee\u9898\u662f\uff0c\u8fd9\u4e4b\u6240\u4ee5\u80fd\u594f\u6548\uff0c\u662f\u56e0\u4e3a\u5f00\u53d1\u56e2\u961f\u5b66\u4f1a\u4e86\u5982\u4f55\u6709\u6548\u5730\u4f7f\u7528\u4eba\u5de5\u667a\u80fd\u5de5\u5177\u3002\u867d\u7136\u4ed6\u4eec\u5728\u7b2c\u4e00\u4e2a\u6708\u7684\u5de5\u4f5c\u6548\u7387\u8f83\u4f4e\uff0c\u4f46\u6b63\u5728\u6478\u7d22\u6b63\u786e\u7684\u5de5\u4f5c\u6d41\u7a0b\u3002<\/p>\n<h3>\u5b66\u5230\u7684\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>1.\u9762\u5411\u5f00\u53d1\u4eba\u5458\u7684\u63d0\u793a\u5de5\u7a0b<\/h4>\n<p>\u800c\u4e0d\u662f\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Plain Text 1 &#8220;Write a function to process user data&#8221;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u8be5\u5f00\u53d1\u56e2\u961f\u91c7\u53d6\u7684\u505a\u6cd5\u662f\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Plain Text 1 &#8220;Write a Python function that: 2 3 &#8211; Takes a user_id and data dictionary 4 &#8211; Validates required fields: name, email, age 5 &#8211; Handles missing fields with default values 6 &#8211; Raises ValidationError for invalid data 7 &#8211; Returns a processed user object 8 9 Use type hints and include error handling.&#8221;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5185\u5bb9\u8d28\u91cf\u4e0a\u7684\u5dee\u5f02\u5341\u5206\u663e\u8457\u3002<\/p>\n<h4>2.\u4ee3\u7801\u5ba1\u67e5\u7b56\u7565<\/h4>\n<p>\u73b0\u5728\u91c7\u53d6\u7684\u505a\u6cd5\u662f\uff1a<\/p>\n<ul data-id=\"u738a58b-DleGAYB5\">\n<li data-id=\"ld70c578-Q0ZOBM5U\">\u7b2c\u4e00\u8f6e\uff1a\u5229\u7528\u4eba\u5de5\u667a\u80fd\u8fdb\u884c\u98ce\u683c\u3001\u6f5c\u5728\u6f0f\u6d1e\u548c\u660e\u663e\u95ee\u9898\u7684\u5ba1\u67e5\u3002<\/li>\n<li data-id=\"ld70c578-7KcGBkSK\">\u7b2c\u4e8c\u8f6e\uff1a\u4eba\u5de5\u5ba1\u67e5\u4e1a\u52a1\u903b\u8f91\u548c\u67b6\u6784\u65b9\u9762\u7684\u95ee\u9898\u3002<\/li>\n<li data-id=\"ld70c578-cIPg0VGC\">\u6700\u540e\u4e00\u8f6e\uff1a\u518d\u6b21\u5229\u7528\u4eba\u5de5\u667a\u80fd\u68c0\u67e5\u5b89\u5168\u6f0f\u6d1e\u3002<\/li>\n<\/ul>\n<h4>3.\u6587\u6863\u751f\u6210<\/h4>\n<p>\u8fd9\u6539\u53d8\u4e86\u6e38\u620f\u89c4\u5219\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 # Original function with minimal docs 2 3 def process_payment(amount, user_id, method): 4 5 # &#8230; implementation &#8230;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<p>\u4eba\u5de5\u667a\u80fd\u5c06\u5176\u6269\u5c55\u4e3a\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 def process_payment( 2 amount: Decimal, 3 user_id: str, 4 method: PaymentMethod 5 ) -&gt; PaymentResult: 6 &#8220;&#8221;&#8221;Process a payment transaction for a user. 7 8 Args: 9 amount: Transaction amount in user&#8217;s local currency. 10 user_id: Unique identifier for the user. 11 method: Payment method object containing card\/bank details. 12 13 Returns: 14 PaymentResult object containing transaction ID and status. 15 16 Raises: 17 InsufficientFundsError: If payment method has insufficient funds. 18 InvalidPaymentMethodError: If payment method is expired\/invalid. 19 PaymentProcessingError: If payment gateway encounters an error. 20 21 Example: 22 &gt;&gt;&gt; result = process_payment( 23 &#8230; amount=Decimal(&#8216;99.99&#8242;), 24 &#8230; user_id=&#8217;usr_123&#8242;, 25 &#8230; method=PaymentMethod(type=&#8217;credit_card&#8217;, token=&#8217;tok_xyz&#8217;) 26 &#8230; ) 27 &gt;&gt;&gt; print(result.transaction_id) 28 &#8216;tx_abc123&#8217; 29 &#8220;&#8221;&#8221;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<li>20.<\/li>\n<li>21.<\/li>\n<li>22.<\/li>\n<li>23.<\/li>\n<li>24.<\/li>\n<li>25.<\/li>\n<li>26.<\/li>\n<li>27.<\/li>\n<li>28.<\/li>\n<li>29.<\/li>\n<li>30.<\/li>\n<\/ul>\n<h3>\u5b89\u5168\u6ce8\u610f\u4e8b\u9879<\/h3>\n<p>\u5728\u5b89\u5168\u65b9\u9762\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u4ee5\u4e0b\u662f\u5438\u53d6\u7684\u4e00\u4e9b\u6559\u8bad\uff1a<\/p>\n<h4>1.\u6c38\u8fdc\u4e0d\u8981\u8ba9\u4eba\u5de5\u667a\u80fd\u751f\u6210\u5b89\u5168\u5173\u952e\u4ee3\u7801<\/h4>\n<p>\u4e0d\u8981\u505a\u7684\u793a\u4f8b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>Python 1 # DON&#8217;T: Let AI generate authentication logic 2 def verify_password(plain_text, hashed): 3 return hashlib.md5(plain_text.encode()).hexdigest() == hashed<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<\/ul>\n<h4>2.\u59cb\u7ec8\u68c0\u67e5\u751f\u6210\u7684SQL<\/h4>\n<p>\u5df2\u7ecf\u770b\u5230\u4eba\u5de5\u667a\u80fd\u5efa\u8bae\u6613\u53d7\u653b\u51fb\u7684\u67e5\u8be2\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>SQL 1 &#8212; DON&#8217;T: Raw string formatting 2 f&#8221;SELECT * FROM users WHERE id = &#8216;{user_id}'&#8221; 3 4 &#8212; DO: Parameterized queries 5 &#8220;SELECT * FROM users WHERE id = %s&#8221;, (user_id,)<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<h3>\u5c55\u671b\u672a\u6765<\/h3>\n<p>\u6839\u636e\u76ee\u524d\u7684\u8d8b\u52bf\u548c\u5f00\u53d1\u4eba\u5458\u7684\u7ecf\u9a8c\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5b9e\u9645\u7684\u53d8\u5316\u8d8b\u52bf\uff1a<\/p>\n<h4>1.\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6574\u5408\u6b63\u53d8\u5f97\u65e5\u76ca\u91cd\u8981<\/h4>\n<p>\u6700\u65b0\u7684\u4eba\u5de5\u667a\u80fd\u9a71\u52a8\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u4e0d\u4ec5\u63d0\u4f9b\u4ee3\u7801\u5efa\u8bae\uff0c\u8fd8\u80fd\u7406\u89e3\u6574\u4e2a\u4ee3\u7801\u5e93\u3002\u4f8b\u5982\uff0c\u5f00\u53d1\u56e2\u961f\u7684IDE\u5f02\u6b65\u51fd\u6570\u5728\u4e0d\u540c\u670d\u52a1\u4e2d\u7684\u8c03\u7528\u65b9\u5f0f\uff0c\u6807\u8bb0\u4e86\u5f02\u6b65\u51fd\u6570\u4e2d\u6f5c\u5728\u7684\u7ade\u4e89\u6761\u4ef6\u3002<\/p>\n<h4>2.\u4e13\u4e1a\u6a21\u578b\u6b63\u5728\u6d8c\u73b0<\/h4>\n<p>\u73b0\u5728\u6709\u4e00\u4e9b\u4eba\u5de5\u667a\u80fd\u6a21\u578b\u4e13\u95e8\u9488\u5bf9\u67d0\u4e9b\u6846\u67b6\u6216\u8bed\u8a00\u8fdb\u884c\u8bad\u7ec3\u3002\u76ee\u524d\uff0c\u83b7\u5f97\u7684\u9488\u5bf9TypeScript\u7684\u7279\u5b9a\u5efa\u8bae\u660e\u663e\u4f18\u4e8e\u901a\u7528\u7684\u4ee3\u7801\u751f\u6210\u3002<\/p>\n<h4>3.\u6d4b\u8bd5\u6b63\u5728\u8f6c\u53d8<\/h4>\n<p>\u4eba\u5de5\u667a\u80fd\u5728\u751f\u6210\u4eba\u7c7b\u53ef\u80fd\u9519\u8fc7\u7684\u8fb9\u7f18\u6848\u4f8b\u548c\u538b\u529b\u6d4b\u8bd5\u65b9\u9762\u505a\u5f97\u8d8a\u6765\u8d8a\u597d\uff0c\u81ea\u4ece\u91c7\u7528\u4eba\u5de5\u667a\u80fd\u5de5\u5177\u4ee5\u6765\uff0c\u6d4b\u8bd5\u8986\u76d6\u7387\u6709\u6240\u63d0\u9ad8\u3002<\/p>\n<h3>\u7ed3\u8bba<\/h3>\n<p>\u4eba\u5de5\u667a\u80fd\u5728\u77ed\u671f\u5185\u5e76\u4e0d\u4f1a\u53d6\u4ee3\u5f00\u53d1\u4eba\u5458\u3002\u4e0e\u5176\u76f8\u53cd\uff0c\u4eba\u5de5\u667a\u80fd\u53ef\u4ee5\u63d0\u9ad8\u8f6f\u4ef6\u5f00\u53d1\u6548\u7387\uff0c\u5e2e\u52a9\u4ed6\u4eec\u66f4\u65e9\u5730\u53d1\u73b0\u6f0f\u6d1e\uff0c\u5e76\u5904\u7406\u7f16\u7a0b\u4e2d\u7e41\u7410\u4e14\u91cd\u590d\u6027\u7684\u4efb\u52a1\u3002\u5173\u952e\u5728\u4e8e\u7406\u89e3\u5176\u5c40\u9650\u6027\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a\u9ad8\u6548\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u800c\u4e0d\u662f\u66ff\u4ee3\u4eba\u7c7b\u7684\u5224\u65ad\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u6570\u5b57\u65f6\u4ee3\u4e2d\u8301\u58ee\u6210\u957f\u7684\u5f00\u53d1\u4eba\u5458\u5e76\u4e0d\u662f\u90a3\u4e9b\u80fd\u7f16\u5199\u5927\u91cf\u4ee3\u7801\u7684\u4eba\uff0c\u800c\u662f\u90a3\u4e9b\u64c5\u957f\u4e0e\u4eba\u5de5\u667a\u80fd\u5de5\u5177\u534f\u4f5c\uff0c\u540c\u65f6\u5bf9\u81ea\u5df1\u6240\u6784\u5efa\u7684\u5185\u5bb9\u53ca\u5176\u80cc\u540e\u7684\u903b\u8f91\u4e0e\u76ee\u7684\u6709\u7740\u6df1\u523b\u8ba4\u8bc6\u7684\u4eba\u3002<\/p>\n<p>Ugochukwu\u5728\u64b0\u5199\u672c\u6587\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5c31\u5de7\u5999\u5730\u501f\u52a9\u4e86\u4eba\u5de5\u667a\u80fd\u7684\u529b\u91cf\u6765\u8f85\u52a9\u90e8\u5206\u5185\u5bb9\u7684\u521b\u4f5c\u3002\u8fd9\u6b63\u662f\u5173\u952e\u6240\u5728\u3002\u4eba\u5de5\u667a\u80fd\u662f\u4e00\u79cd\u5de5\u5177\uff0c\u5f00\u53d1\u4eba\u5458\u9700\u8981\u7406\u89e3\u5e76\u4e14\u6709\u6548\u5730\u5229\u7528\u5b83\u3002<\/p>\n<p>\u6587\u7ae0\u6765\u81ea\uff1a51CTO<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_23570\" class=\"pvc_stats total_only  \" data-element-id=\"23570\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u91c7\u7528\u4eba\u5de5\u667a\u80fd\u7f16\u7801\u52a9\u624b\u53ef\u4ee5\u5c06\u8f6f\u4ef6\u5f00\u53d1\u56e2\u961f\u7684\u6548\u7387\u63d0\u9ad840%\uff0c\u5176\u4e2d\u5305\u62ec\u4ee3\u7801\u5ba1\u67e5\u81f3\u8c03\u8bd5\u7684\u8fc7\u7a0b\uff0c\u540c\u65f6\u53ef\u4ee5\u6709\u6548\u5e94\u5bf9\u73b0\u5b9e\u4e16\u754c [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_23570\" class=\"pvc_stats total_only  \" data-element-id=\"23570\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":56,"featured_media":23572,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,20,80],"tags":[113,1488,1056],"class_list":["post-23570","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-23","category-20","category-80","tag-113","tag-1488","tag-1056"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/23570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=23570"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/23570\/revisions"}],"predecessor-version":[{"id":23573,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/23570\/revisions\/23573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/23572"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=23570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=23570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=23570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}