|
|
@@ -2,7 +2,9 @@
|
|
|
|
|
|
namespace Tests\Integration;
|
|
|
|
|
|
+use App\Http\Controllers\admin\PaymentOrder as PaymentOrderController;
|
|
|
use App\Http\Controllers\admin\Withdraw as WithdrawController;
|
|
|
+use App\Models\PaymentOrder;
|
|
|
use App\Models\User;
|
|
|
use App\Models\Withdraw;
|
|
|
use App\Services\AdminRealtime\AdminRealtime;
|
|
|
@@ -181,6 +183,28 @@ class AdminRealtimeTest extends TestCase
|
|
|
'SQLite 不支持在线判定 SQL,扫描失败只记日志不影响广播');
|
|
|
}
|
|
|
|
|
|
+ public function test_manual_recharge_orders_push_to_the_payment_order_channel(): void
|
|
|
+ {
|
|
|
+ Schema::create('payment_orders', function (Blueprint $t) {
|
|
|
+ $t->id(); $t->integer('type'); $t->string('order_no')->default(''); $t->string('member_id'); $t->decimal('amount', 20, 2)->default(0);
|
|
|
+ $t->decimal('fee', 20, 2)->default(0); $t->string('channel')->default(''); $t->integer('payment_type')->default(0); $t->integer('status')->default(0);
|
|
|
+ $t->text('pay_data')->nullable(); $t->string('remark')->nullable(); $t->text('recharge_bonus_snapshot')->nullable();
|
|
|
+ $t->integer('is_send')->default(0); $t->integer('is_locked')->default(0); $t->timestamps();
|
|
|
+ });
|
|
|
+ $order = PaymentOrder::create(['type' => 3, 'order_no' => 'rgcz_1', 'member_id' => '9001', 'amount' => 50, 'channel' => 'rgcz',
|
|
|
+ 'payment_type' => 1, 'status' => 0, 'recharge_bonus_snapshot' => null]);
|
|
|
+ $order->update(['status' => 5]);
|
|
|
+
|
|
|
+ $events = $this->consume(0)['events'];
|
|
|
+ $this->assertSame([['channel' => 'admin.orders.payment', 'action' => 'created', 'key' => ['id' => 1]]],
|
|
|
+ array_map(fn ($e) => array_intersect_key($e, array_flip(['channel', 'action', 'key'])), $events), '人工充值只推「代收订单」频道');
|
|
|
+
|
|
|
+ $this->app->instance('request', Request::create('/admin/paymentOrder', 'GET', ['channel' => 'rgcz']));
|
|
|
+ $list = (new PaymentOrderController())->index()->getData(true)['data']['data'];
|
|
|
+ $this->assertSame(collect($list)->firstWhere('id', 1), $events[0]['data'], '推送行与人工充值审查列表的行一致');
|
|
|
+ $this->assertSame(5, $events[0]['data']['status']);
|
|
|
+ }
|
|
|
+
|
|
|
public function test_feed_delivers_late_commits_with_a_later_seq(): void
|
|
|
{
|
|
|
$insert = fn (int $id, string $at) => DB::table('admin_realtime_events')->insert([
|