新增荣耀勋章/幸运币商品:迁移、上游商品映射与测试
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- 新增荣耀勋章 / 幸运币系列商品
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
INSERT INTO products (code, name, category, status)
|
||||||
|
SELECT v.code, v.name, v.category, 'active'
|
||||||
|
FROM (VALUES
|
||||||
|
('honor_medal_x2', '荣耀勋章2个', '道具'),
|
||||||
|
('honor_medal_x30', '荣耀勋章30个', '道具'),
|
||||||
|
('honor_medal_x90', '荣耀勋章90个', '道具'),
|
||||||
|
('lucky_coin_x2', '幸运币2个', '道具'),
|
||||||
|
('lucky_coin_x30', '幸运币30个', '道具'),
|
||||||
|
('lucky_coin_x90', '幸运币90个', '道具')
|
||||||
|
) AS v(code, name, category)
|
||||||
|
ON CONFLICT (code) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO merchant_products (merchant_id, product_id, sku, display_name, price_amount, cost_amount, currency, stock, status)
|
||||||
|
SELECT
|
||||||
|
m.id,
|
||||||
|
p.id,
|
||||||
|
p.code,
|
||||||
|
p.name,
|
||||||
|
v.price_amount,
|
||||||
|
v.cost_amount,
|
||||||
|
'POINT',
|
||||||
|
-1,
|
||||||
|
'active'
|
||||||
|
FROM (VALUES
|
||||||
|
('honor_medal_x2', 20, 20),
|
||||||
|
('honor_medal_x30', 300, 300),
|
||||||
|
('honor_medal_x90', 900, 900),
|
||||||
|
('lucky_coin_x2', 20, 20),
|
||||||
|
('lucky_coin_x30', 300, 300),
|
||||||
|
('lucky_coin_x90', 900, 900)
|
||||||
|
) AS v(sku, price_amount, cost_amount)
|
||||||
|
JOIN products p ON p.code = v.sku
|
||||||
|
JOIN merchants m ON m.code = 'self-operated'
|
||||||
|
ON CONFLICT (merchant_id, sku) DO NOTHING;
|
||||||
@@ -26,14 +26,14 @@ const defaultDeliveryBFFBaseURL = "https://www.jxya.top/bff-stg"
|
|||||||
|
|
||||||
// 发货提交阶段,持久化在 result_data.provider_order_stage 中,供排障与补偿扫描区分处理。
|
// 发货提交阶段,持久化在 result_data.provider_order_stage 中,供排障与补偿扫描区分处理。
|
||||||
const (
|
const (
|
||||||
deliveryStageClaimed = "claimed" // 已锁定订单,尚未建 queue
|
deliveryStageClaimed = "claimed" // 已锁定订单,尚未建 queue
|
||||||
deliveryStageQueueCreated = "queue_created" // 已在上游建 queue,尚未生成正式订单
|
deliveryStageQueueCreated = "queue_created" // 已在上游建 queue,尚未生成正式订单
|
||||||
deliveryStageSubmitted = "submitted" // 已在上游创建正式订单
|
deliveryStageSubmitted = "submitted" // 已在上游创建正式订单
|
||||||
deliveryStageBindVerify = "bind_verify" // 绑定账号校验失败
|
deliveryStageBindVerify = "bind_verify" // 绑定账号校验失败
|
||||||
deliveryStageBindMismatch = "bind_mismatch" // 玩家编号与绑定账号不一致
|
deliveryStageBindMismatch = "bind_mismatch" // 玩家编号与绑定账号不一致
|
||||||
deliveryStageCreateQueue = "create_queue" // 创建上游 queue 失败
|
deliveryStageCreateQueue = "create_queue" // 创建上游 queue 失败
|
||||||
deliveryStagePatchQueue = "patch_queue" // 补充 queue 账号信息失败
|
deliveryStagePatchQueue = "patch_queue" // 补充 queue 账号信息失败
|
||||||
deliveryStageCreateOrder = "create_upstream" // 创建上游正式订单失败
|
deliveryStageCreateOrder = "create_upstream" // 创建上游正式订单失败
|
||||||
)
|
)
|
||||||
|
|
||||||
// deliverySubmittedUpstream 判断订单是否已成功提交到上游正式订单。
|
// deliverySubmittedUpstream 判断订单是否已成功提交到上游正式订单。
|
||||||
@@ -959,6 +959,12 @@ func deliveryGoodID(channel, sku string) string {
|
|||||||
"pack_star_roam_outfit": "682ef39ca8f40c4234c59f3e",
|
"pack_star_roam_outfit": "682ef39ca8f40c4234c59f3e",
|
||||||
"pack_star_roam_weapon": "682ef39ca8f40c4234c59f3f",
|
"pack_star_roam_weapon": "682ef39ca8f40c4234c59f3f",
|
||||||
"suit_cloud_bear": "682ef39ca8f40c4234c59f40",
|
"suit_cloud_bear": "682ef39ca8f40c4234c59f40",
|
||||||
|
"honor_medal_x2": "682ef39ca8f40c4234c59f45",
|
||||||
|
"honor_medal_x30": "682ef39ca8f40c4234c59f43",
|
||||||
|
"honor_medal_x90": "682ef39ca8f40c4234c59f41",
|
||||||
|
"lucky_coin_x2": "682ef39ca8f40c4234c59f46",
|
||||||
|
"lucky_coin_x30": "682ef39ca8f40c4234c59f44",
|
||||||
|
"lucky_coin_x90": "682ef39ca8f40c4234c59f42",
|
||||||
}[sku]
|
}[sku]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,22 @@ func TestDeliveryLinkGenerateAuthorizeAndRevoke(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDeliveryGoodIDIncludesMedalAndCoinProducts(t *testing.T) {
|
||||||
|
cases := map[string]string{
|
||||||
|
"honor_medal_x2": "682ef39ca8f40c4234c59f45",
|
||||||
|
"honor_medal_x30": "682ef39ca8f40c4234c59f43",
|
||||||
|
"honor_medal_x90": "682ef39ca8f40c4234c59f41",
|
||||||
|
"lucky_coin_x2": "682ef39ca8f40c4234c59f46",
|
||||||
|
"lucky_coin_x30": "682ef39ca8f40c4234c59f44",
|
||||||
|
"lucky_coin_x90": "682ef39ca8f40c4234c59f42",
|
||||||
|
}
|
||||||
|
for sku, want := range cases {
|
||||||
|
if got := deliveryGoodID("dlc", sku); got != want {
|
||||||
|
t.Fatalf("unexpected good id for %s: got %q want %q", sku, got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestDeliveryMerchantApiBindAndSubmit(t *testing.T) {
|
func TestDeliveryMerchantApiBindAndSubmit(t *testing.T) {
|
||||||
db := newServiceTestDB(t)
|
db := newServiceTestDB(t)
|
||||||
merchantID, _ := seedFulfillmentMerchant(t, db, "delivery-api", 5000, 5, 100)
|
merchantID, _ := seedFulfillmentMerchant(t, db, "delivery-api", 5000, 5, 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user