|
@@ -23,11 +23,11 @@ class MexOrderLogic
|
|
|
* @param int $userId 用户ID
|
|
* @param int $userId 用户ID
|
|
|
* @param int $itemId 商品ID
|
|
* @param int $itemId 商品ID
|
|
|
* @param int $quantity 数量
|
|
* @param int $quantity 数量
|
|
|
- * @param string $price 价格
|
|
|
|
|
|
|
+ * @param float $price 价格(信任Fund模块的数据处理)
|
|
|
* @param FUND_CURRENCY_TYPE|null $currencyType 币种类型,默认使用钻石
|
|
* @param FUND_CURRENCY_TYPE|null $currencyType 币种类型,默认使用钻石
|
|
|
* @return array 操作结果
|
|
* @return array 操作结果
|
|
|
*/
|
|
*/
|
|
|
- public static function createSellOrder(int $userId, int $itemId, int $quantity, string $price, ?FUND_CURRENCY_TYPE $currencyType = null): array
|
|
|
|
|
|
|
+ public static function createSellOrder(int $userId, int $itemId, int $quantity, float $price, ?FUND_CURRENCY_TYPE $currencyType = null): array
|
|
|
{
|
|
{
|
|
|
// 获取币种类型,默认使用钻石
|
|
// 获取币种类型,默认使用钻石
|
|
|
$currencyType = $currencyType ?? FundLogic::getDefaultCurrency();
|
|
$currencyType = $currencyType ?? FundLogic::getDefaultCurrency();
|
|
@@ -38,7 +38,8 @@ class MexOrderLogic
|
|
|
return ['success' => false, 'message' => '商品未配置价格信息'];
|
|
return ['success' => false, 'message' => '商品未配置价格信息'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $totalAmount = bcmul($price, $quantity, 5);
|
|
|
|
|
|
|
+ // 直接计算总金额,信任Fund模块的精度处理
|
|
|
|
|
+ $totalAmount = $price * $quantity;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
$order = MexOrder::create([
|
|
$order = MexOrder::create([
|
|
@@ -71,11 +72,11 @@ class MexOrderLogic
|
|
|
* @param int $userId 用户ID
|
|
* @param int $userId 用户ID
|
|
|
* @param int $itemId 商品ID
|
|
* @param int $itemId 商品ID
|
|
|
* @param int $quantity 数量
|
|
* @param int $quantity 数量
|
|
|
- * @param string $price 价格
|
|
|
|
|
|
|
+ * @param float $price 价格(信任Fund模块的数据处理)
|
|
|
* @param FUND_CURRENCY_TYPE|null $currencyType 币种类型,默认使用钻石
|
|
* @param FUND_CURRENCY_TYPE|null $currencyType 币种类型,默认使用钻石
|
|
|
* @return array 操作结果
|
|
* @return array 操作结果
|
|
|
*/
|
|
*/
|
|
|
- public static function createBuyOrder(int $userId, int $itemId, int $quantity, string $price, ?FUND_CURRENCY_TYPE $currencyType = null): array
|
|
|
|
|
|
|
+ public static function createBuyOrder(int $userId, int $itemId, int $quantity, float $price, ?FUND_CURRENCY_TYPE $currencyType = null): array
|
|
|
{
|
|
{
|
|
|
// 获取币种类型,默认使用钻石
|
|
// 获取币种类型,默认使用钻石
|
|
|
$currencyType = $currencyType ?? FundLogic::getDefaultCurrency();
|
|
$currencyType = $currencyType ?? FundLogic::getDefaultCurrency();
|
|
@@ -86,7 +87,8 @@ class MexOrderLogic
|
|
|
return ['success' => false, 'message' => '商品未配置价格信息'];
|
|
return ['success' => false, 'message' => '商品未配置价格信息'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $totalAmount = bcmul($price, $quantity, 5);
|
|
|
|
|
|
|
+ // 直接计算总金额,信任Fund模块的精度处理
|
|
|
|
|
+ $totalAmount = $price * $quantity;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
$order = MexOrder::create([
|
|
$order = MexOrder::create([
|