fix ads,passport

This commit is contained in:
2026-09-23 00:13:03 +08:00
parent b8ff9acc3d
commit 80b6c140fe
14 changed files with 575 additions and 3755 deletions

View File

@@ -25,13 +25,15 @@ func New(grpcServ *grpc.Server) *Server {
srv := &Server{
Ctx: context.Background(),
Grpc: grpcServ,
Grpc: grpc.NewServer(),
grpcConns: make(map[string]*grpc.ClientConn),
}
// register service to grpc.Server
pb.RegisterFetchServer(srv.Grpc, NewFetchServer())
reflection.Register(srv.Grpc)
if standalone {
reflection.Register(srv.Grpc)
}

View File

@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v7.35.1
// source: module/base/ads/proto/ads.proto
// protoc-gen-go v1.36.12
// protoc v7.36.0
// source: ads.proto
package ads
@@ -30,7 +30,7 @@ type ByPosRequest struct {
func (x *ByPosRequest) Reset() {
*x = ByPosRequest{}
mi := &file_module_base_ads_proto_ads_proto_msgTypes[0]
mi := &file_ads_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -42,7 +42,7 @@ func (x *ByPosRequest) String() string {
func (*ByPosRequest) ProtoMessage() {}
func (x *ByPosRequest) ProtoReflect() protoreflect.Message {
mi := &file_module_base_ads_proto_ads_proto_msgTypes[0]
mi := &file_ads_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -55,7 +55,7 @@ func (x *ByPosRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ByPosRequest.ProtoReflect.Descriptor instead.
func (*ByPosRequest) Descriptor() ([]byte, []int) {
return file_module_base_ads_proto_ads_proto_rawDescGZIP(), []int{0}
return file_ads_proto_rawDescGZIP(), []int{0}
}
func (x *ByPosRequest) GetKey() string {
@@ -74,7 +74,7 @@ type ByPosReply struct {
func (x *ByPosReply) Reset() {
*x = ByPosReply{}
mi := &file_module_base_ads_proto_ads_proto_msgTypes[1]
mi := &file_ads_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -86,7 +86,7 @@ func (x *ByPosReply) String() string {
func (*ByPosReply) ProtoMessage() {}
func (x *ByPosReply) ProtoReflect() protoreflect.Message {
mi := &file_module_base_ads_proto_ads_proto_msgTypes[1]
mi := &file_ads_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -99,7 +99,7 @@ func (x *ByPosReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use ByPosReply.ProtoReflect.Descriptor instead.
func (*ByPosReply) Descriptor() ([]byte, []int) {
return file_module_base_ads_proto_ads_proto_rawDescGZIP(), []int{1}
return file_ads_proto_rawDescGZIP(), []int{1}
}
func (x *ByPosReply) GetData() []*AdsItem {
@@ -123,7 +123,7 @@ type AdsItem struct {
func (x *AdsItem) Reset() {
*x = AdsItem{}
mi := &file_module_base_ads_proto_ads_proto_msgTypes[2]
mi := &file_ads_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -135,7 +135,7 @@ func (x *AdsItem) String() string {
func (*AdsItem) ProtoMessage() {}
func (x *AdsItem) ProtoReflect() protoreflect.Message {
mi := &file_module_base_ads_proto_ads_proto_msgTypes[2]
mi := &file_ads_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -148,7 +148,7 @@ func (x *AdsItem) ProtoReflect() protoreflect.Message {
// Deprecated: Use AdsItem.ProtoReflect.Descriptor instead.
func (*AdsItem) Descriptor() ([]byte, []int) {
return file_module_base_ads_proto_ads_proto_rawDescGZIP(), []int{2}
return file_ads_proto_rawDescGZIP(), []int{2}
}
func (x *AdsItem) GetId() int64 {
@@ -193,11 +193,11 @@ func (x *AdsItem) GetCreated() string {
return ""
}
var File_module_base_ads_proto_ads_proto protoreflect.FileDescriptor
var File_ads_proto protoreflect.FileDescriptor
const file_module_base_ads_proto_ads_proto_rawDesc = "" +
const file_ads_proto_rawDesc = "" +
"\n" +
"\x1fmodule/base/ads/proto/ads.proto\x12\x03ads\" \n" +
"\tads.proto\x12\x03ads\" \n" +
"\fByPosRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\".\n" +
"\n" +
@@ -211,27 +211,27 @@ const file_module_base_ads_proto_ads_proto_rawDesc = "" +
"\x05toUrl\x18\x05 \x01(\tR\x05toUrl\x12\x18\n" +
"\acreated\x18\x06 \x01(\tR\acreated26\n" +
"\x05Fetch\x12-\n" +
"\x05ByPos\x12\x11.ads.ByPosRequest\x1a\x0f.ads.ByPosReply\"\x00B!Z\x1fbsm/full/module/base/ads/pb;adsb\x06proto3"
"\x05ByPos\x12\x11.ads.ByPosRequest\x1a\x0f.ads.ByPosReply\"\x00B\aZ\x05.;adsb\x06proto3"
var (
file_module_base_ads_proto_ads_proto_rawDescOnce sync.Once
file_module_base_ads_proto_ads_proto_rawDescData []byte
file_ads_proto_rawDescOnce sync.Once
file_ads_proto_rawDescData []byte
)
func file_module_base_ads_proto_ads_proto_rawDescGZIP() []byte {
file_module_base_ads_proto_ads_proto_rawDescOnce.Do(func() {
file_module_base_ads_proto_ads_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_module_base_ads_proto_ads_proto_rawDesc), len(file_module_base_ads_proto_ads_proto_rawDesc)))
func file_ads_proto_rawDescGZIP() []byte {
file_ads_proto_rawDescOnce.Do(func() {
file_ads_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ads_proto_rawDesc), len(file_ads_proto_rawDesc)))
})
return file_module_base_ads_proto_ads_proto_rawDescData
return file_ads_proto_rawDescData
}
var file_module_base_ads_proto_ads_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_module_base_ads_proto_ads_proto_goTypes = []any{
var file_ads_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_ads_proto_goTypes = []any{
(*ByPosRequest)(nil), // 0: ads.ByPosRequest
(*ByPosReply)(nil), // 1: ads.ByPosReply
(*AdsItem)(nil), // 2: ads.AdsItem
}
var file_module_base_ads_proto_ads_proto_depIdxs = []int32{
var file_ads_proto_depIdxs = []int32{
2, // 0: ads.ByPosReply.data:type_name -> ads.AdsItem
0, // 1: ads.Fetch.ByPos:input_type -> ads.ByPosRequest
1, // 2: ads.Fetch.ByPos:output_type -> ads.ByPosReply
@@ -242,26 +242,26 @@ var file_module_base_ads_proto_ads_proto_depIdxs = []int32{
0, // [0:1] is the sub-list for field type_name
}
func init() { file_module_base_ads_proto_ads_proto_init() }
func file_module_base_ads_proto_ads_proto_init() {
if File_module_base_ads_proto_ads_proto != nil {
func init() { file_ads_proto_init() }
func file_ads_proto_init() {
if File_ads_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_module_base_ads_proto_ads_proto_rawDesc), len(file_module_base_ads_proto_ads_proto_rawDesc)),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ads_proto_rawDesc), len(file_ads_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_module_base_ads_proto_ads_proto_goTypes,
DependencyIndexes: file_module_base_ads_proto_ads_proto_depIdxs,
MessageInfos: file_module_base_ads_proto_ads_proto_msgTypes,
GoTypes: file_ads_proto_goTypes,
DependencyIndexes: file_ads_proto_depIdxs,
MessageInfos: file_ads_proto_msgTypes,
}.Build()
File_module_base_ads_proto_ads_proto = out.File
file_module_base_ads_proto_ads_proto_goTypes = nil
file_module_base_ads_proto_ads_proto_depIdxs = nil
File_ads_proto = out.File
file_ads_proto_goTypes = nil
file_ads_proto_depIdxs = nil
}

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: module/base/ads/proto/ads.proto
// source: ads.proto
/*
Package ads is a reverse proxy.

View File

@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.35.1
// source: module/base/ads/proto/ads.proto
// - protoc v7.36.0
// source: ads.proto
package ads
@@ -51,16 +51,17 @@ func (c *fetchClient) ByPos(ctx context.Context, in *ByPosRequest, opts ...grpc.
}
// FetchServer is the server API for Fetch service.
// All implementations should embed UnimplementedFetchServer
// All implementations must embed UnimplementedFetchServer
// for forward compatibility.
//
// 广告子系统
type FetchServer interface {
//通过广告位获取广告信息
ByPos(context.Context, *ByPosRequest) (*ByPosReply, error)
mustEmbedUnimplementedFetchServer()
}
// UnimplementedFetchServer should be embedded to have
// UnimplementedFetchServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
@@ -70,6 +71,7 @@ type UnimplementedFetchServer struct{}
func (UnimplementedFetchServer) ByPos(context.Context, *ByPosRequest) (*ByPosReply, error) {
return nil, status.Error(codes.Unimplemented, "method ByPos not implemented")
}
func (UnimplementedFetchServer) mustEmbedUnimplementedFetchServer() {}
func (UnimplementedFetchServer) testEmbeddedByValue() {}
// UnsafeFetchServer may be embedded to opt out of forward compatibility for this service.
@@ -121,5 +123,5 @@ var Fetch_ServiceDesc = grpc.ServiceDesc{
},
},
Streams: []grpc.StreamDesc{},
Metadata: "module/base/ads/proto/ads.proto",
Metadata: "ads.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
package ads;
option go_package = "bsm/full/module/base/ads/pb;ads";
option go_package = ".;ads";
//广告子系统
service Fetch{

View File

@@ -1,326 +0,0 @@
syntax = "proto3";
package base_ads_blocks;
option go_package = "bsm/full/module/base/ads/pb;ads";
// Shared request and response messages.
message Empty {}
message FetchRequest {
int64 page_no = 1 [json_name = "page_no"];
int64 page_size = 2 [json_name = "page_size"];
map<string, string> params = 3;
}
message IdentRequest {
int64 id = 1;
string identity = 2;
}
message VersionRequest {
int64 version = 1;
}
message SearchRequest {
string keyword = 1;
}
message StatusReply {
int32 code = 1;
string message = 2;
string details = 3;
int64 timeseq = 4;
}
// Service-specific variants whose wire formats differ from the shared types.
message CmsSearchRequest {
string keyword = 1;
int64 page_no = 2 [json_name = "page_no"];
int64 page_size = 3 [json_name = "page_size"];
}
message MallFetchRequest {
int64 page_no = 1 [json_name = "page_no"];
int64 page_size = 2 [json_name = "page_size"];
map<string, string> params = 3;
string store_identity = 4 [json_name = "store_identity"];
string keyword = 5;
repeated int64 category_id = 6;
string sort = 7;
int64 min_price = 8 [json_name = "min_price"];
int64 max_price = 9 [json_name = "max_price"];
}
message MarketFetchRequest {
int64 page_no = 1 [json_name = "page_no"];
int64 page_size = 2 [json_name = "page_size"];
map<string, string> params = 3;
string identity = 4;
string keyword = 5;
int32 status = 6;
int32 approve = 7;
}
message OrderIdentRequest {
int64 id = 1;
string identity = 2;
string reason = 3;
int32 approve = 4;
string agency = 5;
string store_identity = 6;
}
message DeliveryStatusReply {
int64 status = 1;
string identity = 2;
string message = 3;
int64 timeseq = 4;
}
message IdentityStatusReply {
int32 code = 1;
string identity = 2;
string message = 3;
int64 timeseq = 4;
}
message OrderStatusReply {
int32 code = 1;
string identity = 2;
string message = 3;
int64 timeseq = 4;
string reason = 5;
}
message DataStatusReply {
string data = 1;
int64 timeseq = 2;
}
message StoreSerialRequest {
string store_identity = 1 [json_name = "store_identity"];
repeated string serial_id = 2 [json_name = "serial_id"];
}
// Cloud messages.
message IDRequest {
uint64 id = 1;
}
message IDListRequest {
repeated uint64 ids = 1;
}
message StdIicuds {
uint64 id = 1;
string created_at = 2;
string updated_at = 3;
string deleted_at = 4;
}
message StdPassport {
uint64 passport_id = 1;
string passport_identity = 2;
}
message CloudBase {
uint64 cloud_id = 1;
string cloud_identity = 2;
}
// CMS messages.
message CmsCategoryItem {
string site_identity = 1 [json_name = "site_identity"];
int64 id = 2;
string identity = 3;
int64 parent_id = 4 [json_name = "parent_id"];
string title = 5;
string cover_path = 6 [json_name = "cover_path"];
string intro = 7;
string created_at = 8 [json_name = "created_at"];
string updated_at = 9 [json_name = "updated_at"];
repeated CmsCategoryItem child = 10;
string category_key = 11 [json_name = "category_key"];
}
message CmsTagsItem {
int64 id = 1;
string identity = 2;
string title = 3;
string cover_path = 4 [json_name = "cover_path"];
string intro = 5;
string created_at = 6 [json_name = "created_at"];
}
message CmsAccessoryItem {
string identity = 1;
string title = 2;
string file_path = 3 [json_name = "file_path"];
string created_at = 4 [json_name = "created_at"];
}
// Passport messages.
message VerifyStatus {
int32 email_verify = 1;
int32 phone_verify = 2;
int32 face_verify = 3;
int32 document_verify = 4;
int32 kyc_verify = 5;
}
// Market messages.
message MarketLoginReply {
string token = 1;
string identity = 2;
string market_identity = 3 [json_name = "market_identity"];
string name = 4;
string account = 5;
string role = 6;
int32 status = 7;
string created_at = 8 [json_name = "created_at"];
string market_name = 9 [json_name = "market_name"];
}
// Order messages.
message OrderSummaryItem {
int64 id = 1;
string order_no = 2 [json_name = "order_no"];
int64 partner_id = 3 [json_name = "partner_id"];
string identity = 4;
int64 total_price = 7 [json_name = "total_price"];
int64 trans_price = 8 [json_name = "trans_price"];
int64 refund_price = 9 [json_name = "refund_price"];
int64 logistics_fee = 11 [json_name = "logistics_fee"];
int64 coupon_amount = 12 [json_name = "coupon_amount"];
string remark = 13;
int32 status = 14;
string logistics_number = 15 [json_name = "logistics_number"];
string address_identity = 16 [json_name = "address_identity"];
string county = 17;
string province = 18;
string city = 19;
string area = 20;
string address = 21;
string contact = 22;
string phone = 23;
string delivery_time = 24 [json_name = "delivery_time"];
string delivery_identity = 25 [json_name = "delivery_identity"];
int32 pay_type = 26 [json_name = "pay_type"];
int64 pay_amount = 27 [json_name = "pay_amount"];
string pay_trade_no = 28 [json_name = "pay_trade_no"];
string pay_time = 29 [json_name = "pay_time"];
string pay_remark = 30 [json_name = "pay_remark"];
string created = 31;
string updated = 32;
repeated OrderDetails details = 33;
string addr = 34;
string car_identity = 35 [json_name = "car_identity"];
string delivery_address = 36 [json_name = "delivery_address"];
string brand = 37;
string version = 38;
string license_number = 39 [json_name = "license_number"];
string member_name = 40 [json_name = "member_name"];
string member_phone = 41 [json_name = "member_phone"];
int32 approve = 42;
}
message OrderDetails {
int64 id = 1;
int64 product_id = 2 [json_name = "product_id"];
string spec_no = 3 [json_name = "spec_no"];
string spec = 4;
int64 type = 5;
string title = 6;
string cover_image = 7 [json_name = "cover_image"];
int64 sales_price = 8 [json_name = "sales_price"];
string product_args = 9 [json_name = "product_args"];
int64 number = 10;
int64 unit_price = 11 [json_name = "unit_price"];
int64 spec_id = 12 [json_name = "spec_id"];
string product_identity = 13 [json_name = "product_identity"];
int64 gas_types = 14 [json_name = "gas_types"];
int64 total_price = 15 [json_name = "total_price"];
}
// Social feed messages.
message FeedPostListReply {
repeated FeedPostItem list = 1;
int64 cnt = 2;
}
message FeedPostItem {
string identity = 1;
string content = 2;
int64 feed_id = 3;
string feed_identity = 4;
bool is_open = 5;
int64 cnt_unlike = 6;
int64 cnt_comment = 7;
int64 cnt_like = 8;
repeated FeedAttachItem attachs = 9;
repeated FeedTagItem tags = 10;
}
message FeedAttachItem {
string identity = 1;
string attach_type = 2;
string url = 3;
}
message FeedTagItem {
string key = 1;
string content = 2;
}
// Social group messages.
message GroupPostListReply {
repeated GroupPostItem list = 1;
int64 cnt = 2;
}
message GroupPostItem {
string identity = 1;
string content = 2;
int64 passport_id = 3;
string passport_identity = 4;
bool is_open = 5;
int64 cnt_unlike = 6;
int64 cnt_comment = 7;
int64 cnt_like = 8;
repeated GroupAttachItem attachs = 9;
repeated GroupTagItem tags = 10;
}
message GroupAttachItem {
string identity = 1;
string attach_type = 2;
string url = 3;
}
message GroupTagItem {
string key = 1;
string content = 2;
}
// Social relation messages.
message RelationItem {
string identity = 1;
string nickname = 2;
string remark_name = 3;
int32 popular = 4;
string avatar = 5;
string birthday = 6;
int32 sex = 7;
int32 province = 8;
int32 city = 9;
int32 area = 10;
string sign = 11;
repeated string tags = 12;
int32 foreign_status = 13;
}
message FetchRelationItemReply {
int64 total = 1;
repeated RelationItem data = 2;
}

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
protoc -I ./proto \
--go_out=paths=source_relative:pb \
--go_out=paths=source_relative:../../../sdk/client/golang/passport \
--go-grpc_out=paths=source_relative:pb \
--go-grpc_out=paths=source_relative:../../../sdk/client/golang/passport \
--grpc-gateway_out=paths=source_relative,generate_unbound_methods=True:pb \
--slc_out=./ \
--ts_out=../../../sdk/client/typescript \
--markdown_out=paths=source_relative:../../../sdk/docs/passport \
proto/*.proto

52
scripts/build-proto.sh Normal file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -Eeuo pipefail
if [[ $# -ne 1 ]]; then
echo "usage: $0 <module>" >&2
echo "example: $0 passport" >&2
exit 2
fi
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
readonly WORKSPACE_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
readonly MODULE_NAME="$1"
mapfile -t MODULE_DIRS < <(find "${WORKSPACE_ROOT}/module" -mindepth 2 -maxdepth 2 -type d -name "${MODULE_NAME}" -print)
if [[ ${#MODULE_DIRS[@]} -ne 1 ]]; then
echo "error: expected one module named '${MODULE_NAME}', found ${#MODULE_DIRS[@]}" >&2
exit 1
fi
readonly MODULE_DIR="${MODULE_DIRS[0]}"
readonly PROTO_DIR="${MODULE_DIR}/proto"
readonly PB_DIR="${MODULE_DIR}/pb"
readonly MODULE_REL="${MODULE_DIR#${WORKSPACE_ROOT}/}"
readonly DOCS_DIR="sdk/docs/${MODULE_NAME}"
readonly DOCS_GO_DIR="sdk/docs/client/golang/${MODULE_NAME}"
readonly DOCS_TS_DIR="sdk/docs/client/typescript/${MODULE_NAME}"
readonly CLIENT_GO_DIR="sdk/client/golang/${MODULE_NAME}"
readonly CLIENT_TS_DIR="sdk/client/typescript/${MODULE_NAME}"
[[ -d "${PROTO_DIR}" ]] || { echo "error: ${PROTO_DIR} does not exist" >&2; exit 1; }
mapfile -t PROTO_FILES < <(find "${PROTO_DIR}" -maxdepth 1 -type f -name '*.proto' -print | sort)
(( ${#PROTO_FILES[@]} > 0 )) || { echo "error: no proto files found in ${PROTO_DIR}" >&2; exit 1; }
cd -- "${WORKSPACE_ROOT}"
mkdir -p "${MODULE_REL}/pb"
mkdir -p \
"${DOCS_DIR}" "${DOCS_GO_DIR}" "${DOCS_TS_DIR}" \
"${CLIENT_GO_DIR}" "${CLIENT_TS_DIR}"
protoc \
--proto_path="${MODULE_REL}/proto" \
--go_out="paths=source_relative:${MODULE_REL}/pb" \
--go_out="paths=source_relative:sdk/client/golang/${MODULE_NAME}" \
--go-grpc_out="paths=source_relative:${MODULE_REL}/pb" \
--go-grpc_out="paths=source_relative:sdk/client/golang/${MODULE_NAME}" \
--grpc-gateway_out="paths=source_relative,generate_unbound_methods=true:${MODULE_REL}/pb" \
--ts_out="sdk/client/typescript" \
--markdown_out="paths=source_relative:${DOCS_DIR}" \
"${MODULE_REL}/proto/"*.proto
(cd -- "${MODULE_REL}" && protoc \
--proto_path=proto \
--slc_out=./ \
proto/*.proto)

View File

@@ -0,0 +1,267 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc v7.36.0
// source: ads.proto
package ads
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ByPosRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ByPosRequest) Reset() {
*x = ByPosRequest{}
mi := &file_ads_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ByPosRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ByPosRequest) ProtoMessage() {}
func (x *ByPosRequest) ProtoReflect() protoreflect.Message {
mi := &file_ads_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ByPosRequest.ProtoReflect.Descriptor instead.
func (*ByPosRequest) Descriptor() ([]byte, []int) {
return file_ads_proto_rawDescGZIP(), []int{0}
}
func (x *ByPosRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
type ByPosReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*AdsItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ByPosReply) Reset() {
*x = ByPosReply{}
mi := &file_ads_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ByPosReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ByPosReply) ProtoMessage() {}
func (x *ByPosReply) ProtoReflect() protoreflect.Message {
mi := &file_ads_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ByPosReply.ProtoReflect.Descriptor instead.
func (*ByPosReply) Descriptor() ([]byte, []int) {
return file_ads_proto_rawDescGZIP(), []int{1}
}
func (x *ByPosReply) GetData() []*AdsItem {
if x != nil {
return x.Data
}
return nil
}
type AdsItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` //广告名称
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` //广告内容
Type int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"` //广告类型 1.文本 2.图片 3.视频
ToUrl string `protobuf:"bytes,5,opt,name=toUrl,proto3" json:"toUrl,omitempty"`
Created string `protobuf:"bytes,6,opt,name=created,proto3" json:"created,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AdsItem) Reset() {
*x = AdsItem{}
mi := &file_ads_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AdsItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AdsItem) ProtoMessage() {}
func (x *AdsItem) ProtoReflect() protoreflect.Message {
mi := &file_ads_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AdsItem.ProtoReflect.Descriptor instead.
func (*AdsItem) Descriptor() ([]byte, []int) {
return file_ads_proto_rawDescGZIP(), []int{2}
}
func (x *AdsItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *AdsItem) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *AdsItem) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *AdsItem) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
func (x *AdsItem) GetToUrl() string {
if x != nil {
return x.ToUrl
}
return ""
}
func (x *AdsItem) GetCreated() string {
if x != nil {
return x.Created
}
return ""
}
var File_ads_proto protoreflect.FileDescriptor
const file_ads_proto_rawDesc = "" +
"\n" +
"\tads.proto\x12\x03ads\" \n" +
"\fByPosRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\".\n" +
"\n" +
"ByPosReply\x12 \n" +
"\x04data\x18\x01 \x03(\v2\f.ads.AdsItemR\x04data\"\x8d\x01\n" +
"\aAdsItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12\x18\n" +
"\acontent\x18\x03 \x01(\tR\acontent\x12\x12\n" +
"\x04type\x18\x04 \x01(\x05R\x04type\x12\x14\n" +
"\x05toUrl\x18\x05 \x01(\tR\x05toUrl\x12\x18\n" +
"\acreated\x18\x06 \x01(\tR\acreated26\n" +
"\x05Fetch\x12-\n" +
"\x05ByPos\x12\x11.ads.ByPosRequest\x1a\x0f.ads.ByPosReply\"\x00B\aZ\x05.;adsb\x06proto3"
var (
file_ads_proto_rawDescOnce sync.Once
file_ads_proto_rawDescData []byte
)
func file_ads_proto_rawDescGZIP() []byte {
file_ads_proto_rawDescOnce.Do(func() {
file_ads_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ads_proto_rawDesc), len(file_ads_proto_rawDesc)))
})
return file_ads_proto_rawDescData
}
var file_ads_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_ads_proto_goTypes = []any{
(*ByPosRequest)(nil), // 0: ads.ByPosRequest
(*ByPosReply)(nil), // 1: ads.ByPosReply
(*AdsItem)(nil), // 2: ads.AdsItem
}
var file_ads_proto_depIdxs = []int32{
2, // 0: ads.ByPosReply.data:type_name -> ads.AdsItem
0, // 1: ads.Fetch.ByPos:input_type -> ads.ByPosRequest
1, // 2: ads.Fetch.ByPos:output_type -> ads.ByPosReply
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_ads_proto_init() }
func file_ads_proto_init() {
if File_ads_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ads_proto_rawDesc), len(file_ads_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ads_proto_goTypes,
DependencyIndexes: file_ads_proto_depIdxs,
MessageInfos: file_ads_proto_msgTypes,
}.Build()
File_ads_proto = out.File
file_ads_proto_goTypes = nil
file_ads_proto_depIdxs = nil
}

View File

@@ -0,0 +1,127 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.36.0
// source: ads.proto
package ads
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Fetch_ByPos_FullMethodName = "/ads.Fetch/ByPos"
)
// FetchClient is the client API for Fetch service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// 广告子系统
type FetchClient interface {
//通过广告位获取广告信息
ByPos(ctx context.Context, in *ByPosRequest, opts ...grpc.CallOption) (*ByPosReply, error)
}
type fetchClient struct {
cc grpc.ClientConnInterface
}
func NewFetchClient(cc grpc.ClientConnInterface) FetchClient {
return &fetchClient{cc}
}
func (c *fetchClient) ByPos(ctx context.Context, in *ByPosRequest, opts ...grpc.CallOption) (*ByPosReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ByPosReply)
err := c.cc.Invoke(ctx, Fetch_ByPos_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FetchServer is the server API for Fetch service.
// All implementations must embed UnimplementedFetchServer
// for forward compatibility.
//
// 广告子系统
type FetchServer interface {
//通过广告位获取广告信息
ByPos(context.Context, *ByPosRequest) (*ByPosReply, error)
mustEmbedUnimplementedFetchServer()
}
// UnimplementedFetchServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFetchServer struct{}
func (UnimplementedFetchServer) ByPos(context.Context, *ByPosRequest) (*ByPosReply, error) {
return nil, status.Error(codes.Unimplemented, "method ByPos not implemented")
}
func (UnimplementedFetchServer) mustEmbedUnimplementedFetchServer() {}
func (UnimplementedFetchServer) testEmbeddedByValue() {}
// UnsafeFetchServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FetchServer will
// result in compilation errors.
type UnsafeFetchServer interface {
mustEmbedUnimplementedFetchServer()
}
func RegisterFetchServer(s grpc.ServiceRegistrar, srv FetchServer) {
// If the following call panics, it indicates UnimplementedFetchServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Fetch_ServiceDesc, srv)
}
func _Fetch_ByPos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ByPosRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FetchServer).ByPos(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Fetch_ByPos_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FetchServer).ByPos(ctx, req.(*ByPosRequest))
}
return interceptor(ctx, in, info, handler)
}
// Fetch_ServiceDesc is the grpc.ServiceDesc for Fetch service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Fetch_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ads.Fetch",
HandlerType: (*FetchServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ByPos",
Handler: _Fetch_ByPos_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ads.proto",
}

3
sdk/client/golang/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module bsm/sdk/client
go 1.27.1

View File

@@ -0,0 +1,44 @@
// Code generated by protoc-gen-typescript-http. DO NOT EDIT.
/* eslint-disable camelcase */
// @ts-nocheck
export type ByPosRequest = {
key?: string;
};
export type ByPosReply = {
data?: AdsItem[];
};
export type AdsItem = {
id?: number;
/** 广告名称 */
title?: string;
/** 广告内容 */
content?: string;
/** 广告类型 1.文本 2.图片 3.视频 */
type?: number;
toUrl?: string;
created?: string;
};
/** 广告子系统 */
export interface Fetch {
}
type RequestType = {
path: string;
method: string;
body: string | null;
};
type RequestHandler = (request: RequestType, meta: { service: string, method: string }) => Promise<unknown>;
export function createFetchClient(
handler: RequestHandler
): Fetch {
return {
};
}
// @@protoc_insertion_point(typescript-http-eof)

32
sdk/docs/ads/ads.md Normal file
View File

@@ -0,0 +1,32 @@
# Fetch
广告子系统
- [/ads.Fetch/ByPos](#adsfetchbypos)
## /ads.Fetch/ByPos
通过广告位获取广告信息
### Request
```javascript
{
key: "", // type<string>
}
```
### Reply
```javascript
{
data: [{
id: "0", // type<int64>
title: "", // type<string>, 广告名称
content: "", // type<string>, 广告内容
type: 0, // type<int32>, 广告类型 1.文本 2.图片 3.视频
toUrl: "", // type<string>
created: "", // type<string>
}], // list<AdsItem>
}
```