This commit is contained in:
parent
4ef9eeac5b
commit
8fcd26dcd7
|
|
@ -12,6 +12,7 @@
|
|||
namespace Beike\Admin\Http\Controllers;
|
||||
|
||||
use Beike\Admin\Http\Requests\CurrencyRequest;
|
||||
use Beike\Models\Order;
|
||||
use Beike\Repositories\CurrencyRepo;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
|
@ -66,9 +67,19 @@ class CurrencyController extends Controller
|
|||
|
||||
public function destroy(Request $request, int $currencyId)
|
||||
{
|
||||
CurrencyRepo::delete($currencyId);
|
||||
hook_action('admin.currency.destroy.after', $currencyId);
|
||||
try {
|
||||
$currency = CurrencyRepo::find($currencyId);
|
||||
$orderExist = Order::query()->where('currency_code', $currency->code)->exists();
|
||||
if ($orderExist) {
|
||||
throw new \Exception(trans('admin/currency.order_exist'));
|
||||
}
|
||||
|
||||
return json_success(trans('common.deleted_success'));
|
||||
CurrencyRepo::delete($currencyId);
|
||||
hook_action('admin.currency.destroy.after', $currencyId);
|
||||
|
||||
return json_success(trans('common.deleted_success'));
|
||||
} catch (\Exception $e) {
|
||||
return json_fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,17 @@ class CurrencyService
|
|||
return $amount;
|
||||
}
|
||||
|
||||
$symbol_left = $this->currencies[$currency]->symbol_left;
|
||||
$symbol_right = $this->currencies[$currency]->symbol_right;
|
||||
$decimal_place = $this->currencies[$currency]->decimal_place;
|
||||
$currencyRow = $this->currencies[$currency] ?? null;
|
||||
if (empty($currencyRow)) {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
$symbol_left = $currencyRow->symbol_left;
|
||||
$symbol_right = $currencyRow->symbol_right;
|
||||
$decimal_place = $currencyRow->decimal_place;
|
||||
|
||||
if (! $value) {
|
||||
$value = $this->currencies[$currency]->value;
|
||||
$value = $currencyRow->value;
|
||||
}
|
||||
|
||||
$amount = $value ? (float) $amount * $value : (float) $amount;
|
||||
|
|
|
|||
|
|
@ -16,4 +16,5 @@ return [
|
|||
'currencies_show' => 'Detail',
|
||||
'currencies_update' => 'Edit',
|
||||
'currencies_delete' => 'Delete',
|
||||
'order_exist' => 'This currency has orders in use and cannot be deleted!',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,33 +10,33 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'marketing_list' => 'Marketing',
|
||||
'marketing_index' => 'Index',
|
||||
'marketing_show' => 'Detail',
|
||||
'marketing_buy' => 'Buy',
|
||||
'marketing_download' => 'Download',
|
||||
'set_token' => 'Set Token',
|
||||
'get_token_text' => 'Log in to BeikeShop official website personal center - bind domain name, add current domain name',
|
||||
'get_token' => 'Get Token',
|
||||
'download_count' => 'download count',
|
||||
'last_update' => 'last update',
|
||||
'text_version' => 'version',
|
||||
'text_compatibility' => 'compatibility',
|
||||
'text_author' => 'plug-in author',
|
||||
'download_plugin' => 'download plugin',
|
||||
'download_description' => 'Plugin description',
|
||||
'text_free' => 'free',
|
||||
'btn_buy' => 'Buy',
|
||||
'text_pay' => 'Payment Amount',
|
||||
'select_pay' => 'select payment method',
|
||||
'wxpay' => 'WeChat scan code payment!',
|
||||
'pay_success_title' => 'Payment successful!',
|
||||
'pay_success_text' => 'The plug-in purchase is successful, click OK to refresh the page',
|
||||
'ali_pay_success' => 'Payment completed? ',
|
||||
'ali_pay_text' => 'Payment has been completed, please refresh the page',
|
||||
'version_compatible_text' => 'This plugin is not compatible with the current system version, please upgrade to <a href="' . config('beike.api_url') . '/download" target="_blank">Latest Version</a>',
|
||||
'to_update' => 'To Upgrade',
|
||||
'bk_register_hint' => 'Register a new account with <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a>',
|
||||
'bk_login_hint' => 'login with <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a> account',
|
||||
'marketing_list' => 'Marketing',
|
||||
'marketing_index' => 'Index',
|
||||
'marketing_show' => 'Detail',
|
||||
'marketing_buy' => 'Buy',
|
||||
'marketing_download' => 'Download',
|
||||
'set_token' => 'Set Token',
|
||||
'get_token_text' => 'Log in to BeikeShop official website personal center - bind domain name, add current domain name',
|
||||
'get_token' => 'Get Token',
|
||||
'download_count' => 'download count',
|
||||
'last_update' => 'last update',
|
||||
'text_version' => 'version',
|
||||
'text_compatibility' => 'compatibility',
|
||||
'text_author' => 'plug-in author',
|
||||
'download_plugin' => 'download plugin',
|
||||
'download_description' => 'Plugin description',
|
||||
'text_free' => 'free',
|
||||
'btn_buy' => 'Buy',
|
||||
'text_pay' => 'Payment Amount',
|
||||
'select_pay' => 'select payment method',
|
||||
'wxpay' => 'WeChat scan code payment!',
|
||||
'pay_success_title' => 'Payment successful!',
|
||||
'pay_success_text' => 'The plug-in purchase is successful, click OK to refresh the page',
|
||||
'ali_pay_success' => 'Payment completed? ',
|
||||
'ali_pay_text' => 'Payment has been completed, please refresh the page',
|
||||
'version_compatible_text' => 'This plugin is not compatible with the current system version, please upgrade to <a href="' . config('beike.api_url') . '/download" target="_blank">Latest Version</a>',
|
||||
'to_update' => 'To Upgrade',
|
||||
'bk_register_hint' => 'Register a new account with <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a>',
|
||||
'bk_login_hint' => 'login with <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a> account',
|
||||
'bind_bk_token' => 'Bind BeikeShop account and get Token automatically',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -16,4 +16,6 @@ return [
|
|||
'currencies_show' => '货币详情',
|
||||
'currencies_update' => '更新货币',
|
||||
'currencies_delete' => '删除货币',
|
||||
|
||||
'order_exist' => '该货币有订单正在使用, 无法删除!',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,34 +10,34 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'marketing_list' => '插件市场',
|
||||
'marketing_index' => '市场首页',
|
||||
'marketing_show' => '插件详情',
|
||||
'marketing_buy' => '购买插件',
|
||||
'marketing_download' => '下载插件',
|
||||
'set_token' => '设置 Token',
|
||||
'get_token_text' => '登录 BeikeShop 官网个人中心-绑定域名,添加当前域名',
|
||||
'get_token' => '点击获取 Token',
|
||||
'download_count' => '下载次数',
|
||||
'last_update' => '最后更新',
|
||||
'text_version' => '插件版本',
|
||||
'text_compatibility' => '兼容性',
|
||||
'text_author' => '插件作者',
|
||||
'download_plugin' => '下载插件',
|
||||
'download_description' => '插件描述',
|
||||
'text_free' => '免费',
|
||||
'btn_buy' => '购买',
|
||||
'text_pay' => '支付金额',
|
||||
'select_pay' => '选择支付方式',
|
||||
'wxpay' => '微信扫码支付!',
|
||||
'pay_success_title' => '支付成功!',
|
||||
'pay_success_text' => '插件购买成功,点击确定刷新页面',
|
||||
'ali_pay_success' => '已完成支付?',
|
||||
'ali_pay_text' => '已完成支付,请刷新页面',
|
||||
'ali_pay_text' => '已完成支付,请刷新页面',
|
||||
'version_compatible_text' => '该插件不兼容当前系统版本,请升级到 <a href="' . config('beike.api_url') . '/download" target="_blank">最新版本</a>',
|
||||
'to_update' => '去升级',
|
||||
'marketing_list' => '插件市场',
|
||||
'marketing_index' => '市场首页',
|
||||
'marketing_show' => '插件详情',
|
||||
'marketing_buy' => '购买插件',
|
||||
'marketing_download' => '下载插件',
|
||||
'set_token' => '设置 Token',
|
||||
'get_token_text' => '登录 BeikeShop 官网个人中心-绑定域名,添加当前域名',
|
||||
'get_token' => '点击获取 Token',
|
||||
'download_count' => '下载次数',
|
||||
'last_update' => '最后更新',
|
||||
'text_version' => '插件版本',
|
||||
'text_compatibility' => '兼容性',
|
||||
'text_author' => '插件作者',
|
||||
'download_plugin' => '下载插件',
|
||||
'download_description' => '插件描述',
|
||||
'text_free' => '免费',
|
||||
'btn_buy' => '购买',
|
||||
'text_pay' => '支付金额',
|
||||
'select_pay' => '选择支付方式',
|
||||
'wxpay' => '微信扫码支付!',
|
||||
'pay_success_title' => '支付成功!',
|
||||
'pay_success_text' => '插件购买成功,点击确定刷新页面',
|
||||
'ali_pay_success' => '已完成支付?',
|
||||
'ali_pay_text' => '已完成支付,请刷新页面',
|
||||
'ali_pay_text' => '已完成支付,请刷新页面',
|
||||
'version_compatible_text' => '该插件不兼容当前系统版本,请升级到 <a href="' . config('beike.api_url') . '/download" target="_blank">最新版本</a>',
|
||||
'to_update' => '去升级',
|
||||
'bk_register_hint' => '用 <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a> 上注册新账号',
|
||||
'bk_login_hint' => '用 <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a> 账号登录',
|
||||
'bind_bk_token' => '绑定BeikeShop账号,自动获取Token',
|
||||
'bk_login_hint' => '用 <a href="https://beikeshop.com/account" target="_blank">beikeshop.com</a> 账号登录',
|
||||
'bind_bk_token' => '绑定BeikeShop账号,自动获取Token',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -16,4 +16,5 @@ return [
|
|||
'currencies_show' => '貨幣詳情',
|
||||
'currencies_update' => '更新貨幣',
|
||||
'currencies_delete' => '刪除貨幣',
|
||||
'order_exist' => '該貨幣有訂單正在使用,無法删除!',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue