Jelajahi Sumber

修正收单统计

icole 4 tahun lalu
induk
melakukan
456566e77f

+ 1 - 1
i2bill.api

@@ -213,7 +213,7 @@ service i2bill-api {
 
 service i2bill-api{
 	@handler AcquirerStudentPage
-	post /api/v1/acquirer_student/page() returns(Response)
+	get /api/v1/acquirer_student/page returns(Response)
 	
 	@handler AcquirerStudentTotal
 	get  /api/v1/acquirer_student/total returns(Response)

+ 1 - 1
internal/handler/routes.go

@@ -104,7 +104,7 @@ func RegisterHandlers(engine *rest.Server, serverCtx *svc.ServiceContext) {
 	engine.AddRoutes(
 		[]rest.Route{
 			{
-				Method:  http.MethodPost,
+				Method:  http.MethodGet,
 				Path:    "/api/v1/acquirer_student/page",
 				Handler: acquirer_student.AcquirerStudentPageHandler(serverCtx),
 			},

+ 14 - 1
internal/logic/acquirer_student/acquirer_student_total_logic.go

@@ -61,7 +61,20 @@ func (l *AcquirerStudentTotalLogic) AcquirerStudentTotal() (*types.Response, err
 	var target int64
 	l.svcCtx.DB.Table("i2bill_mkt_part_time_user").Select("target").Where("user_id = ? and del_flag = 0", userId).Get(&target)
 	var res = make(map[string]interface{})
-	res["check_total"] = totalByCheck
+	var invalide, untreated, valide int64
+	for _, t := range totalByCheck {
+		switch t["check_state"].(int64) {
+		case 54, 56, 59:
+			untreated += t["total"].(int64)
+		case 57:
+			valide += t["total"].(int64)
+		case 58:
+			invalide += t["total"].(int64)
+		}
+	}
+	res["invalide"] = invalide
+	res["untreated"] = untreated
+	res["valide"] = valide
 	res["today_total"] = totalDay[0]["total"]
 	res["target"] = target
 	return &types.Response{200, "", res}, nil

+ 5 - 2
internal/logic/base_organ/get_erp_city_tree_logic.go

@@ -28,6 +28,9 @@ func (l *GetErpCityTreeLogic) GetErpCityTree() (*types.Response, error) {
 	// todo: add your logic here and delete this line
 	ctx := context.Background()
 	in := new(transform.Empty)
-	l.svcCtx.Transformer.GetErpCityTree(ctx, in)
-	return &types.Response{}, nil
+	res, err := l.svcCtx.Transformer.GetErpCityTree(ctx, in)
+	if err != nil {
+		return &types.Response{500, err.Error(), nil}, nil
+	}
+	return &types.Response{200, "", res}, nil
 }

+ 2 - 2
internal/logic/logic_test.go

@@ -12,10 +12,10 @@ import (
 func TestCreateJWT(t *testing.T) {
 	l := new(auth.LoginByWeixinLogic)
 	payloads := map[string]interface{}{
-		"userId":     5,
+		"userId":     3,
 		"sessionKey": "sessionKey",
 	}
-	fmt.Println(l.CreateJWT(1624415746, "6hy789iu87", payloads, 604800))
+	fmt.Println(l.CreateJWT(1625045504, "6hy789iu87", payloads, 604800))
 }
 
 func TestRflect(t *testing.T) {

+ 0 - 0
sqlconfig/i2bill_acquirer_student/i2bill_acquirer_studentr_page_count.tpl → sqlconfig/i2bill_acquirer_student/i2bill_acquirer_student_page_count.tpl