Merge branch 'feat-zjy-issue-008' into main
# Conflicts: # api/bundle/bundle.pb.go # api/bundle/bundle_triple.pb.go # docs/dev/dubbogo.yaml # pkg/router/bundle.go # pkg/service/init.go
This commit is contained in:
commit
bbf093e104
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v4.24.0--rc1
|
||||
// - protoc v3.20.3
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
@ -36,7 +36,6 @@ type BundleClient interface {
|
||||
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)
|
||||
BundleListH5V2(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
|
||||
BundleLangDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleProfileLang, 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)
|
||||
CreateOrderRecord(ctx context.Context, in *OrderCreateRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
@ -50,11 +49,11 @@ type BundleClient interface {
|
||||
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
|
||||
OrderListByOrderNo(ctx context.Context, in *OrderInfoByOrderNoRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
|
||||
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, 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)
|
||||
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)
|
||||
@ -75,7 +74,7 @@ type BundleClient interface {
|
||||
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
|
||||
ToBeComfirmedWorks(ctx context.Context, in *ToBeComfirmedWorksReq, opts ...grpc_go.CallOption) (*ToBeComfirmedWorksResp, common.ErrorWithAttachment)
|
||||
ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts ...grpc_go.CallOption) (*ConfirmWorkResp, common.ErrorWithAttachment)
|
||||
//对账单
|
||||
// 对账单
|
||||
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
|
||||
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
@ -95,7 +94,6 @@ type BundleClientImpl struct {
|
||||
BundleListV2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleListH5V2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleLangDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleProfileLang, error)
|
||||
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderCreateRecord) (*CommonResponse, error)
|
||||
@ -196,12 +194,6 @@ func (c *bundleClient) BundleListH5V2(ctx context.Context, in *BundleListRequest
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleListH5V2", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleLangDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleProfileLang, common.ErrorWithAttachment) {
|
||||
out := new(BundleProfileLang)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleLangDetailV2", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) {
|
||||
out := new(BundleListResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -442,7 +434,6 @@ type BundleServer interface {
|
||||
BundleListV2(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetailV2(context.Context, *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleListH5V2(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleLangDetailV2(context.Context, *BundleDetailRequest) (*BundleProfileLang, error)
|
||||
BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord(context.Context, *OrderCreateRecord) (*CommonResponse, error)
|
||||
@ -456,11 +447,11 @@ type BundleServer interface {
|
||||
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||
//增值套餐
|
||||
// 增值套餐
|
||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, 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)
|
||||
@ -481,7 +472,7 @@ type BundleServer interface {
|
||||
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
|
||||
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
|
||||
//对账单
|
||||
// 对账单
|
||||
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
|
||||
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
||||
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
||||
@ -518,9 +509,6 @@ func (UnimplementedBundleServer) BundleDetailV2(context.Context, *BundleDetailRe
|
||||
func (UnimplementedBundleServer) BundleListH5V2(context.Context, *BundleListRequest) (*BundleListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleListH5V2 not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleLangDetailV2(context.Context, *BundleDetailRequest) (*BundleProfileLang, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleLangDetailV2 not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleList not implemented")
|
||||
}
|
||||
@ -895,35 +883,6 @@ func _Bundle_BundleListH5V2_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_BundleLangDetailV2_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("BundleLangDetailV2", 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) {
|
||||
in := new(BundleListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2065,10 +2024,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "BundleListH5V2",
|
||||
Handler: _Bundle_BundleListH5V2_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleLangDetailV2",
|
||||
Handler: _Bundle_BundleLangDetailV2_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleList",
|
||||
Handler: _Bundle_BundleList_Handler,
|
||||
|
@ -21,6 +21,7 @@ func BundleRouter(r *gin.RouterGroup) {
|
||||
bundleClientRoute.POST("update", bundle.UpdateBundle)
|
||||
bundleClientRoute.POST("remove", bundle.DeleteBundle)
|
||||
bundleClientRoute.POST("bundle-list", bundle.BundleList)
|
||||
bundleClientRoute.POST("add-value/only", bundle.OnlyAddValueListByOrderNo)
|
||||
|
||||
bundleExtend := bundleClientRoute.Group("extend")
|
||||
{
|
||||
@ -33,9 +34,16 @@ func BundleRouter(r *gin.RouterGroup) {
|
||||
bundleBalance.POST("used-record", bundle.GetUsedRecordList)
|
||||
}
|
||||
}
|
||||
|
||||
bundleAppRoute = bundleAppRoute.Group("common")
|
||||
bundleClientRouteV2 := bundleRoute.Group("system/v2")
|
||||
{
|
||||
bundleClientRouteV2.POST("save", bundle.SaveBundleV2)
|
||||
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)
|
||||
bundleAppRoute.POST("bundle-list", bundle.BundleList)
|
||||
|
||||
bundleAppRoute.POST("pending-confirmation-list", bundle.GetToBeComfirmedWorks) // 作品状态变更的待确认记录
|
||||
@ -45,6 +53,17 @@ func BundleRouter(r *gin.RouterGroup) {
|
||||
bundleAppRoute.POST("work-detail", bundle.GetWorkDetail)
|
||||
bundleAppRoute.POST("work-confirm", bundle.WorkConfirm)
|
||||
}
|
||||
bundleAppRouteV2 := bundleAppRoute.Group("app/system/v2")
|
||||
{
|
||||
bundleAppRouteV2.POST("bundle-list", bundle.BundleListV2)
|
||||
bundleAppRouteV2.POST("bundle-detail", bundle.BundleDetailV2)
|
||||
bundleAppRouteV2.POST("add-value/only", bundle.OnlyAddValueListByOrderNo)
|
||||
|
||||
bundleAppRoute.POST("pending-confirmation-list", bundle.GetToBeComfirmedWorks)
|
||||
bundleAppRoute.POST("balance", bundle.GetUserBalance)
|
||||
bundleAppRoute.POST("work-detail", bundle.GetWorkDetail)
|
||||
bundleAppRoute.POST("work-confirm", bundle.WorkConfirm)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
||||
{
|
||||
bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature)
|
||||
bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature)
|
||||
bundleOrderAppRoute.POST("order-del", bundle.DeleteBundleOrder)
|
||||
bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid)
|
||||
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)
|
||||
|
||||
|
@ -156,7 +156,7 @@ func SendMsg(c *gin.Context) {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
service.Success(c, res)
|
||||
service.Success1(c, "发送成功", res)
|
||||
return
|
||||
} else {
|
||||
res, err := service.AccountFieeProvider.SendMsg(context.Background(), &req)
|
||||
@ -165,7 +165,7 @@ func SendMsg(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
service.Success1(c, "发送成功", res)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -77,3 +77,83 @@ func BundleList(c *gin.Context) {
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func OnlyAddValueListByOrderNo(c *gin.Context) {
|
||||
var req bundle.OnlyAddValueListByOrderNoRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.OnlyAddValueListByOrderNo(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ func SignContractV2(customerNum, contract string, price float32, expirationDate
|
||||
}
|
||||
|
||||
func InsertSignatureV2(templatePath, outputPath string, price float32, expirationDate string) error {
|
||||
fmt.Println("================================templatePath:", templatePath)
|
||||
fmt.Println("================================outputPath:", outputPath)
|
||||
fmt.Println("================================price:", price)
|
||||
fmt.Println("================================expirationDate:", expirationDate)
|
||||
pdf := gopdf.GoPdf{}
|
||||
pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4})
|
||||
|
||||
|
@ -2,6 +2,7 @@ package bundle
|
||||
|
||||
import (
|
||||
"context"
|
||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -141,74 +142,290 @@ func CreateAntomPay(c *gin.Context) {
|
||||
// 获取 用户信息
|
||||
userInfo := login.GetUserInfoFromC(c)
|
||||
|
||||
// 检查 订单信息
|
||||
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||
// outTradeNo就是orderNo,根据这个去查询子表的source,如果是2就时单独的子套餐,如果是1就是主套餐
|
||||
orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{
|
||||
OrderNo: req.OutTradeNo,
|
||||
})
|
||||
|
||||
if detailErr != nil {
|
||||
service.Error(c, detailErr)
|
||||
if err != nil {
|
||||
fmt.Println("=============== antom创建支付,查询订单source报错:", err)
|
||||
logger.Errorf("=============== antom创建支付,查询订单source报错:", err)
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("detail.OrderRecord.CustomerID :", detail.OrderRecord.CustomerID)
|
||||
|
||||
// 判断 是否是 本人操作
|
||||
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||
return
|
||||
currencyType := 0
|
||||
if req.ProductPriceCurrency == "cny" || req.ProductPriceCurrency == "CNY" {
|
||||
currencyType = 1
|
||||
}
|
||||
if req.ProductPriceCurrency == "usd" || req.ProductPriceCurrency == "USD" {
|
||||
currencyType = 2
|
||||
}
|
||||
|
||||
fmt.Println("detail.OrderRecord.TotalAmount :", detail.OrderRecord.TotalAmount)
|
||||
fmt.Println("req.ProductAllPrice :", req.ProductAllPrice)
|
||||
fmt.Println("detail.OrderRecord.TotalAmount*100 :", detail.OrderRecord.TotalAmount*100)
|
||||
bundleName := "" // 套餐名称
|
||||
|
||||
//金额校验
|
||||
orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100)))
|
||||
reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice)))
|
||||
if orderAmountInCents != reqAmountInCents {
|
||||
fmt.Println("111111111111111111111111111111111111")
|
||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status)
|
||||
fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId)
|
||||
fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime)
|
||||
|
||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||
// 查询支付结果
|
||||
stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{
|
||||
CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId},
|
||||
if orderLimit != nil && orderLimit.Type == 1 { // 这儿的type实际就是source
|
||||
// 检查 订单信息 type是1说明既有主套餐又有增值服务
|
||||
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||
OrderNo: req.OutTradeNo,
|
||||
})
|
||||
|
||||
if stripeInfosErr != nil {
|
||||
service.Error(c, errors.New(common.ErrorQueryStripeInfo))
|
||||
if detailErr != nil {
|
||||
fmt.Println("=============== antom创建支付,查询主订单信息报错:", detailErr)
|
||||
logger.Errorf("=============== antom创建支付,查询主订单信息报错:", detailErr)
|
||||
service.Error(c, detailErr)
|
||||
return
|
||||
}
|
||||
|
||||
if stripeInfosRes != nil && len(stripeInfosRes.Infos) > 0 {
|
||||
for _, info := range stripeInfosRes.Infos {
|
||||
if info.OutTradeNo == detail.OrderRecord.OrderNo && info.Status == "paid" {
|
||||
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||
Uuid: detail.OrderRecord.Uuid,
|
||||
Status: bundleModel.OrderPaid,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
})
|
||||
fmt.Println("detail.OrderRecord.Uuid :", detail.OrderRecord.Uuid)
|
||||
if updateOrderRecordErr != nil {
|
||||
service.Error(c, detailErr)
|
||||
fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status)
|
||||
fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId)
|
||||
fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime)
|
||||
|
||||
bundleName = detail.OrderRecord.BundleName
|
||||
|
||||
// 主套餐
|
||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||
// 查询支付结果
|
||||
stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{
|
||||
CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId},
|
||||
})
|
||||
|
||||
if stripeInfosErr != nil {
|
||||
service.Error(c, errors.New(common.ErrorQueryStripeInfo))
|
||||
return
|
||||
}
|
||||
|
||||
if stripeInfosRes != nil && len(stripeInfosRes.Infos) > 0 {
|
||||
for _, info := range stripeInfosRes.Infos {
|
||||
if info.OutTradeNo == detail.OrderRecord.OrderNo && info.Status == "paid" {
|
||||
// 更新主套餐和子套餐 TODO
|
||||
// 更新子套餐,TODO
|
||||
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
|
||||
OrderNo: req.OutTradeNo,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
Status: bundleModel.OrderPaid,
|
||||
})
|
||||
fmt.Println("detail.OrderRecord.Uuid :", detail.OrderRecord.Uuid)
|
||||
if updateStatusErr != nil {
|
||||
fmt.Println("=============== antom创建支付,更新主套餐和子套餐支付状态报错:", updateStatusErr)
|
||||
logger.Errorf("=============== antom创建支付,更新主套餐和子套餐支付状态报错:", updateStatusErr)
|
||||
service.Error(c, updateStatusErr)
|
||||
return
|
||||
}
|
||||
service.Success(c, &service.Response{
|
||||
Msg: common.HadPay,
|
||||
Code: 0,
|
||||
})
|
||||
return
|
||||
}
|
||||
service.Success(c, &service.Response{
|
||||
Msg: common.HadPay,
|
||||
Code: 0,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("detail.OrderRecord.CustomerID :", detail.OrderRecord.CustomerID)
|
||||
|
||||
// 判断 是否是 本人操作
|
||||
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("detail.OrderRecord.TotalAmount :", detail.OrderRecord.TotalAmount)
|
||||
fmt.Println("req.ProductAllPrice :", req.ProductAllPrice)
|
||||
fmt.Println("detail.OrderRecord.TotalAmount*100 :", detail.OrderRecord.TotalAmount*100)
|
||||
|
||||
//金额校验
|
||||
orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount) * 100))
|
||||
reqAmountInCents := req.ProductAllPrice
|
||||
if orderAmountInCents != reqAmountInCents {
|
||||
fmt.Println("111111111111111111111111111111111111")
|
||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if orderLimit != nil && orderLimit.Type == 2 {
|
||||
|
||||
res, listErr := service.BundleProvider.OnlyAddValueListByOrderNo(context.Background(), &bundle.OnlyAddValueListByOrderNoRequest{
|
||||
OrderNo: req.OutTradeNo,
|
||||
})
|
||||
if listErr != nil {
|
||||
fmt.Println("=============== antom创建支付,查询单独增值服务列表报错:", listErr)
|
||||
logger.Errorf("=============== antom创建支付,查询单独增值服务列表报错:", listErr)
|
||||
service.Error(c, listErr)
|
||||
return
|
||||
}
|
||||
if res != nil && len(res.AddBundleInfos) > 0 {
|
||||
firstAddBundle := res.AddBundleInfos[0]
|
||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||
if firstAddBundle.PaymentStatus == bundleModel.OrderSigned && firstAddBundle.CheckOutSessionId != "" {
|
||||
// 查询支付结果
|
||||
stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{
|
||||
CheckoutSessionIds: []string{firstAddBundle.CheckOutSessionId},
|
||||
})
|
||||
|
||||
if stripeInfosErr != nil {
|
||||
service.Error(c, errors.New(common.ErrorQueryStripeInfo))
|
||||
return
|
||||
}
|
||||
|
||||
if stripeInfosRes != nil && len(stripeInfosRes.Infos) > 0 {
|
||||
for _, info := range stripeInfosRes.Infos {
|
||||
if info.OutTradeNo == firstAddBundle.OrderNo && info.Status == "paid" {
|
||||
// 更新子套餐,TODO
|
||||
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
|
||||
OrderNo: req.OutTradeNo,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
Status: bundleModel.OrderPaid,
|
||||
})
|
||||
fmt.Println("req.OutTradeNo :", req.OutTradeNo)
|
||||
if updateStatusErr != nil {
|
||||
fmt.Println("=============== antom创建支付,更新子套餐支付状态报错:", updateStatusErr)
|
||||
logger.Errorf("=============== antom创建支付,更新子套餐支付状态报错:", updateStatusErr)
|
||||
service.Error(c, updateStatusErr)
|
||||
return
|
||||
}
|
||||
service.Success(c, &service.Response{
|
||||
Msg: common.HadPay,
|
||||
Code: 0,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("firstAddBundle.CustomerID :", firstAddBundle.CustomerID)
|
||||
|
||||
// 判断 是否是 本人操作
|
||||
if strconv.FormatUint(userInfo.ID, 10) != firstAddBundle.CustomerID {
|
||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||
return
|
||||
}
|
||||
|
||||
orderAmountInCents := int64(0.0)
|
||||
for _, info := range res.AddBundleInfos {
|
||||
temp := int64(math.Round(float64(info.Amount) * 100))
|
||||
orderAmountInCents += temp
|
||||
}
|
||||
|
||||
fmt.Println("orderAmountInCents :", orderAmountInCents)
|
||||
fmt.Println("req.ProductAllPrice :", req.ProductAllPrice)
|
||||
|
||||
//金额校验
|
||||
reqAmountInCents := req.ProductAllPrice
|
||||
if orderAmountInCents != reqAmountInCents {
|
||||
fmt.Println("111111111111111111111111111111111111")
|
||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if req.ProductAllPrice == 0 {
|
||||
////创建对账单 todo 待修改
|
||||
_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
|
||||
BundleOrderOn: req.OutTradeNo,
|
||||
BundleAddOrderOn: req.OutTradeNo,
|
||||
UserName: userInfo.Name,
|
||||
UserTel: userInfo.TelNum,
|
||||
BundleName: bundleName,
|
||||
PayAmount: float32(req.ProductAllPrice),
|
||||
CurrencyType: int32(currencyType),
|
||||
PayStatus: 2,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
UserID: userInfo.ID,
|
||||
SerialNumber: "zero-price-serial-number",
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("=============== antom创建支付,创建对账单报错:", err)
|
||||
logger.Errorf("=============== antom创建支付,创建对账单报错:", err)
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
|
||||
OrderNo: req.OutTradeNo,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
Status: bundleModel.OrderPaid,
|
||||
})
|
||||
if updateStatusErr != nil {
|
||||
fmt.Println("=============== antom创建支付,更新订单报错:", updateStatusErr)
|
||||
logger.Errorf("=============== antom创建支付,更新订单报错:", updateStatusErr)
|
||||
service.Error(c, updateStatusErr)
|
||||
return
|
||||
}
|
||||
|
||||
switch orderLimit.Type {
|
||||
case common.OrderTypePackage:
|
||||
//如果是购买套餐 1:创建新的余量信息CreateBundleBalance 2 添加扩展记录BundleExtend
|
||||
_, err = service.BundleProvider.CreateBundleBalance(context.Background(), &bundle.CreateBundleBalanceReq{
|
||||
UserId: int32(orderLimit.UserId),
|
||||
OrderUUID: orderLimit.OrderUUID,
|
||||
//AccountNumber: orderLimit.AccountNumber,
|
||||
//VideoNumber: orderLimit.VideoNumber,
|
||||
//ImageNumber: orderLimit.ImageNumber,
|
||||
//DataAnalysisNumber: orderLimit.DataNumber,
|
||||
ExpansionPacksNumber: 1,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("=============== antom创建支付,OrderTypePackage报错:", err)
|
||||
logger.Errorf("=============== antom创建支付,OrderTypePackage报错:", err)
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
case common.OrderTypeAddon:
|
||||
//如果是购买增值服务 1:修改余量信息AddBundleBalance 2 添加扩展记录BundleExtend
|
||||
//_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
// UserId: int32(orderLimit.UserId),
|
||||
// OrderUUID: orderLimit.OrderUUID,
|
||||
// AccountNumber: orderLimit.AccountNumber,
|
||||
// VideoNumber: orderLimit.VideoNumber,
|
||||
// ImageNumber: orderLimit.ImageNumber,
|
||||
// DataAnalysisNumber: orderLimit.DataNumber,
|
||||
// ExpansionPacksNumber: 1,
|
||||
//})
|
||||
//if err != nil {
|
||||
// fmt.Println("=============== antom创建支付,OrderTypePackage报错:", err)
|
||||
// logger.Errorf("=============== antom创建支付,OrderTypePackage报错:", err)
|
||||
// service.Error(c, err)
|
||||
// return
|
||||
//}
|
||||
default:
|
||||
fmt.Println("=============== antom创建支付,无效的订单类型:", err)
|
||||
logger.Errorf("=============== antom创建支付,无效的订单类型:", err)
|
||||
service.Error(c, errors.New("无效的订单类型"))
|
||||
return
|
||||
}
|
||||
|
||||
var timeUnit uint32
|
||||
switch orderLimit.Unit {
|
||||
case "天":
|
||||
timeUnit = common.TimeUnitDay
|
||||
case "月":
|
||||
timeUnit = common.TimeUnitMonth
|
||||
case "年":
|
||||
timeUnit = common.TimeUnitYear
|
||||
default:
|
||||
timeUnit = 0
|
||||
}
|
||||
_, err = service.BundleProvider.BundleExtend(context.Background(), &bundle.BundleExtendRequest{
|
||||
UserId: int64(orderLimit.UserId),
|
||||
AccountAdditional: uint32(orderLimit.AccountNumber),
|
||||
VideoAdditional: uint32(orderLimit.VideoNumber),
|
||||
ImagesAdditional: uint32(orderLimit.ImageNumber),
|
||||
DataAdditional: uint32(orderLimit.DataNumber),
|
||||
AvailableDurationAdditional: uint32(orderLimit.Duration),
|
||||
TimeUnit: timeUnit,
|
||||
AssociatedorderNumber: req.OutTradeNo, //增值服务订单号
|
||||
Type: 2, //自行购买
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c)
|
||||
return
|
||||
}
|
||||
|
||||
var antomReq payment.CreatePayRequest
|
||||
@ -233,9 +450,9 @@ func CreateAntomPay(c *gin.Context) {
|
||||
fmt.Println("result.CheckoutSessionId :", result.CheckoutSessionId)
|
||||
fmt.Println("result.Url :", result.Url)
|
||||
|
||||
//更新订单状态
|
||||
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||
Uuid: detail.OrderRecord.Uuid,
|
||||
//更新订单url和checkSessionId
|
||||
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
|
||||
OrderNo: req.OutTradeNo,
|
||||
CheckoutSessionId: result.CheckoutSessionId,
|
||||
CheckoutSessionUrl: result.Url,
|
||||
})
|
||||
@ -243,25 +460,35 @@ func CreateAntomPay(c *gin.Context) {
|
||||
resp := &order.CreateStripeCheckoutSessionResponse{}
|
||||
resp.CheckoutSessionUrl = result.Url
|
||||
resp.CheckoutSessionId = result.CheckoutSessionId
|
||||
fmt.Println("resp:", resp)
|
||||
|
||||
if updateOrderRecordErr != nil {
|
||||
fmt.Println("有更新报错:", updateOrderRecordErr)
|
||||
service.Error(c, updateOrderRecordErr)
|
||||
fmt.Println("req.OutTradeNo :", req.OutTradeNo)
|
||||
if updateStatusErr != nil {
|
||||
fmt.Println("=============== antom创建支付,更新订单的请求id报错:", updateStatusErr)
|
||||
logger.Errorf("=============== antom创建支付,更新订单的请求id报错:", updateStatusErr)
|
||||
service.Error(c, updateStatusErr)
|
||||
return
|
||||
}
|
||||
fmt.Println("resp:", resp)
|
||||
|
||||
////创建对账单 todo 待修改
|
||||
//_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
|
||||
// BundleOrderOn: detail.OrderRecord.OrderNo,
|
||||
// BundleAddOrderOn: detail.OrderRecord.OrderNo,
|
||||
// UserName: userInfo.Name,
|
||||
// UserTel: userInfo.TelNum,
|
||||
// BundleName: detail.OrderRecord.BundleName,
|
||||
// Amount: detail.OrderRecord.TotalAmount,
|
||||
// CurrencyType: int32(detail.OrderRecord.AmountType),
|
||||
// PayStatus: 1,
|
||||
// UserId: userInfo.ID,
|
||||
//})
|
||||
_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
|
||||
BundleOrderOn: req.OutTradeNo,
|
||||
BundleAddOrderOn: req.OutTradeNo,
|
||||
UserName: userInfo.Name,
|
||||
UserTel: userInfo.TelNum,
|
||||
BundleName: bundleName,
|
||||
PayAmount: float32(req.ProductAllPrice),
|
||||
CurrencyType: int32(currencyType),
|
||||
PayStatus: 1,
|
||||
UserID: userInfo.ID,
|
||||
SerialNumber: result.CheckoutSessionId,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("=============== antom创建支付,创建对账单报错:", err)
|
||||
logger.Errorf("=============== antom创建支付,创建对账单报错:", err)
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, resp)
|
||||
|
||||
}
|
||||
@ -374,6 +601,19 @@ func AntomWebhook(c *gin.Context) {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
// 更新对账单
|
||||
_, err = service.BundleProvider.UpdateReconciliationStatusBySerialNumber(context.Background(), &bundle.UpdateStatusAndPayTimeBySerialNumber{
|
||||
PayTime: paymentTime,
|
||||
PaymentStatus: 2,
|
||||
SerialNumber: requestId,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("=============== antom回调,更新对账单报错:", err)
|
||||
logger.Errorf("=============== antom回调,更新对账单报错:", err)
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
//添加余额
|
||||
orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{
|
||||
OrderNo: resp.OutTradeNo,
|
||||
@ -387,12 +627,12 @@ func AntomWebhook(c *gin.Context) {
|
||||
case common.OrderTypePackage:
|
||||
//如果是购买套餐 1:创建新的余量信息CreateBundleBalance 2 添加扩展记录BundleExtend
|
||||
_, err = service.BundleProvider.CreateBundleBalance(context.Background(), &bundle.CreateBundleBalanceReq{
|
||||
UserId: int32(orderLimit.UserId),
|
||||
OrderUUID: orderLimit.OrderUUID,
|
||||
AccountNumber: orderLimit.AccountNumber,
|
||||
VideoNumber: orderLimit.VideoNumber,
|
||||
ImageNumber: orderLimit.ImageNumber,
|
||||
DataAnalysisNumber: orderLimit.DataNumber,
|
||||
UserId: int32(orderLimit.UserId),
|
||||
OrderUUID: orderLimit.OrderUUID,
|
||||
//AccountNumber: orderLimit.AccountNumber,
|
||||
//VideoNumber: orderLimit.VideoNumber,
|
||||
//ImageNumber: orderLimit.ImageNumber,
|
||||
//DataAnalysisNumber: orderLimit.DataNumber,
|
||||
ExpansionPacksNumber: 1,
|
||||
})
|
||||
if err != nil {
|
||||
@ -401,19 +641,19 @@ func AntomWebhook(c *gin.Context) {
|
||||
}
|
||||
case common.OrderTypeAddon:
|
||||
//如果是购买增值服务 1:修改余量信息AddBundleBalance 2 添加扩展记录BundleExtend
|
||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: int32(orderLimit.UserId),
|
||||
OrderUUID: orderLimit.OrderUUID,
|
||||
AccountNumber: orderLimit.AccountNumber,
|
||||
VideoNumber: orderLimit.VideoNumber,
|
||||
ImageNumber: orderLimit.ImageNumber,
|
||||
DataAnalysisNumber: orderLimit.DataNumber,
|
||||
ExpansionPacksNumber: 1,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
//_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
// UserId: int32(orderLimit.UserId),
|
||||
// OrderUUID: orderLimit.OrderUUID,
|
||||
// AccountNumber: orderLimit.AccountNumber,
|
||||
// VideoNumber: orderLimit.VideoNumber,
|
||||
// ImageNumber: orderLimit.ImageNumber,
|
||||
// DataAnalysisNumber: orderLimit.DataNumber,
|
||||
// ExpansionPacksNumber: 1,
|
||||
//})
|
||||
//if err != nil {
|
||||
// service.Error(c, err)
|
||||
// return
|
||||
//}
|
||||
default:
|
||||
service.Error(c, errors.New("无效的订单类型"))
|
||||
return
|
||||
@ -438,6 +678,7 @@ func AntomWebhook(c *gin.Context) {
|
||||
AvailableDurationAdditional: uint32(orderLimit.Duration),
|
||||
TimeUnit: timeUnit,
|
||||
AssociatedorderNumber: resp.OutTradeNo, //增值服务订单号
|
||||
Type: 2, //自行购买
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
@ -485,15 +726,21 @@ func HomePageRoll(c *gin.Context) {
|
||||
|
||||
var roll []Roll
|
||||
for _, i := range res.BundleInfo {
|
||||
maskedTel := userMap[i.CustomerId].TelNum
|
||||
if len(userMap[i.CustomerId].TelNum) >= 11 { // 标准11位手机号
|
||||
maskedTel = userMap[i.CustomerId].TelNum[:3] + "****" + userMap[i.CustomerId].TelNum[7:]
|
||||
} else if len(userMap[i.CustomerId].TelNum) >= 7 { // 短号处理
|
||||
maskedTel = userMap[i.CustomerId].TelNum[:3] + "****" + userMap[i.CustomerId].TelNum[7:]
|
||||
tel := ""
|
||||
name := i.BundleName // Use bundle name as fallback
|
||||
if userInfo, exists := userMap[i.CustomerId]; exists && userInfo != nil {
|
||||
tel = userInfo.TelNum
|
||||
if len(tel) >= 2 {
|
||||
masked := ""
|
||||
for j := 0; j < len(tel)-2; j++ {
|
||||
masked += "*"
|
||||
}
|
||||
tel = masked + tel[len(tel)-2:]
|
||||
}
|
||||
}
|
||||
roll = append(roll, Roll{
|
||||
Tel: maskedTel,
|
||||
Name: i.BundleName,
|
||||
Tel: tel,
|
||||
Name: name,
|
||||
})
|
||||
}
|
||||
service.Success(c, roll)
|
||||
|
Loading…
Reference in New Issue
Block a user