chore: archive AI-generated docs/scripts from webroot into _ai_archive (docs/scripts/sql/logs), keep production entries
这个提交包含在:
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>菜单设置接口测试</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; }
|
||||
.container { max-width: 800px; margin: 0 auto; }
|
||||
.section { margin: 20px 0; padding: 15px; border: 1px solid #ddd; border-radius: 5px; }
|
||||
.error { color: red; }
|
||||
.success { color: green; }
|
||||
.info { color: blue; }
|
||||
button { padding: 10px 20px; margin: 5px; cursor: pointer; }
|
||||
textarea { width: 100%; height: 100px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>菜单设置接口修复验证</h1>
|
||||
|
||||
<div class="section">
|
||||
<h3>问题分析</h3>
|
||||
<p class="info">原始错误:POST请求到 <code>https://mss.nahaichuan.com/index.php/Retail/Xcx/storeSet</code> 返回404</p>
|
||||
<p class="success">修复结果:接口路径正确,返回权限错误(需要登录验证)</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>接口测试</h3>
|
||||
<button onclick="testStoreSetAPI()">测试 storeSet 接口</button>
|
||||
<button onclick="testWithAuth()">模拟登录后测试</button>
|
||||
<div id="testResult"></div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>修复内容</h3>
|
||||
<ul>
|
||||
<li>✅ 修正了表单提交URL路径:<code>/index.php/Retail/Xcx/storeSet</code></li>
|
||||
<li>✅ 添加了完整的错误处理机制</li>
|
||||
<li>✅ 实现了sendRequest通用请求方法</li>
|
||||
<li>✅ 优化了用户反馈信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>权限问题解决方案</h3>
|
||||
<p class="error">当前返回:{"status":0,"msg":"您无权操作1"}</p>
|
||||
<p>需要确保:</p>
|
||||
<ul>
|
||||
<li>用户已正确登录</li>
|
||||
<li>Session中包含必要的权限信息</li>
|
||||
<li>merchant_id 和 store_id 已正确设置</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>建议的完整解决流程</h3>
|
||||
<ol>
|
||||
<li>确保用户通过正确的登录流程</li>
|
||||
<li>验证Session中的权限数据</li>
|
||||
<li>在菜单页面加载前检查用户权限</li>
|
||||
<li>提供友好的权限错误提示</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function testStoreSetAPI() {
|
||||
const resultDiv = document.getElementById('testResult');
|
||||
resultDiv.innerHTML = '<p class="info">正在测试接口...</p>';
|
||||
|
||||
fetch('/index.php/Retail/Xcx/storeSet', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: 'store_name=测试门店&store_address=测试地址&store_phone=13800138000'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
resultDiv.innerHTML = `
|
||||
<h4>接口响应:</h4>
|
||||
<textarea readonly>${JSON.stringify(data, null, 2)}</textarea>
|
||||
<p class="${data.status == 1 ? 'success' : 'error'}">
|
||||
状态:${data.status == 1 ? '成功' : '失败'} - ${data.msg}
|
||||
</p>
|
||||
`;
|
||||
})
|
||||
.catch(error => {
|
||||
resultDiv.innerHTML = `<p class="error">请求失败:${error.message}</p>`;
|
||||
});
|
||||
}
|
||||
|
||||
function testWithAuth() {
|
||||
alert('需要先通过正确的登录流程获取权限,然后再测试接口');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
在新工单中引用
屏蔽一个用户