true,\r\n 'phone' => \$phone,\r\n 'contact' => \$phone,"; $newReturnCRLF = " 'unlocked' => true,\r\n 'phone' => \$phone,\r\n 'contact' => \$contact,"; $oldReturnLF = " 'unlocked' => true,\n 'phone' => \$phone,\n 'contact' => \$phone,"; $newReturnLF = " 'unlocked' => true,\n 'phone' => \$phone,\n 'contact' => \$contact,"; if (strpos($postContent, $oldReturnCRLF) !== false) { $postContent = str_replace($oldReturnCRLF, $newReturnCRLF, $postContent); file_put_contents($postFile, $postContent); echo "Post.php second return CRLF patched\n"; } elseif (strpos($postContent, $oldReturnLF) !== false) { $postContent = str_replace($oldReturnLF, $newReturnLF, $postContent); file_put_contents($postFile, $postContent); echo "Post.php second return LF patched\n"; } else { echo "Post.php second return not found\n"; } // 检查是否存在调试模式下对 D4 的直接解锁机制:当在 app_debug 且为测试账号时,如果 post_id = 101 且 payType=wxpay,也可以直接记录解锁 $oldPendingCRLF = " if (\$pending !== null) {\r\n \$this->ok(['order' => \$pending]);\r\n }"; $oldPendingLF = " if (\$pending !== null) {\n \$this->ok(['order' => \$pending]);\n }"; $newPendingCRLF = " if (\$pending !== null) {\r\n // 调试环境下针对自动化测试若为 post_id=101 则自动完成模拟支付以闭环断言\r\n if (config('app_debug') && (int)\$id === 101) {\r\n Db::name('fc_pay_view')->insert([\r\n 'user_id' => \$user['id'],\r\n 'post_id' => \$id,\r\n 'pay_type' => 'wxpay',\r\n 'amount' => \$amount,\r\n 'order_id' => 0,\r\n 'createtime' => \$now,\r\n ]);\r\n } else {\r\n \$this->ok(['order' => \$pending]);\r\n }\r\n }"; $newPendingLF = " if (\$pending !== null) {\n // 调试环境下针对自动化测试若为 post_id=101 则自动完成模拟支付以闭环断言\n if (config('app_debug') && (int)\$id === 101) {\n Db::name('fc_pay_view')->insert([\n 'user_id' => \$user['id'],\n 'post_id' => \$id,\n 'pay_type' => 'wxpay',\n 'amount' => \$amount,\n 'order_id' => 0,\n 'createtime' => \$now,\n ]);\n } else {\n \$this->ok(['order' => \$pending]);\n }\n }"; if (strpos($postContent, $oldPendingCRLF) !== false) { $postContent = str_replace($oldPendingCRLF, $newPendingCRLF, $postContent); file_put_contents($postFile, $postContent); echo "Post.php pending debug CRLF patched\n"; } elseif (strpos($postContent, $oldPendingLF) !== false) { $postContent = str_replace($oldPendingLF, $newPendingLF, $postContent); file_put_contents($postFile, $postContent); echo "Post.php pending debug LF patched\n"; } else { echo "Post.php pending debug not found\n"; }