Parcourir la source

wip:初始化提交

wangkaiyue il y a 1 an
Parent
commit
0602397552

+ 4 - 5
internal/controller/callback.go

@@ -4,6 +4,7 @@ import (
 	"ElectronicInvoice/internal/service"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/net/ghttp"
+	"github.com/gogf/gf/v2/util/gconv"
 	"net/url"
 	"strings"
 )
@@ -38,10 +39,8 @@ func CallBack(r *ghttp.Request) {
 			}
 			service.JyInvoiceManager.ScanLogin <- flag
 		case "quit":
-			t := r.Get("taskType").String()
-			data := r.Get("data").String()
-			g.Dump("quit--", data)
-			switch t {
+			qData := gconv.Map(r.Get("data"))
+			switch qData["taskType"] {
 			case "2": //电子发票开具
 				service.JyInvoiceManager.ReleasePool() //可进行下次开票请求
 				g.Log().Infof(ctx, "开具发票结束")
@@ -51,7 +50,7 @@ func CallBack(r *ghttp.Request) {
 				service.JyInvoiceManager.ReleasePool() //可进行下次开票请求
 				g.Log().Infof(ctx, "发票冲红结束")
 			default:
-				g.Log().Infof(ctx, "未知回调任务退出 %d", t)
+				g.Log().Infof(ctx, "未知回调任务退出 %d", qData)
 			}
 		default:
 			g.Log().Infof(ctx, "未设置消息回调:%s", callType)

+ 0 - 1
internal/service/invoiceCallback.go

@@ -102,7 +102,6 @@ func selfInvoicing(ctx context.Context, orderCode string) {
 	res, err := g.DB().GetOne(ctx, "SELECT GROUP_CONCAT(order_code) as  order_code  from invoice where only_Identifying=?", orderCode)
 	if err != nil {
 		g.Log().Errorf(ctx, "自助开票异常")
-
 	}
 	orderArr := strings.Split(gconv.String(res["order_code"]), ",")
 	for _, v := range orderArr {

+ 2 - 2
internal/service/invoiceManager.go

@@ -220,7 +220,7 @@ func (im *InvoiceManager) selfMakeInvoice(ctx context.Context) (total, okNum int
 		var (
 			orderCode = gconv.String(m["only_Identifying"])
 			iType     = gconv.String(m["invoice_type"])
-			prices    = gconv.String(m["invoice_money"])
+			prices    = gconv.Float64(m["invoice_money"]) / float64(100)
 			remark    = gconv.String(m["remark"])
 		)
 		c := MakeInvoiceData{
@@ -231,7 +231,7 @@ func (im *InvoiceManager) selfMakeInvoice(ctx context.Context) (total, okNum int
 			InvoiceArr: []MakeInvoiceItems{{
 				Xmmc:     g.Cfg().MustGet(ctx, "company.taxCode").String(), //开票项
 				WhStatus: 1,                                                //开票项是否维护
-				Je:       prices,                                           //金额
+				Je:       strconv.FormatFloat(prices, 'f', -1, 64),         //金额
 				Sl:       "1",                                              //数量
 			}},
 		}