修改部分文本

This commit is contained in:
wystan_rin 2024-11-20 09:49:25 +08:00
parent f40dd30673
commit 87f497a8de
5 changed files with 43 additions and 64 deletions

View File

@ -35,8 +35,8 @@ def create_order():
return jsonify({ return jsonify({
"message": "wrong payment method" "message": "wrong payment method"
}), 400 }), 400
quant = data.get('amount', 0) quant = int(data.get('amount', 0))
if quant < config.order.min_quant: if quant < config.order.get_int("min_quant"):
return jsonify({ return jsonify({
"message": "Amount below minimum limit." "message": "Amount below minimum limit."
}), 400 }), 400

View File

@ -87,9 +87,10 @@ class Setting:
self[k] = getattr(argument_parser, k) self[k] = getattr(argument_parser, k)
def get(self, item, default=None): def get(self, item, default=None):
item = item.lower()
if item not in self.__dict__ and self._parent is not None: if item not in self.__dict__ and self._parent is not None:
return self._parent.get(item.lower(), default) return self._parent.get(item, default)
return default return self.__dict__.get(item, default)
def get_int(self, item): def get_int(self, item):
return int(self.get(item)) return int(self.get(item))
@ -119,6 +120,9 @@ class Setting:
for k, v in self.__dict__.items(): for k, v in self.__dict__.items():
yield k, v yield k, v
def __contains__(self, item):
return item.lower() in self.__dict__
def __str__(self): def __str__(self):
def _str_helper(settings, visited=None, indent_count=0): def _str_helper(settings, visited=None, indent_count=0):
if visited is None: if visited is None:
@ -138,6 +142,7 @@ class Setting:
else: else:
lines.append(f"{indent_str}{key}: {value}") lines.append(f"{indent_str}{key}: {value}")
return '\n'.join(lines) return '\n'.join(lines)
return _str_helper(self) return _str_helper(self)
def __repr__(self): def __repr__(self):
@ -157,6 +162,7 @@ class Setting:
else: else:
lines.append(f"{key}={value}") lines.append(f"{key}={value}")
return f'Setting({", ".join(lines)})' return f'Setting({", ".join(lines)})'
return _str_helper(self) return _str_helper(self)

View File

@ -19,7 +19,7 @@ class OrderService:
order_id = f"{date_str}-{unique_id}" order_id = f"{date_str}-{unique_id}"
create_timestamp = self.order_repo.create(order_id, quant, create_timestamp = self.order_repo.create(order_id, quant,
address, self.config['PaymentAddresses']) address, self.config['PaymentAddresses']['usdt'])
return order_id, create_timestamp return order_id, create_timestamp
def finish_order(self, order_id): def finish_order(self, order_id):

View File

@ -15,9 +15,16 @@
<div class="tips"> <div class="tips">
<p>Kind Reminder:</p> <p>Kind Reminder:</p>
<ol> <ol>
<li>Currently, only USDT deposits are supported, and balances can be withdrawn. Other deposit methods are under development. Please stay tuned for announcements regarding their release.</li> <li>Currently, only USDT deposits are supported, and balances can be withdrawn. Other deposit methods are
<li>The deposit amount will be credited within 1 minute after payment. If it does not arrive within 5 minutes, please contact customer support and provide your U address, deposit screenshot, transaction ID, and account name.</li> under development. Please stay tuned for announcements regarding their release.
<li>The actual amount credited for USDT deposits must match the amount displayed on the USDT deposit payment page; otherwise, the deposit will not be credited. Please be informed.</li> </li>
<li>The deposit amount will be credited within 1 minute after payment. If it does not arrive within 5
minutes, please contact customer support and provide your U address, deposit screenshot, transaction ID,
and account name.
</li>
<li>The actual amount credited for USDT deposits must match the amount displayed on the USDT deposit payment
page; otherwise, the deposit will not be credited. Please be informed.
</li>
</ol> </ol>
<div class="special-notice"> <div class="special-notice">
<strong>Special Notice:</strong> Please ensure the recipient address is correct when making a transfer! <strong>Special Notice:</strong> Please ensure the recipient address is correct when making a transfer!
@ -60,27 +67,27 @@
id="el-id-7163-12"> id="el-id-7163-12">
<label class="el-radio is-bordered is-checked el-radio--default" data-v-0f66bda2=""> <label class="el-radio is-bordered is-checked el-radio--default" data-v-0f66bda2="">
<span class="el-radio__input is-checked"> <span class="el-radio__input is-checked">
<input class="el-radio__original" name="el-id-7163-6" type="radio" value="30" <input class="el-radio__original" name="el-id-7163-6" type="radio"
onclick="setAmountValue(this.value)"/> value="30"/>
<span class="el-radio__inner"></span> <span class="el-radio__inner"></span>
</span> </span>
<span class="el-radio__label">30U</span> <span class="el-radio__label">30USDT</span>
</label>
<label class="el-radio is-bordered el-radio--default" data-v-0f66bda2="">
<span class="el-radio__input">
<input class="el-radio__original" name="el-id-7163-6" type="radio" value="90"
onclick="setAmountValue(this.value)"/>
<span class="el-radio__inner"></span>
</span>
<span class="el-radio__label">90U</span>
</label> </label>
<label class="el-radio is-bordered el-radio--default" data-v-0f66bda2=""> <label class="el-radio is-bordered el-radio--default" data-v-0f66bda2="">
<span class="el-radio__input"> <span class="el-radio__input">
<input class="el-radio__original" name="el-id-7163-6" type="radio" <input class="el-radio__original" name="el-id-7163-6" type="radio"
value="150" onclick="setAmountValue(this.value)"/> value="90"/>
<span class="el-radio__inner"></span> <span class="el-radio__inner"></span>
</span> </span>
<span class="el-radio__label">150U</span> <span class="el-radio__label">90USDT</span>
</label>
<label class="el-radio is-bordered el-radio--default" data-v-0f66bda2="">
<span class="el-radio__input">
<input class="el-radio__original" name="el-id-7163-6" type="radio"
value="150"/>
<span class="el-radio__inner"></span>
</span>
<span class="el-radio__label">150USDT</span>
</label> </label>
</div> </div>
</div> </div>

View File

@ -47,7 +47,7 @@ function finishOrder() {
return; return;
} }
const url = `/finishOrder?orderID=${orderID}`; const url = `http://127.0.0.1:5000/finishOrder?orderID=${orderID}`;
return fetch(url, { return fetch(url, {
method: 'GET' method: 'GET'
@ -95,36 +95,6 @@ function handleMultipleAddresses(walletAddresses) {
openAddressModal(); openAddressModal();
} }
// Function to show the modal with an image
function showImageModal(imageUrl, walletAddress) {
// Find the modal and modal body
const modal = document.getElementById('modal');
const modalBody = document.getElementById('modalBody');
// Clear any previous content
modalBody.innerHTML = '';
// Create an image element
const imageElement = document.createElement('img');
imageElement.src = imageUrl;
imageElement.alt = 'Image';
imageElement.style.maxWidth = '100%';
imageElement.style.maxHeight = '80vh'; // Limit the height for better UX
// Create a div to display the wallet address
const addressDiv = document.createElement('div');
addressDiv.textContent = walletAddress;
addressDiv.style.marginTop = '10px';
addressDiv.style.fontSize = '16px';
addressDiv.style.color = '#333';
// Add image and address to modal body
modalBody.appendChild(imageElement);
modalBody.appendChild(addressDiv);
openAddressModal();
}
function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) { function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) {
document.getElementById('paymentModal').style.display = 'flex'; document.getElementById('paymentModal').style.display = 'flex';
@ -184,11 +154,7 @@ function promptUserForPaymentMethod() {
} }
function handleError(message) { function handleError(message) {
const errorDiv = document.getElementById('error'); alert(message)
errorDiv.innerText = `错误:${message}`;
errorDiv.classList.remove('hidden');
document.getElementById('message').classList.add('hidden');
document.getElementById('addresses').classList.add('hidden');
} }
function promptUserForAddress() { function promptUserForAddress() {