完善后台接口字段
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -961,6 +961,7 @@ def list_shop_manages():
|
||||
'group_id': item.get('groupId'),
|
||||
'group_name': item.get('groupName') or '',
|
||||
'shop_name': item.get('shopName') or '',
|
||||
'mall_name': item.get('mallName') or '',
|
||||
'account': item.get('account') or '',
|
||||
'password': item.get('passwordMasked') or '',
|
||||
'created_at': (item.get('createdAt') or '').replace('T', ' ')[:16],
|
||||
@@ -984,6 +985,7 @@ def create_shop_manage():
|
||||
payload = {
|
||||
'groupId': data.get('group_id'),
|
||||
'shopName': (data.get('shop_name') or '').strip(),
|
||||
'mallName': (data.get('mall_name') or '').strip(),
|
||||
'account': (data.get('account') or '').strip(),
|
||||
'password': (data.get('password') or '').strip(),
|
||||
}
|
||||
@@ -1003,6 +1005,7 @@ def create_shop_manage():
|
||||
'group_id': item.get('groupId'),
|
||||
'group_name': item.get('groupName') or '',
|
||||
'shop_name': item.get('shopName') or '',
|
||||
'mall_name': item.get('mallName') or '',
|
||||
'account': item.get('account') or '',
|
||||
'password': item.get('password') or '',
|
||||
'created_at': (item.get('createdAt') or '').replace('T', ' ')[:16],
|
||||
@@ -1018,6 +1021,7 @@ def update_shop_manage(item_id):
|
||||
payload = {
|
||||
'groupId': data.get('group_id'),
|
||||
'shopName': (data.get('shop_name') or '').strip(),
|
||||
'mallName': (data.get('mall_name') or '').strip(),
|
||||
'account': (data.get('account') or '').strip(),
|
||||
'password': (data.get('password') or '').strip(),
|
||||
}
|
||||
@@ -1036,6 +1040,7 @@ def update_shop_manage(item_id):
|
||||
'id': item.get('id'),
|
||||
'group_name': item.get('groupName') or '',
|
||||
'shop_name': item.get('shopName') or '',
|
||||
'mall_name': item.get('mallName') or '',
|
||||
'account': item.get('account') or '',
|
||||
'password': item.get('password') or '',
|
||||
'created_at': (item.get('createdAt') or '').replace('T', ' ')[:16],
|
||||
|
||||
@@ -23,8 +23,8 @@ bucket_path = "nanri-image/"
|
||||
file_url_pre = f"https://{bucket}.oss-cn-hangzhou.aliyuncs.com/"
|
||||
|
||||
import os
|
||||
# backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://127.0.0.1:18080').rstrip('/')
|
||||
backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://8.136.19.173:18080').rstrip('/')
|
||||
backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://127.0.0.1:18080').rstrip('/')
|
||||
# backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://8.136.19.173:18080').rstrip('/')
|
||||
os.environ['OSS_ACCESS_KEY_ID'] = accessKeyId
|
||||
os.environ['OSS_ACCESS_KEY_SECRET'] = accessKeySecret
|
||||
os.environ['SECRET_KEY'] = "ddffc7c1d02121d9554d7b080b2511b6"
|
||||
|
||||
@@ -364,6 +364,10 @@
|
||||
<label>店铺名</label>
|
||||
<input type="text" id="shopManageShopName" placeholder="请输入店铺名称">
|
||||
</div>
|
||||
<div class="form-group" style="min-width:180px;">
|
||||
<label>店铺商城名</label>
|
||||
<input type="text" id="shopManageMallName" placeholder="请输入店铺商城名">
|
||||
</div>
|
||||
<div class="form-group" style="min-width:180px;">
|
||||
<label>账号</label>
|
||||
<input type="text" id="shopManageAccount" placeholder="请输入账号">
|
||||
@@ -384,6 +388,7 @@
|
||||
<th>序号</th>
|
||||
<th>分组</th>
|
||||
<th>店铺名</th>
|
||||
<th>店铺商城名</th>
|
||||
<th>账号</th>
|
||||
<th>密码</th>
|
||||
<th>创建时间</th>
|
||||
@@ -556,6 +561,10 @@
|
||||
<label>店铺名</label>
|
||||
<input type="text" id="editShopManageShopName" placeholder="店铺名">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>店铺商城名</label>
|
||||
<input type="text" id="editShopManageMallName" placeholder="店铺商城名">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>账号</label>
|
||||
<input type="text" id="editShopManageAccount" placeholder="账号">
|
||||
@@ -1538,16 +1547,16 @@
|
||||
.then(function(res) {
|
||||
var tbody = document.getElementById('shopManageListBody');
|
||||
if (!res.success) {
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
var items = res.items || [];
|
||||
if (items.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="empty-tip">暂无店铺</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="empty-tip">暂无店铺</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = items.map(function(item, index) {
|
||||
var rowNo = (shopManagePage - 1) * shopManagePageSize + index + 1;
|
||||
return '<tr><td>' + rowNo + '</td><td>' + (item.group_name || '') + '</td><td>' + (item.shop_name || '') + '</td><td>' + (item.account || '') + '</td><td>' + (item.password || '') + '</td><td>' + (item.created_at || '') + '</td><td>' + (item.updated_at || '') + '</td><td>' +
|
||||
return '<tr><td>' + rowNo + '</td><td>' + (item.group_name || '') + '</td><td>' + (item.shop_name || '') + '</td><td>' + (item.mall_name || '') + '</td><td>' + (item.account || '') + '</td><td>' + (item.password || '') + '</td><td>' + (item.created_at || '') + '</td><td>' + (item.updated_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-shop-manage-edit="' + item.id + '" data-shop-manage="' + (JSON.stringify(item).replace(/"/g, '"')) + '">编辑</button> ' +
|
||||
'<button class="btn btn-sm btn-danger" data-shop-manage-delete="' + item.id + '" data-shop-manage-name="' + (item.shop_name || '').replace(/"/g, '"') + '">删除</button>' +
|
||||
'</td></tr>';
|
||||
@@ -1557,7 +1566,7 @@
|
||||
bindShopManageActions();
|
||||
})
|
||||
.catch(function() {
|
||||
document.getElementById('shopManageListBody').innerHTML = '<tr><td colspan="8" class="empty-tip">请求失败</td></tr>';
|
||||
document.getElementById('shopManageListBody').innerHTML = '<tr><td colspan="9" class="empty-tip">请求失败</td></tr>';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1568,6 +1577,7 @@
|
||||
try { item = JSON.parse((btn.dataset.shopManage || '').replace(/"/g, '"')); } catch (e) { item = {}; }
|
||||
document.getElementById('editShopManageId').value = item.id || '';
|
||||
document.getElementById('editShopManageShopName').value = item.shop_name || '';
|
||||
document.getElementById('editShopManageMallName').value = item.mall_name || '';
|
||||
document.getElementById('editShopManageAccount').value = item.account || '';
|
||||
document.getElementById('editShopManagePassword').value = item.password || '';
|
||||
document.getElementById('msgEditShopManage').textContent = '';
|
||||
@@ -1643,26 +1653,28 @@
|
||||
document.getElementById('btnCreateShopManage').onclick = function() {
|
||||
var groupId = (document.getElementById('shopManageGroupSelect').value || '').trim();
|
||||
var shopName = (document.getElementById('shopManageShopName').value || '').trim();
|
||||
var mallName = (document.getElementById('shopManageMallName').value || '').trim();
|
||||
var account = (document.getElementById('shopManageAccount').value || '').trim();
|
||||
var password = (document.getElementById('shopManagePassword').value || '').trim();
|
||||
var msgEl = document.getElementById('msgShopManage');
|
||||
msgEl.textContent = '';
|
||||
msgEl.className = 'msg';
|
||||
if (!groupId || !shopName || !account || !password) {
|
||||
msgEl.textContent = '请完整填写分组、店铺名、账号、密码';
|
||||
if (!groupId || !shopName || !mallName || !account || !password) {
|
||||
msgEl.textContent = '请完整填写分组、店铺名、店铺商城名、账号、密码';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/shop-manage', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, account: account, password: password })
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, account: account, password: password })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
if (res.success) {
|
||||
document.getElementById('shopManageGroupSelect').value = '';
|
||||
document.getElementById('shopManageShopName').value = '';
|
||||
document.getElementById('shopManageMallName').value = '';
|
||||
document.getElementById('shopManageAccount').value = '';
|
||||
document.getElementById('shopManagePassword').value = '';
|
||||
msgEl.textContent = res.msg || '创建成功';
|
||||
@@ -1683,20 +1695,21 @@
|
||||
var itemId = document.getElementById('editShopManageId').value;
|
||||
var groupId = (document.getElementById('editShopManageGroupSelect').value || '').trim();
|
||||
var shopName = (document.getElementById('editShopManageShopName').value || '').trim();
|
||||
var mallName = (document.getElementById('editShopManageMallName').value || '').trim();
|
||||
var account = (document.getElementById('editShopManageAccount').value || '').trim();
|
||||
var password = (document.getElementById('editShopManagePassword').value || '').trim();
|
||||
var msgEl = document.getElementById('msgEditShopManage');
|
||||
msgEl.textContent = '';
|
||||
msgEl.className = 'msg';
|
||||
if (!groupId || !shopName || !account || !password) {
|
||||
msgEl.textContent = '请完整填写分组、店铺名、账号、密码';
|
||||
if (!groupId || !shopName || !mallName || !account || !password) {
|
||||
msgEl.textContent = '请完整填写分组、店铺名、店铺商城名、账号、密码';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/shop-manage/' + itemId, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, account: account, password: password })
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, account: account, password: password })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
|
||||
Reference in New Issue
Block a user