Merge remote-tracking branch 'origin/main' into feature/yueyang-pinduoduo-receiving-bills
This commit is contained in:
commit
1999db50e1
@ -1543,6 +1543,29 @@ class Pages extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
if ($platform === 'jd') {
|
||||
fputcsv($csv, [
|
||||
'平台', '店铺', '账户', '日期', '收支类型', '交易类型',
|
||||
'金额(元)', '余额(元)', '备注',
|
||||
]);
|
||||
foreach ($data['jd'] ?? [] as $row) {
|
||||
fputcsv($csv, [
|
||||
'京东京准通',
|
||||
$row['shop_name'] ?? '',
|
||||
$row['account'] ?? '',
|
||||
$row['show_date'] ?? $row['settle_datetime'] ?? '',
|
||||
$row['in_out_type_name'] ?? '',
|
||||
$row['trade_type_name'] ?? '',
|
||||
$row['amount'] ?? '',
|
||||
$row['balance_amount'] ?? '',
|
||||
$row['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
fclose($csv);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fputcsv($csv, ['平台', '店铺/账户', '日期', '类型', '金额(元)', '余额(元)', '备注']);
|
||||
$emit = static function (string $platform, array $rows, array $map) use ($csv): void {
|
||||
foreach ($rows as $row) {
|
||||
@ -1557,9 +1580,7 @@ class Pages extends Controller
|
||||
]);
|
||||
}
|
||||
};
|
||||
if ($platform === 'jd') {
|
||||
$emit('京东京准通', $data['jd'] ?? [], ['name' => fn ($row) => $row['shop_name'] . ' / ' . $row['account'], 'date' => fn ($row) => $row['show_date'] ?? $row['settle_datetime'], 'type' => fn ($row) => $row['trade_type_name'] ?? $row['in_out_type_name'], 'amount' => fn ($row) => $row['amount'] ?? '', 'balance' => fn ($row) => $row['balance_amount'] ?? '', 'remark' => fn ($row) => $row['remark'] ?? '']);
|
||||
} elseif ($platform === 'douyin') {
|
||||
if ($platform === 'douyin') {
|
||||
$emit('抖音千川', $data['dy'] ?? [], ['name' => fn ($row) => $row['shopName'] . ' / ' . $row['account'] . ' / ' . $row['qianchuanAavid'], 'date' => fn ($row) => $row['statDate'] ?? '', 'type' => fn () => '花费', 'amount' => fn ($row) => $row['cost'] ?? '', 'balance' => fn ($row) => $row['balance'] ?? '', 'remark' => fn ($row) => $row['remark'] ?? '']);
|
||||
} elseif ($platform === 'dewu') {
|
||||
$emit('得物推广', $data['dw'] ?? [], ['name' => fn ($row) => $row['shop_name'] . ' / ' . $row['account'], 'date' => fn ($row) => $row['trade_date'] ?? $row['date_time'], 'type' => fn ($row) => $row['flow_type'] ?? '', 'amount' => fn ($row) => $row['trade_amount_yuan'] ?? '', 'balance' => fn ($row) => $row['balance_yuan'] ?? '', 'remark' => fn ($row) => $row['remark'] ?? '']);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@
|
||||
$titles = ['jd' => '京东京准通', 'douyin' => '抖音千川', 'dewu' => '得物推广账户', 'vip' => '唯品会推广流水'];
|
||||
$filterLabel = $platform === 'vip' ? $titles[$platform] . '筛选' : $titles[$platform] . '推广账户筛选';
|
||||
$columns = match ($platform) {
|
||||
'jd' => [['shop_name', '店铺'], ['account', '账户'], ['show_date', '日期'], ['trade_type_name', '交易类型'], ['amount', '金额'], ['balance_amount', '余额'], ['remark', '备注']],
|
||||
'jd' => [['shop_name', '店铺'], ['account', '账户'], ['show_date', '日期'], ['in_out_type_name', '收支类型'], ['trade_type_name', '交易类型'], ['amount', '金额'], ['balance_amount', '余额'], ['remark', '备注']],
|
||||
'douyin' => [['shopName', '店铺'], ['account', '账户'], ['qianchuanAavid', '广告账户'], ['statDate', '日期'], ['cost', '花费'], ['income', '收入'], ['transferIn', '转入'], ['transferOut', '转出'], ['balance', '余额'], ['status', '状态'], ['remark', '备注']],
|
||||
'dewu' => [['shop_name', '店铺'], ['account', '账户'], ['trade_date', '日期'], ['amount_type', '金额类型'], ['flow_type', '收支类型'], ['trade_amount_yuan', '金额'], ['balance_yuan', '余额'], ['remark', '备注']],
|
||||
default => [
|
||||
|
||||
@ -32,6 +32,8 @@ class MarketingPlatformPromotionBillsTest extends FeatureTestCase
|
||||
->assertSeeText('京东京准通')
|
||||
->assertSee('aria-label="京东京准通推广账户筛选"', false)
|
||||
->assertSeeText('测试店铺')
|
||||
->assertSeeText('收支类型')
|
||||
->assertSeeText('出账')
|
||||
->assertSeeText('导出 CSV')
|
||||
->assertSee('class="my-6 business-page--marketing-account-bills"', false)
|
||||
->assertSee(route('business.pages.show', [
|
||||
@ -72,7 +74,12 @@ class MarketingPlatformPromotionBillsTest extends FeatureTestCase
|
||||
"filename*=utf-8''" . rawurlencode($filename),
|
||||
(string) $response->headers->get('Content-Disposition'),
|
||||
);
|
||||
$this->assertStringContainsString('测试店铺', $response->streamedContent());
|
||||
$csv = $response->streamedContent();
|
||||
$this->assertStringContainsString('测试店铺', $csv);
|
||||
$this->assertStringContainsString('收支类型', $csv);
|
||||
$this->assertStringContainsString('交易类型', $csv);
|
||||
$this->assertStringContainsString('出账', $csv);
|
||||
$this->assertStringContainsString('推广费', $csv);
|
||||
}
|
||||
|
||||
public function test_vip_tab_uses_marketing_daily_data(): void
|
||||
@ -195,7 +202,8 @@ class MarketingPlatformPromotionBillsTest extends FeatureTestCase
|
||||
'shop_name' => '测试店铺',
|
||||
'account' => 'account-01',
|
||||
'show_date' => '2026-08-01',
|
||||
'trade_type_name' => '充值',
|
||||
'in_out_type_name' => '出账',
|
||||
'trade_type_name' => '推广费',
|
||||
'amount' => 100,
|
||||
'balance_amount' => 100,
|
||||
'remark' => '测试记录',
|
||||
|
||||
@ -217,14 +217,17 @@ class PagesTest extends FeatureTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function testDouyinAccountBillsExportUsesSelectedColumnOrder(): void
|
||||
public function testDouyinAccountBillsExportUsesDateFiltersAndSelectedColumnOrder(): void
|
||||
{
|
||||
$this->user->attachPermission(
|
||||
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
||||
);
|
||||
|
||||
$repository = Mockery::mock(StoreReceivingDouyinBillMirrorRepository::class);
|
||||
$repository->shouldReceive('exportRows')->once()->with([], 'occurred_at', 'desc')->andReturn([[
|
||||
$repository->shouldReceive('exportRows')->once()->with([
|
||||
'start' => '2026-09-09',
|
||||
'end' => '2026-09-09',
|
||||
], 'occurred_at', 'desc')->andReturn([[
|
||||
'record_code' => '9001',
|
||||
'payload' => [
|
||||
'move_scene' => '头条放心购',
|
||||
@ -235,6 +238,8 @@ class PagesTest extends FeatureTestCase
|
||||
|
||||
$response = $this->loginAs()->get(route('ecommerce-finance.account-bills.export', [
|
||||
'bill_type' => 'douyin',
|
||||
'start' => '2026-09-09',
|
||||
'end' => '2026-09-09',
|
||||
'columns' => 'payload.move_scene,record_code,payload.settle_account',
|
||||
]));
|
||||
|
||||
|
||||
@ -21,7 +21,8 @@ class PlatformPromotionAccountRepositoryTest extends TestCase
|
||||
$factory->shouldReceive('forSource')->once()->with('js_data_middle_platform')->andReturn($query);
|
||||
$query->shouldReceive('select')->once()->ordered()->with(
|
||||
Mockery::on(static fn (string $sql): bool => str_contains($sql, 'SELECT TOP 5000')
|
||||
&& str_contains($sql, 'jd_jzt_finance_records')),
|
||||
&& str_contains($sql, 'jd_jzt_finance_records')
|
||||
&& str_contains($sql, 'in_out_type_name')),
|
||||
['2026-08'],
|
||||
)->andReturn([['shop_name' => '测试店铺', 'amount' => 100]]);
|
||||
$query->shouldReceive('select')->once()->ordered()->with(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user