{ "Name": "创建一个仓库WebHook", "Enabled": true, "Triggers": [ { "$type": "Forguncy.SaveLoad.PostRequestTriggerSaveData, ServerDesignerCommon", "Permission": { "PermissionData": { "$type": "Forguncy.RbacPermission.Core.Impl.ServerCommand.ServerCommandPermissionData, Forguncy.RbacPermission.Core", "permissionResource": { "$type": "Forguncy.RbacPermission.Core.Impl.ServerCommand.ServerCommandPermissionResource, Forguncy.RbacPermission.Core" }, "permissionBindings": [ { "$type": "Forguncy.RbacPermission.Core.Impl.ServerCommand.ServerCommandPermissionBinding, Forguncy.RbacPermission.Core", "roleNames": [ "FGC_LoginUser" ] } ] } }, "Parameters": [ { "Name": "仓库ID", "DataValidationInfo": { "IgnoreBlank": false }, "TestData": "gyrnccc" }, { "Name": "用户名", "DataValidationInfo": { "IgnoreBlank": false }, "TestData": "Administrator" }, { "Name": "回调地址", "DataValidationInfo": {} } ], "InvokeTriggerTestData": { "UserName": "Administrator" } } ], "Commands": [ { "$type": "JsonUtilityCommand.JsonDeserializeCommand, JsonUtilityCommand", "JsonString": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=全局_Gitee" }, "SampleJson": "{\"client_id\":\"c7d05fcbaf78ad728fcc0267d081ae6c50dc667667758a0933525d4cbe09ed90\",\"client_secret\":\"b4d40db2155ca530e5771b37a2fb67161d4106c64df28f32504b4e3bcfb81313\",\"回调地址\":\"https://develop.gridfriend.cn/sims/ServerCommand/GitCallback\"}", "ToParameter": "Gitee配置" }, { "$type": "Forguncy.Model.Commands.SetParameterCommand, ServerDesignerCommon", "ParameterName": "当前用户", "TableValue": { "TableName": "用户信息视图", "TableValueType": 1, "BindingInfos": [ { "GUID": "c26e601c-dffb-46f1-be97-ce46d5deadcc", "BindingInfo": { "TableName": "用户信息视图", "ColumnName": "GIT用户名", "GUID": "a7631324-378f-4577-a8af-d976f21cda27" }, "ColumnName": "GIT用户名" }, { "GUID": "b594d85c-3422-4cb3-a063-69e472c32537", "BindingInfo": { "TableName": "用户信息视图", "ColumnName": "GIT密码", "GUID": "523d4df5-59b6-4437-b68b-661078b7bab5" }, "ColumnName": "GIT密码" } ], "SqlCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "用户信息视图", "ColumnName": "用户名", "GUID": "86de2db8-485a-4991-bb27-80ceb2d895c8" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=用户名" } }, "NullFormulaValueQueryPolicy": 0, "TopCount": "1" }, "ID": "ea6babeddf554a1eb8f46e195877e952" }, { "$type": "Forguncy.Model.Commands.SetParameterCommand, ServerDesignerCommon", "ParameterName": "仓库", "TableValue": { "TableName": "Git仓库表", "TableValueType": 1, "BindingInfos": [ { "GUID": "0a505d22-ea26-4dc6-b902-96c42172d2b9", "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "仓库路径名", "GUID": "2c41e2fb-0784-4414-a2f6-e7bf48e1a825" }, "ColumnName": "仓库路径名" }, { "GUID": "121fa6ba-4747-40c0-b487-a07c961bfc2e", "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "空间路径名", "GUID": "a4dc7e40-113c-4634-a254-bd3d364169e2" }, "ColumnName": "空间路径名" }, { "GUID": "503ebf75-30bd-4a66-a195-648da8f8fc6e", "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "Callback_url", "GUID": "b34b70ae-08b3-4667-be01-afce405fb9bc" }, "ColumnName": "hook_url" }, { "GUID": "86dc894b-ec40-4338-9790-00d444e8415b", "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "hook_api_url", "GUID": "e2132ce0-b395-4f03-8d7d-f8ed3bea93f0" }, "ColumnName": "hook_api_url" }, { "GUID": "a05ca3bf-0ba0-4492-ba0c-214241c0d440", "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "订阅成功", "GUID": "01bbed57-b961-4d6b-b4ee-dba6636960af" }, "ColumnName": "绑定成功" } ], "SqlCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "Git仓库表", "ColumnName": "仓库ID", "GUID": "7aa0116e-f6a8-4a54-9dc1-10755107fdf9" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库ID" } }, "NullFormulaValueQueryPolicy": 0, "TopCount": "1" }, "ID": "1b4300438e784c359a61002851e79412" }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库" } }, "value": "%Null%", "compareType": 1 }, "CommandList": [ { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库.绑定成功" } }, "value": "1", "compareType": 1 }, "CommandList": [ { "$type": "Forguncy.Model.RequestServerCommand, ServerDesignerCommon", "ServerCommandName": "列出仓库的WebHooks", "Parameters": [ { "$type": "Forguncy.Model.RequestServerCommandObjectParam, ServerDesignerCommon", "ParamName": "仓库ID", "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库ID" } }, { "$type": "Forguncy.Model.RequestServerCommandObjectParam, ServerDesignerCommon", "ParamName": "用户名", "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=用户名" } } ], "ResultErrorCodeTo": { "SerializeProperty": "code" }, "ResultMessageTo": { "SerializeProperty": "msg" }, "ReturnPropertiesTo": [ { "ResultPropertyName": "钩子列表", "ResultTo": { "SerializeProperty": "钩子列表" } }, { "ResultPropertyName": "ACCESS_TOKEN", "ResultTo": { "SerializeProperty": "ACCESS_TOKEN" } } ], "RefreshAfterFinish": true, "CheckDataValidation": true }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=code" } }, "value": "0" }, "CommandList": [ { "$type": "Forguncy.Model.Commands.SetParameterCommand, ServerDesignerCommon", "ParameterName": "查找钩子", "ID": "6f7ee52d7d6d4a18b64e15dc1131d859" }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=钩子列表.Count" } }, "value": "0", "compareType": 2 }, "CommandList": [ { "$type": "CollectionOperationKit.ServerSideArrayQuery, CollectionOperationKit", "InParamater": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=钩子列表" }, "Operation": 1, "OperationParamaterPairs": [ { "Name": "url", "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库.hook_url" } } ], "OutParamaterName": "查找钩子" } ], "ID": "b3b57df5-ecb6-42fa-bb73-c215f88d56cb" } ] }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=查找钩子" } }, "value": "%Null%" }, "CommandList": [ { "$type": "Forguncy.Model.CatchExceptionCommand, ServerDesignerCommon", "TryCommandPart": { "CommandList": [ { "$type": "Forguncy.Model.ServerTransactionCommand, ServerDesignerCommon", "CommandList": [ { "$type": "PostDataToWebApi.PostDataCommand, PostDataToWebApi", "PostData": { "DataItemType": 1, "Data": { "$type": "PostDataToWebApi.ObjectData, PostDataToWebApi", "Data": [ { "Name": "access_token", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=ACCESS_TOKEN" } }, { "Name": "url", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=IF(回调地址=\"\",Gitee配置.回调地址,回调地址)" } }, { "Name": "encryption_type", "DataItemType": 0, "Data": 0 }, { "Name": "password", "DataItemType": 0, "Data": 6158891 }, { "Name": "push_events", "DataItemType": 0, "Data": true } ] } }, "JsonString": "", "WebUrl": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库.hook_api_url" }, "Method": "POST", "SuccessCallback": "// 请求成功返回的数据存储在“result”变量中\r\n// 请使用“result”变量来完成请求成功的回调 \r\n//console.log(result);", "ErrorCallback": "// 请求中发生的错误存储在“error”变量中\r\n// 请使用“error”变量来处理异常情况 \r\nconsole.error(error);", "NewParameter": "result", "Header": [], "Timeout": 100.0 }, { "$type": "Forguncy.Model.UpdateDataTableCommand, ServerDesignerCommon", "TableName": "Git仓库表", "ShowConfirm": false, "RowsToUpdate": 1, "RowsToUpdateCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "Git仓库表", "ColumnName": "仓库ID", "GUID": "421e0ce9-cf66-4deb-8fe6-f586f95a2d78" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库ID" } }, "UpdateBindingValues": [ { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "钩子ID", "GUID": "1f729556-f7f8-4aca-99f4-eece62450379" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=result.id" } }, { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "订阅成功", "GUID": "70fb1703-fd1e-482a-b1e0-5aa14fa8b8f2" }, "Value": "1" } ] } ] }, { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "0", "Message": "获取成功" } ] }, "CatchCommandPart": { "CommandList": [ { "$type": "Forguncy.Model.UpdateDataTableCommand, ServerDesignerCommon", "TableName": "Git仓库表", "ShowConfirm": false, "RowsToUpdate": 1, "RowsToUpdateCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "Git仓库表", "ColumnName": "仓库ID", "GUID": "421e0ce9-cf66-4deb-8fe6-f586f95a2d78" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库ID" } }, "UpdateBindingValues": [ { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "钩子ID", "GUID": "0262e00f-f0ad-4090-924a-be83852b83c7" } }, { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "订阅成功", "GUID": "2b24ccec-ece7-4e8c-bea9-d2ca6214f106" }, "Value": "0" } ] }, { "$type": "JsonUtilityCommand.JsonDeserializeCommand, JsonUtilityCommand", "JsonString": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=ExceptionMessage" }, "SampleJson": "{\"message\":\"\"}", "ToParameter": "错误信息" }, { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "400", "Message": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=错误信息.message" } } ] } } ], "ID": "760bd114-6783-442e-b507-7f0816d0e453" }, { "CommandList": [ { "$type": "Forguncy.Model.UpdateDataTableCommand, ServerDesignerCommon", "TableName": "Git仓库表", "ShowConfirm": false, "RowsToUpdate": 1, "RowsToUpdateCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "Git仓库表", "ColumnName": "仓库ID", "GUID": "421e0ce9-cf66-4deb-8fe6-f586f95a2d78" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=仓库ID" } }, "UpdateBindingValues": [ { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "钩子ID", "GUID": "50e8d8ee-ac9a-4a54-b82d-b18e2eb768b1" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=查找钩子.id" } }, { "BindingInfo": { "TableName": "Git仓库表", "ColumnName": "订阅成功", "GUID": "c949b79f-2827-437e-a0f6-e08aae9b7521" }, "Value": "1" } ] }, { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "0", "Message": "钩子已存在" } ], "ID": "0b33a654-854b-4b97-96bd-58fab4325427" } ] } ], "ID": "3c0f6f9d-fca7-471d-a936-547cb663e3b7" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "400", "Message": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=msg" } } ], "ID": "33aaf243-4c86-44fb-b88d-164bcd59956a" } ] } ], "ID": "9b734065-cb4d-4053-8f6c-9f038c68579a" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "0", "Message": "该仓库已绑定" } ], "ID": "75510043-7a63-49cb-99f6-438f3b19992f" } ] } ], "ID": "20a1f362-5334-4de1-b759-fe5daa25e6d6" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "400", "Message": "仓库不存在,请先同步仓库到系统中" } ], "ID": "1c9d0280-0f93-4e9f-8691-6443ba681b9f" } ] } ] }