ctugo

package module
v0.0.0-...-7b5afc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

README

ctugo

golang SDK for ctu product

Build Status

Example

package main

import (
	"log"
	"github.com/dingxiangtech/ctugo"
)

func main() {
	conn := ctugo.NewEngineConnection("http://127.0.0.1:7776/ctu/event.do", "05622f1ab6be69567d65a6e377edfef0", "b2a8a90190fff591bd93bfd99e268438")
	resp, err := conn.CallRiskEngine("marketing_evt2", "marketing_evt2", map[string]interface{}{"ip": "1.2.3.4", "email": "abc@def.com"})
	log.Println(resp)  // &{4fbd05d5-5fc8-44d8-8399-de0018d4e6fc INVALID_REQUEST_PARAMS {ACCEPT  []   [] [] marketing_evt map[_cost_time:1 _error_policy:[优惠券 归属地冲突注册限制] _rule_eval_error:[ruleId=128, seqNumber=1, missing params:ext_youhuiid=null  ruleId=129, seqNumber=1, missing params: ext_phonelocation=null] _success_execute:true] map[]}}
	log.Println(err)  // nil
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineConnection

type EngineConnection struct {
	URLWithoutSign string

	Host      string
	AppKey    string
	AppSecret string
}

EngineConnection object of engine pet tester

func NewEngineConnection

func NewEngineConnection(host, appKey, appSecret string) *EngineConnection

NewEngineConnection generate a new EngineConnection object

func (*EngineConnection) CallRiskEngine

func (e *EngineConnection) CallRiskEngine(eventCode string, flag string, fields map[string]interface{}) (*EngineResponse, error)

CallRiskEngine is used to send request to ctu engine, and got EngineResponse and error

type EngineResponse

type EngineResponse struct {
	UUID   string       `json:"uuid"`
	Status string       `json:"status"`
	Result engineResult `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL