Compare commits
No commits in common. "e35c6365f4ea2207b54d8f1c6e498951d79d668f" and "f17c039c1e624a70185bede46d6311fc48ea511f" have entirely different histories.
e35c6365f4
...
f17c039c1e
File diff suppressed because it is too large
Load Diff
@ -370,22 +370,6 @@ func (this *GetBundleBalanceReq) Validate() error {
|
|||||||
func (this *BundleBalanceItem) Validate() error {
|
func (this *BundleBalanceItem) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *BundleBalanceExportItem) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *BundleBalanceExportReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *BundleBalanceExportResp) 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 *GetBundleBalanceListResp) Validate() error {
|
func (this *GetBundleBalanceListResp) Validate() error {
|
||||||
for _, item := range this.Data {
|
for _, item := range this.Data {
|
||||||
if item != nil {
|
if item != nil {
|
||||||
|
@ -70,7 +70,6 @@ type BundleClient interface {
|
|||||||
CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment)
|
CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment)
|
||||||
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
|
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
|
||||||
BundleActivate(ctx context.Context, in *BundleActivateReq, opts ...grpc_go.CallOption) (*BundleActivateResp, common.ErrorWithAttachment)
|
BundleActivate(ctx context.Context, in *BundleActivateReq, opts ...grpc_go.CallOption) (*BundleActivateResp, common.ErrorWithAttachment)
|
||||||
BundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*BundleBalanceExportResp, common.ErrorWithAttachment)
|
|
||||||
// 使用记录
|
// 使用记录
|
||||||
GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment)
|
GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment)
|
||||||
GetImageWorkDetail(ctx context.Context, in *GetImageWorkDetailReq, opts ...grpc_go.CallOption) (*GetImageWorkDetailResp, common.ErrorWithAttachment)
|
GetImageWorkDetail(ctx context.Context, in *GetImageWorkDetailReq, opts ...grpc_go.CallOption) (*GetImageWorkDetailResp, common.ErrorWithAttachment)
|
||||||
@ -141,7 +140,6 @@ type BundleClientImpl struct {
|
|||||||
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
||||||
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||||
BundleActivate func(ctx context.Context, in *BundleActivateReq) (*BundleActivateResp, error)
|
BundleActivate func(ctx context.Context, in *BundleActivateReq) (*BundleActivateResp, error)
|
||||||
BundleBalanceExport func(ctx context.Context, in *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
|
||||||
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
||||||
GetImageWorkDetail func(ctx context.Context, in *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
GetImageWorkDetail func(ctx context.Context, in *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
||||||
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||||
@ -410,12 +408,6 @@ func (c *bundleClient) BundleActivate(ctx context.Context, in *BundleActivateReq
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleActivate", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleActivate", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *bundleClient) BundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*BundleBalanceExportResp, common.ErrorWithAttachment) {
|
|
||||||
out := new(BundleBalanceExportResp)
|
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
|
||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleBalanceExport", in, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bundleClient) GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment) {
|
func (c *bundleClient) GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment) {
|
||||||
out := new(GetUsedRecordListResp)
|
out := new(GetUsedRecordListResp)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
@ -582,7 +574,6 @@ type BundleServer interface {
|
|||||||
CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
||||||
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||||
BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error)
|
BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error)
|
||||||
BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
|
||||||
// 使用记录
|
// 使用记录
|
||||||
GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
||||||
GetImageWorkDetail(context.Context, *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
GetImageWorkDetail(context.Context, *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
||||||
@ -732,9 +723,6 @@ func (UnimplementedBundleServer) AddBundleBalance(context.Context, *AddBundleBal
|
|||||||
func (UnimplementedBundleServer) BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error) {
|
func (UnimplementedBundleServer) BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method BundleActivate not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method BundleActivate not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedBundleServer) BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method BundleBalanceExport not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedBundleServer) GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error) {
|
func (UnimplementedBundleServer) GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetUsedRecordList not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetUsedRecordList not implemented")
|
||||||
}
|
}
|
||||||
@ -1954,35 +1942,6 @@ func _Bundle_BundleActivate_Handler(srv interface{}, ctx context.Context, dec fu
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Bundle_BundleBalanceExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(BundleBalanceExportReq)
|
|
||||||
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("BundleBalanceExport", 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_GetUsedRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
func _Bundle_GetUsedRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetUsedRecordListReq)
|
in := new(GetUsedRecordListReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -2726,10 +2685,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "BundleActivate",
|
MethodName: "BundleActivate",
|
||||||
Handler: _Bundle_BundleActivate_Handler,
|
Handler: _Bundle_BundleActivate_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "BundleBalanceExport",
|
|
||||||
Handler: _Bundle_BundleBalanceExport_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "GetUsedRecordList",
|
MethodName: "GetUsedRecordList",
|
||||||
Handler: _Bundle_GetUsedRecordList_Handler,
|
Handler: _Bundle_GetUsedRecordList_Handler,
|
||||||
|
@ -34,7 +34,6 @@ func BundleRouter(r *gin.RouterGroup) {
|
|||||||
bundleBalance.POST("list", bundle.GetBundleBalance)
|
bundleBalance.POST("list", bundle.GetBundleBalance)
|
||||||
bundleBalance.POST("used-record", bundle.GetUsedRecordList)
|
bundleBalance.POST("used-record", bundle.GetUsedRecordList)
|
||||||
bundleBalance.POST("activate", bundle.BundleActivate)
|
bundleBalance.POST("activate", bundle.BundleActivate)
|
||||||
r.Group("bundle").GET("system/balance/export", bundle.BundleExport)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bundleClientRouteV2 := bundleRoute.Group("system/v2")
|
bundleClientRouteV2 := bundleRoute.Group("system/v2")
|
||||||
|
@ -3,21 +3,16 @@ package bundle
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
"fonchain-fiee/api/cast"
|
"fonchain-fiee/api/cast"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
|
|
||||||
bundleModel "fonchain-fiee/pkg/model/bundle"
|
bundleModel "fonchain-fiee/pkg/model/bundle"
|
||||||
"fonchain-fiee/pkg/model/login"
|
"fonchain-fiee/pkg/model/login"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/xuri/excelize/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func BundleExtend(c *gin.Context) {
|
func BundleExtend(c *gin.Context) {
|
||||||
@ -268,103 +263,3 @@ func BundleActivate(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
service.Success(ctx, res)
|
service.Success(ctx, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BundleExport(ctx *gin.Context) {
|
|
||||||
var req bundle.BundleBalanceExportReq
|
|
||||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
|
||||||
service.Error(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := service.BundleProvider.BundleBalanceExport(context.Background(), &req)
|
|
||||||
if err != nil {
|
|
||||||
service.Error(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
f := excelize.NewFile()
|
|
||||||
sheet := "Sheet1"
|
|
||||||
f.NewSheet(sheet)
|
|
||||||
|
|
||||||
// 写入表头
|
|
||||||
headers := []string{
|
|
||||||
"所属月份",
|
|
||||||
"用户编号",
|
|
||||||
"名字",
|
|
||||||
"手机号",
|
|
||||||
"支付时间",
|
|
||||||
"套餐金额",
|
|
||||||
"增值服务金额",
|
|
||||||
"支付金额",
|
|
||||||
"币种",
|
|
||||||
"手续费",
|
|
||||||
"套餐视频单价",
|
|
||||||
"增值视频单价",
|
|
||||||
"套餐账号总数",
|
|
||||||
"增值账号总数",
|
|
||||||
"套餐账号使用数",
|
|
||||||
"增值账号使用数",
|
|
||||||
"当前可用套餐视频数",
|
|
||||||
"当前可用增值视频数",
|
|
||||||
"当前已用套餐视频数",
|
|
||||||
"当前已用增值视频数",
|
|
||||||
"当前作废套餐视频数",
|
|
||||||
"当前作废增值视频数",
|
|
||||||
"当月新增套餐视频数",
|
|
||||||
"当月新增增值视频数",
|
|
||||||
"当月作废套餐视频数",
|
|
||||||
"当月作废增值视频数",
|
|
||||||
"当前可用套餐图文数",
|
|
||||||
"当前可用增值图文数",
|
|
||||||
"当前已用套餐图文数",
|
|
||||||
"当前已用增值图文数",
|
|
||||||
"当前作废套餐图文数",
|
|
||||||
"当前作废增值图文数",
|
|
||||||
"当月新增套餐图文数",
|
|
||||||
"当月新增增值图文数",
|
|
||||||
"当月作废套餐图文数",
|
|
||||||
"当月作废增值图文数",
|
|
||||||
"当前可用套餐数据分析数",
|
|
||||||
"当前可用增值数据分析数",
|
|
||||||
"当前已用套餐数据分析数",
|
|
||||||
"当前已用增值数据分析数",
|
|
||||||
"当前作废套餐数据分析数",
|
|
||||||
"当前作废增值数据分析数",
|
|
||||||
"当月新增套餐数据分析数",
|
|
||||||
"当月新增增值数据分析数",
|
|
||||||
"当月作废套餐数据分析数",
|
|
||||||
"当月作废增值数据分析数",
|
|
||||||
"当月手动扩展账号新增数",
|
|
||||||
"当月手动扩展视频新增数",
|
|
||||||
"当月手动扩展图文新增数",
|
|
||||||
"当月手动扩展数据分析新增数",
|
|
||||||
"当月新增手动扩展时长(天)",
|
|
||||||
"当月手动扩展账号使用数",
|
|
||||||
"当月手动扩展视频使用数",
|
|
||||||
"当月手动扩展图文使用数",
|
|
||||||
"当月手动扩展数据分析使用数",
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, h := range headers {
|
|
||||||
cell, _ := excelize.CoordinatesToCellName(i+1, 1)
|
|
||||||
f.SetCellValue(sheet, cell, h)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 写入数据
|
|
||||||
for r, item := range res.Data {
|
|
||||||
row := r + 2
|
|
||||||
v := reflect.ValueOf(item)
|
|
||||||
for c := 0; c < v.NumField(); c++ {
|
|
||||||
cell, _ := excelize.CoordinatesToCellName(c+1, row)
|
|
||||||
f.SetCellValue(sheet, cell, v.Field(c).Interface())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
path := fmt.Sprintf("%s/%d/%s月余量导出.xlsx", os.TempDir(), time.Now().UnixMilli(), req.Month)
|
|
||||||
// 保存文件
|
|
||||||
if err := f.SaveAs(path); err != nil {
|
|
||||||
fmt.Println("保存失败:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer os.Remove(path)
|
|
||||||
ctx.File(path)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user