- 清除所有商品的步梯搬运收费配置,floor_fee和free_floor全部置0 - 订单详情、服务详情页移除步梯搬运费相关显示项 - 提现规则调整为全部金额需后台审核,取消小额免审自动转账 - 新增师傅端收支账单明细页面,支持查看结算和提现记录 - 更新提现相关配置,降低最低提现金额至0.1元,取消提现次数限制
53 行
1.8 KiB
PHP
53 行
1.8 KiB
PHP
<?php
|
|
|
|
define('APP_PATH', __DIR__ . '/../server/application/');
|
|
require __DIR__ . '/../server/thinkphp/base.php';
|
|
\think\App::initCommon();
|
|
|
|
use app\api\controller\Home;
|
|
use app\admin\controller\Service;
|
|
use think\Request;
|
|
|
|
$controller = new ReflectionClass(Service::class);
|
|
$serviceAdmin = $controller->newInstanceWithoutConstructor();
|
|
$request = $controller->getProperty('request');
|
|
$request->setAccessible(true);
|
|
$request->setValue($serviceAdmin, Request::create('/service/add', 'POST', ['floor_fee_mode' => 'paid']));
|
|
$normalizeFloorFees = $controller->getMethod('normalizeFloorFees');
|
|
$normalizeFloorFees->setAccessible(true);
|
|
try {
|
|
$free = $normalizeFloorFees->invoke($serviceAdmin, ['floor_fee' => '0', 'free_floor' => '2']);
|
|
} catch (\think\exception\ValidateException $error) {
|
|
fwrite(STDERR, "Entering 0 yuan should enable free carry: " . $error->getMessage() . "\n");
|
|
exit(1);
|
|
}
|
|
if ((float)$free['floor_fee'] !== 0.0 || (int)$free['free_floor'] !== 0) {
|
|
fwrite(STDERR, "Entering 0 yuan should store free carry for all floors.\n");
|
|
exit(1);
|
|
}
|
|
|
|
$product = ['price_type' => 'fixed', 'base_price' => '80.00', 'floor_fee' => '0.00', 'free_floor' => 2];
|
|
$address = ['floor' => 5, 'has_elevator' => 0, 'urgent' => 0];
|
|
|
|
function assertFloorFee(array $product, array $address, float $expected)
|
|
{
|
|
$amount = Home::calcAmount($product, $address);
|
|
if ($amount['floor_amount'] !== $expected || $amount['total_amount'] !== 80.0 + $expected) {
|
|
fwrite(STDERR, "Expected floor fee {$expected}; calculated {$amount['floor_amount']}\n");
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
assertFloorFee($product, $address, 0.0);
|
|
|
|
$product['floor_fee'] = '8.50';
|
|
assertFloorFee($product, $address, 0.0);
|
|
|
|
$product['free_floor'] = 0;
|
|
assertFloorFee($product, $address, 0.0);
|
|
|
|
$address['has_elevator'] = 1;
|
|
assertFloorFee($product, $address, 0.0);
|
|
|
|
echo "Checkout floor fee tests passed\n";
|