概述:

编辑器对活动主办方提供针对用户是否具有参与资格、作品访问资格、领取奖品资格等提供鉴权。此功能中活动h5会发送自定义鉴权参数到对应鉴权接口(见下方鉴权接口协议部分)进行鉴权,具体接口需要主办方自行实现。

我需要准备什么?

  1. 本授权功能需接入方企业先在营销云开通 “数据集成” 模块,并获得 “自建应用” 的使用权限。

  2. 自建应用内申请开通 编辑器 → 自定义接口鉴权,后续联系管理员审核通过。应用配置界面如下:



    添加后,点击“编辑”进入对应设置页


    注意:此处如果需要自定义外部的校验参数,需勾选”外部接口回调“选项进行配置,具体配置如下




  3. 完成配置后,点击“保存”即可。

  4. 在编辑器中,可在作品预览页面开启作品访问限制鉴权,或在活动玩法配置中对应限制选项中进行配置,配置界面如下:



  5. 此配置案例下,在用户访问作品时,会调用主办方配置的鉴权接口,发送在数据集成自定义接口鉴权中配置好的字段,通过接口返回结果来判断用户是否具有作品访问资格。

外部接口鉴权api参数说明

外部接口请求方法请求参数返回结构请求示例
获取鉴权条件GET-
{
	"code": "200",
	"msg": "ok",
	"data": [
		{
			"label": "范围",
			"type": "area",
			"value": "",
			"children": [
				{
					"value": "80"
				},
				{
					"value": "100"
				}
			]
		},
{
			"label": "时间范围",
			"type": "dateTimeRange",
			"value": "",
			"children": [
				{
					"value": "YYYY-MM-DD HH:mm"
				},
				{
					"value": "YYYY-MM-DD HH:mm"
				}
			]
		},
		{
			"label": "性别",
			"type": "checkbox",
			"value": "",
			"children": [
				{
					"label": "男",
					"value": "1"
				},
				{
					"label": "女",
					"value": "2"
				}
			]
		},
		{
			"label": "部门",
			"value": "",
			"type": "select",
			"children": [
				{
					"label": "A部门",
					"value": "a"
				},
				{
					"label": "B部门",
					"value": "b"
				},
				{
					"label": "C部门",
					"value": "c"
				}
			]
		},
		{
			"label": "年龄",
			"type": "number",
			"value": "18",
			"children": []
		},
		{
			"label": "分类",
			"type": "cascader",
			"value": "",
			"children": [
				{
					"label": "项目分组",
					"value": "project_group",
					"children": [
						{
							"label": "新客户",
							"value": "1"
						},
						{
							"label": "未成交老客户",
							"value": "2"
						}
					]
				},
				{
					"label": "经纪人分组",
					"value": "broker_group",
					"children": [
						{
							"label": "自由合伙人",
							"value": "9004"
						},
						{
							"label": "代理公司",
							"value": "9003"
						}
					]
				}
			]
		}
	]
}

参数说明

label:标签名称

value:标签值

type:文本 text,数值 number,多选 select,单选 checkbox,区间 area ,级联 cascader

children:子集(只有在级联、多选、单选、区间类型时才不为空)

https://editor.test.rabbitpre.com/api/editor/proxy/thirddata/api/xxx/cms/getAuthConditions


保存通知接口POST
字段名称字段类型是否必传字段说明
userIdstringtrue当前用户id。透传到客户侧的参数
componentIdstringfalse
当前作品下玩法组件ID。透传到客户侧的参数
appIdstringfalse兔展作品ID。透传到客户侧的参数,该值是否一定有值和作品(玩法)的保存顺序有关
authScopenumbertrue

默认值 0。

0:玩法资格配置,

1:作品访问限制资格配置,

2:流程策略资格配置

externalConfigIdstringfalse外部配置id(传空代表新增配置,不为空代表修改配置)。也即该接口响应返回的configId字段值
settingData
Array<Object>false
└─ labelstringtrue名称
└─ namestringtrue标识
└─ valueObjecttrue值。不同的type值对应不同数据格式的value,参考示例。type为text、number的value值是string
└─ typestringfalse文本 text,数值 number,多选 select,单选 checkbox,区间 area ,级联 cascader dateTimeRange
└─ operatorstringfalse

ALL : 全部,IN : 其中之一,
EQ : 等于,GT : 大于,GTEQ : 大于等于,LT : 小于,LTEQ : 小于等于,NEQ :不等于

type为cascader、select、number时为空
sceneTypestringfalse玩法类型:

Award-领奖,Lottery-抽奖,Help-助力,Team-组队,Reserve-预约,Signin-签到,Question-问卷,Answer-答题,Vote-投票,Game-游戏,Task-任务,Points-积分,Seckill-秒杀,GroupBuying-拼团,Tzappid-作品级

{
	"code:" 200,
	"data": {
		// 外部接口返回的配置id
		"configId": "aaa-bbb-ccc"
	}
}


https://editor.test.rabbitpre.com/api/editor/proxy/thirddata/api/xxx/cms/saveNotice

 

入参:

{
	"settingData": [{
			"label": "职业文本",
			"type": "text",
			"name": "professiontext",
			"value": "文本的值"
		},
		{
			"label": "用户身份数值",
			"type": "number",
			"name": "userFlagNumber",
			"operator": "EQ",
			"value": "9527"
		},
		{
			"label": "性别",
			"type": "select",
			"name": "gender",
			"operator": "IN",
			"value": [
				"1"
			]
		},
		{
			"label": "是否新客户",
			"type": "checkbox",
			"name": "isCustomer",
			"value": "1"
		},
		{
			"label": "人生阶段",
			"type": "select",
			"name": "lifeStage",
			"operator": "IN",
			"value": [
				"1",
				"2",
				"3",
				"4"
			]
		},
		{},
		{
			"label": "城市",
			"type": "cascader",
			"name": "city",
			"operator": "IN",
			"value": [{
					"label": "北京市",
					"value": "北京市",
					"type": null,
					"children": [{
						"label": "北京市",
						"value": "北京市",
						"type": null,
						"children": null
					}]
				},
				{
					"label": "天津市",
					"value": "天津市",
					"type": null,
					"children": [{
						"label": "天津市",
						"value": "天津市",
						"type": null,
						"children": null
					}]
				}
			]
		}, {
			"label": "城市",
			"type": "cascader",
			"name": "city",
			"operator": "IN",
			"value": ["北京市", "天津"]
		}
	]
}],
"externalConfigId": "",
"userId": "2a40a6c6-7379-4961-9088-cb9a071f3a55",
"componentId": "31bc2f36-c5de-4c34-adf6-c967a92561b8",
"sceneType": "Tzappid",
"appId": "31bc2f36-c5de-4c34-adf6-c967a92561b8",
"authScope": 1
}


 

 

 






鉴权接口协议:

鉴权接口完整URL:自建应用方自己的 domain+URI

例如: https://aa.bb.com/api/xx/checkUserAuth

接口协议:HTTPS

HTTP请求方式:POST

consumes :application/json

produces :application/json

接口响应时间:3秒以内,最好能达到百毫秒级,满足高并发场景。活动H5方调用鉴权接口最多等待3秒,超过3秒没有响应,自动放弃请求,判定为鉴权失败。


接口参数说明表:

字段名称

字段类型

是否必传

字段说明

interfaceName

stringtrue接口鉴权名称

checkType

stringfalse

校验类型: 

false:自定义设置 

true:外部接口回调

externalConditionUrl

stringfalse外部接口回调-获取鉴权条件URL

externalInformUrl

stringfalse外部接口回调-保存通知接口

externalConfigId

stringfalse外部接口配置的ID
userParamObjecttrue用户参数。对应自建应用中的系统参数中的固定参数
└─ audidstringtrue客户档案id
└─ openidstringfalseopenid
└─ appIdstringtrue作品id
└─ componentIdstringfalse组件id
└─ flowIdstringfalse流程策略id
└─ appInstanceIdstringfalse自建应用的id
└─ identityIdstringfalse自建应用的识别的身份id
└─ identityTypestringfalse自建应用的身份类型
└─ realName stringfalse真实姓名
└─ phone   stringfalse手机号码
└─ addressstringfalse地址信息
└─ devicestringfalse手机型号 ios/Android
└─ markFlagintegerfalse

是否星标 1 0

└─ payFeaturestringfalse消费特点
└─ sexintegerfalse性别 1男 2女
└─ identitysArrayfalse用户多身份信息
     └─ identityId stringfalse自建应用的识别的身份id。platform=EXTERNAL(自建应用)
     └─ identityType stringfalse自建应用的身份类型。platform=EXTERNAL(自建应用)
     └─ fromTostringfalse标识来源
     └─ platformstringfalse标识来源平台。平台标识,gzh(微信公众号)、contentminiapp(微信小程序)、EXTERNAL(自建应用)
     └─ openidstringfalseopenid (当 fromTo 为 gzh(微信公众号) 时,openid有值)
     └─ unionidstringfalseunionid (当 fromTo 为 gzh(微信公众号) 时,unionid有值)

     └─ jcappid

Long

true系统集成Id
     └─ appid stringfalse公众号appid

└─ customFields

Arrayfalse

自定义字段可能会存在多个。对应工作台中的用户-字段管理中的字段

此参数已删除

     └─ fieldId

stringfalse

自定义字段ID

     └─ fieldType

stringfalse

自定义字段类型 1 文本输入(默认) 2 单选 3 复选 4 数值

     └─ fieldValue

Arrayfalse

自定义字段值

authParams

Arraytrue鉴权参数集合。对应工作台中的校验参数列表,用于客户侧校验的字段
└─ chineseNamestringtrue参数中文名
└─ englishNamestringtrue参数英文名

└─ paramType

stringtrue

参数类型:

文本-text,数值-number,多选-select,单选-checkbox,区间-area

(文本:可输入string类型,支持字母+数字+下划线+中文

数值:支持双精度小数,整数;支持大于、大于等于、小于等于、小于、区间(闭区间) 

单选、复选: 取值 选项标识参数值去string类型,单选仅满足其中之一;复选可以满足所有选项,也可满足其中之一 )

└─ valuesObjectfalse

参数值

└─ option

Arrayfalse多选值
     └─ keystringfalse复选框key
     └─ valuestringfalse复选框value
└─ operatorstringfalse操作符(EQ(相等)、GT(大于)、GTEQ(大于等于)、LT(小于)、LTEQ(小于等于)、NEQ(不等)、IN(在枚举范围内)、ALL(全部)、BETWEEN(范围比较) )
externalExtras
Objectfalse外部扩展参数
└─ key1Stringfalse外部参数key1,根据实际传递的参数
└─ key2Stringfalse外部参数key2,根据实际传递的参数

接口响应参数说明:

Field

Type

Description

Required

code

string

响应状态码。

200 : 成功。非200都是失败

true

msg

string

响应状态描述

true

data

object

数据。"true"

true

errorCodestring

错误状态码。

如果code返回非200,建议接口提供方必填

false


请求参数示例:

{
    "interfaceName": "接口通过",
    "checkType":true,
    "externalConditionUrl":"",
    "externalInformUrl":"",
    "externalConfigId": "7697ac58-0e30-4111-a169-9c96023aacf8",
    "externalConfigOperator": "ALL",
    "externalConfigValues": [
        [
            "shenfen"
        ]
    ],
    "userParam": {
        "audid": "720332229959618560",
        "openid": "wx35c610c7c049ce8287-8",
        "appId":"xxxxxxx",
        "componentId":"xxxxxxx",
        "flowId":"xxxxxxx",
        "appInstanceId": "自建应用的id",
        "identityId": "12345678",
        "identityType": "customerNo;",
        "phone": "18777777777",
        "realName": "张三",
        "address": "广东省深圳市南山区",
        "device": "ios/Android",
        "markFlag": "1",
        "payFeature": "厉害",
        "sex": "1"
    },
    "authParams": [
        {
            "chineseName": "开始日期",
            "englishName": "start_date",
            "paramType": "text",
            "values": "2021-07-01",
            "operator": null,
            "option": [],
        },
        {
            "chineseName": "结束日期",
            "englishName": "end_date",
            "paramType": "text",
            "values": "2021-07-31",
            "operator": null,
            "option": [],
        },
        {
            "chineseName": "首次办理",
            "englishName": "first_deal",
            "paramType": "select",
            "values": "1",
            "operator": null,
            "option": [],
        },
		{
			"chineseName": "111",
			"englishName": "aa",
			"option": [],
			"paramType": "number",
			"values": "222",
			"operator": "EQ"
		},
		{
			"chineseName": "版本",
			"englishName": "bb",
			"option": [
				{
					"key": "我",
					"value": "哈哈"
				},
				{
					"key": "你",
					"value": "哦哦发"
				}
			],
			"paramType": "checkbox",
			"values": "我"
		},
		{
			"chineseName": "此次",
			"englishName": "cc",
			"option": [],
			"paramType": "area",
			"values": [
				20,
				202
			]
		},
{
			"chineseName": "此次",
			"englishName": "cc",
			"option": [],
			"paramType": "dateTimeRange",
			"values": [
				20,
				202
			]
		},
		{
			"chineseName": "外部接口参数",
			"englishName": "externalInterface",
			"paramType": "cascader",
			"option": [
				{
					"label": "小程序分组",
					"value": "mini_app_group",
					"type": null,
					"children": [
						{
							"label": "小程序新客",
							"value": "500500",
							"type": null,
							"children": []
						},
						{
							"label": "单位人员",
							"value": "7000661",
							"type": null,
							"children": []
						}
					]
				}
			],
			"values": [
				[
					"mini_app_group"
				]
			],
			"operator": "IN"
		}
    ],
    "externalExtras":{
      "key1":"value1",
    "key2":"value2"
   }
}



返回结果示例:

{
    "code":"200",
    "msg":"鉴权成功",
    "data": "true",
    "errorCode" : ""
}


  • 无标签