feat(withdraw): 落地方案B一体化商城余额提现与手续费内扣模式,完善多端打款退款与对账闭环
这个提交包含在:
@@ -104,8 +104,12 @@ class ScoreShop extends Common
|
||||
}
|
||||
|
||||
|
||||
public function skus($goods_id)
|
||||
public function skus($goods_id = null)
|
||||
{
|
||||
if (empty($goods_id)) {
|
||||
$goods_id = $this->request->param('goods_id');
|
||||
}
|
||||
$goods = $this->goodsModel->where('id', $goods_id)->find();
|
||||
$skus = SkuModel::with('children')->where('goods_id', $goods_id)->where('parent_id', 0)->order('weigh', 'desc')->order('id', 'asc')->select();
|
||||
$skuPrices = SkuPriceModel::with(['score_sku_price'])->where('goods_id', $goods_id)->order('weigh', 'desc')->order('id', 'asc')->select();
|
||||
|
||||
@@ -125,6 +129,7 @@ class ScoreShop extends Common
|
||||
}
|
||||
|
||||
$this->success('获取成功', null, [
|
||||
'goods' => $goods,
|
||||
'skus' => $skus,
|
||||
'sku_prices' => $skuPrices,
|
||||
'score_sku_prices' => $scoreSkuPrices
|
||||
@@ -137,6 +142,9 @@ class ScoreShop extends Common
|
||||
*/
|
||||
public function edit($goods_id = null)
|
||||
{
|
||||
if (empty($goods_id)) {
|
||||
$goods_id = $this->request->param('goods_id');
|
||||
}
|
||||
if (!$this->request->isAjax()) {
|
||||
return $this->view->fetch('add');
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class Order extends Common
|
||||
}
|
||||
|
||||
/**
|
||||
* 收益中心分成明细:即时奖列人;均分只汇总人数/人均
|
||||
* 收益中心分成明细:精准查询本单实际收益(即时奖列人、均分奖按本单贡献及关联批次真实核算)
|
||||
*/
|
||||
protected function buildPartnerSplit($order)
|
||||
{
|
||||
@@ -206,6 +206,9 @@ class Order extends Common
|
||||
return [
|
||||
'items' => [],
|
||||
'total_cash' => '0.00',
|
||||
'total_instant_cash' => '0.00',
|
||||
'total_share_cash' => '0.00',
|
||||
'total_all_cash' => '0.00',
|
||||
'total_voucher' => '0.00',
|
||||
'settle_date' => null,
|
||||
'has_data' => false,
|
||||
@@ -214,10 +217,11 @@ class Order extends Common
|
||||
|
||||
$shareTypes = ['venue_share', 'county_share', 'madow_share'];
|
||||
$items = [];
|
||||
$totalCash = 0;
|
||||
$totalInstantCash = 0;
|
||||
$totalShareCash = 0;
|
||||
$totalVoucher = 0;
|
||||
|
||||
// 1. 查询即时收益流水
|
||||
// 1. 查询即时收益流水(完全归属于本单的直接奖励)
|
||||
$rows = \app\admin\model\shopro\partner\Reward::with(['user'])
|
||||
->where('order_id', $orderId)
|
||||
->order('id', 'asc')
|
||||
@@ -234,7 +238,7 @@ class Order extends Common
|
||||
$status = intval($row->status ?? 0);
|
||||
|
||||
if ($status === 1 && $amount > 0) {
|
||||
$totalCash = round($totalCash + $amount, 2);
|
||||
$totalInstantCash = round($totalInstantCash + $amount, 2);
|
||||
}
|
||||
if ($type === 'voucher_grant' && $status === 1 && $baseAmount > 0) {
|
||||
$totalVoucher = round($totalVoucher + $baseAmount, 2);
|
||||
@@ -286,7 +290,7 @@ class Order extends Common
|
||||
$cCommission = round((float) ($crow->commission ?? 0), 2);
|
||||
$cStatus = intval($crow->status ?? 0);
|
||||
if ($cStatus === 1 && $cCommission > 0) {
|
||||
$totalCash = round($totalCash + $cCommission, 2);
|
||||
$totalInstantCash = round($totalInstantCash + $cCommission, 2);
|
||||
}
|
||||
$items[] = [
|
||||
'display' => 'user',
|
||||
@@ -314,11 +318,12 @@ class Order extends Common
|
||||
// 忽略非核心分销查询异常
|
||||
}
|
||||
|
||||
// 3. 统计支付日日结均分奖池概况
|
||||
$settleDate = null;
|
||||
// 3. 精准查询均分加权分红(只核算本单真实注入奖池贡献及其实际参与结算批次)
|
||||
$paidRaw = is_array($order)
|
||||
? ($order['paid_time'] ?? null)
|
||||
: ($order->getData('paid_time') ?? ($order['paid_time'] ?? null));
|
||||
$paidTs = 0;
|
||||
$settleDate = null;
|
||||
if ($paidRaw) {
|
||||
$paidTs = is_numeric($paidRaw) ? intval($paidRaw) : strtotime((string) $paidRaw);
|
||||
if ($paidTs > 0) {
|
||||
@@ -326,126 +331,265 @@ class Order extends Common
|
||||
}
|
||||
}
|
||||
|
||||
if ($settleDate) {
|
||||
$dayStart = strtotime($settleDate . ' 00:00:00');
|
||||
$dayEnd = strtotime($settleDate . ' 23:59:59');
|
||||
$orderStatus = (string) (is_array($order) ? ($order['status'] ?? '') : ($order->status ?? ''));
|
||||
$isPaid = in_array($orderStatus, ['paid', 'completed'], true) || ($paidTs > 0);
|
||||
|
||||
foreach ($shareTypes as $type) {
|
||||
$shareRows = \app\admin\model\shopro\partner\Reward::where(function ($q) use ($settleDate, $dayStart, $dayEnd) {
|
||||
$q->where('settle_date', $settleDate)
|
||||
->whereOr(function ($q2) use ($dayStart, $dayEnd) {
|
||||
$q2->whereNull('settle_date')->whereBetween('createtime', [$dayStart, $dayEnd]);
|
||||
});
|
||||
})
|
||||
->where('reward_type', $type)
|
||||
->where('status', 1)
|
||||
->where('user_id', '>', 0)
|
||||
->select();
|
||||
if ($isPaid) {
|
||||
// 订单 ext 数据
|
||||
$orderExtRaw = is_array($order) ? ($order['ext'] ?? []) : ($order->ext ?? []);
|
||||
$orderExt = is_array($orderExtRaw) ? $orderExtRaw : (json_decode($orderExtRaw ?: '', true) ?: []);
|
||||
|
||||
$distinctUsers = [];
|
||||
$totalAmount = 0;
|
||||
$totalMadow = 0;
|
||||
foreach ($shareRows as $sr) {
|
||||
$totalAmount = round($totalAmount + (float) ($sr->amount ?? 0), 2);
|
||||
$totalMadow = function_exists('bcadd')
|
||||
? (float) bcadd((string) $totalMadow, (string) ($sr->madow ?? 0), 8)
|
||||
: ($totalMadow + (float) ($sr->madow ?? 0));
|
||||
$distinctUsers[intval($sr->user_id)] = true;
|
||||
// 获取本单的规则设定贡献
|
||||
$orderRules = \addons\shopro\service\partner\PartnerConfig::getOrderEffectiveRules($order);
|
||||
$rewardService = new \addons\shopro\service\partner\PartnerRewardService();
|
||||
$qualifiedPayFee = $rewardService->getQualifiedPayFee($order);
|
||||
|
||||
$venueRuleContrib = isset($orderRules['venue_share']) && is_numeric($orderRules['venue_share'])
|
||||
? round((float) $orderRules['venue_share'], 2)
|
||||
: (float) \addons\shopro\service\partner\PartnerConfig::get('partner_venue_share_per_order', 100);
|
||||
|
||||
$countyRuleContrib = isset($orderRules['county_share']) && is_numeric($orderRules['county_share'])
|
||||
? round((float) $orderRules['county_share'], 2)
|
||||
: (float) \addons\shopro\service\partner\PartnerConfig::get('partner_county_share_per_order', 50);
|
||||
|
||||
// 精准查找包含本单 order_id 的实际结算批次
|
||||
$matchedBatches = [];
|
||||
$batchCandidates = \app\admin\model\shopro\partner\Reward::where('order_id', '<', 0)
|
||||
->whereIn('reward_type', $shareTypes)
|
||||
->where('ext', 'like', '%' . $orderId . '%')
|
||||
->order('id', 'asc')
|
||||
->select();
|
||||
|
||||
foreach ($batchCandidates as $bc) {
|
||||
$bcExt = is_array($bc->ext) ? $bc->ext : (json_decode($bc->getData('ext') ?? '', true) ?: []);
|
||||
if (!empty($bcExt['orders']) && is_array($bcExt['orders']) && in_array($orderId, $bcExt['orders'])) {
|
||||
$matchedBatches[$bc->reward_type][] = [
|
||||
'model' => $bc,
|
||||
'ext' => $bcExt,
|
||||
];
|
||||
}
|
||||
$userCount = count($distinctUsers);
|
||||
}
|
||||
|
||||
if ($userCount <= 0) {
|
||||
// 分母为 0 进平台的记录
|
||||
$platRows = \app\admin\model\shopro\partner\Reward::where(function ($q) use ($settleDate, $dayStart, $dayEnd) {
|
||||
$q->where('settle_date', $settleDate)
|
||||
->whereOr(function ($q2) use ($dayStart, $dayEnd) {
|
||||
$q2->whereNull('settle_date')->whereBetween('createtime', [$dayStart, $dayEnd]);
|
||||
});
|
||||
})
|
||||
->where('reward_type', $type)
|
||||
->where('status', 1)
|
||||
->where('user_id', 0)
|
||||
->select();
|
||||
if (empty($platRows) || count($platRows) <= 0) {
|
||||
continue;
|
||||
// 获取当前活跃达标人数(备用)
|
||||
$activeService = new \addons\shopro\service\partner\ActiveService();
|
||||
$windowStart = time() - (\addons\shopro\service\partner\PartnerConfig::activeDays() - 1) * 86400;
|
||||
$activeVenueCount = count($activeService->activeUserIds($windowStart, time(), ['is_venue' => 1]));
|
||||
$activeCountyCount = count($activeService->activeUserIds($windowStart, time(), ['is_county' => 1]));
|
||||
$activeTasterCount = count($activeService->activeUserIds($windowStart, time()));
|
||||
|
||||
$shareDefinitions = [
|
||||
'venue_share' => [
|
||||
'name' => '酒道馆加权奖',
|
||||
'role' => 'venue',
|
||||
'role_text' => '酒道馆',
|
||||
'unit' => '元',
|
||||
'order_contrib' => $venueRuleContrib,
|
||||
'wallet_type' => \addons\shopro\service\partner\PartnerConfig::rewardWalletType(),
|
||||
'wallet_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardWalletType() === 'money' ? '商城余额' : '佣金钱包',
|
||||
'settled_key' => 'venue_settled',
|
||||
'default_user_count' => $activeVenueCount,
|
||||
],
|
||||
'county_share' => [
|
||||
'name' => '区县加权奖',
|
||||
'role' => 'county',
|
||||
'role_text' => '区县',
|
||||
'unit' => '元',
|
||||
'order_contrib' => $countyRuleContrib,
|
||||
'wallet_type' => \addons\shopro\service\partner\PartnerConfig::rewardWalletType(),
|
||||
'wallet_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardWalletType() === 'money' ? '商城余额' : '佣金钱包',
|
||||
'settled_key' => 'county_settled',
|
||||
'default_user_count' => $activeCountyCount,
|
||||
],
|
||||
'madow_share' => [
|
||||
'name' => '每日获得dmepa',
|
||||
'role' => 'taster',
|
||||
'role_text' => '品酒师',
|
||||
'unit' => 'dmepa',
|
||||
'order_contrib' => $qualifiedPayFee,
|
||||
'wallet_type' => 'madow',
|
||||
'wallet_type_text' => '分红dmepa',
|
||||
'settled_key' => 'madow_settled',
|
||||
'default_user_count' => $activeTasterCount,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($shareDefinitions as $type => $def) {
|
||||
$batchList = $matchedBatches[$type] ?? [];
|
||||
$contribPool = round((float) $def['order_contrib'], 2);
|
||||
|
||||
if (!empty($batchList)) {
|
||||
// 1. 已在实际批次中结算完成
|
||||
$firstItem = $batchList[0];
|
||||
$firstModel = $firstItem['model'];
|
||||
$batchExt = $firstItem['ext'];
|
||||
|
||||
$ordersInBatch = is_array($batchExt['orders'] ?? null) ? $batchExt['orders'] : [];
|
||||
$batchOrderCount = max(1, count($ordersInBatch));
|
||||
|
||||
// 参与用户数
|
||||
$userCount = intval($batchExt['share_user_count'] ?? count(array_filter($batchList, function ($r) {
|
||||
return intval($r['model']->user_id ?? 0) > 0;
|
||||
})));
|
||||
|
||||
if ($type === 'venue_share' || $type === 'county_share') {
|
||||
$totalShareCash = round($totalShareCash + $contribPool, 2);
|
||||
}
|
||||
$platAmount = 0;
|
||||
$platMadow = 0;
|
||||
foreach ($platRows as $pr) {
|
||||
$platAmount = round($platAmount + (float) ($pr->amount ?? 0), 2);
|
||||
$platMadow = function_exists('bcadd')
|
||||
? (float) bcadd((string) $platMadow, (string) ($pr->madow ?? 0), 8)
|
||||
: ($platMadow + (float) ($pr->madow ?? 0));
|
||||
|
||||
$batchTotalPool = round((float) ($batchExt['pool'] ?? ($batchExt['gmv'] ?? $firstModel->base_amount)), 2);
|
||||
|
||||
if ($userCount > 0) {
|
||||
if ($type === 'madow_share') {
|
||||
$eachContrib = function_exists('bcdiv')
|
||||
? bcdiv((string) $contribPool, (string) $userCount, 8)
|
||||
: number_format($contribPool / $userCount, 8, '.', '');
|
||||
$eachContribText = \addons\shopro\service\partner\IdentityService::formatMadow($eachContrib);
|
||||
|
||||
$batchEach = function_exists('bcdiv')
|
||||
? bcdiv((string) $batchTotalPool, (string) $userCount, 8)
|
||||
: number_format($batchTotalPool / $userCount, 8, '.', '');
|
||||
$batchEachText = \addons\shopro\service\partner\IdentityService::formatMadow($batchEach);
|
||||
|
||||
$amountText = $eachContribText . ' 枚/人';
|
||||
$tip = $batchOrderCount > 1
|
||||
? "日结均分(结算批次 #{$firstModel->order_id},合并 {$batchOrderCount} 单)"
|
||||
: "日结均分(结算批次 #{$firstModel->order_id})";
|
||||
$formula = $batchOrderCount > 1
|
||||
? "本单GMV {$contribPool} / {$userCount} = {$eachContribText} 枚/人(批次合计 GMV {$batchTotalPool} / {$userCount} = {$batchEachText})"
|
||||
: "GMV {$contribPool} / {$userCount} = {$eachContribText} 枚/人";
|
||||
} else {
|
||||
$eachContrib = function_exists('bcdiv')
|
||||
? bcdiv((string) $contribPool, (string) $userCount, 2)
|
||||
: number_format($contribPool / $userCount, 2, '.', '');
|
||||
$batchEach = function_exists('bcdiv')
|
||||
? bcdiv((string) $batchTotalPool, (string) $userCount, 2)
|
||||
: number_format($batchTotalPool / $userCount, 2, '.', '');
|
||||
|
||||
$amountText = '¥' . $eachContrib . '/人';
|
||||
$tip = $batchOrderCount > 1
|
||||
? "日结均分(结算批次 #{$firstModel->order_id},合并 {$batchOrderCount} 单)"
|
||||
: "日结均分(结算批次 #{$firstModel->order_id})";
|
||||
$formula = $batchOrderCount > 1
|
||||
? "本单贡献 {$contribPool} / {$userCount} = {$eachContrib}(批次总奖池 {$batchTotalPool} / {$userCount} = {$batchEach})"
|
||||
: "奖池 {$contribPool} / {$userCount} = {$eachContrib}";
|
||||
}
|
||||
|
||||
$items[] = [
|
||||
'display' => 'share',
|
||||
'id' => intval($firstModel->id),
|
||||
'reward_type' => $type,
|
||||
'reward_type_text' => $def['name'],
|
||||
'role' => $def['role'],
|
||||
'role_text' => $def['role_text'],
|
||||
'user_id' => 0,
|
||||
'user' => null,
|
||||
'user_count' => $userCount,
|
||||
'each_amount' => $type === 'madow_share' ? '0.00' : $eachContrib,
|
||||
'each_madow' => $type === 'madow_share' ? $eachContribText : '0',
|
||||
'total_amount' => number_format($contribPool, 2, '.', ''),
|
||||
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($contribPool),
|
||||
'batch_total_amount' => number_format($batchTotalPool, 2, '.', ''),
|
||||
'amount_text' => $amountText,
|
||||
'wallet_type' => $def['wallet_type'],
|
||||
'wallet_type_text' => $def['wallet_type_text'],
|
||||
'settle_date' => $firstModel->settle_date ?: $settleDate,
|
||||
'status' => 1,
|
||||
'status_text' => '已入账',
|
||||
'unit' => $def['unit'],
|
||||
'formula' => $formula,
|
||||
'skip_reason_text' => '',
|
||||
'tip' => $tip,
|
||||
];
|
||||
} else {
|
||||
// 分母为 0 进平台留存
|
||||
$tip = "分母为0,本单奖池进平台留存";
|
||||
$items[] = [
|
||||
'display' => 'share',
|
||||
'id' => intval($firstModel->id),
|
||||
'reward_type' => $type,
|
||||
'reward_type_text' => $def['name'],
|
||||
'role' => 'system',
|
||||
'role_text' => '平台',
|
||||
'user_id' => 0,
|
||||
'user' => null,
|
||||
'user_count' => 0,
|
||||
'each_amount' => '0.00',
|
||||
'each_madow' => '0',
|
||||
'total_amount' => number_format($contribPool, 2, '.', ''),
|
||||
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($contribPool),
|
||||
'batch_total_amount' => number_format($batchTotalPool, 2, '.', ''),
|
||||
'amount_text' => $type === 'madow_share' ? (\addons\shopro\service\partner\IdentityService::formatMadow($contribPool) . ' dmepa') : ('¥' . number_format($contribPool, 2, '.', '')),
|
||||
'wallet_type' => 'system',
|
||||
'wallet_type_text' => '平台留存',
|
||||
'settle_date' => $firstModel->settle_date ?: $settleDate,
|
||||
'status' => 1,
|
||||
'status_text' => '已入账',
|
||||
'unit' => $def['unit'],
|
||||
'formula' => "参与人数为0,本单贡献 {$contribPool} 进平台",
|
||||
'skip_reason_text' => '',
|
||||
'tip' => $tip,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
// 2. 尚未结算(待结算状态,展示本单贡献与预估)
|
||||
$userCount = $def['default_user_count'];
|
||||
if ($userCount > 0) {
|
||||
if ($type === 'madow_share') {
|
||||
$eachContrib = function_exists('bcdiv')
|
||||
? bcdiv((string) $contribPool, (string) $userCount, 8)
|
||||
: number_format($contribPool / $userCount, 8, '.', '');
|
||||
$eachContribText = \addons\shopro\service\partner\IdentityService::formatMadow($eachContrib);
|
||||
$amountText = $eachContribText . ' 枚/人 (预估)';
|
||||
$formula = "待结算预估:本单GMV {$contribPool} / 当前达标 {$userCount} 人 = {$eachContribText} 枚/人";
|
||||
} else {
|
||||
$eachContrib = function_exists('bcdiv')
|
||||
? bcdiv((string) $contribPool, (string) $userCount, 2)
|
||||
: number_format($contribPool / $userCount, 2, '.', '');
|
||||
$amountText = '¥' . $eachContrib . '/人 (预估)';
|
||||
$formula = "待结算预估:本单贡献 {$contribPool} / 当前达标 {$userCount} 人 = {$eachContrib}";
|
||||
}
|
||||
} else {
|
||||
$amountText = $type === 'madow_share' ? '0 dmepa' : '¥0.00';
|
||||
$formula = "当前达标人数为0,结算时若无合格者将进平台留存";
|
||||
}
|
||||
$platform = $platRows[0];
|
||||
$amountText = $type === 'madow_share'
|
||||
? \addons\shopro\service\partner\IdentityService::formatMadow($platMadow) . ' dmepa'
|
||||
: '¥' . number_format($platAmount, 2, '.', '');
|
||||
|
||||
$items[] = [
|
||||
'display' => 'share',
|
||||
'id' => intval($platform->id ?? 0),
|
||||
'id' => 0,
|
||||
'reward_type' => $type,
|
||||
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
|
||||
'role' => 'system',
|
||||
'role_text' => '平台',
|
||||
'reward_type_text' => $def['name'],
|
||||
'role' => $def['role'],
|
||||
'role_text' => $def['role_text'],
|
||||
'user_id' => 0,
|
||||
'user' => null,
|
||||
'user_count' => 0,
|
||||
'each_amount' => '0.00',
|
||||
'each_madow' => '0',
|
||||
'total_amount' => number_format($platAmount, 2, '.', ''),
|
||||
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($platMadow),
|
||||
'user_count' => $userCount,
|
||||
'each_amount' => $type === 'madow_share' ? '0.00' : ($userCount > 0 ? $eachContrib : '0.00'),
|
||||
'each_madow' => $type === 'madow_share' ? ($userCount > 0 ? $eachContribText : '0') : '0',
|
||||
'total_amount' => number_format($contribPool, 2, '.', ''),
|
||||
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($contribPool),
|
||||
'batch_total_amount' => number_format($contribPool, 2, '.', ''),
|
||||
'amount_text' => $amountText,
|
||||
'wallet_type' => 'system',
|
||||
'wallet_type_text' => '平台留存',
|
||||
'wallet_type' => $def['wallet_type'],
|
||||
'wallet_type_text' => $def['wallet_type_text'],
|
||||
'settle_date' => $settleDate,
|
||||
'status' => 1,
|
||||
'status_text' => '已入账',
|
||||
'unit' => $type === 'madow_share' ? 'dmepa' : '元',
|
||||
'formula' => (string) ($platform->formula ?? ''),
|
||||
'status' => 0,
|
||||
'status_text' => '待结算',
|
||||
'unit' => $def['unit'],
|
||||
'formula' => $formula,
|
||||
'skip_reason_text' => '',
|
||||
'tip' => '当日无人参与,奖池进平台',
|
||||
'tip' => '待日结均分结算',
|
||||
];
|
||||
continue;
|
||||
}
|
||||
|
||||
$first = $shareRows[0];
|
||||
$eachAmount = function_exists('bcdiv') ? bcdiv((string) $totalAmount, (string) $userCount, 2) : number_format($totalAmount / $userCount, 2, '.', '');
|
||||
$eachMadowVal = function_exists('bcdiv') ? bcdiv((string) $totalMadow, (string) $userCount, 8) : ($totalMadow / $userCount);
|
||||
$eachMadow = \addons\shopro\service\partner\IdentityService::formatMadow($eachMadowVal);
|
||||
|
||||
$items[] = [
|
||||
'display' => 'share',
|
||||
'id' => intval($first->id ?? 0),
|
||||
'reward_type' => $type,
|
||||
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
|
||||
'role' => '',
|
||||
'role_text' => '',
|
||||
'user_id' => 0,
|
||||
'user' => null,
|
||||
'user_count' => $userCount,
|
||||
'each_amount' => $eachAmount,
|
||||
'each_madow' => $eachMadow,
|
||||
'total_amount' => number_format($totalAmount, 2, '.', ''),
|
||||
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($totalMadow),
|
||||
'amount_text' => $type === 'madow_share' ? ($eachMadow . ' dmepa/人') : ('¥' . $eachAmount . '/人'),
|
||||
'wallet_type' => $type === 'madow_share' ? 'madow' : \addons\shopro\service\partner\PartnerConfig::rewardWalletType(),
|
||||
'wallet_type_text' => $type === 'madow_share' ? '分红dmepa' : (\addons\shopro\service\partner\PartnerConfig::rewardWalletType() === 'money' ? '商城余额' : '佣金钱包'),
|
||||
'settle_date' => $settleDate,
|
||||
'status' => 1,
|
||||
'status_text' => '已入账',
|
||||
'unit' => $type === 'madow_share' ? 'dmepa' : '元',
|
||||
'formula' => (string) ($first->formula ?? ''),
|
||||
'skip_reason_text' => '',
|
||||
'tip' => '日结均分(不列出参与用户名单)',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$totalAllCash = round($totalInstantCash + $totalShareCash, 2);
|
||||
|
||||
return [
|
||||
'items' => $items,
|
||||
'total_cash' => number_format($totalCash, 2, '.', ''),
|
||||
'total_cash' => number_format($totalInstantCash, 2, '.', ''), // 直入商城余额的即时现金
|
||||
'total_instant_cash' => number_format($totalInstantCash, 2, '.', ''),
|
||||
'total_share_cash' => number_format($totalShareCash, 2, '.', ''),
|
||||
'total_all_cash' => number_format($totalAllCash, 2, '.', ''),
|
||||
'total_voucher' => number_format($totalVoucher, 2, '.', ''),
|
||||
'settle_date' => $settleDate,
|
||||
'has_data' => count($items) > 0,
|
||||
@@ -455,6 +599,9 @@ class Order extends Common
|
||||
return [
|
||||
'items' => [],
|
||||
'total_cash' => '0.00',
|
||||
'total_instant_cash' => '0.00',
|
||||
'total_share_cash' => '0.00',
|
||||
'total_all_cash' => '0.00',
|
||||
'total_voucher' => '0.00',
|
||||
'settle_date' => null,
|
||||
'has_data' => false,
|
||||
|
||||
@@ -351,7 +351,7 @@ class User extends Common
|
||||
if ($amount < 0 && bcadd((string) $user->money, (string) $amount, 2) < 0) {
|
||||
error_stop('当前余额不足,无法扣除');
|
||||
}
|
||||
return WalletService::change($userId, 'money', $amount, 'admin_recharge', [], $memo ?: '后台管理调整余额');
|
||||
return WalletService::change($userId, 'money', $amount, 'admin_recharge', [], $memo ?: '');
|
||||
}
|
||||
|
||||
if ($type === 'score') {
|
||||
@@ -363,7 +363,7 @@ class User extends Common
|
||||
if ($amount < 0 && ($user->score + $amount) < 0) {
|
||||
error_stop('当前积分不足,无法扣除');
|
||||
}
|
||||
return WalletService::change($userId, 'score', $amount, 'admin_recharge', [], $memo ?: '后台管理调整积分');
|
||||
return WalletService::change($userId, 'score', $amount, 'admin_recharge', [], $memo ?: '');
|
||||
}
|
||||
|
||||
// 对于dmepa (madow) 与兑换券 (voucher),属于合伙人二开资产体系
|
||||
|
||||
在新工单中引用
屏蔽一个用户