Compare commits

..

No commits in common. "dev" and "main" have entirely different histories.
dev ... main

90 changed files with 2492 additions and 25971 deletions

16
.gitignore vendored
View File

@ -1,17 +1,12 @@
.gitignore
.idea
.scannerwork
.vscode
# local env files # local env files
.env.local .env.local
.env.*.local .env.*.local
# Log files # Log files
npm-debug.log* *.log
yarn-debug.log*
yarn-error.log*
# Editor directories and files .idea
.vscode
*.suo *.suo
*.ntvs* *.ntvs*
*.njsproj *.njsproj
@ -32,7 +27,4 @@ yarn-error.log*
# Output of the go coverage tool, specifically when used with LiteIDE # Output of the go coverage tool, specifically when used with LiteIDE
*.out *.out
/cmd/runtime
/cmd/logs/*.log
/cmd/runtime/log/*.log
/build/*

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,9 @@
syntax = "proto3"; syntax = "proto3";
package accountFiee; package accountFiee;
import "github.com/mwitkow/go-proto-validators@v0.3.2/validator.proto"; import "github.com/mwitkow/go-proto-validators@v0.3.2/validator.proto";
option go_package = "./;accountFiee"; option go_package = "./;accountFiee";
//protoc -I . -I C:\Users\lenovo\go\src --go_out=. --go-triple_out=. ./accountFiee.proto
service AccountFiee { service AccountFiee {
rpc Login (LoginRequest) returns (TokenInfo) {} rpc Login (LoginRequest) returns (TokenInfo) {}
rpc RefreshToken (RefreshTokenRequest) returns (TokenInfo) {} //token rpc RefreshToken (RefreshTokenRequest) returns (TokenInfo) {} //token
@ -62,37 +62,6 @@ service AccountFiee {
rpc VerifySliderCaptcha(VerifySliderCaptchaRequest) returns (VerifySliderCaptchaResponse) {}// rpc VerifySliderCaptcha(VerifySliderCaptchaRequest) returns (VerifySliderCaptchaResponse) {}//
rpc SendNationMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} // -- rpc SendNationMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} // --
rpc VerifySliderStatus(VerifySliderStatusRequest) returns (VerifySliderStatusResponse) {}// rpc VerifySliderStatus(VerifySliderStatusRequest) returns (VerifySliderStatusResponse) {}//
// submit info
rpc SaveSubmitInfo(SubmitInfoRequest) returns (CommonResponse);
//-------------------------------------------------------------
rpc CreateChatUser ( ChatUserData )returns( CreateChatUserResp ){} //
rpc UpdateChatUser ( ChatUserData )returns( CommonMsg ){} //
rpc SaveChatUser ( ChatUserData )returns( CommonMsg ){} //
rpc DeleteChatUser ( DeleteChatUserRequest )returns( CommonMsg ){} //
rpc GetChatUserDetail ( GetChatUserByIdRequest )returns( ChatUserData ){} //
rpc GetChatUserList ( GetChatUserListRequest )returns( GetChatUserListResp ){} //
rpc GetChatUserList2 ( GetChatUserListRequest2 )returns( GetChatUserListResp2 ){} //2
rpc RegisterWaiter ( RegisterWaiterRequest )returns( RegisterWaiterResp ){} //
rpc CreateChatRecord ( ChatRecordData )returns( CreateChatRecordResp ){} //ChatRecord
rpc UpdateChatRecord ( ChatRecordData )returns( CommonMsg ){} //ChatRecord
rpc SaveChatRecord ( ChatRecordData )returns( CommonMsg ){} //ChatRecord
rpc DeleteChatRecord ( DeleteChatRecordRequest )returns( CommonMsg ){} //ChatRecord
rpc GetChatRecordDetail ( GetChatRecordByIdRequest )returns( ChatRecordData ){} //ChatRecord详情
rpc GetChatRecordList ( GetChatRecordListRequest )returns( GetChatRecordListResp ){} //ChatRecord列表
rpc CreateChatMedia ( ChatMediaData )returns( CreateChatMediaResp ){} //ChatMedia
rpc UpdateChatMedia ( ChatMediaData )returns( CommonMsg ){} //ChatMedia
rpc SaveChatMedia ( ChatMediaData )returns( CommonMsg ){} //ChatMedia
rpc DeleteChatMedia ( DeleteChatMediaRequest )returns( CommonMsg ){} //ChatMedia
rpc GetChatMediaDetail ( GetChatMediaByIdRequest )returns( ChatMediaData ){} //ChatMedia详情
rpc GetChatMediaList ( GetChatMediaListRequest )returns( GetChatMediaListResp ){} //ChatMedia列表
rpc CreateChatAutoReplyRuler ( ChatAutoReplyRulerData )returns( CreateChatAutoReplyRulerResp ){} //
rpc UpdateChatAutoReplyRuler ( ChatAutoReplyRulerData )returns( CommonMsg ){} //
rpc SaveChatAutoReplyRuler ( ChatAutoReplyRulerData )returns( CommonMsg ){} //
rpc DeleteChatAutoReplyRuler ( DeleteChatAutoReplyRulerRequest )returns( CommonMsg ){} //
rpc GetChatAutoReplyRulerDetail ( GetChatAutoReplyRulerByIdRequest )returns( ChatAutoReplyRulerData ){} //
rpc GetChatAutoReplyRulerList ( GetChatAutoReplyRulerListRequest )returns( GetChatAutoReplyRulerListResp ){} //
} }
message VerifySliderStatusRequest { message VerifySliderStatusRequest {
@ -849,206 +818,3 @@ message ClockLogListResponse{
repeated ClockLogInfo data =1; repeated ClockLogInfo data =1;
uint64 count = 2; uint64 count = 2;
} }
message SubmitInfoRequest{
string firstName = 1;
string lastName = 2;
string email = 3;
string company = 4;
string phone = 5;
}
message CommonMsg{
string msg = 1;
}
enum MsgType{
UnknownMsgType = 0 ;//
TextMsgType = 1 ;//
ImageMsgType = 2 ;//
AudioMsgType = 3 ;//
VideoMsgType = 4 ;//
FileType = 5 ;//
}
message ChatRecordData{
int64 ID=1;
string createdAt=2;
string updatedAt=3;
int64 deletedAt=4;
string sessionId = 5; //UID
int64 userId = 6; //ID
string name = 7; //
string avatar = 8; //
MsgType msgType = 9; //
string content = 10; //
repeated ChatMediaData medias = 11; //
int32 waiterRead=12;// 1= 2=
int64 localStamp = 13; //
string domain =14;//
}
message CreateChatRecordResp{
ChatRecordData data=1;
string msg=2;
}
message DeleteChatRecordRequest{
int64 id=1; //id
repeated int64 ids=2;//id列表
}
message GetChatRecordByIdRequest{
int64 id=1; //id
}
message GetChatRecordListRequest{
ChatRecordData query =1;
int64 page=2;
int64 pageSize=3;
string where=4;
string order=5;
}
message GetChatRecordListResp{
repeated ChatRecordData list=1;
int64 page=2;
int64 pageSize=3;
int64 Total=4;
}
message RegisterWaiterRequest{
string origin=1; //
int64 originId=2; //ID
string nickName=3; //
string avatar=4; //
string telNum=5; //
string invitationCode=6; //
string account=7;
}
message RegisterWaiterResp{
int64 userId=1;
}
message ChatMediaData{
int64 ID=1;
string createdAt=2;
string updatedAt=3;
int64 deletedAt=4;
string url = 5; //url
string md5 = 6; //md5值
string size = 7; //
string ext = 8; //
string convText=9; //
int64 duration=10;//
}
message CreateChatMediaResp{
ChatMediaData data=1;
string msg=2;
}
message DeleteChatMediaRequest{
int64 id=1; //id
repeated int64 ids=2;//id列表
}
message GetChatMediaByIdRequest{
int64 id=1; //id
}
message GetChatMediaListRequest{
ChatMediaData query =1;
int64 page=2;
int64 pageSize=3;
string where=4;
string order=5;
}
message GetChatMediaListResp{
repeated ChatMediaData list=1;
int64 page=2;
int64 pageSize=3;
int64 Total=4;
}
message GetChatUserListRequest2{
int64 page=1;
int64 pageSize=2;
string where=3;
string name=4;
repeated int64 userIdIn=5;
}
message ChatUser2{
int64 userId=1;
string name=2;
string avatar=3;
string origin=4;
string originId=5;
}
message GetChatUserListResp2{
repeated ChatUser2 list=1;
int64 page=2;
int64 pageSize=3;
int64 Total=4;
string where=5;
}
message ChatAutoReplyRulerData{
int64 ID = 1; //
string createdAt = 2; //
string updatedAt = 3; //
int64 deletedAt = 4; //
string title = 5; //
string ruler = 6; //
int32 rulerStatus = 7; //: 1= 2=
}
message CreateChatAutoReplyRulerResp{
ChatAutoReplyRulerData data=1;
string msg=2;
}
message DeleteChatAutoReplyRulerRequest{
int64 id=1; //id
repeated int64 ids=2;//id列表
}
message GetChatAutoReplyRulerByIdRequest{
int64 id=1; //id
}
message GetChatAutoReplyRulerListRequest{
ChatAutoReplyRulerData query =1;
int64 page=2;
int64 pageSize=3;
string where=4;
string order=5;
}
message GetChatAutoReplyRulerListResp{
repeated ChatAutoReplyRulerData list=1;
int64 page=2;
int64 pageSize=3;
int64 Total=4;
}
message ChatUserData{
int64 ID = 1; //
string createdAt = 2; //
string updatedAt = 3; //
int64 deletedAt = 4; //
string nickName = 5; //
string account = 6; //
int32 role = 7; // 1= 2=
string origin = 8; //
int64 originId = 9; //ID
string avatar = 10; //
}
message CreateChatUserResp{
ChatUserData data=1;
string msg=2;
}
message DeleteChatUserRequest{
int64 id=1; //id
repeated int64 ids=2;//id列表
}
message GetChatUserByIdRequest{
int64 id=1; //id
}
message GetChatUserListRequest{
ChatUserData query =1;
int64 page=2;
int64 pageSize=3;
string where=4;
string order=5;
}
message GetChatUserListResp{
repeated ChatUserData list=1;
int64 page=2;
int64 pageSize=3;
int64 Total=4;
}

View File

@ -522,6 +522,3 @@ func (this *ClockLogListResponse) Validate() error {
} }
return nil return nil
} }
func (this *SubmitInfoRequest) Validate() error {
return nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,36 +17,10 @@ var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf var _ = math.Inf
func (this *PackagePriceAndTimeResponse) Validate() error {
return nil
}
func (this *CommonResponse) Validate() error { func (this *CommonResponse) Validate() error {
return nil return nil
} }
func (this *BundleProfile) Validate() error { func (this *BundleProfile) Validate() error {
for _, item := range this.SelectValueAddService {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("SelectValueAddService", err)
}
}
}
for _, item := range this.BundleProfileLang {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("BundleProfileLang", err)
}
}
}
return nil
}
func (this *BundleProfileLang) Validate() error {
return nil
}
func (this *SaveResponse) Validate() error {
return nil
}
func (this *SelectValueAddService) Validate() error {
return nil return nil
} }
func (this *DelBundleRequest) Validate() error { func (this *DelBundleRequest) Validate() error {
@ -68,9 +42,6 @@ func (this *BundleListResponse) Validate() error {
func (this *BundleDetailRequest) Validate() error { func (this *BundleDetailRequest) Validate() error {
return nil return nil
} }
func (this *HandShelfRequest) Validate() error {
return nil
}
func (this *BundleDetailResponse) Validate() error { func (this *BundleDetailResponse) Validate() error {
if this.Bundle != nil { if this.Bundle != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bundle); err != nil { if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bundle); err != nil {
@ -79,38 +50,7 @@ func (this *BundleDetailResponse) Validate() error {
} }
return nil return nil
} }
func (this *BundleDetailResponseV2) Validate() error {
if this.Bundle != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bundle); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Bundle", err)
}
}
return nil
}
func (this *OrderRecord) Validate() error { func (this *OrderRecord) Validate() error {
for _, item := range this.PriceOptionsInfo {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("PriceOptionsInfo", err)
}
}
}
return nil
}
func (this *OrderAddRecord) Validate() error {
for _, item := range this.AddPriceOptionsList {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("AddPriceOptionsList", err)
}
}
}
return nil
}
func (this *AddPriceOptionsInfo) Validate() error {
return nil
}
func (this *PriceOptionsInfo) Validate() error {
return nil return nil
} }
func (this *OrderRecordsRequest) Validate() error { func (this *OrderRecordsRequest) Validate() error {
@ -179,78 +119,3 @@ func (this *ValueAddBundleDetailResponse) Validate() error {
func (this *FinancialConfirmationRequest) Validate() error { func (this *FinancialConfirmationRequest) Validate() error {
return nil return nil
} }
func (this *ValueAddService) Validate() error {
for _, item := range this.ServiceLang {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ServiceLang", err)
}
}
}
return nil
}
func (this *ValueAddServiceLang) Validate() error {
for _, item := range this.Options {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Options", err)
}
}
}
return nil
}
func (this *ValueAddPriceOptions) Validate() error {
return nil
}
func (this *ValueAddServiceListRequest) Validate() error {
return nil
}
func (this *ValueAddServiceListResponse) Validate() error {
for _, item := range this.ValueAddServiceList {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddServiceList", err)
}
}
}
return nil
}
func (this *ValueAddServiceDetailRequest) Validate() error {
return nil
}
func (this *ValueAddServiceDetailResponse) Validate() error {
if this.ValueAddService != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ValueAddService); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddService", err)
}
}
return nil
}
func (this *BundleExtendRequest) Validate() error {
return nil
}
func (this *BundleExtendResponse) Validate() error {
return nil
}
func (this *BundleExtendRecordsListRequest) Validate() error {
return nil
}
func (this *BundleExtendRecordsListResponse) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *BundleExtendRecordItem) Validate() error {
return nil
}
func (this *SetBundleBalanceRequest) Validate() error {
return nil
}
func (this *SetBundleBalanceResponse) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT. // Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-triple v1.0.8 // - protoc-gen-go-triple v1.0.8
// - protoc v4.24.0--rc1 // - protoc v3.10.1
// source: pb/bundle.proto // source: pb/bundle.proto
package bundle package bundle
@ -31,10 +31,6 @@ type BundleClient interface {
CreateBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) CreateBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) UpdateBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
DeleteBundle(ctx context.Context, in *DelBundleRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) DeleteBundle(ctx context.Context, in *DelBundleRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
HandShelf(ctx context.Context, in *HandShelfRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
SaveBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment)
BundleListV2(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
BundleDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponseV2, common.ErrorWithAttachment)
BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
BundleDetail(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponse, common.ErrorWithAttachment) BundleDetail(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponse, common.ErrorWithAttachment)
CreateOrderRecord(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) CreateOrderRecord(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
@ -43,19 +39,10 @@ type BundleClient interface {
OrderRecordsList(ctx context.Context, in *OrderRecordsRequest, opts ...grpc_go.CallOption) (*OrderRecordsResponse, common.ErrorWithAttachment) OrderRecordsList(ctx context.Context, in *OrderRecordsRequest, opts ...grpc_go.CallOption) (*OrderRecordsResponse, common.ErrorWithAttachment)
OrderRecordsDetail(ctx context.Context, in *OrderRecordsDetailRequest, opts ...grpc_go.CallOption) (*OrderRecordsDetailResponse, common.ErrorWithAttachment) OrderRecordsDetail(ctx context.Context, in *OrderRecordsDetailRequest, opts ...grpc_go.CallOption) (*OrderRecordsDetailResponse, common.ErrorWithAttachment)
UpdateFinancialConfirmationStatus(ctx context.Context, in *FinancialConfirmationRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) UpdateFinancialConfirmationStatus(ctx context.Context, in *FinancialConfirmationRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
CreateOrderAddRecord(ctx context.Context, in *OrderAddRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
PackagePriceAndTime(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*PackagePriceAndTimeResponse, common.ErrorWithAttachment)
//增值套餐 //增值套餐
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment) ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment) ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
//新增值服务
SaveValueAddService(ctx context.Context, in *ValueAddServiceLang, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment)
ValueAddServiceList(ctx context.Context, in *ValueAddServiceListRequest, opts ...grpc_go.CallOption) (*ValueAddServiceListResponse, common.ErrorWithAttachment)
ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment)
// 余量管理
BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment)
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
} }
type bundleClient struct { type bundleClient struct {
@ -66,10 +53,6 @@ type BundleClientImpl struct {
CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error) CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error) UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error) DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error)
HandShelf func(ctx context.Context, in *HandShelfRequest) (*CommonResponse, error)
SaveBundle func(ctx context.Context, in *BundleProfile) (*SaveResponse, error)
BundleListV2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
BundleDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponseV2, error)
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error) BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error) BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
CreateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error) CreateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
@ -78,16 +61,9 @@ type BundleClientImpl struct {
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error) OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
UpdateFinancialConfirmationStatus func(ctx context.Context, in *FinancialConfirmationRequest) (*CommonResponse, error) UpdateFinancialConfirmationStatus func(ctx context.Context, in *FinancialConfirmationRequest) (*CommonResponse, error)
CreateOrderAddRecord func(ctx context.Context, in *OrderAddRecord) (*CommonResponse, error)
PackagePriceAndTime func(ctx context.Context, in *OrderRecord) (*PackagePriceAndTimeResponse, error)
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error) ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
SaveValueAddService func(ctx context.Context, in *ValueAddServiceLang) (*SaveResponse, error)
ValueAddServiceList func(ctx context.Context, in *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
ValueAddServiceDetail func(ctx context.Context, in *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
} }
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient { func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
@ -120,30 +96,6 @@ func (c *bundleClient) DeleteBundle(ctx context.Context, in *DelBundleRequest, o
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteBundle", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteBundle", in, out)
} }
func (c *bundleClient) HandShelf(ctx context.Context, in *HandShelfRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/HandShelf", in, out)
}
func (c *bundleClient) SaveBundle(ctx context.Context, in *BundleProfile, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment) {
out := new(SaveResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SaveBundle", in, out)
}
func (c *bundleClient) BundleListV2(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) {
out := new(BundleListResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleListV2", in, out)
}
func (c *bundleClient) BundleDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponseV2, common.ErrorWithAttachment) {
out := new(BundleDetailResponseV2)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleDetailV2", in, out)
}
func (c *bundleClient) BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) { func (c *bundleClient) BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) {
out := new(BundleListResponse) out := new(BundleListResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -192,18 +144,6 @@ func (c *bundleClient) UpdateFinancialConfirmationStatus(ctx context.Context, in
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateFinancialConfirmationStatus", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateFinancialConfirmationStatus", in, out)
} }
func (c *bundleClient) CreateOrderAddRecord(ctx context.Context, in *OrderAddRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateOrderAddRecord", in, out)
}
func (c *bundleClient) PackagePriceAndTime(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*PackagePriceAndTimeResponse, common.ErrorWithAttachment) {
out := new(PackagePriceAndTimeResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PackagePriceAndTime", in, out)
}
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) { func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
out := new(CreateValueAddBundleResponse) out := new(CreateValueAddBundleResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -222,36 +162,6 @@ func (c *bundleClient) ValueAddBundleDetail(ctx context.Context, in *ValueAddBun
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddBundleDetail", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddBundleDetail", in, out)
} }
func (c *bundleClient) SaveValueAddService(ctx context.Context, in *ValueAddServiceLang, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment) {
out := new(SaveResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SaveValueAddService", in, out)
}
func (c *bundleClient) ValueAddServiceList(ctx context.Context, in *ValueAddServiceListRequest, opts ...grpc_go.CallOption) (*ValueAddServiceListResponse, common.ErrorWithAttachment) {
out := new(ValueAddServiceListResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddServiceList", in, out)
}
func (c *bundleClient) ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment) {
out := new(ValueAddServiceDetailResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddServiceDetail", in, out)
}
func (c *bundleClient) BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment) {
out := new(BundleExtendResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleExtend", in, out)
}
func (c *bundleClient) BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment) {
out := new(BundleExtendRecordsListResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleExtendRecordsList", in, out)
}
// BundleServer is the server API for Bundle service. // BundleServer is the server API for Bundle service.
// All implementations must embed UnimplementedBundleServer // All implementations must embed UnimplementedBundleServer
// for forward compatibility // for forward compatibility
@ -259,10 +169,6 @@ type BundleServer interface {
CreateBundle(context.Context, *BundleProfile) (*CommonResponse, error) CreateBundle(context.Context, *BundleProfile) (*CommonResponse, error)
UpdateBundle(context.Context, *BundleProfile) (*CommonResponse, error) UpdateBundle(context.Context, *BundleProfile) (*CommonResponse, error)
DeleteBundle(context.Context, *DelBundleRequest) (*CommonResponse, error) DeleteBundle(context.Context, *DelBundleRequest) (*CommonResponse, error)
HandShelf(context.Context, *HandShelfRequest) (*CommonResponse, error)
SaveBundle(context.Context, *BundleProfile) (*SaveResponse, error)
BundleListV2(context.Context, *BundleListRequest) (*BundleListResponse, error)
BundleDetailV2(context.Context, *BundleDetailRequest) (*BundleDetailResponseV2, error)
BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error) BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error)
BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error) BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error)
CreateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error) CreateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error)
@ -271,19 +177,10 @@ type BundleServer interface {
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error) OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error) UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error)
CreateOrderAddRecord(context.Context, *OrderAddRecord) (*CommonResponse, error)
PackagePriceAndTime(context.Context, *OrderRecord) (*PackagePriceAndTimeResponse, error)
//增值套餐 //增值套餐
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error) ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
//新增值服务
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
// 余量管理
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
mustEmbedUnimplementedBundleServer() mustEmbedUnimplementedBundleServer()
} }
@ -301,18 +198,6 @@ func (UnimplementedBundleServer) UpdateBundle(context.Context, *BundleProfile) (
func (UnimplementedBundleServer) DeleteBundle(context.Context, *DelBundleRequest) (*CommonResponse, error) { func (UnimplementedBundleServer) DeleteBundle(context.Context, *DelBundleRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteBundle not implemented") return nil, status.Errorf(codes.Unimplemented, "method DeleteBundle not implemented")
} }
func (UnimplementedBundleServer) HandShelf(context.Context, *HandShelfRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandShelf not implemented")
}
func (UnimplementedBundleServer) SaveBundle(context.Context, *BundleProfile) (*SaveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SaveBundle not implemented")
}
func (UnimplementedBundleServer) BundleListV2(context.Context, *BundleListRequest) (*BundleListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleListV2 not implemented")
}
func (UnimplementedBundleServer) BundleDetailV2(context.Context, *BundleDetailRequest) (*BundleDetailResponseV2, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleDetailV2 not implemented")
}
func (UnimplementedBundleServer) BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error) { func (UnimplementedBundleServer) BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleList not implemented") return nil, status.Errorf(codes.Unimplemented, "method BundleList not implemented")
} }
@ -337,12 +222,6 @@ func (UnimplementedBundleServer) OrderRecordsDetail(context.Context, *OrderRecor
func (UnimplementedBundleServer) UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error) { func (UnimplementedBundleServer) UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateFinancialConfirmationStatus not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateFinancialConfirmationStatus not implemented")
} }
func (UnimplementedBundleServer) CreateOrderAddRecord(context.Context, *OrderAddRecord) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateOrderAddRecord not implemented")
}
func (UnimplementedBundleServer) PackagePriceAndTime(context.Context, *OrderRecord) (*PackagePriceAndTimeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PackagePriceAndTime not implemented")
}
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) { func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented") return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
} }
@ -352,21 +231,6 @@ func (UnimplementedBundleServer) ValueAddBundleList(context.Context, *ValueAddBu
func (UnimplementedBundleServer) ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) { func (UnimplementedBundleServer) ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValueAddBundleDetail not implemented") return nil, status.Errorf(codes.Unimplemented, "method ValueAddBundleDetail not implemented")
} }
func (UnimplementedBundleServer) SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SaveValueAddService not implemented")
}
func (UnimplementedBundleServer) ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValueAddServiceList not implemented")
}
func (UnimplementedBundleServer) ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValueAddServiceDetail not implemented")
}
func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleExtend not implemented")
}
func (UnimplementedBundleServer) BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleExtendRecordsList not implemented")
}
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) { func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl s.proxyImpl = impl
} }
@ -482,122 +346,6 @@ func _Bundle_DeleteBundle_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Bundle_HandShelf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(HandShelfRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("HandShelf", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_SaveBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleProfile)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("SaveBundle", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_BundleListV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleListRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("BundleListV2", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_BundleDetailV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleDetailRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("BundleDetailV2", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_BundleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Bundle_BundleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleListRequest) in := new(BundleListRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -830,64 +578,6 @@ func _Bundle_UpdateFinancialConfirmationStatus_Handler(srv interface{}, ctx cont
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Bundle_CreateOrderAddRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OrderAddRecord)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("CreateOrderAddRecord", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_PackagePriceAndTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OrderRecord)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("PackagePriceAndTime", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateValueAddBundleRequest) in := new(CreateValueAddBundleRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -975,151 +665,6 @@ func _Bundle_ValueAddBundleDetail_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Bundle_SaveValueAddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ValueAddServiceLang)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("SaveValueAddService", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_ValueAddServiceList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ValueAddServiceListRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("ValueAddServiceList", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_ValueAddServiceDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ValueAddServiceDetailRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("ValueAddServiceDetail", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_BundleExtend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleExtendRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("BundleExtend", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_BundleExtendRecordsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleExtendRecordsListRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("BundleExtendRecordsList", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service. // Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
// It's only intended for direct use with grpc_go.RegisterService, // It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -1139,22 +684,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "DeleteBundle", MethodName: "DeleteBundle",
Handler: _Bundle_DeleteBundle_Handler, Handler: _Bundle_DeleteBundle_Handler,
}, },
{
MethodName: "HandShelf",
Handler: _Bundle_HandShelf_Handler,
},
{
MethodName: "SaveBundle",
Handler: _Bundle_SaveBundle_Handler,
},
{
MethodName: "BundleListV2",
Handler: _Bundle_BundleListV2_Handler,
},
{
MethodName: "BundleDetailV2",
Handler: _Bundle_BundleDetailV2_Handler,
},
{ {
MethodName: "BundleList", MethodName: "BundleList",
Handler: _Bundle_BundleList_Handler, Handler: _Bundle_BundleList_Handler,
@ -1187,14 +716,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "UpdateFinancialConfirmationStatus", MethodName: "UpdateFinancialConfirmationStatus",
Handler: _Bundle_UpdateFinancialConfirmationStatus_Handler, Handler: _Bundle_UpdateFinancialConfirmationStatus_Handler,
}, },
{
MethodName: "CreateOrderAddRecord",
Handler: _Bundle_CreateOrderAddRecord_Handler,
},
{
MethodName: "PackagePriceAndTime",
Handler: _Bundle_PackagePriceAndTime_Handler,
},
{ {
MethodName: "CreateValueAddBundle", MethodName: "CreateValueAddBundle",
Handler: _Bundle_CreateValueAddBundle_Handler, Handler: _Bundle_CreateValueAddBundle_Handler,
@ -1207,26 +728,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "ValueAddBundleDetail", MethodName: "ValueAddBundleDetail",
Handler: _Bundle_ValueAddBundleDetail_Handler, Handler: _Bundle_ValueAddBundleDetail_Handler,
}, },
{
MethodName: "SaveValueAddService",
Handler: _Bundle_SaveValueAddService_Handler,
},
{
MethodName: "ValueAddServiceList",
Handler: _Bundle_ValueAddServiceList_Handler,
},
{
MethodName: "ValueAddServiceDetail",
Handler: _Bundle_ValueAddServiceDetail_Handler,
},
{
MethodName: "BundleExtend",
Handler: _Bundle_BundleExtend_Handler,
},
{
MethodName: "BundleExtendRecordsList",
Handler: _Bundle_BundleExtendRecordsList_Handler,
},
}, },
Streams: []grpc_go.StreamDesc{}, Streams: []grpc_go.StreamDesc{},
Metadata: "pb/bundle.proto", Metadata: "pb/bundle.proto",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,463 +0,0 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.1
// source: pb/fiee/cast.proto
package cast
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// CastClient is the client API for Cast 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 CastClient interface {
MediaUserList(ctx context.Context, in *MediaUserListReq, opts ...grpc_go.CallOption) (*MediaUserListResp, common.ErrorWithAttachment)
UpdateMediaAccount(ctx context.Context, in *UpdateMediaAccountReq, opts ...grpc_go.CallOption) (*UpdateMediaAccountResp, common.ErrorWithAttachment)
UnbindManager(ctx context.Context, in *UnbindManagerReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
BindManager(ctx context.Context, in *BindManagerReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
UpdateWorkImage(ctx context.Context, in *UpdateWorkImageReq, opts ...grpc_go.CallOption) (*UpdateWorkImageResp, common.ErrorWithAttachment)
UpdateWorkVideo(ctx context.Context, in *UpdateWorkVideoReq, opts ...grpc_go.CallOption) (*UpdateWorkVideoResp, common.ErrorWithAttachment)
WorkList(ctx context.Context, in *WorkListReq, opts ...grpc_go.CallOption) (*WorkListResp, common.ErrorWithAttachment)
WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment)
}
type castClient struct {
cc *triple.TripleConn
}
type CastClientImpl struct {
MediaUserList func(ctx context.Context, in *MediaUserListReq) (*MediaUserListResp, error)
UpdateMediaAccount func(ctx context.Context, in *UpdateMediaAccountReq) (*UpdateMediaAccountResp, error)
UnbindManager func(ctx context.Context, in *UnbindManagerReq) (*emptypb.Empty, error)
BindManager func(ctx context.Context, in *BindManagerReq) (*emptypb.Empty, error)
UpdateWorkImage func(ctx context.Context, in *UpdateWorkImageReq) (*UpdateWorkImageResp, error)
UpdateWorkVideo func(ctx context.Context, in *UpdateWorkVideoReq) (*UpdateWorkVideoResp, error)
WorkList func(ctx context.Context, in *WorkListReq) (*WorkListResp, error)
WorkDetail func(ctx context.Context, in *WorkDetailReq) (*WorkDetailResp, error)
}
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
return NewCastClient(cc)
}
func (c *CastClientImpl) XXX_InterfaceName() string {
return "Cast.Cast"
}
func NewCastClient(cc *triple.TripleConn) CastClient {
return &castClient{cc}
}
func (c *castClient) MediaUserList(ctx context.Context, in *MediaUserListReq, opts ...grpc_go.CallOption) (*MediaUserListResp, common.ErrorWithAttachment) {
out := new(MediaUserListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/MediaUserList", in, out)
}
func (c *castClient) UpdateMediaAccount(ctx context.Context, in *UpdateMediaAccountReq, opts ...grpc_go.CallOption) (*UpdateMediaAccountResp, common.ErrorWithAttachment) {
out := new(UpdateMediaAccountResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateMediaAccount", in, out)
}
func (c *castClient) UnbindManager(ctx context.Context, in *UnbindManagerReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
out := new(emptypb.Empty)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UnbindManager", in, out)
}
func (c *castClient) BindManager(ctx context.Context, in *BindManagerReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
out := new(emptypb.Empty)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BindManager", in, out)
}
func (c *castClient) UpdateWorkImage(ctx context.Context, in *UpdateWorkImageReq, opts ...grpc_go.CallOption) (*UpdateWorkImageResp, common.ErrorWithAttachment) {
out := new(UpdateWorkImageResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateWorkImage", in, out)
}
func (c *castClient) UpdateWorkVideo(ctx context.Context, in *UpdateWorkVideoReq, opts ...grpc_go.CallOption) (*UpdateWorkVideoResp, common.ErrorWithAttachment) {
out := new(UpdateWorkVideoResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateWorkVideo", in, out)
}
func (c *castClient) WorkList(ctx context.Context, in *WorkListReq, opts ...grpc_go.CallOption) (*WorkListResp, common.ErrorWithAttachment) {
out := new(WorkListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkList", in, out)
}
func (c *castClient) WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment) {
out := new(WorkDetailResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkDetail", in, out)
}
// CastServer is the server API for Cast service.
// All implementations must embed UnimplementedCastServer
// for forward compatibility
type CastServer interface {
MediaUserList(context.Context, *MediaUserListReq) (*MediaUserListResp, error)
UpdateMediaAccount(context.Context, *UpdateMediaAccountReq) (*UpdateMediaAccountResp, error)
UnbindManager(context.Context, *UnbindManagerReq) (*emptypb.Empty, error)
BindManager(context.Context, *BindManagerReq) (*emptypb.Empty, error)
UpdateWorkImage(context.Context, *UpdateWorkImageReq) (*UpdateWorkImageResp, error)
UpdateWorkVideo(context.Context, *UpdateWorkVideoReq) (*UpdateWorkVideoResp, error)
WorkList(context.Context, *WorkListReq) (*WorkListResp, error)
WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error)
mustEmbedUnimplementedCastServer()
}
// UnimplementedCastServer must be embedded to have forward compatible implementations.
type UnimplementedCastServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedCastServer) MediaUserList(context.Context, *MediaUserListReq) (*MediaUserListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method MediaUserList not implemented")
}
func (UnimplementedCastServer) UpdateMediaAccount(context.Context, *UpdateMediaAccountReq) (*UpdateMediaAccountResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateMediaAccount not implemented")
}
func (UnimplementedCastServer) UnbindManager(context.Context, *UnbindManagerReq) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnbindManager not implemented")
}
func (UnimplementedCastServer) BindManager(context.Context, *BindManagerReq) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method BindManager not implemented")
}
func (UnimplementedCastServer) UpdateWorkImage(context.Context, *UpdateWorkImageReq) (*UpdateWorkImageResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkImage not implemented")
}
func (UnimplementedCastServer) UpdateWorkVideo(context.Context, *UpdateWorkVideoReq) (*UpdateWorkVideoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkVideo not implemented")
}
func (UnimplementedCastServer) WorkList(context.Context, *WorkListReq) (*WorkListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method WorkList not implemented")
}
func (UnimplementedCastServer) WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method WorkDetail not implemented")
}
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedCastServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedCastServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Cast_ServiceDesc
}
func (s *UnimplementedCastServer) XXX_InterfaceName() string {
return "Cast.Cast"
}
func (UnimplementedCastServer) mustEmbedUnimplementedCastServer() {}
// UnsafeCastServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CastServer will
// result in compilation errors.
type UnsafeCastServer interface {
mustEmbedUnimplementedCastServer()
}
func RegisterCastServer(s grpc_go.ServiceRegistrar, srv CastServer) {
s.RegisterService(&Cast_ServiceDesc, srv)
}
func _Cast_MediaUserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(MediaUserListReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("MediaUserList", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_UpdateMediaAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateMediaAccountReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UpdateMediaAccount", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_UnbindManager_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UnbindManagerReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UnbindManager", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_BindManager_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BindManagerReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("BindManager", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_UpdateWorkImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateWorkImageReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UpdateWorkImage", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_UpdateWorkVideo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateWorkVideoReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UpdateWorkVideo", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_WorkList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(WorkListReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("WorkList", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Cast_WorkDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(WorkDetailReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("WorkDetail", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Cast_ServiceDesc is the grpc_go.ServiceDesc for Cast service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Cast_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "Cast.Cast",
HandlerType: (*CastServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "MediaUserList",
Handler: _Cast_MediaUserList_Handler,
},
{
MethodName: "UpdateMediaAccount",
Handler: _Cast_UpdateMediaAccount_Handler,
},
{
MethodName: "UnbindManager",
Handler: _Cast_UnbindManager_Handler,
},
{
MethodName: "BindManager",
Handler: _Cast_BindManager_Handler,
},
{
MethodName: "UpdateWorkImage",
Handler: _Cast_UpdateWorkImage_Handler,
},
{
MethodName: "UpdateWorkVideo",
Handler: _Cast_UpdateWorkVideo_Handler,
},
{
MethodName: "WorkList",
Handler: _Cast_WorkList_Handler,
},
{
MethodName: "WorkDetail",
Handler: _Cast_WorkDetail_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/fiee/cast.proto",
}

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +0,0 @@
syntax = "proto3";
package files;
option go_package = "./;files";
service File{
rpc List(FileListReq) returns (FileListResp) {} //
rpc Info(FileInfoReq) returns (FileInfoResp) {} //
rpc Create(CreateReq) returns (CreateResp) {} //
rpc Delete(DeleteReq) returns (DeleteResp) {} //
rpc Search(searchReq) returns (searchResp) {} //
rpc Upload(UploadReq) returns (UploadResp) {} //
rpc TusCreate(TusCreateReq) returns (TusCreateResp) {} //
rpc TusUpload(TusUploadReq) returns (TusUploadResp) {} //
rpc ResumableTransfer(ResumableTransferReq) returns (ResumableTransferResp) {} // grpc实现
rpc Preview(PreviewReq) returns (PreviewResp) {} //
rpc Action(ActionReq) returns (ActionResp) {} //
rpc DirDownload(DirDownloadReq) returns (stream DirDownloadResp) {} //
}
message FileListReq{
string path = 1; //
string userSpacePath = 2; //
Sorting sorting = 3;
}
message Items {
string path = 1;
string name = 2;
int64 size = 3;
string extension = 4;
string modified = 5;
string mode = 6;
bool isDir = 7;
bool isSymlink = 8;
string type = 9;
}
message Sorting {
string by = 1;
bool asc = 2;
}
message FileListResp {
repeated Items items = 1;
int32 numDirs = 2;
int32 numFiles = 3;
Sorting sorting = 4;
string path = 5;
string name = 6;
int64 size = 7;
string extension = 8;
string modified = 9;
string mode = 10;
bool isDir = 11;
bool isSymlink = 12;
string type = 13;
}
message CreateReq{
string path = 1;
string userSpacePath = 2;
}
message CreateResp{
}
message DeleteReq{
string path = 1;
string userSpacePath = 2;
}
message DeleteResp{
}
message UploadReq{
string path = 1;
string userSpacePath = 2;
bytes content =3;
}
message UploadResp{
}
message searchReq{
string path = 1;
string userSpacePath = 2;
string query = 3;
}
message searchResp{
message Nested {
bool dir = 1;
string path = 2;
}
repeated Nested items = 1;
}
message TusCreateReq{
string path = 1;
string userSpacePath = 2;
bool override =3 ;
}
message TusCreateResp{
int64 uploadLength = 1;
int64 uploadOffset = 2;
}
message TusUploadReq{
string path = 1;
string userSpacePath = 2;
int64 uploadOffset = 3;
bytes content = 4;
}
message TusUploadResp{
int64 uploadOffset = 1;
}
message ResumableTransferReq{
string path = 1;
string userSpacePath = 2;
int64 offset = 3;
int64 length = 4;
}
message ResumableTransferResp{
bytes content = 1;
}
message FileInfoReq{
string path = 1;
string userSpacePath = 2;
}
message FileInfoResp{
string path = 1;
string name = 2;
int64 size = 3;
string extension = 4;
string modified = 5;
string mode = 6;
bool isDir = 7;
bool isSymlink = 8;
string type = 9;
}
message PreviewReq{
string path = 1;
string userSpacePath = 2;
uint32 size = 3; // 0256x256, 1:1080x1080
}
message PreviewResp{
bytes content = 1;
string fileName = 2;
int64 modTime = 3;
}
message ActionReq{
string path = 1;
string userSpacePath = 2;
string action = 3;
string destination = 4;
bool override = 5;
bool rename = 6;
}
message ActionResp{
}
message DirDownloadReq {
string path = 1;
string userSpacePath = 2;
repeated string files =3;
string algo = 4;
}
message DirDownloadResp {
bytes content = 1;
}

View File

@ -1,122 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: files.proto
package files
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *FileListReq) Validate() error {
if this.Sorting != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Sorting); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Sorting", err)
}
}
return nil
}
func (this *Items) Validate() error {
return nil
}
func (this *Sorting) Validate() error {
return nil
}
func (this *FileListResp) Validate() error {
for _, item := range this.Items {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Items", err)
}
}
}
if this.Sorting != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Sorting); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Sorting", err)
}
}
return nil
}
func (this *CreateReq) Validate() error {
return nil
}
func (this *CreateResp) Validate() error {
return nil
}
func (this *DeleteReq) Validate() error {
return nil
}
func (this *DeleteResp) Validate() error {
return nil
}
func (this *UploadReq) Validate() error {
return nil
}
func (this *UploadResp) Validate() error {
return nil
}
func (this *SearchReq) Validate() error {
return nil
}
func (this *SearchResp) Validate() error {
for _, item := range this.Items {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Items", err)
}
}
}
return nil
}
func (this *SearchResp_Nested) Validate() error {
return nil
}
func (this *TusCreateReq) Validate() error {
return nil
}
func (this *TusCreateResp) Validate() error {
return nil
}
func (this *TusUploadReq) Validate() error {
return nil
}
func (this *TusUploadResp) Validate() error {
return nil
}
func (this *ResumableTransferReq) Validate() error {
return nil
}
func (this *ResumableTransferResp) Validate() error {
return nil
}
func (this *FileInfoReq) Validate() error {
return nil
}
func (this *FileInfoResp) Validate() error {
return nil
}
func (this *PreviewReq) Validate() error {
return nil
}
func (this *PreviewResp) Validate() error {
return nil
}
func (this *ActionReq) Validate() error {
return nil
}
func (this *ActionResp) Validate() error {
return nil
}
func (this *DirDownloadReq) Validate() error {
return nil
}
func (this *DirDownloadResp) Validate() error {
return nil
}

View File

@ -1,678 +0,0 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.20.3
// source: files.proto
package files
import (
context "context"
constant1 "dubbo.apache.org/dubbo-go/v3/common/constant"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
fmt "fmt"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// FileClient is the client API for File 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 FileClient interface {
List(ctx context.Context, in *FileListReq, opts ...grpc_go.CallOption) (*FileListResp, common.ErrorWithAttachment)
Info(ctx context.Context, in *FileInfoReq, opts ...grpc_go.CallOption) (*FileInfoResp, common.ErrorWithAttachment)
Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment)
Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment)
Search(ctx context.Context, in *SearchReq, opts ...grpc_go.CallOption) (*SearchResp, common.ErrorWithAttachment)
Upload(ctx context.Context, in *UploadReq, opts ...grpc_go.CallOption) (*UploadResp, common.ErrorWithAttachment)
TusCreate(ctx context.Context, in *TusCreateReq, opts ...grpc_go.CallOption) (*TusCreateResp, common.ErrorWithAttachment)
TusUpload(ctx context.Context, in *TusUploadReq, opts ...grpc_go.CallOption) (*TusUploadResp, common.ErrorWithAttachment)
ResumableTransfer(ctx context.Context, in *ResumableTransferReq, opts ...grpc_go.CallOption) (*ResumableTransferResp, common.ErrorWithAttachment)
Preview(ctx context.Context, in *PreviewReq, opts ...grpc_go.CallOption) (*PreviewResp, common.ErrorWithAttachment)
Action(ctx context.Context, in *ActionReq, opts ...grpc_go.CallOption) (*ActionResp, common.ErrorWithAttachment)
DirDownload(ctx context.Context, in *DirDownloadReq, opts ...grpc_go.CallOption) (File_DirDownloadClient, error)
}
type fileClient struct {
cc *triple.TripleConn
}
type FileClientImpl struct {
List func(ctx context.Context, in *FileListReq) (*FileListResp, error)
Info func(ctx context.Context, in *FileInfoReq) (*FileInfoResp, error)
Create func(ctx context.Context, in *CreateReq) (*CreateResp, error)
Delete func(ctx context.Context, in *DeleteReq) (*DeleteResp, error)
Search func(ctx context.Context, in *SearchReq) (*SearchResp, error)
Upload func(ctx context.Context, in *UploadReq) (*UploadResp, error)
TusCreate func(ctx context.Context, in *TusCreateReq) (*TusCreateResp, error)
TusUpload func(ctx context.Context, in *TusUploadReq) (*TusUploadResp, error)
ResumableTransfer func(ctx context.Context, in *ResumableTransferReq) (*ResumableTransferResp, error)
Preview func(ctx context.Context, in *PreviewReq) (*PreviewResp, error)
Action func(ctx context.Context, in *ActionReq) (*ActionResp, error)
DirDownload func(ctx context.Context, in *DirDownloadReq) (File_DirDownloadClient, error)
}
func (c *FileClientImpl) GetDubboStub(cc *triple.TripleConn) FileClient {
return NewFileClient(cc)
}
func (c *FileClientImpl) XXX_InterfaceName() string {
return "files.File"
}
func NewFileClient(cc *triple.TripleConn) FileClient {
return &fileClient{cc}
}
func (c *fileClient) List(ctx context.Context, in *FileListReq, opts ...grpc_go.CallOption) (*FileListResp, common.ErrorWithAttachment) {
out := new(FileListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/List", in, out)
}
func (c *fileClient) Info(ctx context.Context, in *FileInfoReq, opts ...grpc_go.CallOption) (*FileInfoResp, common.ErrorWithAttachment) {
out := new(FileInfoResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Info", in, out)
}
func (c *fileClient) Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment) {
out := new(CreateResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Create", in, out)
}
func (c *fileClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment) {
out := new(DeleteResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Delete", in, out)
}
func (c *fileClient) Search(ctx context.Context, in *SearchReq, opts ...grpc_go.CallOption) (*SearchResp, common.ErrorWithAttachment) {
out := new(SearchResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Search", in, out)
}
func (c *fileClient) Upload(ctx context.Context, in *UploadReq, opts ...grpc_go.CallOption) (*UploadResp, common.ErrorWithAttachment) {
out := new(UploadResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Upload", in, out)
}
func (c *fileClient) TusCreate(ctx context.Context, in *TusCreateReq, opts ...grpc_go.CallOption) (*TusCreateResp, common.ErrorWithAttachment) {
out := new(TusCreateResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/TusCreate", in, out)
}
func (c *fileClient) TusUpload(ctx context.Context, in *TusUploadReq, opts ...grpc_go.CallOption) (*TusUploadResp, common.ErrorWithAttachment) {
out := new(TusUploadResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/TusUpload", in, out)
}
func (c *fileClient) ResumableTransfer(ctx context.Context, in *ResumableTransferReq, opts ...grpc_go.CallOption) (*ResumableTransferResp, common.ErrorWithAttachment) {
out := new(ResumableTransferResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ResumableTransfer", in, out)
}
func (c *fileClient) Preview(ctx context.Context, in *PreviewReq, opts ...grpc_go.CallOption) (*PreviewResp, common.ErrorWithAttachment) {
out := new(PreviewResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Preview", in, out)
}
func (c *fileClient) Action(ctx context.Context, in *ActionReq, opts ...grpc_go.CallOption) (*ActionResp, common.ErrorWithAttachment) {
out := new(ActionResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Action", in, out)
}
func (c *fileClient) DirDownload(ctx context.Context, in *DirDownloadReq, opts ...grpc_go.CallOption) (File_DirDownloadClient, error) {
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
stream, err := c.cc.NewStream(ctx, "/"+interfaceKey+"/DirDownload", opts...)
if err != nil {
return nil, err
}
x := &fileDirDownloadClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type File_DirDownloadClient interface {
Recv() (*DirDownloadResp, error)
grpc_go.ClientStream
}
type fileDirDownloadClient struct {
grpc_go.ClientStream
}
func (x *fileDirDownloadClient) Recv() (*DirDownloadResp, error) {
m := new(DirDownloadResp)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// FileServer is the server API for File service.
// All implementations must embed UnimplementedFileServer
// for forward compatibility
type FileServer interface {
List(context.Context, *FileListReq) (*FileListResp, error)
Info(context.Context, *FileInfoReq) (*FileInfoResp, error)
Create(context.Context, *CreateReq) (*CreateResp, error)
Delete(context.Context, *DeleteReq) (*DeleteResp, error)
Search(context.Context, *SearchReq) (*SearchResp, error)
Upload(context.Context, *UploadReq) (*UploadResp, error)
TusCreate(context.Context, *TusCreateReq) (*TusCreateResp, error)
TusUpload(context.Context, *TusUploadReq) (*TusUploadResp, error)
ResumableTransfer(context.Context, *ResumableTransferReq) (*ResumableTransferResp, error)
Preview(context.Context, *PreviewReq) (*PreviewResp, error)
Action(context.Context, *ActionReq) (*ActionResp, error)
DirDownload(*DirDownloadReq, File_DirDownloadServer) error
mustEmbedUnimplementedFileServer()
}
// UnimplementedFileServer must be embedded to have forward compatible implementations.
type UnimplementedFileServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedFileServer) List(context.Context, *FileListReq) (*FileListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedFileServer) Info(context.Context, *FileInfoReq) (*FileInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedFileServer) Create(context.Context, *CreateReq) (*CreateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedFileServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedFileServer) Search(context.Context, *SearchReq) (*SearchResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedFileServer) Upload(context.Context, *UploadReq) (*UploadResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedFileServer) TusCreate(context.Context, *TusCreateReq) (*TusCreateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method TusCreate not implemented")
}
func (UnimplementedFileServer) TusUpload(context.Context, *TusUploadReq) (*TusUploadResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method TusUpload not implemented")
}
func (UnimplementedFileServer) ResumableTransfer(context.Context, *ResumableTransferReq) (*ResumableTransferResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResumableTransfer not implemented")
}
func (UnimplementedFileServer) Preview(context.Context, *PreviewReq) (*PreviewResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Preview not implemented")
}
func (UnimplementedFileServer) Action(context.Context, *ActionReq) (*ActionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Action not implemented")
}
func (UnimplementedFileServer) DirDownload(*DirDownloadReq, File_DirDownloadServer) error {
return status.Errorf(codes.Unimplemented, "method DirDownload not implemented")
}
func (s *UnimplementedFileServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedFileServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedFileServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &File_ServiceDesc
}
func (s *UnimplementedFileServer) XXX_InterfaceName() string {
return "files.File"
}
func (UnimplementedFileServer) mustEmbedUnimplementedFileServer() {}
// UnsafeFileServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileServer will
// result in compilation errors.
type UnsafeFileServer interface {
mustEmbedUnimplementedFileServer()
}
func RegisterFileServer(s grpc_go.ServiceRegistrar, srv FileServer) {
s.RegisterService(&File_ServiceDesc, srv)
}
func _File_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(FileListReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("List", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(FileInfoReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Info", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Create", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Delete", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Search", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Upload", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_TusCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(TusCreateReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("TusCreate", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_TusUpload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(TusUploadReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("TusUpload", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_ResumableTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ResumableTransferReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("ResumableTransfer", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Preview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(PreviewReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Preview", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_Action_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ActionReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Action", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _File_DirDownload_Handler(srv interface{}, stream grpc_go.ServerStream) error {
_, ok := srv.(dubbo3.Dubbo3GrpcService)
ctx := stream.Context()
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
stream.(grpc_go.CtxSetterStream).SetContext(context.WithValue(ctx, constant1.AttachmentKey, invAttachment))
invo := invocation.NewRPCInvocation("DirDownload", nil, nil)
if !ok {
fmt.Println(invo)
return nil
}
m := new(DirDownloadReq)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(FileServer).DirDownload(m, &fileDirDownloadServer{stream})
}
type File_DirDownloadServer interface {
Send(*DirDownloadResp) error
grpc_go.ServerStream
}
type fileDirDownloadServer struct {
grpc_go.ServerStream
}
func (x *fileDirDownloadServer) Send(m *DirDownloadResp) error {
return x.ServerStream.SendMsg(m)
}
// File_ServiceDesc is the grpc_go.ServiceDesc for File service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var File_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "files.File",
HandlerType: (*FileServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "List",
Handler: _File_List_Handler,
},
{
MethodName: "Info",
Handler: _File_Info_Handler,
},
{
MethodName: "Create",
Handler: _File_Create_Handler,
},
{
MethodName: "Delete",
Handler: _File_Delete_Handler,
},
{
MethodName: "Search",
Handler: _File_Search_Handler,
},
{
MethodName: "Upload",
Handler: _File_Upload_Handler,
},
{
MethodName: "TusCreate",
Handler: _File_TusCreate_Handler,
},
{
MethodName: "TusUpload",
Handler: _File_TusUpload_Handler,
},
{
MethodName: "ResumableTransfer",
Handler: _File_ResumableTransfer_Handler,
},
{
MethodName: "Preview",
Handler: _File_Preview_Handler,
},
{
MethodName: "Action",
Handler: _File_Action_Handler,
},
},
Streams: []grpc_go.StreamDesc{
{
StreamName: "DirDownload",
Handler: _File_DirDownload_Handler,
ServerStreams: true,
},
},
Metadata: "files.proto",
}

View File

@ -1,997 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.29.1
// protoc v3.20.3
// source: governance.proto
package governance
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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 Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Attachment string `protobuf:"bytes,3,opt,name=attachment,proto3" json:"attachment,omitempty"`
AttachmentName string `protobuf:"bytes,4,opt,name=attachmentName,proto3" json:"attachmentName,omitempty"`
Sort int32 `protobuf:"varint,5,opt,name=sort,proto3" json:"sort,omitempty"`
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
Operator string `protobuf:"bytes,8,opt,name=operator,proto3" json:"operator,omitempty"`
OperatorId int32 `protobuf:"varint,9,opt,name=operatorId,proto3" json:"operatorId,omitempty"`
}
func (x *Item) Reset() {
*x = Item{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Item) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Item) ProtoMessage() {}
func (x *Item) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Item.ProtoReflect.Descriptor instead.
func (*Item) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{0}
}
func (x *Item) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *Item) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *Item) GetAttachment() string {
if x != nil {
return x.Attachment
}
return ""
}
func (x *Item) GetAttachmentName() string {
if x != nil {
return x.AttachmentName
}
return ""
}
func (x *Item) GetSort() int32 {
if x != nil {
return x.Sort
}
return 0
}
func (x *Item) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *Item) GetUpdatedAt() int64 {
if x != nil {
return x.UpdatedAt
}
return 0
}
func (x *Item) GetOperator() string {
if x != nil {
return x.Operator
}
return ""
}
func (x *Item) GetOperatorId() int32 {
if x != nil {
return x.OperatorId
}
return 0
}
type ListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` // 1 下架 2 上架
Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"`
PageSize int32 `protobuf:"varint,4,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
}
func (x *ListReq) Reset() {
*x = ListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListReq) ProtoMessage() {}
func (x *ListReq) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListReq.ProtoReflect.Descriptor instead.
func (*ListReq) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{1}
}
func (x *ListReq) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *ListReq) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *ListReq) GetPage() int32 {
if x != nil {
return x.Page
}
return 0
}
func (x *ListReq) GetPageSize() int32 {
if x != nil {
return x.PageSize
}
return 0
}
type ListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
Data []*Item `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ListResp) Reset() {
*x = ListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListResp) ProtoMessage() {}
func (x *ListResp) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListResp.ProtoReflect.Descriptor instead.
func (*ListResp) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{2}
}
func (x *ListResp) GetTotal() int32 {
if x != nil {
return x.Total
}
return 0
}
func (x *ListResp) GetData() []*Item {
if x != nil {
return x.Data
}
return nil
}
type DeleteReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *DeleteReq) Reset() {
*x = DeleteReq{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteReq) ProtoMessage() {}
func (x *DeleteReq) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteReq.ProtoReflect.Descriptor instead.
func (*DeleteReq) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{3}
}
func (x *DeleteReq) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
type DeleteResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteResp) Reset() {
*x = DeleteResp{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteResp) ProtoMessage() {}
func (x *DeleteResp) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteResp.ProtoReflect.Descriptor instead.
func (*DeleteResp) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{4}
}
type EditReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Attachment string `protobuf:"bytes,3,opt,name=attachment,proto3" json:"attachment,omitempty"`
AttachmentName string `protobuf:"bytes,4,opt,name=attachmentName,proto3" json:"attachmentName,omitempty"`
Sort int32 `protobuf:"varint,5,opt,name=sort,proto3" json:"sort,omitempty"`
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
Operator string `protobuf:"bytes,7,opt,name=operator,proto3" json:"operator,omitempty"`
OperatorId int32 `protobuf:"varint,8,opt,name=operatorId,proto3" json:"operatorId,omitempty"`
}
func (x *EditReq) Reset() {
*x = EditReq{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EditReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EditReq) ProtoMessage() {}
func (x *EditReq) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EditReq.ProtoReflect.Descriptor instead.
func (*EditReq) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{5}
}
func (x *EditReq) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *EditReq) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *EditReq) GetAttachment() string {
if x != nil {
return x.Attachment
}
return ""
}
func (x *EditReq) GetAttachmentName() string {
if x != nil {
return x.AttachmentName
}
return ""
}
func (x *EditReq) GetSort() int32 {
if x != nil {
return x.Sort
}
return 0
}
func (x *EditReq) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *EditReq) GetOperator() string {
if x != nil {
return x.Operator
}
return ""
}
func (x *EditReq) GetOperatorId() int32 {
if x != nil {
return x.OperatorId
}
return 0
}
type EditResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *EditResp) Reset() {
*x = EditResp{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EditResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EditResp) ProtoMessage() {}
func (x *EditResp) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EditResp.ProtoReflect.Descriptor instead.
func (*EditResp) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{6}
}
type CreateReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Sort uint32 `protobuf:"varint,2,opt,name=sort,proto3" json:"sort,omitempty"`
Attachment string `protobuf:"bytes,3,opt,name=attachment,proto3" json:"attachment,omitempty"`
AttachmentName string `protobuf:"bytes,4,opt,name=attachmentName,proto3" json:"attachmentName,omitempty"`
Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"`
Operator string `protobuf:"bytes,6,opt,name=operator,proto3" json:"operator,omitempty"`
OperatorId int32 `protobuf:"varint,7,opt,name=operatorId,proto3" json:"operatorId,omitempty"`
}
func (x *CreateReq) Reset() {
*x = CreateReq{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreateReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateReq) ProtoMessage() {}
func (x *CreateReq) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateReq.ProtoReflect.Descriptor instead.
func (*CreateReq) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{7}
}
func (x *CreateReq) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *CreateReq) GetSort() uint32 {
if x != nil {
return x.Sort
}
return 0
}
func (x *CreateReq) GetAttachment() string {
if x != nil {
return x.Attachment
}
return ""
}
func (x *CreateReq) GetAttachmentName() string {
if x != nil {
return x.AttachmentName
}
return ""
}
func (x *CreateReq) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *CreateReq) GetOperator() string {
if x != nil {
return x.Operator
}
return ""
}
func (x *CreateReq) GetOperatorId() int32 {
if x != nil {
return x.OperatorId
}
return 0
}
type CreateResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CreateResp) Reset() {
*x = CreateResp{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreateResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateResp) ProtoMessage() {}
func (x *CreateResp) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateResp.ProtoReflect.Descriptor instead.
func (*CreateResp) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{8}
}
type DisplayReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DisplayReq) Reset() {
*x = DisplayReq{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DisplayReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DisplayReq) ProtoMessage() {}
func (x *DisplayReq) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DisplayReq.ProtoReflect.Descriptor instead.
func (*DisplayReq) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{9}
}
type DisplayResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*Item `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *DisplayResp) Reset() {
*x = DisplayResp{}
if protoimpl.UnsafeEnabled {
mi := &file_governance_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DisplayResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DisplayResp) ProtoMessage() {}
func (x *DisplayResp) ProtoReflect() protoreflect.Message {
mi := &file_governance_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DisplayResp.ProtoReflect.Descriptor instead.
func (*DisplayResp) Descriptor() ([]byte, []int) {
return file_governance_proto_rawDescGZIP(), []int{10}
}
func (x *DisplayResp) GetData() []*Item {
if x != nil {
return x.Data
}
return nil
}
var File_governance_proto protoreflect.FileDescriptor
var file_governance_proto_rawDesc = []byte{
0x0a, 0x10, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x22, 0xfa,
0x01, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1e, 0x0a,
0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a,
0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07,
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x07, 0x4c,
0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65,
0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65,
0x53, 0x69, 0x7a, 0x65, 0x22, 0x46, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x24, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63,
0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1b, 0x0a, 0x09,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x0c, 0x0a, 0x0a, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0xdf, 0x01, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74,
0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74,
0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61,
0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x74, 0x74,
0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a,
0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x0a, 0x0a, 0x08, 0x45, 0x64, 0x69,
0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0xd1, 0x01, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a,
0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a,
0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a,
0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x0c, 0x0a, 0x0a, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x0c, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x70, 0x6c,
0x61, 0x79, 0x52, 0x65, 0x71, 0x22, 0x33, 0x0a, 0x0b, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79,
0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e,
0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xaa, 0x02, 0x0a, 0x0a, 0x47,
0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x4c, 0x69, 0x73,
0x74, 0x12, 0x13, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x4c,
0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61,
0x6e, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x39,
0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72,
0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a,
0x16, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x04, 0x45, 0x64, 0x69,
0x74, 0x12, 0x13, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x45,
0x64, 0x69, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61,
0x6e, 0x63, 0x65, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x39,
0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72,
0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a,
0x16, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x44, 0x69, 0x73,
0x70, 0x6c, 0x61, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63,
0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x67,
0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61,
0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x3b, 0x67, 0x6f,
0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_governance_proto_rawDescOnce sync.Once
file_governance_proto_rawDescData = file_governance_proto_rawDesc
)
func file_governance_proto_rawDescGZIP() []byte {
file_governance_proto_rawDescOnce.Do(func() {
file_governance_proto_rawDescData = protoimpl.X.CompressGZIP(file_governance_proto_rawDescData)
})
return file_governance_proto_rawDescData
}
var file_governance_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_governance_proto_goTypes = []interface{}{
(*Item)(nil), // 0: governance.Item
(*ListReq)(nil), // 1: governance.ListReq
(*ListResp)(nil), // 2: governance.ListResp
(*DeleteReq)(nil), // 3: governance.DeleteReq
(*DeleteResp)(nil), // 4: governance.DeleteResp
(*EditReq)(nil), // 5: governance.EditReq
(*EditResp)(nil), // 6: governance.EditResp
(*CreateReq)(nil), // 7: governance.CreateReq
(*CreateResp)(nil), // 8: governance.CreateResp
(*DisplayReq)(nil), // 9: governance.DisplayReq
(*DisplayResp)(nil), // 10: governance.DisplayResp
}
var file_governance_proto_depIdxs = []int32{
0, // 0: governance.ListResp.data:type_name -> governance.Item
0, // 1: governance.DisplayResp.data:type_name -> governance.Item
1, // 2: governance.Governance.List:input_type -> governance.ListReq
3, // 3: governance.Governance.Delete:input_type -> governance.DeleteReq
5, // 4: governance.Governance.Edit:input_type -> governance.EditReq
7, // 5: governance.Governance.Create:input_type -> governance.CreateReq
9, // 6: governance.Governance.Display:input_type -> governance.DisplayReq
2, // 7: governance.Governance.List:output_type -> governance.ListResp
4, // 8: governance.Governance.Delete:output_type -> governance.DeleteResp
6, // 9: governance.Governance.Edit:output_type -> governance.EditResp
8, // 10: governance.Governance.Create:output_type -> governance.CreateResp
10, // 11: governance.Governance.Display:output_type -> governance.DisplayResp
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_governance_proto_init() }
func file_governance_proto_init() {
if File_governance_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_governance_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Item); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EditReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EditResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DisplayReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_governance_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DisplayResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_governance_proto_rawDesc,
NumEnums: 0,
NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_governance_proto_goTypes,
DependencyIndexes: file_governance_proto_depIdxs,
MessageInfos: file_governance_proto_msgTypes,
}.Build()
File_governance_proto = out.File
file_governance_proto_rawDesc = nil
file_governance_proto_goTypes = nil
file_governance_proto_depIdxs = nil
}

View File

@ -1,81 +0,0 @@
syntax = "proto3";
package governance;
//import "descriptor.proto";
//import "validator.proto";
option go_package = "./;governance";
service Governance{
rpc List(ListReq) returns (ListResp) {}
rpc Delete(DeleteReq) returns (DeleteResp) {}
rpc Edit(EditReq) returns (EditResp) {}
rpc Create(CreateReq) returns (CreateResp) {}
rpc Display(DisplayReq) returns (DisplayResp) {}
}
message Item{
int32 id = 1;
string title = 2;
string attachment = 3;
string attachmentName = 4;
int32 sort = 5;
int32 status = 6;
int64 updatedAt = 7;
string operator = 8;
int32 operatorId = 9;
}
message ListReq{
string title = 1;
int32 status = 2; // 1 2
int32 page = 3;
int32 pageSize = 4;
}
message ListResp{
int32 total = 1;
repeated Item data =2;
}
message DeleteReq{
int32 id = 1;
}
message DeleteResp{
}
message EditReq{
uint32 id = 1;
string title = 2;
string attachment = 3;
string attachmentName = 4;
int32 sort = 5;
int32 status = 6;
string operator = 7;
int32 operatorId = 8;
}
message EditResp{
}
message CreateReq{
string title = 1;
uint32 sort = 2;
string attachment = 3;
string attachmentName = 4;
int32 status = 5;
string operator = 6;
int32 operatorId = 7;
}
message CreateResp{
}
message DisplayReq{
}
message DisplayResp{
repeated Item data = 1;
}

View File

@ -1,64 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: governance.proto
package governance
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *Item) Validate() error {
return nil
}
func (this *ListReq) Validate() error {
return nil
}
func (this *ListResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *DeleteReq) Validate() error {
return nil
}
func (this *DeleteResp) Validate() error {
return nil
}
func (this *EditReq) Validate() error {
return nil
}
func (this *EditResp) Validate() error {
return nil
}
func (this *CreateReq) Validate() error {
return nil
}
func (this *CreateResp) Validate() error {
return nil
}
func (this *DisplayReq) Validate() error {
return nil
}
func (this *DisplayResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}

View File

@ -1,327 +0,0 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.20.3
// source: governance.proto
package governance
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// GovernanceClient is the client API for Governance 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 GovernanceClient interface {
List(ctx context.Context, in *ListReq, opts ...grpc_go.CallOption) (*ListResp, common.ErrorWithAttachment)
Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment)
Edit(ctx context.Context, in *EditReq, opts ...grpc_go.CallOption) (*EditResp, common.ErrorWithAttachment)
Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment)
Display(ctx context.Context, in *DisplayReq, opts ...grpc_go.CallOption) (*DisplayResp, common.ErrorWithAttachment)
}
type governanceClient struct {
cc *triple.TripleConn
}
type GovernanceClientImpl struct {
List func(ctx context.Context, in *ListReq) (*ListResp, error)
Delete func(ctx context.Context, in *DeleteReq) (*DeleteResp, error)
Edit func(ctx context.Context, in *EditReq) (*EditResp, error)
Create func(ctx context.Context, in *CreateReq) (*CreateResp, error)
Display func(ctx context.Context, in *DisplayReq) (*DisplayResp, error)
}
func (c *GovernanceClientImpl) GetDubboStub(cc *triple.TripleConn) GovernanceClient {
return NewGovernanceClient(cc)
}
func (c *GovernanceClientImpl) XXX_InterfaceName() string {
return "governance.Governance"
}
func NewGovernanceClient(cc *triple.TripleConn) GovernanceClient {
return &governanceClient{cc}
}
func (c *governanceClient) List(ctx context.Context, in *ListReq, opts ...grpc_go.CallOption) (*ListResp, common.ErrorWithAttachment) {
out := new(ListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/List", in, out)
}
func (c *governanceClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment) {
out := new(DeleteResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Delete", in, out)
}
func (c *governanceClient) Edit(ctx context.Context, in *EditReq, opts ...grpc_go.CallOption) (*EditResp, common.ErrorWithAttachment) {
out := new(EditResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Edit", in, out)
}
func (c *governanceClient) Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment) {
out := new(CreateResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Create", in, out)
}
func (c *governanceClient) Display(ctx context.Context, in *DisplayReq, opts ...grpc_go.CallOption) (*DisplayResp, common.ErrorWithAttachment) {
out := new(DisplayResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Display", in, out)
}
// GovernanceServer is the server API for Governance service.
// All implementations must embed UnimplementedGovernanceServer
// for forward compatibility
type GovernanceServer interface {
List(context.Context, *ListReq) (*ListResp, error)
Delete(context.Context, *DeleteReq) (*DeleteResp, error)
Edit(context.Context, *EditReq) (*EditResp, error)
Create(context.Context, *CreateReq) (*CreateResp, error)
Display(context.Context, *DisplayReq) (*DisplayResp, error)
mustEmbedUnimplementedGovernanceServer()
}
// UnimplementedGovernanceServer must be embedded to have forward compatible implementations.
type UnimplementedGovernanceServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedGovernanceServer) List(context.Context, *ListReq) (*ListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedGovernanceServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedGovernanceServer) Edit(context.Context, *EditReq) (*EditResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Edit not implemented")
}
func (UnimplementedGovernanceServer) Create(context.Context, *CreateReq) (*CreateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedGovernanceServer) Display(context.Context, *DisplayReq) (*DisplayResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Display not implemented")
}
func (s *UnimplementedGovernanceServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedGovernanceServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedGovernanceServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Governance_ServiceDesc
}
func (s *UnimplementedGovernanceServer) XXX_InterfaceName() string {
return "governance.Governance"
}
func (UnimplementedGovernanceServer) mustEmbedUnimplementedGovernanceServer() {}
// UnsafeGovernanceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GovernanceServer will
// result in compilation errors.
type UnsafeGovernanceServer interface {
mustEmbedUnimplementedGovernanceServer()
}
func RegisterGovernanceServer(s grpc_go.ServiceRegistrar, srv GovernanceServer) {
s.RegisterService(&Governance_ServiceDesc, srv)
}
func _Governance_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ListReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("List", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Governance_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Delete", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Governance_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(EditReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Edit", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Governance_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Create", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Governance_Display_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DisplayReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Display", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Governance_ServiceDesc is the grpc_go.ServiceDesc for Governance service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Governance_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "governance.Governance",
HandlerType: (*GovernanceServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "List",
Handler: _Governance_List_Handler,
},
{
MethodName: "Delete",
Handler: _Governance_Delete_Handler,
},
{
MethodName: "Edit",
Handler: _Governance_Edit_Handler,
},
{
MethodName: "Create",
Handler: _Governance_Create_Handler,
},
{
MethodName: "Display",
Handler: _Governance_Display_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "governance.proto",
}

File diff suppressed because it is too large Load Diff

View File

@ -1,119 +0,0 @@
syntax = "proto3";
package pressreleases;
//import "descriptor.proto";
//import "validator.proto";
option go_package = "./;pressreleases";
service PressReleases{
rpc List(ListReq) returns (ListResp) {}
rpc Display(DisplayReq) returns (DisplayResp) {}
rpc Edit(EditReq) returns (EditResp) {}
rpc Create(CreateReq) returns (CreateResp) {}
rpc Delete(DeleteReq) returns (DeleteResp) {}
rpc Get(GetReq) returns (GetResp) {}
}
message Item{
uint32 id = 1;
string title = 2;
uint64 createdAt = 3;
uint32 sort = 4;
string content = 5;
string attachment = 6;
string attachmentName = 7;
uint64 updatedAt = 8;
uint32 status = 9;
uint32 display = 10;
string summary = 11;
string operator = 12;
int32 operatorId = 13;
}
message ListReq{
string title = 1;
uint64 startTime = 2;
uint64 endTime = 3;
uint32 status = 4;
uint32 display = 5;
int32 page = 6;
int32 pageSize = 7;
}
message ListResp{
uint64 total = 1;
repeated Item data = 2;
}
message DisplayReq{
string query = 1;
uint32 page = 2;
uint32 pageSize = 3;
int64 timeStart = 4;
int64 timeEnd = 5;
int32 display = 6;
}
message DisplayResp{
int64 total = 1;
repeated Item data = 2;
}
message EditReq{
uint32 id = 1;
string title = 2;
uint64 createdAt = 3;
uint32 sort = 4;
string content = 5;
string attachment = 6;
string attachmentName = 7;
uint32 status = 8;
uint32 display = 9;
string summary = 10;
string operator = 11;
int32 operatorId = 12;
}
message EditResp{
}
message CreateReq{
string title = 1;
uint64 createdAt = 2;
uint32 sort = 3;
string content = 4;
string attachment = 5;
string attachmentName = 6;
uint32 status = 7;
uint32 display = 8;
string summary = 9;
string operator = 10;
int32 operatorId = 11;
}
message CreateResp{
}
message DeleteReq{
uint32 id = 1;
}
message DeleteResp{
}
message GetReq{
int64 id = 1;
}
message GetResp{
uint32 id = 1;
string title = 2;
uint64 createdAt = 3;
string content = 4;
string attachment = 5;
string attachmentName = 6;
string summary = 7;
}

View File

@ -1,70 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: press_releases.proto
package pressreleases
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *Item) Validate() error {
return nil
}
func (this *ListReq) Validate() error {
return nil
}
func (this *ListResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *DisplayReq) Validate() error {
return nil
}
func (this *DisplayResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *EditReq) Validate() error {
return nil
}
func (this *EditResp) Validate() error {
return nil
}
func (this *CreateReq) Validate() error {
return nil
}
func (this *CreateResp) Validate() error {
return nil
}
func (this *DeleteReq) Validate() error {
return nil
}
func (this *DeleteResp) Validate() error {
return nil
}
func (this *GetReq) Validate() error {
return nil
}
func (this *GetResp) Validate() error {
return nil
}

View File

@ -1,372 +0,0 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.20.3
// source: press_releases.proto
package pressreleases
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// PressReleasesClient is the client API for PressReleases 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 PressReleasesClient interface {
List(ctx context.Context, in *ListReq, opts ...grpc_go.CallOption) (*ListResp, common.ErrorWithAttachment)
Display(ctx context.Context, in *DisplayReq, opts ...grpc_go.CallOption) (*DisplayResp, common.ErrorWithAttachment)
Edit(ctx context.Context, in *EditReq, opts ...grpc_go.CallOption) (*EditResp, common.ErrorWithAttachment)
Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment)
Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment)
Get(ctx context.Context, in *GetReq, opts ...grpc_go.CallOption) (*GetResp, common.ErrorWithAttachment)
}
type pressReleasesClient struct {
cc *triple.TripleConn
}
type PressReleasesClientImpl struct {
List func(ctx context.Context, in *ListReq) (*ListResp, error)
Display func(ctx context.Context, in *DisplayReq) (*DisplayResp, error)
Edit func(ctx context.Context, in *EditReq) (*EditResp, error)
Create func(ctx context.Context, in *CreateReq) (*CreateResp, error)
Delete func(ctx context.Context, in *DeleteReq) (*DeleteResp, error)
Get func(ctx context.Context, in *GetReq) (*GetResp, error)
}
func (c *PressReleasesClientImpl) GetDubboStub(cc *triple.TripleConn) PressReleasesClient {
return NewPressReleasesClient(cc)
}
func (c *PressReleasesClientImpl) XXX_InterfaceName() string {
return "pressreleases.PressReleases"
}
func NewPressReleasesClient(cc *triple.TripleConn) PressReleasesClient {
return &pressReleasesClient{cc}
}
func (c *pressReleasesClient) List(ctx context.Context, in *ListReq, opts ...grpc_go.CallOption) (*ListResp, common.ErrorWithAttachment) {
out := new(ListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/List", in, out)
}
func (c *pressReleasesClient) Display(ctx context.Context, in *DisplayReq, opts ...grpc_go.CallOption) (*DisplayResp, common.ErrorWithAttachment) {
out := new(DisplayResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Display", in, out)
}
func (c *pressReleasesClient) Edit(ctx context.Context, in *EditReq, opts ...grpc_go.CallOption) (*EditResp, common.ErrorWithAttachment) {
out := new(EditResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Edit", in, out)
}
func (c *pressReleasesClient) Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment) {
out := new(CreateResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Create", in, out)
}
func (c *pressReleasesClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment) {
out := new(DeleteResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Delete", in, out)
}
func (c *pressReleasesClient) Get(ctx context.Context, in *GetReq, opts ...grpc_go.CallOption) (*GetResp, common.ErrorWithAttachment) {
out := new(GetResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Get", in, out)
}
// PressReleasesServer is the server API for PressReleases service.
// All implementations must embed UnimplementedPressReleasesServer
// for forward compatibility
type PressReleasesServer interface {
List(context.Context, *ListReq) (*ListResp, error)
Display(context.Context, *DisplayReq) (*DisplayResp, error)
Edit(context.Context, *EditReq) (*EditResp, error)
Create(context.Context, *CreateReq) (*CreateResp, error)
Delete(context.Context, *DeleteReq) (*DeleteResp, error)
Get(context.Context, *GetReq) (*GetResp, error)
mustEmbedUnimplementedPressReleasesServer()
}
// UnimplementedPressReleasesServer must be embedded to have forward compatible implementations.
type UnimplementedPressReleasesServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedPressReleasesServer) List(context.Context, *ListReq) (*ListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedPressReleasesServer) Display(context.Context, *DisplayReq) (*DisplayResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Display not implemented")
}
func (UnimplementedPressReleasesServer) Edit(context.Context, *EditReq) (*EditResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Edit not implemented")
}
func (UnimplementedPressReleasesServer) Create(context.Context, *CreateReq) (*CreateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedPressReleasesServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedPressReleasesServer) Get(context.Context, *GetReq) (*GetResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (s *UnimplementedPressReleasesServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedPressReleasesServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedPressReleasesServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &PressReleases_ServiceDesc
}
func (s *UnimplementedPressReleasesServer) XXX_InterfaceName() string {
return "pressreleases.PressReleases"
}
func (UnimplementedPressReleasesServer) mustEmbedUnimplementedPressReleasesServer() {}
// UnsafePressReleasesServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PressReleasesServer will
// result in compilation errors.
type UnsafePressReleasesServer interface {
mustEmbedUnimplementedPressReleasesServer()
}
func RegisterPressReleasesServer(s grpc_go.ServiceRegistrar, srv PressReleasesServer) {
s.RegisterService(&PressReleases_ServiceDesc, srv)
}
func _PressReleases_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ListReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("List", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _PressReleases_Display_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DisplayReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Display", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _PressReleases_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(EditReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Edit", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _PressReleases_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Create", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _PressReleases_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Delete", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _PressReleases_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Get", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// PressReleases_ServiceDesc is the grpc_go.ServiceDesc for PressReleases service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var PressReleases_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "pressreleases.PressReleases",
HandlerType: (*PressReleasesServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "List",
Handler: _PressReleases_List_Handler,
},
{
MethodName: "Display",
Handler: _PressReleases_Display_Handler,
},
{
MethodName: "Edit",
Handler: _PressReleases_Edit_Handler,
},
{
MethodName: "Create",
Handler: _PressReleases_Create_Handler,
},
{
MethodName: "Delete",
Handler: _PressReleases_Delete_Handler,
},
{
MethodName: "Get",
Handler: _PressReleases_Get_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "press_releases.proto",
}

View File

@ -109,7 +109,6 @@ type Redis struct {
type System struct { type System struct {
Mode string Mode string
AppMode string
Version string Version string
HttpPort string HttpPort string
Host string Host string

2
conf/.gitignore vendored
View File

@ -1,2 +0,0 @@
conf.ini
dubbogo.yaml

36
conf/conf.ini Normal file
View File

@ -0,0 +1,36 @@
[system]
Domain = "fiee"
AppMode = "debug"
HttpPort = ":8085"
Host = "http://127.0.0.1:8085"
RedirectUri = "/api/redirect/url"
[bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306"
BucketName = "dci-file-new"
BosUrl = ".bj.bcebos.com"
BosBaseDir = "fonchain-main"
BosHttp = "https://"
BosDomain = "cdns.fontree.cn"
[oss]
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
BucketName = "fontree-test"
BaseDir = "fonchain-main"
CdnHost = "https://cdn-test.szjixun.cn"
[redis]
RedisDB = "2"
RedisAddr = "127.0.0.1:6379"
RedisPW = ""
RedisDBNAme = "2"
[ai]
Host = "https://erpapi.fontree.cn"
TelNum = "18021272627"
Password = "Gy.123456"
[service]
IsHTTPS = false

29
conf/dubbogo.yaml Normal file
View File

@ -0,0 +1,29 @@
dubbo:
registries:
demoZK:
protocol: zookeeper
timeout: 5s
address: 127.0.0.1:2181
consumer:
references:
AccountClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.Account
filter: echo,metrics,token,accesslog,sign,tps,generic_service,execute
params:
.accessKeyId: "Accountksl"
.secretAccessKey: "BSDY-FDF1-Fontree_account"
AccountFieeClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.micro.account.fiee
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
# params:
# .accessKeyId: "Accountksl"
# .secretAccessKey: "BSDY-FDF1-Fontree_account"
BundleClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.fiee.bundle # must be compatible with grpc or dubbo-java

View File

@ -1,6 +1,6 @@
[system] [system]
Domain = "artistinfo" Domain = "artistinfo"
AppMode = "dev" AppMode = "debug"
HttpPort = ":8085" HttpPort = ":8085"
Host = "https://common.szjixun.cn" Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"

View File

@ -4,8 +4,8 @@ dubbo:
protocol: zookeeper protocol: zookeeper
timeout: 3s timeout: 3s
# address: 121.229.45.214:9004 # address: 121.229.45.214:9004
# address: 172.16.100.93:2181 address: 172.16.100.93:2181
address: 127.0.0.1:2181 # address: 127.0.0.1:2181
# address: 114.218.158.24:2181 # address: 114.218.158.24:2181
consumer: consumer:
filter: tracing filter: tracing
@ -42,46 +42,3 @@ dubbo:
params: params:
.accessKeyId: "Paymentksl" .accessKeyId: "Paymentksl"
.secretAccessKey: "BSDY-FDF1-Fontree_payment" .secretAccessKey: "BSDY-FDF1-Fontree_payment"
CastClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.multicast
logger:
zap-config:
level: error # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/logs/fiee.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 30
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 30
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

View File

@ -1,6 +1,6 @@
[system] [system]
Domain = "artistinfo" Domain = "artistinfo"
AppMode = "prod" AppMode = "debug"
HttpPort = ":8085" HttpPort = ":8085"
Host = "https://common.szjixun.cn" Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"

View File

@ -42,46 +42,3 @@ dubbo:
params: params:
.accessKeyId: "Paymentksl" .accessKeyId: "Paymentksl"
.secretAccessKey: "BSDY-FDF1-Fontree_payment" .secretAccessKey: "BSDY-FDF1-Fontree_payment"
CastClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.multicast
logger:
zap-config:
level: error # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/logs/fiee.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 30
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 30
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

View File

@ -1,6 +1,6 @@
[system] [system]
Domain = "artistinfo" Domain = "artistinfo"
AppMode = "test" AppMode = "debug"
HttpPort = ":8085" HttpPort = ":8085"
Host = "https://common.szjixun.cn" Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"
@ -8,29 +8,18 @@ RedirectUri = "/api/redirect/url"
[bos] [bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306" Sk = "d2ecaa9d75114d3b9f42b99014198306"
BucketName = "dci-file-new" BucketName = "dci-file-new"
BosUrl = ".bj.bcebos.com" BosUrl = ".bj.bcebos.com"
BosBaseDir = "fiee" BosBaseDir = "fonchain-main"
BosHttp = "https://" BosHttp = "https://"
BosDomain = "cdns.fontree.cn"
[oss]
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
BucketName = "fontree-test"
BaseDir = "fiee"
CdnHost = "https://cdn-test.szjixun.cn"
[redis] [redis]
RedisDB = "2" RedisDB = "2"
RedisAddr = "172.16.100.114:6379" RedisAddr = "redis:6379"
RedisPW = "kP6tW4tS3qB2dW4aE6uI5cX2" RedisPW = "root"
RedisDBNAme = "2" RedisDBNAme = "2"
[ai] [ai]
Host = "https://erpapi.fontree.cn" Host = "https://erpapi.fontree.cn"
TelNum = "18021272627" TelNum = "18021272627"
Password = "Gy.123456" Password = "Gy.123456"
[stripe]
Webhookkey = "whsec_uOQpG6IZTqtfLuePIDtfLCGJPqedSCCN"

View File

@ -4,84 +4,5 @@ dubbo:
protocol: zookeeper protocol: zookeeper
timeout: 3s timeout: 3s
# address: 121.229.45.214:9004 # address: 121.229.45.214:9004
address: 172.16.100.93:2181 address: 127.0.0.1:2181
# address: 127.0.0.1:2181
# address: 114.218.158.24:2181 # address: 114.218.158.24:2181
consumer:
filter: tracing
request-timeout: 30s
references:
OrderClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.order # must be compatible with grpc or dubbo-java
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
params:
.accessKeyId: "SYD8-order-04"
.secretAccessKey: "Al-order-FDF112"
BundleClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.fiee.bundle # must be compatible with grpc or dubbo-java
AccountClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.Account
filter: echo,metrics,token,accesslog,sign,tps,generic_service,execute
params:
.accessKeyId: "Accountksl"
.secretAccessKey: "BSDY-FDF1-Fontree_account"
AccountFieeClientImpl:
protocol: tri
retries: 3
interface: com.fontree.microservices.common.micro.account.fiee
# filter: echo,metrics,token,accesslog,sign,tps,generic_service,execute,pshutdown,auth,fonValidateFilter
PaymentCentClientImpl:
interface: com.fontree.microservices.common.payment # must be compatible with grpc or dubbo-java
filter: cshutdown,sign,auth
params:
.accessKeyId: "Paymentksl"
.secretAccessKey: "BSDY-FDF1-Fontree_payment"
CastClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.multicast
logger:
zap-config:
level: error # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/logs/fiee.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 30
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 30
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

17
go.mod
View File

@ -1,14 +1,11 @@
module fonchain-fiee module fonchain-fiee
go 1.21.3 go 1.18
toolchain go1.23.6
replace ( replace (
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-/utils/objstorage
github.com/fonchain/utils/voice => ../utils/voice
github.com/fonchain_enterprise/utils/aes => ../utils/aes github.com/fonchain_enterprise/utils/aes => ../utils/aes
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-/utils/objstorage
) )
// //
@ -49,11 +46,11 @@ require (
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/goccy/go-json v0.10.2 github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.0 // indirect
github.com/jinzhu/copier v0.3.5 // indirect github.com/jinzhu/copier v0.3.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/k0kubun/pp v3.0.1+incompatible // indirect github.com/k0kubun/pp v3.0.1+incompatible // indirect
@ -104,8 +101,6 @@ require (
github.com/BurntSushi/toml v1.2.1 github.com/BurntSushi/toml v1.2.1
github.com/PuerkitoBio/goquery v1.8.1 github.com/PuerkitoBio/goquery v1.8.1
github.com/disintegration/imaging v1.6.2 github.com/disintegration/imaging v1.6.2
github.com/envoyproxy/protoc-gen-validate v0.1.0
github.com/fonchain/utils/voice v0.0.0-00010101000000-000000000000
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000 github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
github.com/gin-contrib/pprof v1.4.0 github.com/gin-contrib/pprof v1.4.0
github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis v6.15.9+incompatible
@ -121,7 +116,7 @@ require (
cloud.google.com/go v0.65.0 // indirect cloud.google.com/go v0.65.0 // indirect
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
github.com/alibaba/sentinel-golang v1.0.4 // indirect github.com/alibaba/sentinel-golang v1.0.4 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1376 // indirect github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/aws/aws-sdk-go v1.38.20 // indirect github.com/aws/aws-sdk-go v1.38.20 // indirect
github.com/baidubce/bce-sdk-go v0.9.123 // indirect github.com/baidubce/bce-sdk-go v0.9.123 // indirect
@ -133,10 +128,10 @@ require (
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dorlolo/simpleRequest v1.2.7 // indirect
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
github.com/emicklei/go-restful/v3 v3.7.4 // indirect github.com/emicklei/go-restful/v3 v3.7.4 // indirect
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-co-op/gocron v1.9.0 // indirect github.com/go-co-op/gocron v1.9.0 // indirect

7
go.sum
View File

@ -71,9 +71,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alibaba/sentinel-golang v1.0.4 h1:i0wtMvNVdy7vM4DdzYrlC4r/Mpk1OKUUBurKKkWhEo8= github.com/alibaba/sentinel-golang v1.0.4 h1:i0wtMvNVdy7vM4DdzYrlC4r/Mpk1OKUUBurKKkWhEo8=
github.com/alibaba/sentinel-golang v1.0.4/go.mod h1:Lag5rIYyJiPOylK8Kku2P+a23gdKMMqzQS7wTnjWEpk= github.com/alibaba/sentinel-golang v1.0.4/go.mod h1:Lag5rIYyJiPOylK8Kku2P+a23gdKMMqzQS7wTnjWEpk=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1376 h1:lExo7heZgdFn5AbaNJEllbA0KSJ/Z8T7MphvMREJOOo=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1376/go.mod h1:9CMdKNL3ynIGPpfTcdwTvIm8SGuAZYYC4jFVSSvE1YQ=
github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible h1:KXeJoM1wo9I/6xPTyt6qCxoSZnmASiAjlrr0dyTUKt8= github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible h1:KXeJoM1wo9I/6xPTyt6qCxoSZnmASiAjlrr0dyTUKt8=
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
@ -188,8 +187,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dorlolo/simpleRequest v1.2.7 h1:I6AlEhMBSZPNQ4QjpCevhpxsPRDa3lgDOxJYYfmPTU8=
github.com/dorlolo/simpleRequest v1.2.7/go.mod h1:koVT8DQu+JK40UoMNBQjt+zomlCW8FqE0ffEzjTOWYY=
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 h1:XoR8SSVziXe698dt4uZYDfsmHpKLemqAgFyndQsq5Kw= github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 h1:XoR8SSVziXe698dt4uZYDfsmHpKLemqAgFyndQsq5Kw=
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
@ -287,7 +284,6 @@ github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
@ -1369,7 +1365,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=

2
pkg/cache/common.go vendored
View File

@ -17,7 +17,7 @@ type RedisConfig struct {
RedisDbName string RedisDbName string
} }
// LoadRedis 在中间件中初始化redis链接 //LoadRedis 在中间件中初始化redis链接
func LoadRedis(configEnv RedisConfig) { func LoadRedis(configEnv RedisConfig) {
db, _ := strconv.ParseUint(configEnv.RedisDbName, 10, 64) db, _ := strconv.ParseUint(configEnv.RedisDbName, 10, 64)
client := redis.NewClient(&redis.Options{ client := redis.NewClient(&redis.Options{

View File

@ -1,77 +0,0 @@
// Package jwt -----------------------------
// @file : common.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2025/6/12 18:07
// -------------------------------------------
package jwt
import (
"context"
"fonchain-fiee/api/account"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/pkg/config"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils/secret"
"github.com/gin-gonic/gin"
)
// ParseToChatUser 将token信息转换为聊天室用户信息
func ParseToChatUser(c *gin.Context) (chatUserInfo *accountFiee.ChatUserData, code e.ErrorCodeType) {
domain := config.Domain
domainAny, exist := c.Get("domain")
if exist {
domain = domainAny.(string)
}
var err error
token := c.GetHeader(e.Authorization)
if token == "" {
code = e.NotLogin
return
}
ctx := context.Background()
var originId int64 = 0
switch domain {
case config.Domain:
//fiee token校验
token, err = secret.GetJwtFromStr(token)
if err != nil {
code = e.NotLogin
return
}
var fieeJwtInfo *accountFiee.DecryptJwtResponse
fieeJwtInfo, err = service.AccountFieeProvider.DecryptJwt(ctx, &accountFiee.DecryptJwtRequest{Token: token, Domain: domain})
if err != nil || fieeJwtInfo.IsOffline {
return
}
originId = int64(fieeJwtInfo.ID)
case "fontree":
//erp token校验
token, err = secret.GetJwtFromStr(token)
if err != nil {
code = e.NotLogin
return
}
var fontreeJwtInfo *account.DecryptJwtResponse
fontreeJwtInfo, err = service.AccountProvider.DecryptJwt(ctx, &account.DecryptJwtRequest{Token: token, Domain: domain})
if err != nil || fontreeJwtInfo.IsOffline {
code = e.NotLogin
return
}
originId = int64(fontreeJwtInfo.ID)
}
var userQueryRes *accountFiee.GetChatUserListResp
userQueryRes, err = service.AccountFieeProvider.GetChatUserList(c, &accountFiee.GetChatUserListRequest{
Query: &accountFiee.ChatUserData{Origin: domain, OriginId: originId},
Page: 1,
PageSize: 1,
})
if err != nil || userQueryRes.Total == 0 {
code = e.ErrorNotExistUser
return
}
chatUserInfo = userQueryRes.List[0]
return
}

View File

@ -57,10 +57,6 @@ var EnMessages = map[string]string{
"服务器错误": "Server error", "服务器错误": "Server error",
"验证失败,请控制拼图对齐缺口": "Verification failed, please control puzzle alignment gap", "验证失败,请控制拼图对齐缺口": "Verification failed, please control puzzle alignment gap",
"滑块验证状态不存在,请退出重试": "The slider verification status does not exist. Please exit and try again", "滑块验证状态不存在,请退出重试": "The slider verification status does not exist. Please exit and try again",
"请先实名": "Please use your real name first",
"实名审核中": "Real-name verification is underway",
"实名审核失败": "The real-name verification failed",
"未知实名状态": "Unknown real-name status",
} }
var DeDEMessages = map[string]string{ var DeDEMessages = map[string]string{
@ -112,10 +108,6 @@ var DeDEMessages = map[string]string{
"服务器错误": "Serverfehler", "服务器错误": "Serverfehler",
"验证失败,请控制拼图对齐缺口": "Überprüfung fehlgeschlagen, bitte Steuerung Puzzle-Ausrichtungslücke", "验证失败,请控制拼图对齐缺口": "Überprüfung fehlgeschlagen, bitte Steuerung Puzzle-Ausrichtungslücke",
"滑块验证状态不存在,请退出重试": "Die krümmbestätigung existiert nicht. Bitte beenden sie den vorgang", "滑块验证状态不存在,请退出重试": "Die krümmbestätigung existiert nicht. Bitte beenden sie den vorgang",
"请先实名": "Bitte, nur der name",
"实名审核中": "Contest läuft",
"实名审核失败": "Die confirmation hat versagt",
"未知实名状态": "Noch nicht registriert",
} }
var JaJPMessages = map[string]string{ var JaJPMessages = map[string]string{
@ -167,10 +159,6 @@ var JaJPMessages = map[string]string{
"服务器错误": "サーバーエラー", "服务器错误": "サーバーエラー",
"验证失败,请控制拼图对齐缺口": "検証に失敗しました。パズルの整列ギャップを制御してください", "验证失败,请控制拼图对齐缺口": "検証に失敗しました。パズルの整列ギャップを制御してください",
"滑块验证状态不存在,请退出重试": "スライダー検証状態が存在しません,リトライをログアウトしてください", "滑块验证状态不存在,请退出重试": "スライダー検証状態が存在しません,リトライをログアウトしてください",
"请先实名": "まずは実名でお願いします",
"实名审核中": "実名審査中です",
"实名审核失败": "実名検証失敗です",
"未知实名状态": "未知の実名状態です",
} }
var ZhTWMessages = map[string]string{ var ZhTWMessages = map[string]string{
@ -222,8 +210,4 @@ var ZhTWMessages = map[string]string{
"服务器错误": "服務器錯誤", "服务器错误": "服務器錯誤",
"验证失败,请控制拼图对齐缺口": "驗證失敗,請控制拼圖對齊缺口", "验证失败,请控制拼图对齐缺口": "驗證失敗,請控制拼圖對齊缺口",
"滑块验证状态不存在,请退出重试": "滑塊驗證狀態不存在,請退出重試", "滑块验证状态不存在,请退出重试": "滑塊驗證狀態不存在,請退出重試",
"请先实名": "請先實名",
"实名审核中": "實名審覈中",
"实名审核失败": "實名審覈失敗",
"未知实名状态": "未知實名狀態",
} }

View File

@ -1,178 +0,0 @@
// Package ws -----------------------------
// @file : hertzWSUpgrade.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/6/28 14:14
// -------------------------------------------
package ws
import (
"encoding/json"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/serializer"
"strings"
)
type WsType int
const (
RegisterType WsType = iota
ErrorType
TestType
ChatType
NewChatMsgType //新消息通知
AuthorizationType //token校验通知
)
// 消息结构
type WSMessage struct {
Type string `json:"type"`
Data string `json:"data"`
}
// websocket消息内容
type WsInfo struct {
Type WsType `json:"type"` //消息类型
Content interface{} `json:"content"` //消息内容
From string `json:"from"` //发送者 0为服务端,客户端填写clientId
To string `json:"to"` //接收者 接收消息的用户id
Mark string `json:"mark"`
//Conn *websocket.Conn `json:"-"` //客户端发送消息使用
}
type WsSessionInfo struct {
Type WsType `json:"type"` //消息类型
//SessionId string `json:"sessionId"` //会话Id
Content interface{} `json:"content"` //消息内容
}
// 身份认证消息
type AuthorizationInfo struct {
Type WsType `json:"type"` //消息类型
Content AuthInfo `json:"content"`
}
type AuthInfo struct {
Auth string `json:"auth"`
Domain string `json:"domain"`
}
// 注册消息
type WsRegisterInfo struct {
Type WsType `json:"type"` //消息类型
Content UserInfo `json:"content"` //消息内容
From string `json:"from"` //发送者 0为服务端,客户端填写clientId
To string `json:"to"` //接收者 接收消息的用户id
//Conn *websocket.Conn `json:"-"` //客户端发送消息使用
}
type UserInfo struct {
Uuid string `json:"uuid"` //画家uid
UserId int64 `json:"userId"` //用户id
ClientId string `json:"clientId,omitempty"` //服务端临时签发的客户端uid
}
type TempClientInfo struct {
ClientId string `json:"clientId"`
}
func WsMessageRegisterCallback(clientId string) []byte {
var errMsg = WsInfo{
Type: RegisterType,
Content: map[string]string{
"clientId": clientId,
},
From: "0",
To: clientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsErrorMessage(wsType WsType, clientId string, code e.ErrorCodeType, err error) []byte {
var ers string
if err != nil {
ers = err.Error()
}
var content = serializer.Response{
Code: code,
Err: ers,
Msg: code.String(),
}
var errMsg = WsInfo{
Type: wsType,
Content: content,
From: "0",
To: clientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsErrorPermissionDenied(wsType WsType, clientId string) []byte {
var content = serializer.Response{
Code: e.PermissionDenied,
Err: "Permission Denied",
Msg: "拒绝访问",
}
var errMsg = WsInfo{
Type: wsType,
Content: content,
From: "0",
To: clientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsErrorInvalidDataFormat(clientId string) []byte {
var content = serializer.Response{
Status: e.Failed,
Code: e.Failed,
Err: "Invalid Data Format",
Msg: "发送失败",
}
var errMsg = WsInfo{
Type: ErrorType,
Content: content,
From: "0",
To: clientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsErrorUnknownMessageType(clientId string) []byte {
var errMsg = WsInfo{
Type: ErrorType,
Content: "Unknown notice type",
From: "0",
To: clientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsErrorConnection(clientId string, err string, marks ...string) []byte {
mark := ""
if marks != nil {
mark = strings.Join(marks, ";")
}
var errMsg = WsInfo{
Type: ErrorType,
Content: "Connection error:" + err,
From: "0",
To: clientId,
Mark: mark,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}
func WsChatMessage(clientId string, targetClientId string, msg string) []byte {
var errMsg = WsInfo{
Type: ChatType,
Content: msg,
From: clientId,
To: targetClientId,
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}

View File

@ -1,315 +0,0 @@
// Package ws -----------------------------
// @file : chatRoom.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/21 18:17:17
// -------------------------------------------
package ws
import (
"encoding/json"
"fmt"
"fonchain-fiee/pkg/utils"
"github.com/gorilla/websocket"
"go.uber.org/zap"
"log"
"runtime"
"strconv"
"sync"
"time"
)
const (
// Time allowed to write a notice to the peer.
writeWait = 10 * time.Second
// Time allowed to read the next pong notice from the peer.
pongWait = 60 * time.Second
// Send pings to peer with this period. Must be less than pongWait.
pingPeriod = (pongWait * 9) / 10
// Maximum notice size allowed from peer.
maxMessageSize = 1024
)
func NewChatRoom() *ChatRoom {
var room = ChatRoom{
clientsRwLocker: &sync.RWMutex{},
clients: make(map[int64]map[string]*Client),
register: make(clientChan),
UnRegister: make(clientChan),
broadcast: make(broadcastChan),
}
go room.Run()
return &room
}
type broadcastMessage struct {
UserIds []int64
message []byte
}
type (
// []byte类型管道 用于客户端接收消息数据
messageChan chan []byte
//
wsConnChan chan *websocket.Conn
// Client类型数据管道
clientChan chan *Client
broadcastChan chan *broadcastMessage
)
type ChatRoom struct {
clientsRwLocker *sync.RWMutex
//clients 客户端信息存储
//// 支持多客户端连接 map[userId]map[clientId]*Client
clients map[int64]map[string]*Client
//会话 map[sessionId][]*Client
Session map[string][]*Client
//register register 注册管道
register clientChan
//unRegister 注销管道 接收需要注销的客户端
UnRegister clientChan
broadcast broadcastChan
}
func (o *ChatRoom) Run() {
//消息分发
for {
select {
// 注册事件
case newClient := <-o.register:
////删除临时map中的客户户端
//delete(o.tempClient, client.clientId)
o.clientsRwLocker.Lock()
//添加到客户端集合中
if o.clients[newClient.UserId] == nil {
o.clients[newClient.UserId] = make(map[string]*Client)
}
o.clients[newClient.UserId][newClient.ClientId] = newClient
//添加到会话集合中
if o.Session == nil {
o.Session = make(map[string][]*Client)
}
//if _, ok := o.Session[newClient.SessionId]; ok {
// for i, client := range o.Session[newClient.SessionId] {
// if client.ClientId == newClient.ClientId {
// //将之前的客户端注销
// o.UnRegister <- client
// }
// o.Session[newClient.SessionId][i] = newClient
// }
//}
if newClient.Waiter {
//客服人员没有默认会话窗口,而是自动加入所有用户的会话
for sessionId, _ := range o.Session {
sessionId := sessionId
if sessionId != newClient.SessionId {
for _, client := range o.clients[newClient.UserId] {
o.Session[sessionId] = append(o.Session[sessionId], client)
}
}
}
} else {
//画家添加会话的逻辑
_, ok := o.Session[newClient.SessionId]
if !ok {
o.Session[newClient.SessionId] = make([]*Client, 0)
//把客服拉入会话
for userId, clientInfo := range o.clients {
if userId == newClient.UserId {
continue
}
for i, client := range clientInfo {
if client != nil && client.Waiter {
//把客服人员客户端加入会话中
o.Session[newClient.SessionId] = append(o.Session[newClient.SessionId], clientInfo[i])
}
}
}
}
//再把自己的客户端加入会话
o.Session[newClient.SessionId] = append(o.Session[newClient.SessionId], newClient)
}
o.clientsRwLocker.Unlock()
//注销事件
case client := <-o.UnRegister:
//panic 恢复
defer func() {
if r := recover(); r != "" {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
err, ok := r.(error)
if !ok {
err = fmt.Errorf("%v", r)
}
log.Fatal("close webosocket connection occured panic , recovered!", zap.Any("client", client), zap.Error(err), zap.String("stack", string(buf)))
}
}()
fmt.Println("ws客户端注销事件触发")
//从客户端集合中删除
if _, ok := o.clients[client.UserId]; ok {
if client != nil && client.Conn != nil {
//_ = client.Conn.WriteMessage(websocket.CloseMessage, []byte{})
_ = client.Conn.Close()
}
o.clients[client.UserId][client.ClientId] = nil
delete(o.clients[client.UserId], client.ClientId)
fmt.Printf("ws客户端%s 被注销\n", client.ClientId)
}
// 消息群发事件
case messageInfo := <-o.broadcast:
o.Broadcast(messageInfo.message, messageInfo.UserIds...)
}
}
}
func (o *ChatRoom) Register(c *Client) (sessionId string) {
if c.SessionId == "" && !c.Waiter {
//这里的c经常拿不到sessionId所以使用userId固定死
//c.SessionId = fmt.Sprintf("%d-%d", c.UserId, time.Now().Unix())
c.SessionId = fmt.Sprintf("%d", c.UserId)
}
o.register <- c
return c.SessionId
}
// SendSessionMessage
// sendUserId: 发送消息的用户id消息提醒时此用户将会被排除
// sessionId 会话id
// msgType 消息类型
// message: 消息内容
func (o *ChatRoom) SendSessionMessage(sendUserId int64, sessionId string, msgType WsType, message any) (userIdInSession []int64, err error) {
o.clientsRwLocker.Lock()
defer o.clientsRwLocker.Unlock()
var msg = WsSessionInfo{
Type: msgType,
Content: message,
}
msgBytes, _ := json.Marshal(msg)
if o.Session[sessionId] == nil {
err = fmt.Errorf("该会话不存在或已失效")
return
}
fmt.Println("ChatRoom.SendSessionMessage - 1")
usableClients := []*Client{}
fmt.Printf("sessionId:[%s],客户端数量%d\n", sessionId, len(o.Session[sessionId]))
for i, client := range o.Session[sessionId] {
if client != nil {
_, exist := o.clients[client.UserId][client.ClientId]
if exist {
usableClients = append(usableClients, o.Session[sessionId][i])
}
}
fmt.Printf("client:%+v\n", client)
if client != nil && client.UserId != sendUserId {
client.Send <- msgBytes
userIdInSession = append(userIdInSession, client.UserId)
}
//client.Send <- msgBytes
}
o.Session[sessionId] = usableClients
fmt.Printf("sessionId:[%s],客户端数量%d\n", sessionId, len(o.Session[sessionId]))
fmt.Println("userIdInSession", userIdInSession)
return
}
func (o *ChatRoom) GetUserIdInSession(sessionId string, withoutUserId ...int64) (userIds []int64) {
fmt.Printf("sessionId:%s withoutUserId:%d\n", sessionId, withoutUserId)
//o.clientsRwLocker.RLock()
//defer o.clientsRwLocker.RUnlock()
fmt.Println("GetUserIdInSession 1")
if o.Session[sessionId] != nil {
fmt.Printf("GetUserIdInSession 2,o.Session[sessionId]:%+v", o.Session[sessionId])
for _, client := range o.Session[sessionId] {
fmt.Println("session one of userId", client.UserId)
var jump bool
if withoutUserId != nil {
for _, userId := range withoutUserId {
if client.UserId == userId {
jump = true
continue
}
}
}
if !jump {
fmt.Println("ADD USER", client.UserId)
userId := client.UserId
userIds = append(userIds, userId)
}
}
}
//针对app没有连接上websocket(聊天室没有检查到用户的客户端此时websocket无法发送通知)但是需要推送app通知给用户的情况进行优化
fmt.Println("GetUserIdInSession 3,userIds:", userIds)
if len(userIds) == 0 {
sessionUserId, _ := strconv.Atoi(sessionId)
add := true
if sessionUserId != 0 {
for _, v := range withoutUserId {
if v == int64(sessionUserId) {
add = false
break
}
}
}
if add {
userIds = append(userIds, int64(sessionUserId))
}
fmt.Println("GetUserIdInSession 4,userIds:", userIds)
}
userIds = utils.Unique(userIds)
fmt.Println("GetUserIdInSession 5,userIds:", userIds)
return
}
// func (o ChatRoom) RegisterClient(c *Client) {
// o.register <- c
// }
//
// func (o ChatRoom) DeleteClient(c *Client) {
// o.unRegister <- c
// }
func (o ChatRoom) Broadcast(message []byte, userIds ...int64) {
// 如果userIds为空则群发,否则找到这个用户的ws对象
if userIds == nil {
for _, userClients := range o.clients {
for _, cli := range userClients {
if cli == nil {
o.UnRegister <- cli
continue
}
go func() {
err := cli.Conn.WriteMessage(websocket.TextMessage, message)
if err != nil {
o.UnRegister <- cli
}
}()
}
}
} else {
for _, userId := range userIds {
userClients, ok := o.clients[userId]
if ok == false {
return
}
for _, cli := range userClients {
if cli == nil {
o.UnRegister <- cli
continue
}
go func() {
err := cli.Conn.WriteMessage(websocket.TextMessage, message)
if err != nil {
o.UnRegister <- cli
}
}()
}
}
}
}

View File

@ -1,111 +0,0 @@
// Package ws -----------------------------
// @file : client.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/21 18:18:05
// -------------------------------------------
package ws
import (
"context"
"fmt"
"github.com/gorilla/websocket"
uuid "github.com/satori/go.uuid"
"go.uber.org/zap"
"log"
"strings"
"time"
)
var (
// 注册事件最大等待时间
limitRegisterWaitTime = time.Second * 6
limitReadTime = time.Second * 5
)
// NewClient 创建客户端实例
//
// param userId 用户id
// param uid 用户uuid
// param conn 客户端websocket连接对象
// return *Client
func NewClient(userId int64, uid string, conn *websocket.Conn, room *ChatRoom) *Client {
uidobj, _ := uuid.NewV4()
var v = &Client{
Room: room,
UserId: userId,
Uuid: uid,
ClientId: strings.Replace(uidobj.String(), "-", "", -1),
Conn: conn,
Send: make(chan []byte, 500),
}
return v
}
type Client struct {
Room *ChatRoom `json:"-" `
UserId int64 `json:"userId" ` //用户id
Uuid string `json:"uuid"` //画家uid
ClientId string `json:"clientId"` //为用户不同设备分配不同的客户端ID
Conn *websocket.Conn `json:"-"`
Send chan []byte
SessionId string `json:"sessionId"` //会话ID同一个用户多客户端登录会话ID相同
Waiter bool `json:"waiter"` //是否是客服
}
func (c *Client) Reading(ctx context.Context, handleFunc ...func(sourceData []byte, cli *Client)) {
defer func() {
c.Room.UnRegister <- c
ctx.Done()
return
}()
//c.Conn.SetReadLimit(maxMessageSize)
c.Conn.SetReadDeadline(time.Now().Add(pongWait))
//接收到ping命令后更新读取时间
c.Conn.SetPongHandler(func(string) error {
c.Conn.SetReadDeadline(time.Now().Add(pongWait))
return nil
})
for {
msgType, byteData, err := c.Conn.ReadMessage()
if msgType == -1 {
return
}
if err != nil {
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
log.Println("ws连接已关闭", zap.Error(err))
}
break
}
if handleFunc != nil {
handleFunc[0](byteData, c)
} else {
HandleMessage(byteData, c)
}
}
}
func (c *Client) WriteWait() {
ticker := time.NewTicker(pingPeriod)
defer func() {
ticker.Stop()
c.Conn.Close()
}()
for {
select {
case msg, ok := <-c.Send:
fmt.Printf("发送消息:%+v\n", string(msg))
c.Conn.WriteMessage(websocket.TextMessage, msg)
fmt.Println("发送消息结束")
if !ok {
// 聊天室关闭了管道
c.Conn.WriteControl(websocket.CloseMessage, []byte{}, time.Now().Add(writeWait))
return
}
case <-ticker.C:
if err := c.Conn.WriteControl(websocket.PingMessage, nil, time.Now().Add(pongWait)); err != nil {
return
}
}
}
}

View File

@ -1,21 +0,0 @@
// Package utils -----------------------------
// @file : hertzWSUpgrade.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/6/28 14:19
// -------------------------------------------
package ws
import (
"github.com/gorilla/websocket"
"net/http"
)
var UpGrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
// 检查请求的来源是否允许websocket连接可根据需求自行实现
return true
},
}

View File

@ -1,53 +0,0 @@
# wsscoket 对接说明
## 客户端对接测试页面
[{{服务端地址}}/ws/client](http://127.0.0.1:8088/ws/client)
## 客户端对接websocket流程
### websocket的连接
1. 客户端登录后获取uuid
2. 连接服务端websocket后在10s内发送一下格式的数据否则websocket连接将断开。
uuid请添加登录后获取的如果uuid不正确连接也会断开
```json
{
"type": "register",
"from": "",
"to": "0",
"content": {
"uuid":"用户的uuid"
}
}
```
注册成功后服务端将返回客户端临时id
```json
{"clientId":"02de5759-3f0a-47fa-a79f-afe61c39c5aa"}
```
### weboscket 数据发送测试
消息类型`type="test"`时,客户端将会把`content`内容原路返回,以此来测试最基本的通讯功能。
```json
{
"type": "test",
"from": "用户clientId",
"to": "0",
"content": {
"demo":"testdemo"
}
}
```
### websocket消息类型说明
#### 错误消息
在websocket通讯过程中服务端会对客户端发送过来的消息进行验证。
| type字段 | content字段 | 说明 |
|--------|----------------------|------------------------------|
| Error | Permission denied | 拒绝访问。 此报错一般出现在首次连接验证uuid的时候 |
| Error | Invalid data format | 无效的数据格式。消息内容未按照指定格式书写 |
| Error | Unknown message type | 未知的消息类型。接收到了未定义的type |
**错误消息示例:**
```json
{"type":"Error","content":"Permission denied","from":"0","to":"tempId"}
//{"type":"Error","content":"Invalid data format","from":"0","to":""}
//{"type":"Error","content":"Unknown notice type","from":"0","to":"0"}
```

View File

@ -1,145 +0,0 @@
// Package ws -----------------------------
// @file : handler.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/23 11:13:43
// -------------------------------------------
package ws
import (
"context"
"encoding/json"
"fonchain-fiee/api/account"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/pkg/config"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils/secret"
)
func AuthorizationVerify(sourceData []byte) (userInfo *accountFiee.ChatUserData, ok bool, err error) {
var msg AuthorizationInfo
err = json.Unmarshal(sourceData, &msg)
if err != nil {
return
}
if msg.Type != AuthorizationType {
return
}
if msg.Content.Auth == "" {
return
}
var ctx = context.Background()
var accountInfo accountFiee.ChatUserData
switch msg.Content.Domain {
case config.Domain:
//fiee token校验
msg.Content.Auth, err = secret.GetJwtFromStr(msg.Content.Auth)
if err != nil {
return
}
var fieeJwtInfo *accountFiee.DecryptJwtResponse
fieeJwtInfo, err = service.AccountFieeProvider.DecryptJwt(ctx, &accountFiee.DecryptJwtRequest{Token: msg.Content.Auth, Domain: msg.Content.Domain})
if err != nil || fieeJwtInfo.IsOffline {
return
}
accountInfo.Origin = msg.Content.Domain
accountInfo.OriginId = int64(fieeJwtInfo.ID)
accountInfo.Account = fieeJwtInfo.Account
accountInfo.NickName = fieeJwtInfo.NickName
case "fontree":
//erp token校验
msg.Content.Auth, err = secret.GetJwtFromStr(msg.Content.Auth)
if err != nil {
return
}
var fontreeJwtInfo *account.DecryptJwtResponse
fontreeJwtInfo, err = service.AccountProvider.DecryptJwt(ctx, &account.DecryptJwtRequest{Token: msg.Content.Auth, Domain: msg.Content.Domain})
if err != nil || fontreeJwtInfo.IsOffline {
return
}
accountInfo.Origin = msg.Content.Domain
accountInfo.OriginId = int64(fontreeJwtInfo.ID)
accountInfo.Account = fontreeJwtInfo.Account
accountInfo.NickName = fontreeJwtInfo.NickName
}
//查询是否已经注册
var chatUserQuery *accountFiee.GetChatUserListResp
chatUserQuery, err = service.AccountFieeProvider.GetChatUserList(ctx, &accountFiee.GetChatUserListRequest{
Query: &accountFiee.ChatUserData{OriginId: int64(accountInfo.ID), Origin: msg.Content.Domain},
Page: 1,
PageSize: 1,
})
//如果找不到聊天用户则创建
if err != nil || chatUserQuery.Total > 0 {
//注册客服
var createUserRes *accountFiee.CreateChatUserResp
createUserRes, err = service.AccountFieeProvider.CreateChatUser(ctx, &accountFiee.ChatUserData{
NickName: accountInfo.NickName,
Account: accountInfo.Account,
Role: 2,
Origin: msg.Content.Domain,
OriginId: int64(accountInfo.ID),
})
if err != nil {
return
}
userInfo = createUserRes.GetData()
}
ok = true
return
}
func HandleMessage(sourceData []byte, cli *Client) {
var msg WsInfo
err := json.Unmarshal(sourceData, &msg)
if err != nil {
cli.Send <- WsErrorInvalidDataFormat(msg.From)
return
}
switch msg.Type {
default:
cli.Send <- WsErrorUnknownMessageType(msg.From)
case TestType:
var newMsg = WsInfo{
Type: TestType,
Content: msg.Content,
From: "0",
To: msg.From,
}
byteMsg, _ := json.Marshal(newMsg)
cli.Send <- byteMsg
case ChatType:
if msg.From == "" {
//客户端id不能为空
cli.Send <- WsErrorMessage(ChatType, "null", e.ErrInvalidClientId, nil)
return
}
var chatInfo ChatInfo
_ = json.Unmarshal(sourceData, &chatInfo)
//解析Content
if clients, ok := cli.Room.clients[chatInfo.Content.TargetUserId]; ok {
for _, targetObj := range clients {
if targetObj != nil {
targetObj.Send <- WsChatMessage(msg.From, chatInfo.Content.TargetClientId, chatInfo.Content.Msg)
}
}
} else {
//对方不在线
cli.Send <- WsErrorMessage(ChatType, msg.From, e.ErrTargetOutLine, nil)
}
}
}
type ChatInfo struct {
Type WsType `json:"type"` //消息类型
Content ChatContent `json:"content"` //消息内容
From string `json:"from"` //发送者 0为服务端,客户端填写clientId
To string `json:"to"` //接收者 接收消息的用户id
}
type ChatContent struct {
TargetUuid string `json:"targetUuid"`
TargetUserId int64 `json:"targetUserId"`
TargetClientId string `json:"targetClientId"`
Msg string `json:"msg"`
}

View File

@ -1,127 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chat Example</title>
<script type="text/javascript">
window.onload = function () {
var conn;
var msg = document.getElementById("msg");
var log = document.getElementById("log");
function appendLog(item) {
var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;
log.appendChild(item);
if (doScroll) {
log.scrollTop = log.scrollHeight - log.clientHeight;
}
}
//时间格式化
Date.prototype.Format = function (fmt) { // author: meizz
var o = {
"M+": this.getMonth() + 1, // 月份
"d+": this.getDate(), // 日
"h+": this.getHours(), // 小时
"m+": this.getMinutes(), // 分
"s+": this.getSeconds(), // 秒
"q+": Math.floor((this.getMonth() + 3) / 3), // 季度
"S": this.getMilliseconds() // 毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
document.getElementById("form").onsubmit = function () {
if (!conn) {
return false;
}
if (!msg.value) {
return false;
}
conn.send(msg.value);
var item = document.createElement("div");
var now = new Date().Format("yyyy-MM-dd hh:mm:ss:S")
item.innerText = "客户端发送消息:\t"+now+"\n\t\t"+msg.value+"\n\n";
appendLog(item);
msg.value = "";
return false;
};
if (window["WebSocket"]) {
conn = new WebSocket("ws://" + document.location.host + "/ws");
conn.onclose = function (evt) {
var item = document.createElement("div");
item.innerHTML = "<b>Connection closed.</b>";
appendLog(item);
};
conn.onmessage = function (evt) {
var messages = evt.data.split('\n');
var now = new Date().Format("yyyy-MM-dd hh:mm:ss:S")
for (var i = 0; i < messages.length; i++) {
var item = document.createElement("div");
item.innerText = "服务端回复消息:\t"+now+"\n\t\t"+messages[i]+"\n\n";
appendLog(item);
}
};
} else {
var item = document.createElement("div");
item.innerHTML = "<b>Your browser does not support WebSockets.</b>";
appendLog(item);
}
};
</script>
<style type="text/css">
html {
overflow: hidden;
}
body {
overflow: hidden;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
background: gray;
}
#log {
background: white;
margin: 0;
padding: 0.5em 0.5em 0.5em 0.5em;
position: absolute;
top: 0.5em;
left: 0.5em;
right: 0.5em;
bottom: 3em;
overflow: auto;
}
#form {
padding: 0 0.5em 0 0.5em;
margin: 0;
position: absolute;
bottom: 1em;
left: 0px;
width: 100%;
overflow: hidden;
}
input{
height: 50px;
font-size: larger;
}
</style>
</head>
<body>
<div id="log"></div>
<form id="form">
<input type="submit" value="Send" />
<input type="text" id="msg" size="64" autofocus />
</form>
</body>
</html>

View File

@ -1,63 +0,0 @@
// Package e -----------------------------
// @file : chatCode.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2025/6/12 16:57
// -------------------------------------------
package e
import "fmt"
type ErrorCodeType int
func (e ErrorCodeType) String() string {
return GetCodeMsg(e)
}
func (e ErrorCodeType) Error() string {
return GetCodeMsg(e)
}
func (e ErrorCodeType) Int() int {
return int(e)
}
func GetCodeMsg(e ErrorCodeType) string {
v, ok := msgFlags[e]
if !ok {
return fmt.Sprintf("未知错误:[%d]", e)
}
return v
}
var msgFlags = map[ErrorCodeType]string{
SUCCESS: "操作成功",
UpdatePasswordSuccess: "修改密码成功",
NotExistInentifier: "该第三方账号未绑定",
ERROR: "fail",
InvalidParams: "请求参数错误",
BindError: "参数绑定错误,类型不一致",
JsonUnmarshal: "Json解析错误",
ErrorDatabase: "数据库操作出错,请重试",
ErrorOss: "OSS配置错误",
InvalidToken: "Token验证失败",
ErrorUploadFile: "上传失败",
ErrorUploadVideoCover: "视频截取封面错误",
ErrorUploadValidParam: "上传参数非法",
ErrorFileReadErr: "读取文件错误",
ErrorFileNotExists: "文件不存在",
ErrorChunkNotGt: "分块数量不一致",
ErrorChunk: "读取分块错误",
ErrorUploadBos: "上传bos错误",
ErrorFileCreate: "文件创建错误",
ErrInvalidDataFormat: "无效的数据格式",
ErrInvalidClientId: "无效的客户端ID",
ErrRegisterFailed: "注册失败",
ErrUnRegistered: "未注册客户端",
PermissionDenied: "拒绝访问",
ErrChatSendErr: "消息发送失败",
NotLogin: "请先登录",
ErrorNotExistUser: "用户不存在",
}

View File

@ -139,15 +139,6 @@ const (
ERROR_Text_Irregularity = 90018 ERROR_Text_Irregularity = 90018
ERROR_Text_Length = 90019 ERROR_Text_Length = 90019
ERROR_NoPermission = 90020 ERROR_NoPermission = 90020
//聊天室
ErrInvalidDataFormat = 80100 //无效的数据格式
ErrInvalidClientId = 80101 //无效的客户端id
ErrRegisterFailed = 80102 //注册失败
ErrUnRegistered = 80103 //未注册
PermissionDenied = 80104 //拒绝访问
ErrChatSendErr = 80105 //聊天记录发送失败
ErrTargetOutLine = 80106 //目标离线
) )
const ( const (
Push = 1 Push = 1

View File

@ -1,56 +0,0 @@
package e
import "strings"
type FileType int
// 定义文件类型值
const (
Video FileType = 1
Audio FileType = 2
Image FileType = 3
File FileType = 4
Other FileType = 5
)
// 根据扩展名映射到文件类型值
var extensionToType = map[string]FileType{
// 视频文件
".3g2": Video, ".3gp": Video, ".asf": Video, ".avi": Video, ".divx": Video, ".drc": Video,
".flv": Video, ".h261": Video, ".h264": Video, ".mkv": Video, ".mov": Video, ".mp4": Video, ".mpg": Video,
".mpeg": Video, ".mpv": Video, ".mxf": Video, ".nuv": Video, ".qt": Video, ".rm": Video,
".rmvb": Video, ".srt": Video, ".swf": Video, ".vob": Video, ".vp6": Video, ".vp8": Video, ".webm": Video,
".wmv": Video, ".xesc": Video,
// 音频文件
".aac": Audio, ".aax": Audio, ".ac3": Audio, ".act": Audio, ".au": Audio, ".flac": Audio,
".m4a": Audio, ".m4p": Audio, ".m4r": Audio, ".mid": Audio, ".midi": Audio, ".mp2": Audio,
".mp3": Audio, ".mpa": Audio, ".mpc": Audio, ".ogg": Audio, ".wav": Audio, ".wma": Audio, ".wv": Audio,
// 图像文件
".bmp": Image, ".gif": Image, ".ico": Image, ".jpeg": Image, ".jpg": Image, ".jpe": Image,
".png": Image, ".psd": Image, ".tiff": Image, ".webp": Image,
// 普通文件
".a": File, ".abw": File, ".azw": File, ".bin": File, ".bz2": File, ".c": File, ".cab": File,
".class": File, ".conf": File, ".crt": File, ".css": File, ".csv": File, ".dat": File, ".deb": File,
".dll": File, ".dms": File, ".doc": File, ".docx": File, ".eot": File, ".eps": File, ".exe": File,
".gz": File, ".h": File, ".htm": File, ".html": File, ".iso": File, ".jar": File,
".js": File, ".json": File, ".log": File, ".m3u": File, ".m3u8": File, ".md": File, ".msi": File,
".otf": File, ".pcap": File, ".pdf": File, ".ppt": File, ".pptx": File, ".rar": File, ".rpm": File,
".rss": File, ".run": File, ".sh": File, ".sql": File, ".svg": File, ".tar": File, ".tgz": File,
".ttf": File, ".txt": File, ".vsd": File, ".weba": File,
".wps": File, ".xml": File, ".xpi": File, ".zip": File, ".z": File,
// 未知文件扩展名
"": Other,
}
// DetectFileTypeByExtension 通过文件扩展名判断文件类型并返回对应的值
func DetectFileTypeByExtension(extension string) FileType {
extension = strings.ToLower(extension)
if fileType, exists := extensionToType[extension]; exists {
return fileType
}
return Other
}

View File

@ -146,8 +146,6 @@ var MsgFlags = map[int]string{
ERROR_Text_Irregularity: "文字内容不合规", ERROR_Text_Irregularity: "文字内容不合规",
ERROR_Text_Length: "文本长度超出限制", ERROR_Text_Length: "文本长度超出限制",
ERROR_NoPermission: "您暂无权限,请联系客服", ERROR_NoPermission: "您暂无权限,请联系客服",
ErrInvalidClientId: "无效的客户端ID",
} }
const ( const (

View File

@ -1,6 +1,7 @@
package middleware package middleware
import ( import (
"dubbo.apache.org/dubbo-go/v3/common/logger"
"errors" "errors"
"fmt" "fmt"
"fonchain-fiee/api/account" "fonchain-fiee/api/account"
@ -13,10 +14,8 @@ import (
"fonchain-fiee/pkg/model/login" "fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils/secret" "fonchain-fiee/pkg/utils/secret"
"time"
"dubbo.apache.org/dubbo-go/v3/common/logger"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"time"
) )
// CheckLogin 检测登陆 // CheckLogin 检测登陆
@ -151,7 +150,7 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
loginInfo := login.Info{ loginInfo := login.Info{
Domain: info.Domain, Domain: info.Domain,
ID: info.ID, ID: info.ID,
Name: info.NickName, //Account: info.Account,
//NickName: info.NickName, //NickName: info.NickName,
//PositionUsers: qres.PositionUsers, //PositionUsers: qres.PositionUsers,
//Extend: infoRes.Info.Extend, //Extend: infoRes.Info.Extend,

View File

@ -2,7 +2,7 @@ package middleware
import ( import (
"bytes" "bytes"
"io" "io/ioutil"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -24,14 +24,11 @@ func NewLogger() gin.HandlerFunc {
latencyTime := endTime.Sub(startTime) // 请求方式 latencyTime := endTime.Sub(startTime) // 请求方式
path := c.Request.URL.Path path := c.Request.URL.Path
query := c.Request.URL.RawQuery query := c.Request.URL.RawQuery
data, _ := io.ReadAll(c.Request.Body) data, _ := ioutil.ReadAll(c.Request.Body)
val := c.GetHeader("Accept-Language")
if val == "" {
c.Request.Header.Set("Accept-Language", "zh-CN")
}
log.Printf("[%s] %s %d %s %s %s %s %s %s", path, c.Request.Method, c.Writer.Status(), query, log.Printf("[%s] %s %d %s %s %s %s %s %s", path, c.Request.Method, c.Writer.Status(), query,
string(data), c.ClientIP(), c.Request.UserAgent(), c.Errors.ByType(gin.ErrorTypePrivate).String(), latencyTime.String()) string(data), c.ClientIP(), c.Request.UserAgent(), c.Errors.ByType(gin.ErrorTypePrivate).String(), latencyTime.String())
c.Request.Body = io.NopCloser(bytes.NewBuffer(data))
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(data))
c.Next() c.Next()
} }
} }

View File

@ -4,7 +4,6 @@ import (
"fonchain-fiee/pkg/middleware" "fonchain-fiee/pkg/middleware"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/bundle" "fonchain-fiee/pkg/service/bundle"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -22,21 +21,10 @@ func BundleRouter(r *gin.RouterGroup) {
bundleClientRoute.POST("remove", bundle.DeleteBundle) bundleClientRoute.POST("remove", bundle.DeleteBundle)
bundleClientRoute.POST("bundle-list", bundle.BundleList) bundleClientRoute.POST("bundle-list", bundle.BundleList)
} }
bundleClientRouteV2 := bundleRoute.Group("system/v2")
bundleAppRoute = bundleAppRoute.Group("common")
{ {
bundleClientRouteV2.POST("save", bundle.SaveBundleV2) bundleAppRoute.POST("bundle-list", bundle.BundleList)
bundleClientRouteV2.POST("update/shelfStatus", bundle.HandShelf)
bundleClientRouteV2.POST("bundle-list", bundle.BundleListV2)
bundleClientRouteV2.POST("bundle-detail", bundle.BundleDetailV2)
}
bundleAppRouteV1 := bundleAppRoute.Group("common")
{
bundleAppRouteV1.POST("bundle-list", bundle.BundleList)
}
bundleAppRouteV2 := bundleAppRoute.Group("app/system/v2")
{
bundleAppRouteV2.POST("bundle-list", bundle.BundleListV2)
bundleAppRouteV2.POST("bundle-detail", bundle.BundleDetailV2)
} }
} }

View File

@ -15,12 +15,12 @@ func BundleOrderRouter(r *gin.RouterGroup) {
bundleOrderRoute := r.Group("bundle-order") bundleOrderRoute := r.Group("bundle-order")
bundleOrderRoute.Use(middleware.CheckLogin(service.AccountFieeProvider)) bundleOrderRoute.Use(middleware.CheckLogin(service.AccountFieeProvider))
bundleOrderWebRoute := r.Group("bundle-order") //bundleOrderWebRoute := r.Group("bundle-order")
bundleOrderWebRoute.Use(middleware.CheckWebLogin(service.AccountProvider)) //bundleOrderWebRoute.Use(middleware.CheckWebLogin(service.AccountProvider))
// 套餐 // 套餐
{ {
bundleOrderClientWebRoute := bundleOrderWebRoute.Group("common/web") bundleOrderClientWebRoute := bundleOrderRoute.Group("common/web")
{ {
bundleOrderClientWebRoute.POST("bundle-order-list", bundle.OrderRecordsList) bundleOrderClientWebRoute.POST("bundle-order-list", bundle.OrderRecordsList)
} }
@ -31,14 +31,13 @@ func BundleOrderRouter(r *gin.RouterGroup) {
//bundleOrderWebRoute := bundleOrderRoute.Group("web") //bundleOrderWebRoute := bundleOrderRoute.Group("web")
{ {
bundleOrderWebRoute.POST("financial-confirm", bundle.UpdateFinancialConfirmationStatus) bundleOrderRoute.POST("financial-confirm", bundle.UpdateFinancialConfirmationStatus)
bundleOrderWebRoute.POST("order-export", bundle.ExportOrderInfoOss) bundleOrderRoute.POST("order-export", bundle.ExportOrderInfo)
} }
bundleOrderAppRoute := bundleOrderRoute.Group("app") bundleOrderAppRoute := bundleOrderRoute.Group("app")
{ {
bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature) bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature)
bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature)
bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid) bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid)
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail) bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)

View File

@ -1,29 +0,0 @@
package router
import (
"fonchain-fiee/pkg/middleware"
"fonchain-fiee/pkg/service"
serviceCast "fonchain-fiee/pkg/service/cast"
"github.com/gin-gonic/gin"
)
func MediaRouter(r *gin.RouterGroup) {
//noAuth := r.Group("")
auth := r.Group("")
auth.Use(middleware.CheckWebLogin(service.AccountProvider))
media := auth.Group("media")
{
media.POST("user-list", serviceCast.MediaUserList)
media.POST("unbind-manager", serviceCast.UnbindManager)
media.POST("bind-manager", serviceCast.BindManager)
media.POST("update-account", serviceCast.UpdateMediaAccount)
}
work := auth.Group("work")
{
work.POST("update-work-image", serviceCast.UpdateWorkImage)
work.POST("update-work-video", serviceCast.UpdateWorkVideo)
work.POST("list", serviceCast.WorkList)
work.POST("detail", serviceCast.WorkDetail)
}
}

View File

@ -4,12 +4,8 @@ import (
"fonchain-fiee/pkg/middleware" "fonchain-fiee/pkg/middleware"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/account" "fonchain-fiee/pkg/service/account"
"fonchain-fiee/pkg/service/asChat"
"fonchain-fiee/pkg/service/auth" "fonchain-fiee/pkg/service/auth"
"fonchain-fiee/pkg/service/file"
"fonchain-fiee/pkg/service/governance"
"fonchain-fiee/pkg/service/lang" "fonchain-fiee/pkg/service/lang"
"fonchain-fiee/pkg/service/pressreleases"
"fonchain-fiee/pkg/service/qr" "fonchain-fiee/pkg/service/qr"
"fonchain-fiee/pkg/service/redirect" "fonchain-fiee/pkg/service/redirect"
"fonchain-fiee/pkg/service/upload" "fonchain-fiee/pkg/service/upload"
@ -26,10 +22,7 @@ import (
func NewRouter() *gin.Engine { func NewRouter() *gin.Engine {
//使用默认gin路由 //使用默认gin路由
r := gin.Default() r := gin.Default()
wsGroup := r.Group("api/fiee")
wsGroup.Use(
middleware.GinRecovery(true),
)
r.Use(gzip.Gzip(gzip.BestSpeed)) // 中间件占用绝大部分内存 r.Use(gzip.Gzip(gzip.BestSpeed)) // 中间件占用绝大部分内存
//加入日志中间件,跨域中间件 //加入日志中间件,跨域中间件
r.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true)) r.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true))
@ -48,7 +41,6 @@ func NewRouter() *gin.Engine {
BundleRouter(privateGroup) BundleRouter(privateGroup)
BundleOrderRouter(privateGroup) BundleOrderRouter(privateGroup)
ValueAddBundleRouter(privateGroup) ValueAddBundleRouter(privateGroup)
MediaRouter(privateGroup)
{ {
v1.POST("version", version.Version) //版本号公共 v1.POST("version", version.Version) //版本号公共
@ -115,67 +107,7 @@ func NewRouter() *gin.Engine {
redirectRoute.POST("sdk/down/v2", auth.DownImgV2) redirectRoute.POST("sdk/down/v2", auth.DownImgV2)
redirectRoute.POST("sdk/down/v3", auth.DownImgV3) redirectRoute.POST("sdk/down/v3", auth.DownImgV3)
} }
//========================================================================================
// 客户聊天
{
// websocket数据接收
wsGroup.GET("aschat/ws", asChat.ChatHandlerIns.Connection)
v1.POST("aschat/message/new", asChat.ChatHandlerIns.NewMessage)
v1.POST("aschat/media/upload", asChat.ChatHandlerIns.Upload)
v1.POST("aschat/message/list", asChat.ChatHandlerIns.MessageList)
v1.POST("aschat/user/stat", asChat.ChatHandlerIns.UserMessageStat)
v1.POST("aschat/voicetotext", asChat.ChatHandlerIns.VoiceToText)
//v1.POST("aschat/artistDetail", asChat.ChatHandlerIns.ArtistDetail)
v1.POST("aschat/autoReplyRuler/create", asChat.Handler.CreateChatAutoReplyRuler)
v1.POST("aschat/autoReplyRuler/delete", asChat.Handler.DeleteChatAutoReplyRuler)
v1.POST("aschat/autoReplyRuler/update", asChat.Handler.UpdateChatAutoReplyRuler)
v1.POST("aschat/autoReplyRuler/detail", asChat.Handler.GetChatAutoReplyRulerDetail)
v1.POST("aschat/autoReplyRuler/query", asChat.Handler.GetChatAutoReplyRulerList)
}
{
// 素材库
resourceRoute := v1.Group("/resource")
resourceRoute.GET("", file.Info)
resourceRoute.DELETE("", file.Delete)
resourceRoute.PUT("", file.Action)
resourceRoute.POST("", file.Create)
resourceRoute.GET("/search", file.Search)
resourceRoute.POST("/upload", file.Upload)
resourceRoute.POST("/tus/create", file.TusCreate)
resourceRoute.POST("/tus/upload", file.TusUpload)
resourceRoute.GET("/raw", file.Raw)
resourceRoute.GET("/raw/dir", file.DirDownload)
resourceRoute.GET("/preview", file.Preview)
resourceRoute.GET("/list", file.List)
}
{
// 官网文档
governanceRoute := v1.Group("/governance")
governanceRouteLogin := governanceRoute.Group("", middleware.CheckWebLogin(service.AccountProvider))
governanceRoute.GET("/display", governance.Display)
governanceRouteLogin.POST("/list", governance.List)
governanceRouteLogin.POST("", governance.Create)
governanceRouteLogin.POST("/edit", governance.Edit)
governanceRouteLogin.POST("/delete", governance.Delete)
}
{
// 官网新闻
pressreleasesRoute := v1.Group("/pressreleases")
pressreleasesRouteLogin := pressreleasesRoute.Group("", middleware.CheckWebLogin(service.AccountProvider))
pressreleasesRoute.POST("/display", pressreleases.Display)
pressreleasesRoute.GET("", pressreleases.Get)
pressreleasesRouteLogin.POST("/list", pressreleases.List)
pressreleasesRouteLogin.POST("", pressreleases.Create)
pressreleasesRouteLogin.POST("/edit", pressreleases.Edit)
pressreleasesRouteLogin.POST("/delete", pressreleases.Delete)
}
//静态文件 //静态文件
r.StaticFS("/api/static", http.Dir("./runtime")) r.StaticFS("/api/static", http.Dir("./runtime"))
r.NoRoute(func(c *gin.Context) { r.NoRoute(func(c *gin.Context) {

View File

@ -23,21 +23,10 @@ func ValueAddBundleRouter(r *gin.RouterGroup) {
bundleClientRoute.POST("list", bundle.ValueAddBundleList) bundleClientRoute.POST("list", bundle.ValueAddBundleList)
bundleClientRoute.POST("detail", bundle.ValueAddBundleDetail) bundleClientRoute.POST("detail", bundle.ValueAddBundleDetail)
} }
bundleClientRouteV2 := valueAddBundleRoute.Group("system/v2")
{
bundleClientRouteV2.POST("save", bundle.SaveValueAddService)
bundleClientRouteV2.POST("list", bundle.ValueAddServiceList)
bundleClientRouteV2.POST("detail", bundle.ValueAddServiceDetail)
}
valueAddBundleAppRouteV1 := valueAddBundleAppRoute.Group("system") valueAddBundleAppRoute = valueAddBundleAppRoute.Group("system")
{ {
valueAddBundleAppRouteV1.POST("list", bundle.ValueAddBundleList) valueAddBundleAppRoute.POST("list", bundle.ValueAddBundleList)
}
valueAddBundleAppRouteV2 := valueAddBundleAppRoute.Group("system/v2")
{
valueAddBundleAppRouteV2.POST("list", bundle.ValueAddServiceList)
valueAddBundleAppRouteV2.POST("detail", bundle.ValueAddServiceDetail)
} }
} }

View File

@ -1,19 +1,17 @@
package serializer package serializer
import "fonchain-fiee/pkg/e"
// Response 基础序列化器 // Response 基础序列化器
type Response struct { type Response struct {
Status int `json:"status"` Status int `json:"status"`
Data interface{} `json:"data"` Data interface{} `json:"data"`
Msg string `json:"msg"` Msg string `json:"msg"`
Code e.ErrorCodeType `json:"code"` Code int `json:"code"`
Error error `json:"error"` Error error `json:"error"`
Err string `json:"err"` Err string `json:"err"`
Keys []string `json:"keys"` Keys []string `json:"keys"`
Mark string `json:"mark,omitempty"` Mark string `json:"mark,omitempty"`
Page *PageInfo `json:"page,omitempty"` Page *PageInfo `json:"page,omitempty"`
Positions interface{} `json:"positions"` Positions interface{} `json:"positions"`
} }
type PageInfo struct { type PageInfo struct {
Page int32 `json:"page" query:"page"` Page int32 `json:"page" query:"page"`

View File

@ -1,241 +0,0 @@
// Package asChat -----------------------------
// @file : cache.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2024/9/11 下午5:18
// -------------------------------------------
package asChat
import (
"context"
"errors"
"fmt"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/pkg/cache"
"github.com/go-redis/redis"
"github.com/goccy/go-json"
"go.uber.org/zap"
"log"
"strings"
"sync"
"time"
)
const CacheChatRecordKey = "chatRecord"
const CacheSessionKey = "chatSession"
const CacheNewMsgStatKey = "newMsgStat"
var chatCacheLocker sync.RWMutex
type ChatCache struct {
newMessageStatExpireAfter time.Duration //消息统计的数据过期时间
}
// ------------------------------存储用户的会话ID--------------------------------
func (cr ChatCache) GetUserSessionCacheKey(userId int64) string {
return fmt.Sprintf("%s:%d", CacheSessionKey, userId)
}
func (cr ChatCache) SaveUserSession(userId int64, sessionId string) {
chatCacheLocker.Lock()
defer chatCacheLocker.Unlock()
////var c = context.Background()
err := cache.RedisClient.Set(cr.GetUserSessionCacheKey(userId), sessionId, 0).Err()
if err != nil {
log.Fatal("保存用户会话失败", zap.Error(err))
}
}
func (cr ChatCache) GetUserSession(userId int64) (sessionId string) {
fmt.Println("GetUserSession-1")
chatCacheLocker.RLock()
defer chatCacheLocker.RUnlock()
//var c = context.Background()
sessionId, err := cache.RedisClient.Get(cr.GetUserSessionCacheKey(userId)).Result()
fmt.Println("GetUserSession-2")
if err != nil {
if err.Error() == "redis: nil" {
err = nil
} else {
log.Fatal("获取用户会话失败", zap.Error(err))
}
}
fmt.Println("GetUserSession-3, sessionId:", sessionId)
return
}
// ------------------------------存储会话的聊天记录--------------------------------
func (cr ChatCache) GetChatRecordCacheKey(sessionId string) string {
return fmt.Sprintf("%s:%s", CacheChatRecordKey, sessionId)
}
func (cr ChatCache) AddChatRecord(sessionId string, data ...*accountFiee.ChatRecordData) (err error) {
////var c = context.Background()
messages := cr.GetChatRecord(sessionId)
fmt.Printf("AddChatRecord add data:%+v\n", data)
messages = append(messages, data...)
cacheBytes, _ := json.Marshal(messages)
fmt.Println("Marshal result", string(cacheBytes))
err = cache.RedisClient.Set(cr.GetChatRecordCacheKey(sessionId), cacheBytes, 2*time.Hour).Err()
return
}
func (cr ChatCache) CoverChatRecord(sessionId string, data []*accountFiee.ChatRecordData) (err error) {
chatCacheLocker.Lock()
defer chatCacheLocker.Unlock()
//var c = context.Background()
cacheBytes, _ := json.Marshal(data)
err = cache.RedisClient.Set(cr.GetChatRecordCacheKey(sessionId), cacheBytes, 2*time.Hour).Err()
return
}
func (cr ChatCache) GetChatRecord(sessionId string) (data []*accountFiee.ChatRecordData) {
chatCacheLocker.RLock()
defer chatCacheLocker.RUnlock()
data = make([]*accountFiee.ChatRecordData, 0)
//var c = context.Background()
messages, err := cache.RedisClient.Get(cr.GetChatRecordCacheKey(sessionId)).Bytes()
if err != nil {
if err.Error() == "redis: nil" {
err = nil
}
//log.Fatal("获取聊天记录失败", zap.Error(err))
return
}
fmt.Printf("cache data: %+v", string(messages))
if len(messages) > 0 {
_ = json.Unmarshal(messages, &data)
}
return
}
// ------------------------------存储新消息统计--------------------------------
func (cr ChatCache) GetNewMsgStatCacheKey(ownerId int64) string {
return fmt.Sprintf("%s:%d", CacheNewMsgStatKey, ownerId)
}
// 消息数量自增
func (cr ChatCache) IncreaseNewMessageTotal(ownerId int64, sessionId string) (err error) {
chatCacheLocker.Lock()
defer chatCacheLocker.Unlock()
ctx := context.Background()
data := cr.GetNewMessageStat(ctx, ownerId)
if len(data) > 0 {
foundIndex := -1
for i, v := range data {
if v.SessionId == sessionId {
foundIndex = i
break
}
}
if foundIndex > -1 {
data[foundIndex].Total += 1
}
//将foundIndex之后的所有元素右移动一位
if foundIndex > 0 {
elementToMove := data[foundIndex]
copy(data[1:], data[0:foundIndex])
data[0] = elementToMove
} else if foundIndex == -1 {
data = append([]UserMsgStatic{{SessionId: sessionId, Total: 1}}, data...)
}
} else {
data = []UserMsgStatic{{SessionId: sessionId, Total: 1}}
}
return cr.coverOwnerNewMessageStat(ctx, ownerId, data)
}
// 重置新消息数量
func (cr ChatCache) ResetNewMessageTotal(ownerId int64, sessionId string, total ...int64) error {
chatCacheLocker.Lock()
defer chatCacheLocker.Unlock()
var tl int64
if len(total) > 0 {
tl = total[0]
}
ctx := context.Background()
data := cr.GetNewMessageStat(ctx, ownerId)
found := false
for i, v := range data {
if v.SessionId == sessionId {
found = true
data[i].Total = tl
break
}
}
if !found {
data = append(data, UserMsgStatic{
SessionId: sessionId,
Total: tl,
})
}
return cr.coverOwnerNewMessageStat(ctx, ownerId, data)
}
func (cr ChatCache) RecountNewMessageTotal(ownerId int64) {
//var c = context.Background()
var keys []string
var err error
keys, err = cache.RedisClient.Keys(CacheChatRecordKey + "*").Result()
if err != nil {
log.Fatal("获取聊天记录所有缓存KEY失败", zap.Error(err))
return
}
var countMap = make(map[string]int)
for _, key := range keys {
var messages []byte
var data []*accountFiee.ChatRecordData
messages, err = cache.RedisClient.Get(key).Bytes()
if err != nil {
if err.Error() == "redis: nil" {
err = nil
}
log.Fatal("获取聊天记录失败", zap.Error(err))
data = make([]*accountFiee.ChatRecordData, 0)
continue
}
if len(messages) > 0 {
_ = json.Unmarshal(messages, &data)
}
var sessionId = strings.Split(key, ":")[1]
countMap[sessionId] = 0
for _, v := range data {
if v.WaiterRead == 2 { //统计未读消息数量
countMap[sessionId]++
}
}
}
for sessionId, count := range countMap {
err = cr.ResetNewMessageTotal(ownerId, sessionId, int64(count))
if err != nil {
log.Fatal("重置新消息数量统计",
zap.String("function", "RecountNewMessageTotal"),
zap.Int64("ownerId", ownerId),
zap.String("sessionId", sessionId),
zap.Int("count", count),
zap.Error(err),
)
}
}
return
}
// erp获取最新的消息统计
func (cr ChatCache) GetNewMessageStat(ctx context.Context, ownerId int64) (result []UserMsgStatic) {
//chatCacheLocker.RLock()
//defer chatCacheLocker.RUnlock()
result = make([]UserMsgStatic, 0)
vals, err := cache.RedisClient.Get(cr.GetNewMsgStatCacheKey(ownerId)).Bytes()
if err != nil && errors.Is(err, redis.Nil) {
log.Fatal("从缓存获取新消息统计失败", zap.Error(err), zap.Int64("ownerId", ownerId))
return
}
if vals != nil {
_ = json.Unmarshal(vals, &result)
}
return
}
// 覆盖指定erp用户的新消息统计
func (cr ChatCache) coverOwnerNewMessageStat(ctx context.Context, ownerId int64, data []UserMsgStatic) (err error) {
value, _ := json.Marshal(data)
//err = cache.RedisClient.Set(ctx, cr.GetNewMsgStatCacheKey(ownerId), value, cr.newMessageStatExpireAfter).Err()
err = cache.RedisClient.Set(cr.GetNewMsgStatCacheKey(ownerId), value, 0).Err()
return
}

View File

@ -1,90 +0,0 @@
package asChat
import (
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils"
"github.com/gin-gonic/gin"
)
var Handler = &ChatAutoReplyRulerHandler{}
type ChatAutoReplyRulerHandler struct {
}
// 创建自动回复规则
func (a *ChatAutoReplyRulerHandler) CreateChatAutoReplyRuler(c *gin.Context) {
var req accountFiee.ChatAutoReplyRulerData
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
_, err := service.AccountFieeProvider.CreateChatAutoReplyRuler(c, &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c)
}
// 删除自动回复规则
func (a *ChatAutoReplyRulerHandler) DeleteChatAutoReplyRuler(c *gin.Context) {
var req accountFiee.DeleteChatAutoReplyRulerRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
_, err := service.AccountFieeProvider.DeleteChatAutoReplyRuler(c, &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c)
}
// 更新自动回复规则
func (a *ChatAutoReplyRulerHandler) UpdateChatAutoReplyRuler(c *gin.Context) {
var req accountFiee.ChatAutoReplyRulerData
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
_, err := service.AccountFieeProvider.UpdateChatAutoReplyRuler(c, &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c)
}
// 使用id查询自动回复规则
func (a *ChatAutoReplyRulerHandler) GetChatAutoReplyRulerDetail(c *gin.Context) {
var req accountFiee.GetChatAutoReplyRulerByIdRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
resp, err := service.AccountFieeProvider.GetChatAutoReplyRulerDetail(c, &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, resp)
}
// 批量查询自动回复规则
func (a *ChatAutoReplyRulerHandler) GetChatAutoReplyRulerList(c *gin.Context) {
var req GetChatAutoReplyRulerListRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
var protoReq = accountFiee.GetChatAutoReplyRulerListRequest{Query: &accountFiee.ChatAutoReplyRulerData{}}
utils.RequestDataConvert(&req, &protoReq)
resp, err := service.AccountFieeProvider.GetChatAutoReplyRulerList(c, &protoReq)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, resp.List)
}

View File

@ -1,33 +0,0 @@
// package asChat -----------------------------
// @file : chatRoom.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/21 18:17:17
// -------------------------------------------
package asChat
import (
"encoding/json"
"fonchain-fiee/pkg/common/ws"
)
var (
ChatRoom = ws.NewChatRoom()
)
type WsInfo struct {
Type ws.WsType `json:"type"` //消息类型
Content any `json:"content"`
}
func WsMessageRegisterCallback(clientId string, sessionId string) []byte {
var errMsg = WsInfo{
Type: ws.RegisterType,
Content: map[string]string{
//"clientId": clientId,
"sessionId": sessionId,
},
}
byteMsg, _ := json.Marshal(errMsg)
return byteMsg
}

View File

@ -1,136 +0,0 @@
// Package asChat -----------------------------
// @file : dto.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2024/9/10 下午6:28
// -------------------------------------------
package asChat
import (
"encoding/json"
"fonchain-fiee/api/accountFiee"
"time"
)
type Message struct {
MsgType accountFiee.MsgType `json:"msgType"`
Text string `json:"text"` //文本内容
Media []MessageMedia `json:"media"`
LocalStamp int64 `json:"localStamp"`
}
type MessageMedia struct {
MediaId int64 `json:"mediaId"` //媒体文件id
MediaSize string `json:"mediaSize"` //媒体文件大小
Ext string `json:"ext"` //后缀格式
Url string `json:"url"` //文件地址
ConvText string `json:"convText"` //语音转文字内容,需要调用语音转文字接口后才会有值
Duration int64 `json:"duration"` //时长 单位:毫秒
}
// 客户端发送消息请求使用api发送消息
type NewMessageRequest struct {
Waiter bool `json:"waiter"` //是否是客服发送,客服没有userId
SessionId string `json:"sessionId"`
Message
}
// 服务端接收到消息后使用websocket发送给userId关联的客户端通知客户端有新消息然后调用接口获取消息
type NewMessageNotice struct {
Name string `json:"name"` //名字
UserId int64 `json:"userId"` //用户id
SessionId string `json:"sessionId"`
MessageId int64 `json:"messageId"` //消息id
//NewMsgTotal int64 `json:"newMsgTotal"` //新消息数量
//Active bool `json:"active"` //是否在线
}
// 获取会话列表
type SessionType struct {
NewMessageNotice
RecentMessage []*Message `json:"recentMessage"` //最近消息
}
type MessageListType struct {
ID int64 `json:"ID"`
CreatedAt string `json:"createdAt"`
UserId int64 `json:"userId"`
Name string `json:"name"`
Message Message `json:"message"`
}
func (m *MessageListType) BuildMessage(data *accountFiee.ChatRecordData) {
m.ID = data.ID
m.CreatedAt = data.CreatedAt
m.UserId = data.UserId
m.Name = data.Name
switch data.MsgType {
case accountFiee.MsgType_TextMsgType:
m.Message = Message{
MsgType: accountFiee.MsgType_TextMsgType,
Text: data.Content,
Media: []MessageMedia{},
LocalStamp: data.LocalStamp,
}
case accountFiee.MsgType_ImageMsgType, accountFiee.MsgType_AudioMsgType, accountFiee.MsgType_VideoMsgType:
m.Message.MsgType = data.MsgType
m.Message.Text = data.Content
m.Message.LocalStamp = data.LocalStamp
if data.Medias != nil {
for _, media := range data.Medias {
m.Message.Media = append(m.Message.Media, MessageMedia{
MediaId: media.ID,
MediaSize: media.Size,
Ext: media.Ext,
Url: media.Url,
ConvText: media.ConvText,
Duration: media.Duration,
})
}
}
}
}
func (m *MessageListType) ToJson() string {
jsonBytes, _ := json.Marshal(m)
return string(jsonBytes)
}
type UserMsgStatic struct {
UserId int64 `json:"userId"` //用户id
Name string `json:"name"` //名称
ArtistUid string `json:"artistUid,omitempty"`
SessionId string `json:"sessionId"` //会话id
Total int64 `json:"total"` //新消息数量
//NewMessageTime string `json:"newMessageTime"` //最新消息的创建时间
}
type MessageListRequest struct {
SessionId string `json:"sessionId"` //不传则获取自己的会话消息里列表
CurrentId int64 `json:"currentId"` //组合查询条件1基于某个消息id向前或向后查找。两种组合条件不能同时使用
Direction int `json:"direction"` //组合查询条件1方向 1=向前查找 2=向后查找
Recent bool `json:"recent"` //组合查询条件2查找最新的若干条消息。两种组合条件不能同时使用
InHour time.Duration `json:"inHour"` //组合查询条件2可选查询指定小时内的数据
PageSize int64 `json:"pageSize"` //查找数量
}
type VoiceToTextRequest struct {
MediaId int64 `json:"mediaId"`
}
type ArtistInfoRequest struct {
UserId int64 `json:"userId"`
}
type ArtistInfo struct {
Tnum string `json:"tnum"`
ArtistName string `json:"artistName"`
Age int64 `json:"age"`
Sex string `json:"sex"`
NativePlace string `json:"nativePlace"`
TelNum string `json:"telNum"`
RecentPhoto string `json:"recentPhoto"`
}
type GetChatAutoReplyRulerListRequest struct {
Page int64 `json:"page"`
PageSize int64 `json:"pageSize"`
accountFiee.ChatAutoReplyRulerData
}

View File

@ -1,566 +0,0 @@
// package asChat -----------------------------
// @file : handler.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/23 11:13:43
// -------------------------------------------
package asChat
import (
"bytes"
"context"
"crypto/md5"
"encoding/hex"
"errors"
"fmt"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/pkg/common/jwt"
"fonchain-fiee/pkg/common/ws"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/upload"
"fonchain-fiee/pkg/utils"
"fonchain-fiee/pkg/utils/stime"
"github.com/fonchain/utils/voice"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
uuid "github.com/satori/go.uuid"
"go.uber.org/zap"
"io"
"log"
"path"
"slices"
"sort"
"strconv"
"strings"
"time"
)
var ChatHandlerIns = ChatHandler{
cache: ChatCache{newMessageStatExpireAfter: 10 * time.Minute},
}
type ChatHandler struct {
cache ChatCache
}
func (cr ChatHandler) Connection(c *gin.Context) {
conn, err := ws.UpGrader.Upgrade(c.Writer, c.Request, nil)
conn.SetReadDeadline(time.Now().Add(time.Second * 10))
if err != nil {
log.Fatal("无法升级为websocket连接", zap.Error(err))
c.String(500, "无法转为websocket连接")
return
}
defer func() {
if conn != nil {
conn.Close()
}
}()
_, byteData, err := conn.ReadMessage()
if err != nil {
_ = conn.WriteMessage(websocket.TextMessage, ws.WsErrorConnection("null", err.Error(), "conn.ReadMessag1"))
return
}
fmt.Println("22222222222222,AuthorizationVerify")
var ok bool
var userInfo *accountFiee.ChatUserData
userInfo, ok, err = ws.AuthorizationVerify(byteData)
if err != nil {
_ = conn.WriteMessage(websocket.TextMessage, ws.WsErrorConnection("null", err.Error(), "AuthorizationVerify2"))
return
}
if !ok {
_ = conn.WriteMessage(websocket.TextMessage, ws.WsErrorConnection("null", "登录状态失效", "AuthorizationVerify2.1"))
return
}
fmt.Println("33333333333333,RecountNewMessageTotal")
conn.SetReadDeadline(time.Time{})
go cr.cache.RecountNewMessageTotal(userInfo.ID)
fmt.Println("44444444444444,ws.NewClient")
//注册ws客户端并发送clientId给ws客户端
var cli = ws.NewClient(userInfo.ID, "", conn, ChatRoom)
cli.Waiter = userInfo.Role == 2
fmt.Println("55555555555555,GetUserSession")
//查询是否有历史的sessionId
cli.SessionId = cr.cache.GetUserSession(userInfo.ID)
ChatRoom.Register(cli)
cr.cache.SaveUserSession(userInfo.ID, cli.SessionId)
fmt.Println("66666666666666666666666666")
go cli.WriteWait()
cli.Send <- WsMessageRegisterCallback(cli.ClientId, cli.SessionId)
fmt.Println("777777777777777777777777")
// 处理websocket连接的逻辑
ctx, _ := context.WithCancel(context.Background())
cli.Reading(ctx, HandleMessage)
fmt.Println("88888888888888888888888888")
select {
case <-ctx.Done():
return
}
}
func (cr ChatHandler) NewMessage(c *gin.Context) {
var request NewMessageRequest
if err := c.ShouldBindJSON(&request); err != nil {
service.Error(c, err)
return
}
if request.SessionId == "" {
service.Error(c, errors.New("sessionId不能为空"))
return
}
if request.MsgType == 0 {
service.Error(c, errors.New("msgType不能为空"))
return
}
fmt.Println("NewMessage 1111111111111111111111111111111")
//获取用户信息
chatUser, code := jwt.ParseToChatUser(c)
if code != 0 {
service.ErrWithCode(c, code)
return
}
fmt.Println("NewMessage 22222222222222222222222222222222222")
//存储入库
if chatUser.NickName != "" {
chatUser.NickName = fmt.Sprintf("未知用户(%d)", chatUser.ID)
}
fmt.Println("NewMessage 3333333333333333333333333333333333")
var data = accountFiee.ChatRecordData{
SessionId: request.SessionId,
UserId: chatUser.ID,
Name: chatUser.NickName,
Avatar: "",
MsgType: request.MsgType,
Content: request.Message.Text,
LocalStamp: request.LocalStamp,
Medias: nil,
}
if len(request.Message.Media) > 0 {
for _, media := range request.Message.Media {
data.Medias = append(data.Medias, &accountFiee.ChatMediaData{
ID: media.MediaId,
})
}
}
fmt.Println("NewMessage 4444444444444444444444444444444444")
resp, err := service.AccountFieeProvider.CreateChatRecord(c, &data)
if err != nil {
service.Error(c, errors.New("创建失败"))
return
}
fmt.Printf("CreateChatRecord resp:%+v\n", resp)
//录入缓存
err = cr.cache.AddChatRecord(request.SessionId, resp.Data)
if err != nil {
service.Error(c, errors.New("创建失败"))
return
}
fmt.Println("NewMessage 5 消息数量+1")
//新消息数量统计+1
noticeUserId := ChatRoom.GetUserIdInSession(request.SessionId, chatUser.ID)
fmt.Println("NewMessage 5.1 消息数量配置结束")
fmt.Printf("noticeUserId %+v\n", noticeUserId)
for _, userId := range noticeUserId {
fmt.Println("userId")
cr.cache.IncreaseNewMessageTotal(userId, request.SessionId)
}
fmt.Println("NewMessage 6")
//发送websocket消息提醒通知
var notice = MessageListType{}
notice.BuildMessage(resp.Data)
fmt.Printf("ws消息提醒:%+v\n", notice)
_, err = ChatRoom.SendSessionMessage(chatUser.ID, request.SessionId, ws.NewChatMsgType, notice)
if err != nil {
log.Fatal("发送新消息通知失败", zap.Error(err), zap.Any("notice", notice))
}
fmt.Println("NewMessage 7 -end")
//发送app推送(无横幅推送)
//go func() {
// omitMessage := ""
// switch request.MsgType {
// case accountFiee.MsgType_TextMsgType:
// runMsg := []rune(request.Text)
// if len(runMsg) > 15 {
// omitMessage = string(runMsg[:15]) + "..."
// } else {
// omitMessage = request.Text
// }
// case accountFiee.MsgType_ImageMsgType:
// omitMessage = "[图片]"
// case accountFiee.MsgType_AudioMsgType:
// omitMessage = "[音频]"
// case accountFiee.MsgType_VideoMsgType:
// omitMessage = "[视频]"
// default:
// omitMessage = "新消息请查收"
// }
// for _, userId := range noticeUserId {
// _ = asPusher.NewArtistinfoUniPush().NewChatMessageNotice(userId, omitMessage)
// }
//}()
service.Success(c)
}
func (cr ChatHandler) MessageList(c *gin.Context) {
var request MessageListRequest
if err := c.ShouldBindJSON(&request); err != nil {
service.Error(c, err)
return
}
domain := c.GetHeader("domain")
if (request.Direction == 0 && request.Recent == false) || (request.Direction > 0 && request.Recent == true) {
service.Error(c, errors.New("组合条件校验失败"))
return
}
if request.SessionId == "" {
service.Error(c, errors.New("sessionId不能为空"))
return
}
if request.PageSize < -1 {
service.Error(c, errors.New("pageSize校验错误"))
return
}
var resp = make([]*MessageListType, 0)
if request.CurrentId == 0 && request.Direction == 1 {
service.Success(c, resp)
return
}
chatUser, code := jwt.ParseToChatUser(c)
if code != 0 {
service.ErrWithCode(c, code)
return
}
//if request.SessionId == "" {
// request.SessionId = cr.cache.GetUserSession(tokenResult.UserInfo.ID)
// if request.SessionId == "" {
// service.Success(c, resp)
// return
// }
//}
//messages := cr.cache.GetChatRecord(request.SessionId)
messages := []*accountFiee.ChatRecordData{}
var returnDataIdList = make([]int64, 0)
defer func() {
//获取最新数据时,重置新消息数量统计
if request.Direction == 2 || request.Recent {
cr.cache.ResetNewMessageTotal(chatUser.ID, request.SessionId)
}
//设置消息已被客服阅读,当客服重新通过通过websocket连接时这些消息将不被纳入新消息数量统计
if len(returnDataIdList) > 0 && domain == "fontree" {
for _, hasReadId := range returnDataIdList {
for i, message := range messages {
if message.ID == hasReadId {
messages[i].WaiterRead = 1
}
}
}
err := cr.cache.CoverChatRecord(request.SessionId, messages)
if err != nil {
log.Fatal("设置消息已读失败", zap.Error(err))
}
for _, v := range messages {
_, err = service.AccountFieeProvider.SaveChatRecord(context.Background(), v)
if err != nil {
log.Fatal("设置消息已读失败", zap.Error(err))
}
}
}
}()
if len(messages) == 0 {
//从数据库获取
recordResp, err := service.AccountFieeProvider.GetChatRecordList(c, &accountFiee.GetChatRecordListRequest{
Query: &accountFiee.ChatRecordData{SessionId: request.SessionId},
Page: 1,
PageSize: -1,
//Where: fmt.Sprintf("id %s %d", utils.IfGec(request.Direction == 1, "<", ">"), request.CurrentId),
})
if err != nil {
service.Error(c, err)
return
}
messages = recordResp.List
err = cr.cache.CoverChatRecord(request.SessionId, messages)
if err != nil {
log.Fatal("覆盖聊天记录失败", zap.Error(err))
}
}
if request.Recent {
if int64(len(messages)) >= request.PageSize {
messages = messages[len(messages)-int(request.PageSize):]
}
var now = time.Now()
for _, message := range messages {
if request.InHour > 0 {
messageCreatedAt, _ := stime.StringToTime(message.CreatedAt)
if now.Sub(*messageCreatedAt) >= request.InHour*time.Hour {
continue
}
}
returnDataIdList = append(returnDataIdList, message.ID)
var msg = &MessageListType{}
msg.BuildMessage(message)
resp = append(resp, msg)
}
} else {
sort.Slice(messages, func(i, j int) bool {
if request.Direction == 1 {
return messages[i].ID < messages[j].ID
} else {
return messages[i].ID > messages[j].ID
}
})
fmt.Printf("data is %+v\n", messages)
total := 0
for i, message := range messages {
switch request.Direction {
case 1: //向下查找找比CurrentId大的数据
if message.ID <= request.CurrentId {
continue
}
case 2: //向上查找找比CurrentId小的数据
if message.ID >= request.CurrentId {
continue
}
}
message := message
fmt.Println(i, message.ID)
if request.PageSize != -1 && int64(total+1) > request.PageSize {
continue
}
total++
returnDataIdList = append(returnDataIdList, message.ID)
var msg = &MessageListType{}
msg.BuildMessage(message)
resp = append(resp, msg)
}
}
//二次排序
sort.Slice(resp, func(i, j int) bool {
return resp[i].ID < resp[j].ID
})
//优化空列表
for i, v := range resp {
if v.Message.Media == nil {
resp[i].Message.Media = []MessageMedia{}
}
}
service.Success(c, resp)
}
func (cr ChatHandler) Upload(c *gin.Context) {
fmt.Println("111111111111")
//获取用户信息
chatUser, code := jwt.ParseToChatUser(c)
if code != 0 {
service.ErrWithCode(c, code)
return
}
//获取文件对象
file, err := c.FormFile("file")
if err != nil {
log.Fatal("ERROR: upload file failed. ", zap.Error(err))
return
}
duration := c.PostForm("duration")
fmt.Println(duration)
ext := c.PostForm("ext")
fileExt := strings.ToLower(path.Ext(file.Filename))
if ext != "" {
fileExt = ext
}
fileType := e.DetectFileTypeByExtension(fileExt)
if fileType == e.Audio {
if !slices.Contains([]string{".mp4", ".aac", ".mp3", ".opus", ".wav"}, fileExt) {
service.Error(c, errors.New("不支持的格式"))
return
}
}
//计算md5
tmp, err := file.Open()
if err != nil {
service.Error(c, errors.New("上传失败"))
return
}
fileContent, err := io.ReadAll(tmp)
if err != nil {
service.Error(c, errors.New("文件读取失败"))
return
}
hash := md5.New()
_, err = hash.Write(fileContent)
if err != nil {
service.Error(c, errors.New("文件读取失败"))
return
}
md5Bytes := hash.Sum(nil) // 获取 MD5 字节切片
md5String := hex.EncodeToString(md5Bytes) // 转换为十六进制字符串表示
//检查文件是否存在
checkResp, err := service.AccountFieeProvider.GetChatMediaList(c, &accountFiee.GetChatMediaListRequest{Query: &accountFiee.ChatMediaData{Md5: md5String}, Page: 1, PageSize: 1})
if err != nil {
log.Fatal("md5查询附件失败", zap.Error(err))
}
if checkResp.Total > 0 {
service.Success(c, checkResp.List[0])
return
}
//文件不存在则上传文件
filename, _ := uuid.NewV4()
defer tmp.Close()
fileBuffer := bytes.NewBuffer(fileContent)
var bosUrl string
bosUrl, err = upload.UploadWithBuffer(fileBuffer, fmt.Sprintf("%d/%v%v", chatUser.ID, filename, fileExt))
if err != nil {
service.Error(c, err)
return
}
//存到数据库
var durationInt64, _ = strconv.ParseInt(duration, 10, 64)
var mediaData = accountFiee.ChatMediaData{
Url: bosUrl,
Md5: md5String,
Size: fmt.Sprintf("%d", file.Size),
Ext: fileExt,
Duration: durationInt64,
}
resp, err := service.AccountFieeProvider.CreateChatMedia(c, &mediaData)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, resp.Data)
}
func (cr ChatHandler) UserMessageStat(c *gin.Context) {
//获取用户信息
chatUser, code := jwt.ParseToChatUser(c)
if code != 0 {
service.ErrWithCode(c, code)
return
}
result := cr.cache.GetNewMessageStat(c, chatUser.ID)
if len(result) == 0 {
service.Success(c, result)
return
}
fmt.Printf("cache stat:%+v\n", result)
//获取实名信息
var protoReq = accountFiee.GetChatUserListRequest2{
Page: 1,
PageSize: int64(len(result)),
}
for i, item := range result {
if item.UserId == 0 {
sessionId, _ := strconv.Atoi(item.SessionId)
item.UserId = int64(sessionId)
result[i].UserId = int64(sessionId)
}
protoReq.UserIdIn = append(protoReq.UserIdIn, item.UserId)
}
fmt.Printf("protoReq.UserIdIn:%+v\n", protoReq.UserIdIn)
listRes, err := service.AccountFieeProvider.GetChatUserList2(c, &protoReq)
if err != nil {
service.Error(c, err)
return
}
fmt.Printf("GetChatUserList:%+v\n", listRes)
for i, item := range result {
for _, user := range listRes.List {
if item.UserId == user.UserId {
user := user
result[i].Name = user.Name
//result[i].ArtistUid = user.ArtistUid
break
}
}
if result[i].Name == "" {
result[i].Name = beautifulZeroName(result[i].Name, result[i].UserId)
}
}
reverse(result)
service.Success(c, result)
}
func reverse(slice []UserMsgStatic) {
for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
slice[i], slice[j] = slice[j], slice[i]
}
}
func (cr ChatHandler) VoiceToText(c *gin.Context) {
var req VoiceToTextRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
detail, err := service.AccountFieeProvider.GetChatMediaDetail(c, &accountFiee.GetChatMediaByIdRequest{Id: req.MediaId})
if err != nil {
service.Error(c, err)
return
}
if detail.ConvText != "" {
service.Success(c, map[string]string{"convText": detail.ConvText})
return
}
voiceApi := voice.NewVoiceApi()
detail.ConvText, err = voiceApi.ToTextFromUrl(detail.Url)
if err != nil {
service.Error(c, errors.New("语音转文字失败"))
return
}
defer func() {
service.AccountFieeProvider.UpdateChatMedia(context.Background(), detail)
}()
service.Success(c, map[string]string{"convText": detail.ConvText})
}
//func (cr ChatHandler) ArtistDetail(c *gin.Context) {
// var req ArtistInfoRequest
// if err := c.ShouldBindJSON(&req); err != nil {
// service.Error(c, err)
// return
// }
// if req.UserId == 0 {
// service.Success(c, ArtistInfo{})
// return
// }
// detail, err := service.GrpcArtistInfoUserImpl.FindUsersUserView(c, &artistInfoUser.FindUsersRequest{UserId: req.UserId})
// if err != nil {
// service.Error(c, err)
// return
// }
// var (
// tnum string
// artistName string
// age int64
// sex string
// nativePlace string
// telNum string
// recentPhoto string
// )
// if len(detail.Data) > 0 {
// tnum = detail.Data[0].Tnum
// artistName = beautifulZeroName(detail.Data[0].RealName, req.UserId)
// age = detail.Data[0].Age
// sex = detail.Data[0].Sex
// nativePlace = detail.Data[0].NativePlace
// telNum = detail.Data[0].TelNum
// recentPhoto = detail.Data[0].Photo
// }
// resp := ArtistInfo{
// Tnum: tnum,
// ArtistName: artistName,
// Age: age,
// Sex: sex,
// NativePlace: nativePlace,
// TelNum: telNum,
// RecentPhoto: recentPhoto,
// }
// service.Success(c, resp)
//}
// 对没有名字的name进行优化
func beautifulZeroName(name string, userId int64) string {
return utils.IfGec(name == "", fmt.Sprintf("未实名用户:%d", userId), name)
}

View File

@ -1,26 +0,0 @@
# asChat 客服聊天
## 聊天室主要流程与功能描述
1. 用户通过画家包登录
2. 打开客服页面。 画家宝客户端自动进行websocket连接后台会自动创建一个默认聊天室聊天室携带一个SessionId
3. 用户调用api接口发送消息。 服务端接收到消息后会通过websocket通知聊天室里面所有用户。
4. erp首次打开客服菜单时会进行websocket连接并调用一次api接口刷新消息列表。后续通过websocket接收消息推送收到消息时应主动调用一次消息列表刷新接口。
5. erp客服端发送消息时加入到此聊天室。
6. 用户端调用api接口获取新消息列表。
## 客户端应具备的其它功能
1. weboscket断开自动重连
2. 当通过websocket接收到错误类型的消息应具备对应的错误处理机制<p>
错误消息示例
```json
{"type":1,"content":"Connection error:登录状态失效","from":"0","to":"null"}
```
## 服务端应具备的功能
1. 通过redis缓存聊天消息
2. 通过redis缓存用户的sessionId避免ws断开后找不到之前的sessionId
3. 客服端由于不是画家宝用户没有userId。在websocket连接时如果找不到userId应该为其在画家宝创建一个账号。且经纪人不可见。
4. 由于没有创建聊天室的需求,所以每个用户使用一个聊天室即可。客服与之对话时,就自动加入用户端的聊天室
5. 新消息统计
- 当发送消息时,该聊天室中除了发信者以外,其它用户的新消息数都+1录入缓存。
- 当新客服人员加入时,没有新消息统计的缓存。~~他的新消息数量应该从创建时间开始计算~~,所以都是0。

View File

@ -1,46 +0,0 @@
// Package asChat -----------------------------
// @file : service.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2024/9/10 下午7:05
// -------------------------------------------
package asChat
import (
"encoding/json"
"fonchain-fiee/pkg/common/ws"
)
func HandleMessage(sourceData []byte, cli *ws.Client) {
var msg map[string]any
err := json.Unmarshal(sourceData, &msg)
if err != nil {
cli.Send <- ws.WsErrorInvalidDataFormat(cli.ClientId)
return
}
switch msg["type"] {
default:
cli.Send <- ws.WsErrorUnknownMessageType(cli.ClientId)
case ws.TestType:
var newMsg = ws.WsInfo{
Type: ws.TestType,
Content: msg["content"],
}
byteMsg, _ := json.Marshal(newMsg)
cli.Send <- byteMsg
//case ws.ChatType:
// var chatInfo ChatInfo
// _ = json.Unmarshal(sourceData, &chatInfo)
// //解析Content
// if clients, ok := cli.Room.clients[chatInfo.Content.TargetUserId]; ok {
// for _, targetObj := range clients {
// if targetObj != nil {
// targetObj.Send <- WsChatMessage(msg.From, chatInfo.Content.TargetClientId, chatInfo.Content.Msg)
// }
// }
// } else {
// //对方不在线
// cli.Send <- WsErrorMessage(ChatType, msg.From, e.ErrTargetOutLine, nil)
// }
}
}

View File

@ -189,17 +189,3 @@ func translateErrorMessage(c *gin.Context, message string) string {
return common.EnMessages[message] return common.EnMessages[message]
} }
} }
func ErrWithCode(c *gin.Context, code e.ErrorCodeType, newMsg ...string) {
msg := e.GetCodeMsg(code)
if newMsg != nil {
msg = newMsg[0]
}
c.JSON(e.Success, serializer.Response{
Code: code,
Status: 1,
Msg: msg,
Data: nil,
})
}

View File

@ -1,38 +0,0 @@
package bundle
import (
"context"
"fonchain-fiee/api/bundle"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
func BundleExtend(c *gin.Context) {
var req bundle.BundleExtendRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.BundleExtend(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func BundleExtendRecordsList(c *gin.Context) {
var req bundle.BundleExtendRecordsListRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.BundleExtendRecordsList(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}

View File

@ -12,183 +12,14 @@ import (
"fonchain-fiee/pkg/service/bundle/common" "fonchain-fiee/pkg/service/bundle/common"
"fonchain-fiee/pkg/service/bundle/logic" "fonchain-fiee/pkg/service/bundle/logic"
bundleModel "fonchain-fiee/pkg/service/bundle/model" bundleModel "fonchain-fiee/pkg/service/bundle/model"
"fonchain-fiee/pkg/service/upload" "math/big"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
) )
func CreateBundleOrderAddSignature(c *gin.Context) {
var req bundle.OrderAddRecord
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
if req.Language == "" {
service.Error(c, errors.New(common.MissLanguageTypes))
return
}
if req.BundleUuid == "" {
service.Error(c, errors.New(common.MissOrderNo))
return
}
// 获取用户信息
userInfo := login.GetUserInfoFromC(c)
if msg, exists := map[int32]string{
1: common.Unnamed,
2: common.UnderReview,
3: common.ReviewFailed,
}[userInfo.Status]; userInfo.Status != 4 {
if exists {
service.Error(c, errors.New(msg))
} else {
service.Error(c, errors.New(common.UnknownStatus))
}
return
}
// 校验套餐是否已购买
orderRecordReq := bundle.OrderRecordsDetailRequest{
BundleUUID: req.BundleUuid,
CustomerID: strconv.FormatUint(userInfo.ID, 10),
}
orderRecordResp, err := service.BundleProvider.OrderRecordsDetail(context.Background(), &orderRecordReq)
if err != nil {
service.Error(c, err)
return
}
if orderRecordResp.OrderRecord.ExpirationTime == "" || orderRecordResp.OrderRecord.ExpirationTime < time.Now().Format("2006-01-02") {
service.Error(c, errors.New(common.ThePackageHasExpired))
return
}
// 获取套餐详情(待替换逻辑)
bundleDetail, err := service.BundleProvider.BundleDetail(context.Background(), &bundle.BundleDetailRequest{
Uuid: req.BundleUuid,
})
if err != nil {
service.Error(c, err)
return
}
// todo 需要判断购买的增值服务是否为可用时长 如果为可以用时长 合同截止日期为购买时长时间 否则合同截止日期为主套餐截止日期
// 处理多个增值服务
type ValueAddServiceInfo struct {
Service *bundle.ValueAddServiceLang
Options *bundle.ValueAddPriceOptions
ID int32
}
var (
valueAddServices []ValueAddServiceInfo
totalAmount float64
mainDeadline = orderRecordResp.OrderRecord.ExpirationTime
)
//for _, opt := range req.AddPriceOptionsList {
// valueAddInfo, err := service.BundleProvider.ValueAddServiceDetail(context.Background(), &bundle.ValueAddServiceDetailRequest{
// Uuid: opt.ValueUid,
// Language: req.Language,
// })
// if err != nil {
// service.Error(c, err)
// return
// }
// // 找到匹配的选项
// var selectedOption *bundle.ValueAddPriceOptions
// for _, option := range valueAddInfo.ValueAddServiceLang.Options {
// if int32(option.Id) == opt.Id {
// selectedOption = option
// break
// }
// }
// if selectedOption == nil {
// service.Error(c, errors.New("未找到匹配的价格选项"))
// return
// }
// valueAddServices = append(valueAddServices, ValueAddServiceInfo{
// Service: valueAddInfo.ValueAddServiceLang,
// Options: selectedOption,
// ID: opt.Id,
// })
//}
// 计算总金额和确定截止日期
var expirationDate string
var addPriceList []*bundle.AddPriceOptionsInfo
for _, svc := range valueAddServices {
price, err := strconv.ParseFloat(svc.Options.Price, 64)
if err != nil {
service.Error(c, errors.New("价格格式错误"))
return
}
var nowAmount float64
switch svc.Service.PriceMode {
case 1: // 数量×单价模式
nowAmount = float64(svc.Options.Num) * price
totalAmount += float64(svc.Options.Num) * price
case 2: // 固定价格模式
nowAmount = price
totalAmount += price
}
addPriceList = append(addPriceList, &bundle.AddPriceOptionsInfo{
ValueUid: svc.Service.Uuid,
ServiceType: svc.Service.ServiceType,
CurrencyType: svc.Service.PriceType,
Amount: float32(nowAmount),
Num: svc.Options.Num,
Unit: svc.Service.Unit,
})
// 如果是可用时长服务,计算新的截止日期
if svc.Service.ServiceType == 5 {
newDeadline := calculateExpirationDate(svc.Options.Num, svc.Service.Unit)
if expirationDate == "" || newDeadline > expirationDate {
expirationDate = newDeadline
}
}
}
// 如果没有可用时长服务,使用主套餐截止日期
if expirationDate == "" {
expirationDate = mainDeadline
}
req.CustomerNum = userInfo.SubNum
req.CustomerName = userInfo.Name
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
req.Source = 2
req.SignedTime = common.GetBeijingTime()
req.ExpirationDate = expirationDate
req.AddPriceOptionsList = addPriceList
// 当前 未将 签名 写入合同中
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, float32(totalAmount), expirationDate)
if signContractErr != nil {
service.Error(c, signContractErr)
return
}
req.SignContract = signContract
// 创建增值服务订单记录
res, err := service.BundleProvider.CreateOrderAddRecord(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
// 计算截止日期辅助函数
func calculateExpirationDate(num int32, unit string) string {
now := time.Now()
switch unit {
case "天":
return now.AddDate(0, 0, int(num)).Format("2006-01-02")
case "月":
return now.AddDate(0, int(num), 0).Format("2006-01-02")
case "年":
return now.AddDate(int(num), 0, 0).Format("2006-01-02")
default:
return ""
}
}
func CreateBundleOrderSignature(c *gin.Context) { func CreateBundleOrderSignature(c *gin.Context) {
var req bundle.OrderRecord var req bundle.OrderRecord
@ -201,31 +32,16 @@ func CreateBundleOrderSignature(c *gin.Context) {
service.Error(c, errors.New(common.MissBundleUUID)) service.Error(c, errors.New(common.MissBundleUUID))
return return
} }
if req.Language == "" {
service.Error(c, errors.New(common.MissLanguageTypes))
return
}
// 不去校验 签名 // 不去校验 签名
/*if req.Signature == "" { /*if req.Signature == "" {
service.Error(c, errors.New(common.MissOrderSignature)) service.Error(c, errors.New(common.MissOrderSignature))
return return
}*/ }*/
statusMessages := map[int32]string{
1: common.Unnamed,
2: common.UnderReview,
3: common.ReviewFailed,
}
// 获取 用户信息 // 获取 用户信息
userInfo := login.GetUserInfoFromC(c) userInfo := login.GetUserInfoFromC(c)
if userInfo.Status != 4 {
if msg, exists := statusMessages[userInfo.Status]; exists {
service.Error(c, errors.New(msg))
return
} else {
service.Error(c, errors.New(common.UnknownStatus))
return
}
}
// 校验 当前用户只能买一次套餐 // 校验 当前用户只能买一次套餐
orderRecordsListReq := bundle.OrderRecordsRequest{ orderRecordsListReq := bundle.OrderRecordsRequest{
CustomerID: strconv.FormatUint(userInfo.ID, 10), CustomerID: strconv.FormatUint(userInfo.ID, 10),
@ -235,10 +51,10 @@ func CreateBundleOrderSignature(c *gin.Context) {
service.Error(c, orderRecordsListErr) service.Error(c, orderRecordsListErr)
return return
} }
//有套餐并且套餐未过期
if orderRecordsList.OrderRecords != nil { if orderRecordsList.OrderRecords != nil {
for _, orderInfo := range orderRecordsList.OrderRecords { for _, order := range orderRecordsList.OrderRecords {
if orderInfo.CustomerID == strconv.FormatUint(userInfo.ID, 10) && orderInfo.ExpirationTime > time.Now().Format("2006-01-02") { if order.CustomerID == strconv.FormatUint(userInfo.ID, 10) {
service.Error(c, errors.New(common.HadOrder)) service.Error(c, errors.New(common.HadOrder))
return return
} }
@ -279,50 +95,43 @@ func CreateBundleOrderSignature(c *gin.Context) {
} }
//获取增值套餐信息 //获取增值套餐信息
//if req.ValueAddBundleUuid != "" { if req.ValueAddBundleUuid != "" {
// valueAddBundleDetail, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &bundle.ValueAddBundleDetailRequest{ valueAddBundleDetail, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &bundle.ValueAddBundleDetailRequest{
// Uuid: req.ValueAddBundleUuid, Uuid: req.ValueAddBundleUuid,
// }) })
// if err != nil { if err != nil {
// service.Error(c, err) service.Error(c, err)
// return return
// } }
//
// req.ValueAddBundleUuid = valueAddBundleDetail.Data.Uuid req.ValueAddBundleUuid = valueAddBundleDetail.Data.Uuid
// req.ValueAddOriginalPrice = valueAddBundleDetail.Data.OriginalPrice req.ValueAddOriginalPrice = valueAddBundleDetail.Data.OriginalPrice
// req.ValueAddDiscountPrice = valueAddBundleDetail.Data.DiscountPrice req.ValueAddDiscountPrice = valueAddBundleDetail.Data.DiscountPrice
// req.AddBundleCommonUid = valueAddBundleDetail.Data.AddBundleCommonUid req.AddBundleCommonUid = valueAddBundleDetail.Data.AddBundleCommonUid
//
// if valueAddBundleDetail.Data.Choose { // 可选条数 if valueAddBundleDetail.Data.Choose { // 可选条数
// req.ValueAddBundleAmount = valueAddBundleDetail.Data.DiscountPrice * float32(req.Num) req.ValueAddBundleAmount = valueAddBundleDetail.Data.DiscountPrice * float32(req.Num)
// discount, _ := new(big.Float).Sub(big.NewFloat(float64(valueAddBundleDetail.Data.OriginalPrice)), big.NewFloat(float64(valueAddBundleDetail.Data.DiscountPrice))).Float32() discount, _ := new(big.Float).Sub(big.NewFloat(float64(valueAddBundleDetail.Data.OriginalPrice)), big.NewFloat(float64(valueAddBundleDetail.Data.DiscountPrice))).Float32()
// req.ValueAddSavedAmount = discount * float32(req.Num) req.ValueAddSavedAmount = discount * float32(req.Num)
// } else { // 固定条数 } else { // 固定条数
// req.ValueAddBundleAmount = valueAddBundleDetail.Data.TotalPrice req.ValueAddBundleAmount = valueAddBundleDetail.Data.TotalPrice
// req.ValueAddSavedAmount = valueAddBundleDetail.Data.SavedAmount req.ValueAddSavedAmount = valueAddBundleDetail.Data.SavedAmount
// } }
//
// req.TotalAmount, _ = new(big.Float).Add(big.NewFloat(float64(req.ValueAddBundleAmount)), big.NewFloat(float64(bundleDetail.Bundle.Price))).Float32() req.TotalAmount, _ = new(big.Float).Add(big.NewFloat(float64(req.ValueAddBundleAmount)), big.NewFloat(float64(bundleDetail.Bundle.Price))).Float32()
//} }
req.BundleName = bundleDetail.Bundle.Name req.BundleName = bundleDetail.Bundle.Name
req.Amount = bundleDetail.Bundle.Price req.Amount = bundleDetail.Bundle.Price
req.AmountType = bundleDetail.Bundle.PriceType req.AmountType = bundleDetail.Bundle.PriceType
req.BundleCommonUid = bundleDetail.Bundle.BundleCommonUid req.BundleCommonUid = bundleDetail.Bundle.BundleCommonUid
req.TotalAmount = bundleDetail.Bundle.Price req.TotalAmount = req.Amount + req.ValueAddBundleAmount
req.PayType = 1 // 默认 人民币 req.PayType = 1 // 默认 人民币
//获取过期时间和增值服务金额
PriceAndTime, err := service.BundleProvider.PackagePriceAndTime(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
//套餐金额+增值服务金额
totalAmount := PriceAndTime.Price + bundleDetail.Bundle.Price
req.ContractNo = common.GenerateContractNo(lastContractNo) req.ContractNo = common.GenerateContractNo(lastContractNo)
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改 // 当前 未将 签名 写入合同中
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, totalAmount, PriceAndTime.Time) signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, req.TotalAmount, bundleDetail.Bundle.ContractDuration)
if signContractErr != nil { if signContractErr != nil {
service.Error(c, signContractErr) service.Error(c, signContractErr)
return return
@ -617,93 +426,8 @@ func ExportOrderInfo(c *gin.Context) {
} }
} }
var exportUrl = strings.Replace(strings.Replace(filePath, ".", fmt.Sprintf("%s://%s", httpType, c.Request.Host), 1), "runtime", "api/fiee/static", 1) var exportUrl = strings.Replace(strings.Replace(filePath, ".", fmt.Sprintf("%s://%s", httpType, c.Request.Host), 1), "runtime", "api/static", 1)
//var exportUrl = fmt.Sprintf("%s%s/%s", httpType, c.Request.Host, dirPath + path) //var exportUrl = fmt.Sprintf("%s%s/%s", httpType, c.Request.Host, dirPath + path)
fmt.Println("exportUrl : ", exportUrl) fmt.Println("exportUrl : ", exportUrl)
service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl}) service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl})
} }
func ExportOrderInfoOss(c *gin.Context) {
var req bundle.OrderRecordsRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.OrderRecordsList(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
rows := make([][]interface{}, 0)
for _, orderRecord := range res.OrderRecords {
if orderRecord.CustomerID != "" {
var userID uint64
userID, err = strconv.ParseUint(orderRecord.CustomerID, 10, 64)
if err != nil {
err = nil
continue
}
userInfo, _ := service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
Domain: "app",
ID: userID,
})
if userInfo != nil {
orderRecord.Sex = userInfo.Sex
orderRecord.Nationality = userInfo.Nationality
orderRecord.TelNum = userInfo.TelNum
}
}
status := ""
if orderRecord.Status == bundleModel.OrderSigned {
status = "未支付"
} else if orderRecord.Status == bundleModel.OrderPaid {
status = "已支付"
}
financialConfirmation := ""
if orderRecord.FinancialConfirmation == bundleModel.UnConfirm {
financialConfirmation = "未确认"
} else if orderRecord.FinancialConfirmation == bundleModel.Confirmed {
financialConfirmation = "已确认"
}
rows = append(rows, []interface{}{
orderRecord.OrderNo,
orderRecord.CustomerNum,
orderRecord.CustomerName,
orderRecord.Sex,
orderRecord.TelNum,
orderRecord.Nationality,
orderRecord.BundleName,
orderRecord.SignedTime,
orderRecord.Amount,
orderRecord.Num,
orderRecord.ValueAddBundleAmount,
orderRecord.TotalAmount,
status,
orderRecord.PayTime,
financialConfirmation,
})
}
dirPath := "./runtime"
filePath, err := logic.WriteToExcel(dirPath, rows)
if err != nil {
service.Error(c, err)
return
}
exportUrl, err := upload.PutBos(filePath, "excel", true)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl})
}

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"fonchain-fiee/api/bundle" "fonchain-fiee/api/bundle"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
) )
@ -77,66 +76,3 @@ func BundleList(c *gin.Context) {
service.Success(c, res) service.Success(c, res)
} }
func SaveBundleV2(c *gin.Context) {
var req bundle.BundleProfile
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.SaveBundle(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func BundleListV2(c *gin.Context) {
var req bundle.BundleListRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.BundleListV2(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func BundleDetailV2(c *gin.Context) {
var req bundle.BundleDetailRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.BundleDetailV2(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func HandShelf(c *gin.Context) {
var req bundle.HandShelfRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.HandShelf(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}

View File

@ -9,9 +9,8 @@ const (
// 订单 // 订单
const ( const (
MissOrderNo = "缺少订单号" MissOrderNo = "缺少订单号"
MissOrderUUID = "缺少订单信息" MissOrderUUID = "缺少订单信息"
MissLanguageTypes = "缺少语言类型"
NotMatchOrderInfo = "非当前用户订单信息不可操作" NotMatchOrderInfo = "非当前用户订单信息不可操作"
InvalidOrderAmount = "订单金额错误" InvalidOrderAmount = "订单金额错误"
@ -20,7 +19,6 @@ const (
HadOrder = "您已购买过套餐,无法再次购买" HadOrder = "您已购买过套餐,无法再次购买"
InvalidValueAddBundleNum = "套餐数量无效" InvalidValueAddBundleNum = "套餐数量无效"
ThePackageHasExpired = "当前套餐已过期"
) )
const ( const (
@ -36,12 +34,6 @@ const (
ErrorDownloadFile = "下载文件失败" ErrorDownloadFile = "下载文件失败"
ErrorUploadFile = "上传文件失败" ErrorUploadFile = "上传文件失败"
) )
const (
Unnamed = "请先实名"
UnderReview = "实名审核中"
ReviewFailed = "实名审核失败"
UnknownStatus = "未知实名状态"
)
/*var EnMessages = map[string]string{ /*var EnMessages = map[string]string{
"创建套餐信息失败": "Failed to create bundle information", "创建套餐信息失败": "Failed to create bundle information",

View File

@ -14,7 +14,7 @@ import (
"time" "time"
) )
func SignContractV2(customerNum, contract string, price float32, expirationDate string) (outputUrl string, err error) { func SignContractV2(customerNum, contract string, price float32, contractDuration int64) (outputUrl string, err error) {
filePath := model.MediaPath + customerNum + time.Now().Format("20060102150405") + ".pdf" filePath := model.MediaPath + customerNum + time.Now().Format("20060102150405") + ".pdf"
downloadFileErr := DownloadFile(filePath, contract) downloadFileErr := DownloadFile(filePath, contract)
if downloadFileErr != nil { if downloadFileErr != nil {
@ -31,7 +31,7 @@ func SignContractV2(customerNum, contract string, price float32, expirationDate
return outputUrl, errors.New(common.ErrorInsertSignature) return outputUrl, errors.New(common.ErrorInsertSignature)
}*/ }*/
signErr := InsertSignatureV2(filePath, signFile, price, expirationDate) signErr := InsertSignatureV2(filePath, signFile, price, contractDuration)
if signErr != nil { if signErr != nil {
zap.L().Error("insert signature error: ", zap.Error(signErr)) zap.L().Error("insert signature error: ", zap.Error(signErr))
return outputUrl, errors.New(common.ErrorInsertSignature) return outputUrl, errors.New(common.ErrorInsertSignature)
@ -46,7 +46,7 @@ func SignContractV2(customerNum, contract string, price float32, expirationDate
return outputUrl, nil return outputUrl, nil
} }
func InsertSignatureV2(templatePath, outputPath string, price float32, expirationDate string) error { func InsertSignatureV2(templatePath, outputPath string, price float32, contractDuration int64) error {
pdf := gopdf.GoPdf{} pdf := gopdf.GoPdf{}
pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4}) pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4})
@ -90,28 +90,22 @@ func InsertSignatureV2(templatePath, outputPath string, price float32, expiratio
pdf.SetPage(limitTimePage) pdf.SetPage(limitTimePage)
// 英文格式的时间 // 英文格式的时间
parsedTime, err := time.Parse("2006-01-02", expirationDate) t := time.Now().AddDate(int(contractDuration), 0, 0)
if err != nil {
panic("日期格式错误!")
}
year := parsedTime.Format("2006") // "2006"
month := parsedTime.Format("01") // "01"
day := parsedTime.Format("02") // "02"
pdf.SetX(160) pdf.SetX(160)
pdf.SetY(387) pdf.SetY(387)
pdf.Cell(nil, expirationDate) pdf.Cell(nil, t.Format("2006-01-02"))
pdf.SetX(330) pdf.SetX(330)
pdf.SetY(403) pdf.SetY(403)
pdf.Cell(nil, year) pdf.Cell(nil, t.Format("2006"))
pdf.SetX(396) pdf.SetX(396)
pdf.SetY(403) pdf.SetY(403)
pdf.Cell(nil, month) pdf.Cell(nil, t.Format("01"))
pdf.SetX(443) pdf.SetX(443)
pdf.SetY(403) pdf.SetY(403)
pdf.Cell(nil, day) pdf.Cell(nil, t.Format("02"))
// 生成新的 PDF // 生成新的 PDF
if err = pdf.WritePdf(outputPath); err != nil { if err = pdf.WritePdf(outputPath); err != nil {

View File

@ -67,49 +67,3 @@ func ValueAddBundleDetail(c *gin.Context) {
service.Success1(c, res.Msg, res) service.Success1(c, res.Msg, res)
} }
func SaveValueAddService(c *gin.Context) {
var req bundle.ValueAddServiceLang
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error1(c, err)
return
}
res, err := service.BundleProvider.SaveValueAddService(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func ValueAddServiceList(c *gin.Context) {
var req bundle.ValueAddServiceListRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error1(c, err)
return
}
res, err := service.BundleProvider.ValueAddServiceList(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}
func ValueAddServiceDetail(c *gin.Context) {
var req bundle.ValueAddServiceDetailRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error1(c, err)
return
}
res, err := service.BundleProvider.ValueAddServiceDetail(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}

View File

@ -1,118 +0,0 @@
package cast
import (
"context"
"errors"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/cast"
"fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"strconv"
)
func MediaUserList(ctx *gin.Context) {
var req *cast.MediaUserListReq
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if err = req.Validate(); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.CastProvider.MediaUserList(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}
func UnbindManager(ctx *gin.Context) {
var req *cast.UnbindManagerReq
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if err = req.Validate(); err != nil {
service.Error(ctx, err)
return
}
_, err = service.CastProvider.UnbindManager(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, nil)
return
}
func BindManager(ctx *gin.Context) {
var req *cast.BindManagerReq
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if err = req.Validate(); err != nil {
service.Error(ctx, err)
return
}
_, err = service.CastProvider.BindManager(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, nil)
return
}
func UpdateMediaAccount(ctx *gin.Context) {
var req *cast.UpdateMediaAccountReq
var infoResp *accountFiee.UserInfoResponse
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if err = req.Validate(); err != nil {
service.Error(ctx, err)
return
}
// 查询艺人的信息
// 字符串转整型
artistID, err := strconv.ParseUint(req.ArtistUuid, 10, 64)
if config.AppConfig.System.AppMode != "dev" {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: artistID,
Domain: "app",
})
if err != nil {
service.Error(ctx, err)
return
}
} else {
infoResp = &accountFiee.UserInfoResponse{
Name: "小波",
TelNum: "18288888888",
}
}
req.ArtistName = infoResp.Name
req.ArtistPhone = infoResp.TelNum
if _, ok := cast.PlatformIDENUM_name[int32(req.PlatformID)]; !ok {
service.Error(ctx, errors.New(e.GetMsg(e.InvalidParams)))
return
}
resp, err := service.CastProvider.UpdateMediaAccount(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}

View File

@ -1,119 +0,0 @@
package cast
import (
"context"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/cast"
"fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"strconv"
)
func UpdateWorkImage(ctx *gin.Context) {
var req *cast.UpdateWorkImageReq
var infoResp *accountFiee.UserInfoResponse
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if config.AppConfig.System.AppMode != "dev" {
artistId, _ := strconv.ParseUint(req.ArtistUuid, 10, 64)
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: artistId,
Domain: "app",
})
if err != nil {
service.Error(ctx, err)
return
}
} else {
infoResp = &accountFiee.UserInfoResponse{
Name: "小波",
TelNum: "18288888888",
}
}
req.ArtistName = infoResp.Name
req.ArtistPhone = infoResp.TelNum
resp, err := service.CastProvider.UpdateWorkImage(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}
func UpdateWorkVideo(ctx *gin.Context) {
var req *cast.UpdateWorkVideoReq
var infoResp *accountFiee.UserInfoResponse
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if config.AppConfig.System.AppMode != "dev" {
artistId, _ := strconv.ParseUint(req.ArtistUuid, 10, 64)
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: artistId,
Domain: "app",
})
if err != nil {
service.Error(ctx, err)
return
}
} else {
infoResp = &accountFiee.UserInfoResponse{
Name: "小波",
TelNum: "18288888888",
}
}
req.ArtistName = infoResp.Name
req.ArtistPhone = infoResp.TelNum
resp, err := service.CastProvider.UpdateWorkVideo(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}
func WorkList(ctx *gin.Context) {
var (
req *cast.WorkListReq
resp *cast.WorkListResp
)
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err = service.CastProvider.WorkList(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}
func WorkDetail(ctx *gin.Context) {
var (
req *cast.WorkDetailReq
resp *cast.WorkDetailResp
)
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err = service.CastProvider.WorkDetail(ctx, req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}

View File

@ -1,254 +0,0 @@
package file
import (
"bytes"
"errors"
"fmt"
"fonchain-fiee/api/files"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service"
"io"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
func Raw(ctx *gin.Context) {
r := ctx.Request
w := ctx.Writer
w.Header().Add("Content-Security-Policy", `script-src 'none';`)
w.Header().Set("Cache-Control", "private")
rs, err := newGrpcReaderSeeker(getUserSpacePath(ctx), ctx.Query("path"))
if err != nil {
service.Error(ctx, err)
return
}
if r.URL.Query().Get("inline") == "true" {
w.Header().Set("Content-Disposition", "inline")
} else {
// As per RFC6266 section 4.3
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+rs.FileName)
}
http.ServeContent(ctx.Writer, r, rs.FileName, time.Now(), rs)
}
func List(ctx *gin.Context) {
path := ctx.DefaultQuery("path", "/")
sortBy := ctx.DefaultQuery("sortBy", "name")
sortAsc, _ := strconv.ParseBool(ctx.DefaultQuery("sortAsc", "true"))
resp, err := service.FilesProvider.List(ctx, &files.FileListReq{
Path: path,
UserSpacePath: getUserSpacePath(ctx),
Sorting: &files.Sorting{
By: sortBy,
Asc: sortAsc,
},
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Info(ctx *gin.Context) {
resp, err := service.FilesProvider.Info(ctx, &files.FileInfoReq{
Path: ctx.DefaultQuery("path", "/"),
UserSpacePath: getUserSpacePath(ctx),
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Create(ctx *gin.Context) {
var req files.CreateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
req.UserSpacePath = getUserSpacePath(ctx)
resp, err := service.FilesProvider.Create(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Delete(ctx *gin.Context) {
resp, err := service.FilesProvider.Delete(ctx, &files.DeleteReq{
Path: ctx.DefaultQuery("path", "/"),
UserSpacePath: getUserSpacePath(ctx),
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Search(ctx *gin.Context) {
resp, err := service.FilesProvider.Search(ctx, &files.SearchReq{
UserSpacePath: getUserSpacePath(ctx),
Path: ctx.Query("path"),
Query: ctx.Query("query"),
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Upload(ctx *gin.Context) {
path, ok := ctx.GetQuery("path")
if !ok {
service.Error(ctx, errors.New("缺失参数路径"))
return
}
b, err := io.ReadAll(ctx.Request.Body)
if !ok {
service.Error(ctx, err)
return
}
resp, err := service.FilesProvider.Upload(ctx, &files.UploadReq{
Path: path,
UserSpacePath: getUserSpacePath(ctx),
Content: b,
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func TusCreate(ctx *gin.Context) {
var req files.TusCreateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
req.UserSpacePath = getUserSpacePath(ctx)
resp, err := service.FilesProvider.TusCreate(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func TusUpload(ctx *gin.Context) {
path, ok := ctx.GetQuery("path")
if !ok {
service.Error(ctx, errors.New("文件路径缺失"))
return
}
uploadOffset, err := getUploadOffset(ctx.Request)
if err != nil {
service.Error(ctx, fmt.Errorf("invalid upload offset: %w", err))
return
}
b, err := io.ReadAll(ctx.Request.Body)
if !ok {
service.Error(ctx, err)
return
}
resp, err := service.FilesProvider.TusUpload(ctx, &files.TusUploadReq{
Path: path,
UploadOffset: uploadOffset,
Content: b,
UserSpacePath: getUserSpacePath(ctx),
})
if err != nil {
service.Error(ctx, err)
return
}
ctx.Writer.Header().Set("Upload-Offset", strconv.FormatInt(resp.UploadOffset, 10))
service.Success(ctx, nil)
}
func Preview(ctx *gin.Context) {
var size int
size, err := strconv.Atoi(ctx.Query("size"))
if err != nil {
size = 1
}
resp, err := service.FilesProvider.Preview(ctx, &files.PreviewReq{
Path: ctx.Query("path"),
UserSpacePath: getUserSpacePath(ctx),
Size: uint32(size),
})
if err != nil {
service.Error(ctx, err)
return
}
ctx.Writer.Header().Set("Cache-Control", "private")
http.ServeContent(ctx.Writer, ctx.Request, resp.FileName, time.UnixMilli(resp.ModTime), bytes.NewReader(resp.Content))
}
func Action(ctx *gin.Context) {
var req files.ActionReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
req.UserSpacePath = getUserSpacePath(ctx)
resp, err := service.FilesProvider.Action(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func DirDownload(ctx *gin.Context) {
path := ctx.Query("path")
fileList := strings.Split(ctx.Query("files"), ",")
algo := ctx.Query("algo")
stream, err := service.FilesProvider.DirDownload(ctx, &files.DirDownloadReq{
Algo: algo,
Files: fileList,
Path: path,
UserSpacePath: getUserSpacePath(ctx),
})
if err != nil {
service.Error(ctx, err)
return
}
header, err := stream.Header()
if err != nil {
service.Error(ctx, err)
return
}
ctx.Writer.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(header.Get("filename")[0]))
for {
recvMsg, err := stream.Recv()
if err != nil {
break
}
ctx.Writer.Write(recvMsg.Content)
}
}
func getUploadOffset(r *http.Request) (int64, error) {
uploadOffset, err := strconv.ParseInt(r.Header.Get("Upload-Offset"), 10, 64)
if err != nil {
return 0, fmt.Errorf("invalid upload offset: %w", err)
}
return uploadOffset, nil
}
func getUserSpacePath(ctx *gin.Context) string {
user := login.GetUserInfoFromC(ctx)
return strconv.Itoa(int(user.ID))
}

View File

@ -1,91 +0,0 @@
package file
import (
"context"
"errors"
"fonchain-fiee/api/files"
"fonchain-fiee/pkg/service"
"io"
)
type grpcReaderSeeker struct {
io.Reader
io.Seeker
path string
userSpacePath string
cursor int64
length int64
FileName string
}
func (g *grpcReaderSeeker) Seek(offset int64, whence int) (int64, error) {
var abs int64
switch whence {
case io.SeekStart:
abs = offset
case io.SeekCurrent:
abs = g.cursor + offset
case io.SeekEnd:
abs = g.length + offset
default:
return 0, errors.New("grpc.Reader.Seek: invalid whence")
}
if abs < 0 {
return 0, errors.New("grpc.Reader.Seek: negative position")
}
g.cursor = abs
return abs, nil
}
func (g *grpcReaderSeeker) Read(b []byte) (n int, err error) {
if g.cursor >= g.length {
return 0, io.EOF
}
data, err := g.getBytesData(len(b))
if err != nil {
return 0, err
}
n = copy(b, data)
g.cursor += int64(n)
return
}
// 通过grpc获取到bytes数据
func (g *grpcReaderSeeker) getBytesData(len int) ([]byte, error) {
resp, err := service.FilesProvider.ResumableTransfer(context.TODO(), &files.ResumableTransferReq{
UserSpacePath: g.userSpacePath,
Path: g.path,
Offset: g.cursor,
Length: int64(len),
})
if err != nil {
return nil, err
}
return resp.Content, nil
}
// grpc 获取到文件信息
func (g *grpcReaderSeeker) initInfo() error {
resp, err := service.FilesProvider.Info(context.TODO(), &files.FileInfoReq{
UserSpacePath: g.userSpacePath,
Path: g.path,
})
if err != nil {
return nil
}
g.FileName = resp.Name
g.length = resp.Size
return err
}
func newGrpcReaderSeeker(userSpacePath string, path string) (*grpcReaderSeeker, error) {
g := new(grpcReaderSeeker)
g.userSpacePath = userSpacePath
g.path = path
err := g.initInfo()
if err != nil {
return nil, err
}
return g, nil
}

View File

@ -1,84 +0,0 @@
package governance
import (
"github.com/gin-gonic/gin"
"fonchain-fiee/api/governance"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service"
)
func Create(ctx *gin.Context) {
var req governance.CreateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
user := login.GetUserInfoFromC(ctx)
// user := login.Info{
// Name: "test" + strconv.Itoa(rand.Intn(10)),
// ID: uint64(rand.Intn(10)),
// }
req.Operator = user.Name
req.OperatorId = int32(user.ID)
resp, err := service.GovernanceProvider.Create(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Delete(ctx *gin.Context) {
var req governance.DeleteReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.GovernanceProvider.Delete(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Display(ctx *gin.Context) {
resp, err := service.GovernanceProvider.Display(ctx, &governance.DisplayReq{})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func List(ctx *gin.Context) {
var req governance.ListReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.GovernanceProvider.List(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Edit(ctx *gin.Context) {
var req governance.EditReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
user := login.GetUserInfoFromC(ctx)
req.Operator = user.Name
req.OperatorId = int32(user.ID)
resp, err := service.GovernanceProvider.Edit(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}

View File

@ -1,22 +1,17 @@
package service package service
import ( import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/imports"
"fmt" "fmt"
"fonchain-fiee/api/account" "fonchain-fiee/api/account"
"fonchain-fiee/api/accountFiee" "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle" "fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast"
"fonchain-fiee/api/files"
"fonchain-fiee/api/governance"
"fonchain-fiee/api/order" "fonchain-fiee/api/order"
"fonchain-fiee/api/payment" "fonchain-fiee/api/payment"
"fonchain-fiee/api/pressreleases"
pkConfig "fonchain-fiee/pkg/config" pkConfig "fonchain-fiee/pkg/config"
"os" "os"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/imports"
) )
var AccountProvider = new(account.AccountClientImpl) var AccountProvider = new(account.AccountClientImpl)
@ -24,11 +19,7 @@ var AccountFieeProvider = new(accountFiee.AccountFieeClientImpl)
var BundleProvider = new(bundle.BundleClientImpl) var BundleProvider = new(bundle.BundleClientImpl)
var OrderProvider = new(order.OrderClientImpl) var OrderProvider = new(order.OrderClientImpl)
var FilesProvider = new(files.FileClientImpl)
var PaymentProvider = new(payment.PaymentCentClientImpl) var PaymentProvider = new(payment.PaymentCentClientImpl)
var CastProvider = new(cast.CastClientImpl)
var GovernanceProvider = new(governance.GovernanceClientImpl)
var PressReleasesProvider = new(pressreleases.PressReleasesClientImpl)
func init() { func init() {
config.SetConsumerService(BundleProvider) config.SetConsumerService(BundleProvider)
@ -36,10 +27,7 @@ func init() {
config.SetConsumerService(AccountProvider) config.SetConsumerService(AccountProvider)
config.SetConsumerService(PaymentProvider) config.SetConsumerService(PaymentProvider)
config.SetConsumerService(AccountFieeProvider) config.SetConsumerService(AccountFieeProvider)
config.SetConsumerService(CastProvider)
config.SetConsumerService(FilesProvider)
config.SetConsumerService(GovernanceProvider)
config.SetConsumerService(PressReleasesProvider)
if err := config.Load(); err != nil { if err := config.Load(); err != nil {
panic(err) panic(err)
} }

View File

@ -1,103 +0,0 @@
package pressreleases
import (
"strconv"
"github.com/gin-gonic/gin"
"fonchain-fiee/api/pressreleases"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service"
)
func Create(ctx *gin.Context) {
var req pressreleases.CreateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
user := login.GetUserInfoFromC(ctx)
req.Operator = user.Name
req.OperatorId = int32(user.ID)
resp, err := service.PressReleasesProvider.Create(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Delete(ctx *gin.Context) {
var req pressreleases.DeleteReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.PressReleasesProvider.Delete(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Display(ctx *gin.Context) {
var req pressreleases.DisplayReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.PressReleasesProvider.Display(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func List(ctx *gin.Context) {
var req pressreleases.ListReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.PressReleasesProvider.List(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Edit(ctx *gin.Context) {
var req pressreleases.EditReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
user := login.GetUserInfoFromC(ctx)
req.Operator = user.Name
req.OperatorId = int32(user.ID)
resp, err := service.PressReleasesProvider.Edit(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func Get(ctx *gin.Context) {
id, err := strconv.Atoi(ctx.Query("id"))
if err != nil {
service.Error(ctx, err)
return
}
resp, err := service.PressReleasesProvider.Get(ctx, &pressreleases.GetReq{
Id: int64(id),
})
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}

View File

@ -329,18 +329,3 @@ func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName str
snapshotName = names[len(names)-1] + "." + PngType snapshotName = names[len(names)-1] + "." + PngType
return return
} }
func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url string, err error) {
Client, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
if err != nil {
err = errors.New(fmt.Sprintf("云存储初始化失败:%s", err.Error()))
return
}
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
_, err = Client.PutObjectFromBytes(config.ConfigData.Oss.BucketName, cloudStoreSubPath, fileBuffer.Bytes())
return
}
func getEnvDir(cloudStoreSubPath string) (ep string) {
ep, _ = url.JoinPath("fiee", cloudStoreSubPath)
return ep
}

View File

@ -1,47 +0,0 @@
/*
* @FileName: if.go
* @Author: JJXu
* @CreateTime: 2022/3/31 下午10:34
* @Description:
*/
package utils
import "strings"
func If(condition bool, trueVal, falseVal interface{}) interface{} {
if condition {
return trueVal
}
return falseVal
}
func IfGec[T ~string | ~int | ~int32 | ~int64 | ~bool | ~float32 | ~float64](condition bool, trueVal, falseVal T) T {
if condition {
return trueVal
}
return falseVal
}
// IsValueInList 值是否在列表中
// value:查询的值
// list: 列表
// disableStrictCase: 禁用严格大小写检查。默认是严格大小写
func IsValueInList(value string, list []string, disableStrictCase ...bool) bool {
var disStrictCase bool
if disableStrictCase != nil {
disStrictCase = disableStrictCase[0]
}
for _, v := range list {
var listValue string
if disStrictCase {
listValue = strings.ToLower(v)
value = strings.ToLower(v)
} else {
listValue = v
}
if listValue == value {
return true
}
}
return false
}

View File

@ -1,51 +0,0 @@
// Package utils -----------------------------
// @file : requestDataToProto.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2023/8/28 17:57
// -------------------------------------------
package utils
import (
"reflect"
"strings"
)
// http请求转proto请求
func RequestDataConvert(from interface{}, to interface{}) {
var proxyField = "Query"
fromValue := reflect.ValueOf(from)
toValue := reflect.ValueOf(to)
toType := reflect.TypeOf(to)
// 获取From结构体的字段信息
fromType := fromValue.Type().Elem()
for i := 0; i < fromType.NumField(); i++ {
// 获取字段名和字段值
fieldName := fromType.Field(i).Name
fieldValue := fromValue.Elem().FieldByName(fieldName)
if fieldName != proxyField {
_, exists := toType.Elem().FieldByName(fieldName)
if exists {
// 设置To结构体中相应字段的值
toValue.Elem().FieldByName(fieldName).Set(fieldValue)
}
}
}
queryField, exists := toType.Elem().FieldByName(proxyField)
if exists {
var queryFieldTypeName string
// 指针类型额外处理,拿到真实的数据类型
if queryField.Type.Kind() == reflect.Ptr {
queryFieldTypeName = queryField.Type.Elem().String()
} else {
queryFieldTypeName = queryField.Type.Kind().String()
}
//处理拿到的结构体类型如 utils.xxxx的类型去掉utils.这部分
if strings.Contains(queryFieldTypeName, ".") {
queryFieldTypeName = strings.Split(queryFieldTypeName, ".")[1]
}
fromQueryValue := fromValue.Elem().FieldByName(queryFieldTypeName)
toValue.Elem().FieldByName(proxyField).Set(fromQueryValue.Addr())
}
}

View File

@ -1,90 +0,0 @@
// Package stime -----------------------------
// @file : common.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/10/21 00:19:04
// -------------------------------------------
package stime
import (
"time"
)
var Loc loc
type loc time.Location
func (l loc) Shanghai() *time.Location {
var shanghai, err = time.LoadLocation("Asia/Shanghai")
if err != nil {
shanghai = time.FixedZone("CST", 8*3600)
}
return shanghai
}
const (
//常规时间格式(日期带横杠)
Format_Normal_YMDhms = "2006-01-02 15:04:05"
Format_Normal_YMDh = "2006-01-02 15:04"
Format_Normal_YMD = "2006-01-02"
Format_Normal_hms = "15:04:05"
Format_Normal_hm = "15:04"
Format_Normal_YM = "2006-01"
Format_Dot_YMD = "2006.01.02"
//带斜杠的时间格式
Format_Slash_YMDhms = "2006/01/02 15:04:05"
Format_Slash_YMD = "2006/01/02"
//无间隔符
Format_NoSpacer_YMDhms = "20060102150405"
Format_NoSpacer_YMD = "20060102"
Format_ChinaChar_YMD = "2006年01月02日"
)
var MonthStrMap = map[string]string{
"January": "01",
"February": "02",
"March": "03",
"April": "04",
"May": "05",
"June": "06",
"July": "07",
"August": "08",
"September": "09",
"October": "10",
"November": "11",
"December": "12",
}
var MonthIntMap = map[string]int{
"January": 1,
"February": 2,
"March": 3,
"April": 4,
"May": 5,
"June": 6,
"July": 7,
"August": 8,
"September": 9,
"October": 10,
"November": 11,
"December": 12,
}
var WeekIntMap = map[string]int{
"Monday": 1,
"Tuesday": 2,
"Wednesday": 3,
"Thursday": 4,
"Friday": 5,
"Saturday": 6,
"Sunday": 7,
}
var WeekStrMap = map[string]string{
"Monday": "一",
"Tuesday": "二",
"Wednesday": "三",
"Thursday": "四",
"Friday": "五",
"Saturday": "六",
"Sunday": "日",
}

View File

@ -1,128 +0,0 @@
/*
* @FileName: getTime.go
* @Author: JJXu
* @CreateTime: 2022/3/1 下午6:35
* @Description:
*/
package stime
import (
"fmt"
"time"
)
func StrNowDate() string {
return TimeToString(time.Now(), Format_Normal_YMD)
}
func StrNowYearMonth() string {
return TimeToString(time.Now(), Format_Normal_YM)
}
//ThisMorming 今天凌晨
func ThisMorming(format string) (strTime string) {
thisTime := time.Now()
year := thisTime.Year()
month := MonthStrMap[thisTime.Month().String()]
day := fmt.Sprintf("%02d", thisTime.Day())
strTime = fmt.Sprintf("%v-%v-%v 00:00:00", year, month, day)
if format != Format_Normal_YMDhms {
t1, _ := time.ParseInLocation(Format_Normal_YMDhms, strTime, Loc.Shanghai())
strTime = t1.Format(format)
}
return strTime
}
//ThisMorningUnix 获取当日凌晨的时间戳
func ThisMorningToUnix() int64 {
thist := time.Now()
zero_tm := time.Date(thist.Year(), thist.Month(), thist.Day(), 0, 0, 0, 0, thist.Location()).Unix()
return zero_tm
}
//TomorrowMorning 第二天凌晨
func TomorrowMorning(baseTime time.Time) *time.Time {
year := baseTime.Year()
month := MonthStrMap[baseTime.Month().String()]
day := fmt.Sprintf("%02d", baseTime.Day()+1)
strTime := fmt.Sprintf("%v-%v-%v 00:00:00", year, month, day)
res, _ := StringToTime(strTime)
return res
}
//ThisTimeUnix 获取当前时间的时间戳
func CurrentimeToUnix() int64 {
return time.Now().Unix()
}
//Currentime 获取当前时间
func Currentime(format string) (strTime string) {
strTime = time.Now().Format(format)
return
}
//HoursAgo 若干小时之前的时间
func HoursAgo(hours time.Duration, format string) (lastTimeStr string) {
lastStamp := time.Now().Unix() - int64((time.Hour * hours).Seconds())
lastTime := time.Unix(lastStamp, 0).In(Loc.Shanghai())
lastTimeStr = lastTime.Format(format)
return
}
//TimeToString 时间转字符串
func TimeToString(t time.Time, format string) string {
return t.Format(format)
}
//计算指定月份的天数
func YearMonthToDayNumber(year int, month int) int {
// 有31天的月份
day31 := map[int]bool{
1: true,
3: true,
5: true,
7: true,
8: true,
10: true,
12: true,
}
if day31[month] == true {
return 31
}
// 有30天的月份
day30 := map[int]bool{
4: true,
6: true,
9: true,
11: true,
}
if day30[month] == true {
return 30
}
// 计算是平年还是闰年
if (year%4 == 0 && year%100 != 0) || year%400 == 0 {
// 得出2月的天数
return 29
}
// 得出2月的天数
return 28
}
// 求时间差返回一个数字该数字单位由传过来的unit决定。若unit为60则单位是分钟。
func GetDiffTime(start_time string, end_time string, unit int64) int64 {
// 转成时间戳
if len(start_time) == 10 {
start_time = fmt.Sprintf("%v 00:00:00", start_time)
}
if len(end_time) == 10 {
end_time = fmt.Sprintf("%v 00:00:00", end_time)
}
startUnix, _ := time.ParseInLocation("2006-01-02 15:04:05", start_time, Loc.Shanghai())
endUnix, _ := time.ParseInLocation("2006-01-02 15:04:05", end_time, Loc.Shanghai())
startTime := startUnix.Unix()
endTime := endUnix.Unix()
// 求相差天数
date := (endTime - startTime) / unit
return date
}

View File

@ -1,101 +0,0 @@
package stime
import (
"fmt"
"strconv"
"time"
)
// 根据指定时间获取后面的若干天工作日列表
// param baseOn 指定基准时间
// param daysNum 获取工作日的数量
func GetWorkDayList(baseOn *time.Time, daysNum int) []time.Time {
var timeList []time.Time
var basCount = 1
var workDay time.Time
for {
if len(timeList) == daysNum {
break
}
workDay = baseOn.AddDate(0, 0, basCount)
switch workDay.Weekday() {
case time.Saturday:
basCount += 2
continue
case time.Sunday:
basCount++
continue
default:
timeList = append(timeList, workDay)
basCount++
}
}
return timeList
}
// 根据指定时间获取后面的若干天工作日列表
// param baseOn 指定基准时间
// param daysNum 获取工作日的数量
func GetWorkDayStrList(baseOn *time.Time, daysNum int) []string {
var timeList []string
var basCount = 1
var workDay time.Time
for {
if len(timeList) == daysNum {
break
}
workDay = baseOn.AddDate(0, 0, basCount)
switch workDay.Weekday() {
case time.Saturday:
basCount += 2
continue
case time.Sunday:
basCount++
continue
default:
timeList = append(timeList, TimeToString(workDay, Format_Normal_YMD))
basCount++
}
}
return timeList
}
// 获取时间差文字描述
func GetTimeDifferenceDesc(now *time.Time, before *time.Time) string {
if before == nil {
return ""
}
if now.After(*before) {
subTimestamp := now.Unix() - before.Unix()
day := subTimestamp / (3600 * 24)
hour := (subTimestamp - day*3600*24) / 3600
minute := (subTimestamp - day*3600*24 - hour*3600) / 60
second := subTimestamp - day*3600*24 - hour*3600 - minute*60
switch {
case day > 0:
if hour > 0 {
return fmt.Sprintf("%d天%d小时", day, hour)
} else {
return fmt.Sprintf("%d天", day)
}
case hour > 0:
if minute < 10 {
return fmt.Sprintf("%d小时", hour)
} else {
return fmt.Sprintf("%d小时%d", hour, minute)
}
case hour == 0 && minute > 0:
return fmt.Sprintf("%d分钟", minute)
case hour == 0 && minute == 0:
return fmt.Sprintf("%d秒", second)
}
}
return ""
}
// TimeStampToBytes 时间戳转字节
func TimeStampToBytes(stamp int64) []byte {
timeStr := strconv.FormatInt(stamp, 2)
return []byte(timeStr)
}

View File

@ -1,12 +0,0 @@
package stime
import (
"testing"
"time"
)
func TestGetWorkDayStrList(t *testing.T) {
now := time.Now()
result := GetWorkDayStrList(&now, 5)
t.Log(result)
}

View File

@ -1,64 +0,0 @@
/*
* @Author: immortal
* @Date: 2022-03-11 20:55:38
* @LastEditors: immortal
* @LastEditTime: 2022-03-12 14:26:42
* @Description:
* @FilePath: \monitor_env\utils\simpletime\timeTranslate.go
*/
/**
* @Author Puzzle
* @Date 2021/11/18 1:36 下午
**/
package stime
import (
"time"
)
func GetTimestampMillisecond() int64 {
now := time.Now()
return now.UnixNano() / 1e6
}
func StringToTime(strTime string) (*time.Time, error) {
const TIME_LAYOUT = "2006-01-02 15:04:05" //此时间不可更改
timeobj, err := time.ParseInLocation(TIME_LAYOUT, strTime, Loc.Shanghai())
return &timeobj, err
}
func StringToTimeWithFormat(strTime string, timeFormat string) (*time.Time, error) {
timeobj, err := time.ParseInLocation(timeFormat, strTime, Loc.Shanghai())
return &timeobj, err
}
// 去除精确时间后面的小数点
func NowTimeToTime(layout string) *time.Time {
otime := time.Now().Format(layout) //"2006-01-02 15:04:05" and so on
tt, _ := StringToTime(otime)
return tt
}
// 时间之间的转换
func TimeStampToString(timestamp int64, format string) string {
t := time.Unix(timestamp, 0)
return t.Format(format)
}
func GetAge(birthday time.Time) int {
if birthday.IsZero() {
return 0
}
now := time.Now()
year, month, day := now.Date()
if year == 0 || month == 0 || day == 0 {
return 0
}
age := year - birthday.Year() - 1
//判断年龄
if birthday.Month() < month || birthday.Month() == month && birthday.Day() <= day {
age++
}
return age
}

View File

@ -1,26 +0,0 @@
/*
* @FileName: time_test.go
* @Author: JJXu
* @CreateTime: 2022/2/25 下午2:37
* @Description:
*/
package stime
import (
"fmt"
"testing"
"time"
)
func TestTime(t *testing.T) {
result := NowTimeToTime(Format_Normal_YMDhms)
fmt.Println(result)
}
func TestGetAge(t *testing.T) {
age := GetAge(time.Date(1991, 3, 6, 0, 0, 0, 0, Loc.Shanghai()))
fmt.Println(age)
if age != 31 {
t.Errorf("want 31 but get %v", age)
}
}

View File

@ -1,52 +0,0 @@
/**
* @Author Puzzle
* @Date 2022/5/20 12:54 下午
**/
package stime
import "time"
func NowWeekDay() string {
var weekday = [7]string{"七", "一", "二", "三", "四", "五", "六"}
week := int(time.Now().Weekday())
return weekday[week]
}
// 获取按年算的周数
func GetYearWeek(t *time.Time) int {
yearDay := t.YearDay()
yearFirstDay := t.AddDate(0, 0, -yearDay+1)
firstDayInWeek := int(yearFirstDay.Weekday())
//今年第一周有几天
firstWeekDays := 1
if firstDayInWeek != 0 {
firstWeekDays = 7 - firstDayInWeek + 1
}
var week int
if yearDay <= firstWeekDays {
week = 1
} else {
week = (yearDay-firstWeekDays)/7 + 2
}
return week
}
// GetWeekDate 获取基准时间范围最最近的某个星期时间
//
// param baseOn: 基准时间
// param weekNum: 中国星期数 1~7
// return *time.Time
func GetWeekDate(baseOn time.Time, weekNum int) *time.Time {
if baseOn.IsZero() || (weekNum <= 0 || weekNum > 7) {
return nil
}
baseDate := time.Date(baseOn.Year(), baseOn.Month(), baseOn.Day(), 0, 0, 0, 0, Loc.Shanghai())
var (
w = int(baseOn.Weekday())
weekDate time.Time
)
weekDate = baseDate.AddDate(0, 0, weekNum-w)
return &weekDate
}

View File

@ -1,20 +0,0 @@
// Package simpletime -----------------------------
// @file : week_test.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/8/31 14:57
// -------------------------------------------
package stime
import (
"testing"
"time"
)
func TestGetYearWeek(t *testing.T) {
now := time.Now()
t.Log(GetYearWeek(&now))
var w = int(now.Weekday())
t.Log(now.AddDate(0, 0, -w+1).Weekday())
t.Log(now.AddDate(0, 0, 7-w).Weekday())
}

View File

@ -1,19 +0,0 @@
// Package utils -----------------------------
// @file : unqiue.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2024/9/12 下午5:03
// -------------------------------------------
package utils
func Unique[T int | int8 | int32 | int64 | string](slice []T) []T {
seen := make(map[T]bool) // 创建一个 map 来跟踪已经看到的元素
unique := make([]T, 0) // 创建一个新的切片来存储唯一的元素
for _, v := range slice {
if _, ok := seen[v]; !ok {
seen[v] = true // 标记元素为已见
unique = append(unique, v) // 将元素添加到唯一元素切片中
}
}
return unique
}