Merge branch 'dev' of http://gitea.tools.fontree.cn:3000/fiee/fonchain-fiee into dev
This commit is contained in:
commit
fb3ad46ba5
File diff suppressed because it is too large
Load Diff
@ -14,12 +14,14 @@ service PaymentCent{
|
||||
rpc CreateRefund(CreateRefundRequest) returns (CreateRefundResponse); // 发起退款,暂定公共
|
||||
|
||||
rpc StripeGermanyWebhook(GetCheckoutWebhookRequest) returns(GetCheckoutWebhookResponse){};// stripe支付回调, 德国账号
|
||||
rpc StripeJapanWebhook(GetCheckoutWebhookRequest) returns(GetCheckoutWebhookResponse){};// stripe支付回调, 日本账号
|
||||
|
||||
rpc AliCommonWebhook(NotifyPayRequest) returns (NotifyPayResponse){}; // 支付宝支付回调,通用
|
||||
|
||||
rpc WechatFengLianWebhook(NotifyPayRequest) returns (NotifyPayResponse){}; // 微信支付回调,丰链
|
||||
rpc AntomWebhook(AntomNotifyPayRequest) returns (AntomNotifyPayResponse){}; // Antom支付回调
|
||||
rpc QueryAntomPayByCheckoutSessionId(AntomPayQueryRequest) returns (AntomPayQueryResponse){}; // 根据checkoutSessionIds查询支付情况
|
||||
rpc ExpireStripePayByCheckoutSessionId(ExpireRequest) returns (CommonResponse){}; // 根据checkoutSessionId
|
||||
|
||||
|
||||
|
||||
@ -127,6 +129,7 @@ message CreatePayResponse {
|
||||
string partnerId = 11 [json_name = "partnerId"];
|
||||
|
||||
string checkoutSessionId = 12 [json_name = "checkoutSessionId"];
|
||||
string antomId = 13 [json_name = "antomId"];
|
||||
}
|
||||
|
||||
message CreateRefundRequest {
|
||||
@ -633,6 +636,7 @@ message WechatPayOkRequest {
|
||||
message CommonResponse {
|
||||
bool Success = 1 [json_name = "success"];
|
||||
uint32 ID = 2 ;
|
||||
string Message = 3 ;
|
||||
}
|
||||
|
||||
message PayQueryRequest {
|
||||
@ -711,6 +715,7 @@ message OrderDetail {
|
||||
string productName = 19;
|
||||
string productImg = 20;
|
||||
string productDescription = 21;
|
||||
string antomId = 22;
|
||||
}
|
||||
|
||||
message BusinessInfo {
|
||||
@ -741,3 +746,8 @@ message ChannelIncome {
|
||||
int64 totalRefundAmount = 6; // 总退款费
|
||||
int64 netIncome = 7; // 净收入
|
||||
}
|
||||
|
||||
message ExpireRequest {
|
||||
string checkoutSessionId = 1;
|
||||
string payee = 2; //
|
||||
}
|
||||
|
||||
@ -299,3 +299,6 @@ func (this *Overview) Validate() error {
|
||||
func (this *ChannelIncome) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExpireRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -35,10 +35,12 @@ type PaymentCentClient interface {
|
||||
QueryExportPay(ctx context.Context, in *ExportPayRequest, opts ...grpc_go.CallOption) (*ExportPayResponse, common.ErrorWithAttachment)
|
||||
CreateRefund(ctx context.Context, in *CreateRefundRequest, opts ...grpc_go.CallOption) (*CreateRefundResponse, common.ErrorWithAttachment)
|
||||
StripeGermanyWebhook(ctx context.Context, in *GetCheckoutWebhookRequest, opts ...grpc_go.CallOption) (*GetCheckoutWebhookResponse, common.ErrorWithAttachment)
|
||||
StripeJapanWebhook(ctx context.Context, in *GetCheckoutWebhookRequest, opts ...grpc_go.CallOption) (*GetCheckoutWebhookResponse, common.ErrorWithAttachment)
|
||||
AliCommonWebhook(ctx context.Context, in *NotifyPayRequest, opts ...grpc_go.CallOption) (*NotifyPayResponse, common.ErrorWithAttachment)
|
||||
WechatFengLianWebhook(ctx context.Context, in *NotifyPayRequest, opts ...grpc_go.CallOption) (*NotifyPayResponse, common.ErrorWithAttachment)
|
||||
AntomWebhook(ctx context.Context, in *AntomNotifyPayRequest, opts ...grpc_go.CallOption) (*AntomNotifyPayResponse, common.ErrorWithAttachment)
|
||||
QueryAntomPayByCheckoutSessionId(ctx context.Context, in *AntomPayQueryRequest, opts ...grpc_go.CallOption) (*AntomPayQueryResponse, common.ErrorWithAttachment)
|
||||
ExpireStripePayByCheckoutSessionId(ctx context.Context, in *ExpireRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
// stripe支付
|
||||
CreateStripeCheckoutSession(ctx context.Context, in *CreateStripeCheckoutSessionRequest, opts ...grpc_go.CallOption) (*CreateStripeCheckoutSessionResponse, common.ErrorWithAttachment)
|
||||
// 支付宝支付
|
||||
@ -76,10 +78,12 @@ type PaymentCentClientImpl struct {
|
||||
QueryExportPay func(ctx context.Context, in *ExportPayRequest) (*ExportPayResponse, error)
|
||||
CreateRefund func(ctx context.Context, in *CreateRefundRequest) (*CreateRefundResponse, error)
|
||||
StripeGermanyWebhook func(ctx context.Context, in *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error)
|
||||
StripeJapanWebhook func(ctx context.Context, in *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error)
|
||||
AliCommonWebhook func(ctx context.Context, in *NotifyPayRequest) (*NotifyPayResponse, error)
|
||||
WechatFengLianWebhook func(ctx context.Context, in *NotifyPayRequest) (*NotifyPayResponse, error)
|
||||
AntomWebhook func(ctx context.Context, in *AntomNotifyPayRequest) (*AntomNotifyPayResponse, error)
|
||||
QueryAntomPayByCheckoutSessionId func(ctx context.Context, in *AntomPayQueryRequest) (*AntomPayQueryResponse, error)
|
||||
ExpireStripePayByCheckoutSessionId func(ctx context.Context, in *ExpireRequest) (*CommonResponse, error)
|
||||
CreateStripeCheckoutSession func(ctx context.Context, in *CreateStripeCheckoutSessionRequest) (*CreateStripeCheckoutSessionResponse, error)
|
||||
AliWapPay func(ctx context.Context, in *AliWapPayRequest) (*AliWapPayResponse, error)
|
||||
AliAppPay func(ctx context.Context, in *AliAppPayRequest) (*AliAppPayResponse, error)
|
||||
@ -151,6 +155,12 @@ func (c *paymentCentClient) StripeGermanyWebhook(ctx context.Context, in *GetChe
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/StripeGermanyWebhook", in, out)
|
||||
}
|
||||
|
||||
func (c *paymentCentClient) StripeJapanWebhook(ctx context.Context, in *GetCheckoutWebhookRequest, opts ...grpc_go.CallOption) (*GetCheckoutWebhookResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetCheckoutWebhookResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/StripeJapanWebhook", in, out)
|
||||
}
|
||||
|
||||
func (c *paymentCentClient) AliCommonWebhook(ctx context.Context, in *NotifyPayRequest, opts ...grpc_go.CallOption) (*NotifyPayResponse, common.ErrorWithAttachment) {
|
||||
out := new(NotifyPayResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -175,6 +185,12 @@ func (c *paymentCentClient) QueryAntomPayByCheckoutSessionId(ctx context.Context
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryAntomPayByCheckoutSessionId", in, out)
|
||||
}
|
||||
|
||||
func (c *paymentCentClient) ExpireStripePayByCheckoutSessionId(ctx context.Context, in *ExpireRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ExpireStripePayByCheckoutSessionId", in, out)
|
||||
}
|
||||
|
||||
func (c *paymentCentClient) CreateStripeCheckoutSession(ctx context.Context, in *CreateStripeCheckoutSessionRequest, opts ...grpc_go.CallOption) (*CreateStripeCheckoutSessionResponse, common.ErrorWithAttachment) {
|
||||
out := new(CreateStripeCheckoutSessionResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -312,10 +328,12 @@ type PaymentCentServer interface {
|
||||
QueryExportPay(context.Context, *ExportPayRequest) (*ExportPayResponse, error)
|
||||
CreateRefund(context.Context, *CreateRefundRequest) (*CreateRefundResponse, error)
|
||||
StripeGermanyWebhook(context.Context, *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error)
|
||||
StripeJapanWebhook(context.Context, *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error)
|
||||
AliCommonWebhook(context.Context, *NotifyPayRequest) (*NotifyPayResponse, error)
|
||||
WechatFengLianWebhook(context.Context, *NotifyPayRequest) (*NotifyPayResponse, error)
|
||||
AntomWebhook(context.Context, *AntomNotifyPayRequest) (*AntomNotifyPayResponse, error)
|
||||
QueryAntomPayByCheckoutSessionId(context.Context, *AntomPayQueryRequest) (*AntomPayQueryResponse, error)
|
||||
ExpireStripePayByCheckoutSessionId(context.Context, *ExpireRequest) (*CommonResponse, error)
|
||||
// stripe支付
|
||||
CreateStripeCheckoutSession(context.Context, *CreateStripeCheckoutSessionRequest) (*CreateStripeCheckoutSessionResponse, error)
|
||||
// 支付宝支付
|
||||
@ -366,6 +384,9 @@ func (UnimplementedPaymentCentServer) CreateRefund(context.Context, *CreateRefun
|
||||
func (UnimplementedPaymentCentServer) StripeGermanyWebhook(context.Context, *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method StripeGermanyWebhook not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentCentServer) StripeJapanWebhook(context.Context, *GetCheckoutWebhookRequest) (*GetCheckoutWebhookResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method StripeJapanWebhook not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentCentServer) AliCommonWebhook(context.Context, *NotifyPayRequest) (*NotifyPayResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AliCommonWebhook not implemented")
|
||||
}
|
||||
@ -378,6 +399,9 @@ func (UnimplementedPaymentCentServer) AntomWebhook(context.Context, *AntomNotify
|
||||
func (UnimplementedPaymentCentServer) QueryAntomPayByCheckoutSessionId(context.Context, *AntomPayQueryRequest) (*AntomPayQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QueryAntomPayByCheckoutSessionId not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentCentServer) ExpireStripePayByCheckoutSessionId(context.Context, *ExpireRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExpireStripePayByCheckoutSessionId not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentCentServer) CreateStripeCheckoutSession(context.Context, *CreateStripeCheckoutSessionRequest) (*CreateStripeCheckoutSessionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateStripeCheckoutSession not implemented")
|
||||
}
|
||||
@ -643,6 +667,35 @@ func _PaymentCent_StripeGermanyWebhook_Handler(srv interface{}, ctx context.Cont
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _PaymentCent_StripeJapanWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetCheckoutWebhookRequest)
|
||||
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("StripeJapanWebhook", 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 _PaymentCent_AliCommonWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NotifyPayRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -759,6 +812,35 @@ func _PaymentCent_QueryAntomPayByCheckoutSessionId_Handler(srv interface{}, ctx
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _PaymentCent_ExpireStripePayByCheckoutSessionId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExpireRequest)
|
||||
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("ExpireStripePayByCheckoutSessionId", 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 _PaymentCent_CreateStripeCheckoutSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateStripeCheckoutSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -1399,6 +1481,10 @@ var PaymentCent_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "StripeGermanyWebhook",
|
||||
Handler: _PaymentCent_StripeGermanyWebhook_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "StripeJapanWebhook",
|
||||
Handler: _PaymentCent_StripeJapanWebhook_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AliCommonWebhook",
|
||||
Handler: _PaymentCent_AliCommonWebhook_Handler,
|
||||
@ -1415,6 +1501,10 @@ var PaymentCent_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "QueryAntomPayByCheckoutSessionId",
|
||||
Handler: _PaymentCent_QueryAntomPayByCheckoutSessionId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExpireStripePayByCheckoutSessionId",
|
||||
Handler: _PaymentCent_ExpireStripePayByCheckoutSessionId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateStripeCheckoutSession",
|
||||
Handler: _PaymentCent_CreateStripeCheckoutSession_Handler,
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
"fonchain-fiee/pkg/utils"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fonchain_enterprise/utils/baidu"
|
||||
@ -277,6 +278,40 @@ func dd(dateStr string) string {
|
||||
|
||||
}
|
||||
|
||||
func isValidMainlandID(id string) bool {
|
||||
id = strings.TrimSpace(strings.ToUpper(id))
|
||||
if len(id) != 18 {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < 17; i++ {
|
||||
if id[i] < '0' || id[i] > '9' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
last := id[17]
|
||||
if (last < '0' || last > '9') && last != 'X' {
|
||||
return false
|
||||
}
|
||||
|
||||
birthday := id[6:14]
|
||||
birthTime, err := time.Parse("20060102", birthday)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if birthTime.After(time.Now()) {
|
||||
return false
|
||||
}
|
||||
|
||||
weights := []int{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}
|
||||
checkMap := "10X98765432"
|
||||
sum := 0
|
||||
for i := 0; i < 17; i++ {
|
||||
sum += int(id[i]-'0') * weights[i]
|
||||
}
|
||||
checkCode := checkMap[sum%11]
|
||||
return byte(checkCode) == last
|
||||
}
|
||||
|
||||
// SendMsg 用户发送验证码
|
||||
func SendMsg(c *gin.Context) {
|
||||
var req account.SendMsgRequest
|
||||
@ -388,12 +423,14 @@ func RealName(c *gin.Context) {
|
||||
user := login.GetUserInfoFromC(c)
|
||||
req.Id = user.ID
|
||||
if req.DocumentType == 2 {
|
||||
if len(req.IdNumber) != 18 {
|
||||
if req.Nationality == "中国大陆" {
|
||||
if !isValidMainlandID(req.IdNumber) {
|
||||
service.Error(c, errors.New("身份证号格式错误"))
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if req.IdNumber == "" {
|
||||
if strings.TrimSpace(req.IdNumber) == "" {
|
||||
service.Error(c, errors.New("证件号码不能为空"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -143,8 +143,44 @@ func AICompetitorReport(ctx *gin.Context) {
|
||||
if needText {
|
||||
textChan = make(chan textResult, 1)
|
||||
go func() {
|
||||
// 根据是否有视频来判断作品类型
|
||||
isVideo := len(req.Videos) > 0
|
||||
|
||||
// 根据作品类型设置差异化内容
|
||||
var extraPoint, extraData string
|
||||
if isVideo {
|
||||
extraPoint = "6. 配乐亮点:"
|
||||
extraData = "2. 完播率表现:\n3. 点赞/分享/评论表现:"
|
||||
} else {
|
||||
extraData = "2. 点赞/分享/评论表现:"
|
||||
}
|
||||
|
||||
// 构建文本生成提示词:理解内容 + 用户要求
|
||||
textPrompt := fmt.Sprintf("基于以下视频和图片的内容描述:\n%s\n\n请根据以下要求生成竞品报告:注意不要输出markdown格式来进行排版,请直接输出纯文本。只需要回复竞品报告的内容,其他无关的内容不要输出,输出的内容第一行不要标题,直接输出竞品报告的正文即可\n我的要求是:\n%s", vlContent, req.TextPrompt)
|
||||
textPrompt := fmt.Sprintf(`基于以下视频和图片的内容描述:
|
||||
%s
|
||||
|
||||
请根据以下要求生成竞品报告。注意不要输出markdown格式来进行排版,请直接输出纯文本。只需要回复竞品报告的内容,其他无关的内容不要输出,输出的内容第一行不要标题,直接输出竞品报告的正文即可
|
||||
|
||||
我的要求是:
|
||||
%s
|
||||
|
||||
请严格按照以下模板输出:
|
||||
|
||||
一、亮点表现分析
|
||||
[100字以内的概述]
|
||||
|
||||
1. 标题亮点:
|
||||
2. 题材亮点:
|
||||
3. 内容亮点:
|
||||
4. 文案亮点:
|
||||
5. 数据亮点:
|
||||
%s
|
||||
|
||||
二、数据表现分析
|
||||
1. 浏览量表现:
|
||||
%s
|
||||
|
||||
三、整体总结及可优化建议`, vlContent, req.TextPrompt, extraPoint, extraData)
|
||||
|
||||
chatReq, err := buildChatRequest(textPrompt, nil)
|
||||
if err != nil {
|
||||
@ -172,7 +208,7 @@ func AICompetitorReport(ctx *gin.Context) {
|
||||
imageChan = make(chan imageResult, 1)
|
||||
go func() {
|
||||
// 先请求聊天获取图片提示词
|
||||
imagePromptText := fmt.Sprintf("基于以下视频和图片的内容描述:\n%s\n\n请根据以下要求生成竞品报告图片的提示词:\n%s", vlContent, req.ImagePrompt)
|
||||
imagePromptText := fmt.Sprintf("基于以下视频和图片的内容描述:\n%s\n\n请根据以下要求生成竞品报告图片的提示词:\n%s\n\n重要提示:生成的图片内容中不要包含任何文字,仅仅是根据内容生成一张配图即可", vlContent, req.ImagePrompt)
|
||||
|
||||
chatReq, err := buildChatRequest(imagePromptText, nil)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user