update coupon service proto

This commit is contained in:
daniel.w 2024-10-25 18:11:50 +08:00
parent 25b422b907
commit a575e4fc42
1 changed files with 132 additions and 30 deletions

View File

@ -301,7 +301,7 @@ message ProductCreateReq {
repeated string tags = 9; // 便
string sku = 10; // Stock Keeping Unit
repeated string images = 11; //
optional string coupon_id = 12; // id
repeated string coupon_id = 12; // id
}
message ProductUpdateReq {
@ -317,7 +317,7 @@ message ProductUpdateReq {
repeated string tags = 10; // 便
optional string sku = 11; // Stock Keeping Unit
repeated string images = 12; //
optional string coupon_id = 13; // id
repeated string coupon_id = 13; // id
optional bool is_available = 14; //
}
@ -336,13 +336,13 @@ message ProductResp {
string content = 4; //
double price = 5; //
int64 amount_type = 6; // 1 2
repeated string currency = 7; // ( USD, TWD)
string currency = 7; // ( USD, TWD)
repeated string brand = 8; // channel_id or uid
string category = 9; //
repeated string category = 9; //
repeated string tags = 10; // 便
string sku = 11; // Stock Keeping Unit
repeated string images = 12; //
string coupon_id = 13; // id
repeated string coupon_id = 13; // id
bool is_available = 14; //
}
@ -379,16 +379,22 @@ service ProductService {
// ========== ===========
//
// ()
message SubscriptionCreateReq {
string user_id = 1; // 使ID
string uid = 1; // 使ID
string plan_id = 2; // ID
string start_date = 3; //
bool auto_renew = 3; //
optional int64 auto_renew_day = 4; //
int64 start_date = 5; //
int64 end_date = 6; //
}
message SubscriptionUpdateReq {
string subscription_id = 1; // ID
string plan_id = 2; // ID
optional int64 end_date = 2; //
optional bool cancel = 3; //
optional bool auto_renew = 4; //
optional int64 auto_renew_day = 5; //
}
message SubscriptionCancelReq {
@ -401,17 +407,22 @@ message SubscriptionQueryReq {
message SubscriptionResp {
string subscription_id = 1; // ID
string user_id = 2; // 使ID
string uid = 2; // 使ID
string plan_id = 3; // ID
string start_date = 4; //
string end_date = 5; //
string status = 6; // (: "active", "expired", "canceled")
int64 start_date = 4; //
int64 end_date = 5; //
int64 status = 6; // (: 1"active", 2"expired", 3"canceled")
bool auto_renew = 7; //
int64 auto_renew_day = 8; //
}
message ListSubscriptionsReq {
int64 page_index = 1;
int64 page_size = 2;
optional string uid = 3;
repeated string subscription_id = 4;
repeated string plan_id = 5;
int64 status = 6; // (: 1"active", 2"expired", 3"canceled")
}
message SubscriptionListResp {
@ -421,7 +432,7 @@ message SubscriptionListResp {
message SubscriptionRenewReq {
string subscription_id = 1; // ID
string renewal_date = 2; //
int64 renewal_date = 2; //
}
message SubscriptionStatusQueryReq {
@ -430,8 +441,7 @@ message SubscriptionStatusQueryReq {
message SubscriptionStatusResp {
string subscription_id = 1; // ID
string status = 2; //
string message = 3; //
int64 status = 2; // (: 1"active", 2"expired", 3"canceled")
}
service SubscriptionService {
@ -449,6 +459,98 @@ service SubscriptionService {
rpc RenewSubscription(SubscriptionRenewReq) returns (SubscriptionResp);
// CheckSubscriptionStatus (//)
rpc CheckSubscriptionStatus(SubscriptionStatusQueryReq) returns (SubscriptionStatusResp);
// RefreshSubscriptionStatus cron 5
// RefreshSubscriptionStatus cron 5
rpc RefreshSubscriptionStatus(NoneReq) returns (OKResp);
}
// ========== ===========
message Coupon {
string coupon_id = 1; //
string code = 2; //
double discount = 3; // ()
string discount_type = 4; // ("percent" "fixed")
string start_date = 5; // (: YYYY-MM-DD)
string end_date = 6; // (: YYYY-MM-DD)
int32 usage_limit = 7; // 使
int32 used_count = 8; // 使
string status = 9; // ("active", "expired", "inactive")
repeated string applicable_product_ids = 10; // 使ID列表
bool is_common = 11; //
}
message CreateCouponReq {
string code = 1; //
double discount = 2; //
string discount_type = 3; // ("percent" "fixed")
int64 start_date = 4; // (: YYYY-MM-DD)
int64 end_date = 5; // (: YYYY-MM-DD)
int64 usage_limit = 6; // 使
bool is_common = 7; //
repeated string applicable_product_ids = 8; // ID列表
}
message UpdateCouponReq {
string coupon_id = 1; // ID
string code = 2; //
double discount = 3; //
string discount_type = 4; // ("percent" "fixed")
int64 start_date = 5; //
int64 end_date = 6; //
int64 usage_limit = 7; // 使
repeated string applicable_product_ids = 8; // ID列表
optional bool is_common = 9; //
}
message CouponQueryReq {
string coupon_id = 1; // ID
}
message CouponResp {
Coupon coupon = 1; //
}
message CouponListReq {
int64 page_index = 1;
int64 page_size = 2;
repeated string coupon_id = 3;
repeated string code = 4;
int64 start_date = 5; //
int64 end_date = 6; //
repeated string applicable_product_ids = 7; // ID列表
bool is_use_able = 8; //
}
message CouponListResp {
repeated Coupon coupons = 1; //
Pager page = 2;
}
message ValidateCouponReq {
string product_id = 1; // 使ID
double order_amount = 2; //
optional string code = 3; //
optional string coupon_id = 4;
}
message CouponValidationResp {
bool is_valid = 1; //
string message = 2; // ()
double discount_applied = 3; //
string coupon_id = 4; // ID
}
service CouponService {
// CreateCoupon
rpc CreateCoupon(CreateCouponReq) returns (CouponResp);
// UpdateCoupon更新優惠券
rpc UpdateCoupon(UpdateCouponReq) returns (CouponResp);
// QueryCoupon查詢優惠券
rpc QueryCoupon(CouponQueryReq) returns (CouponResp);
// DeleteCoupon
rpc DeleteCoupon(CouponQueryReq) returns (OKResp);
// ListCoupons列出所有優惠券
rpc ListCoupons(CouponListReq) returns (CouponListResp);
// ValidateCoupon (使)
rpc ValidateCoupon(ValidateCouponReq) returns (CouponValidationResp);
}