{ "Name": "请求令牌", "Enabled": true, "Triggers": [ { "$type": "Forguncy.SaveLoad.InvokeTriggerSaveData, ServerDesignerCommon", "Parameters": [ { "Name": "用户名", "DataValidationInfo": { "IgnoreBlank": false }, "TestData": "cuckooent" }, { "Name": "强制刷新", "DataValidationInfo": {} } ], "InvokeTriggerTestData": { "UserName": "Administrator" } } ], "Commands": [ { "$type": "JsonUtilityCommand.JsonDeserializeCommand, JsonUtilityCommand", "JsonString": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=全局_Gitee" }, "SampleJson": "{\r\n \"client_id\": \"c7d05fcbaf78ad728fcc0267d081ae6c50dc667667758a0933525d4cbe09ed90\",\r\n \"client_secret\": \"b4d40db2155ca530e5771b37a2fb67161d4106c64df28f32504b4e3bcfb81313\"\r\n}", "ToParameter": "Gitee配置" }, { "$type": "Forguncy.Model.Commands.SetParameterCommand, ServerDesignerCommon", "ParameterName": "当前用户", "TableValue": { "TableName": "用户信息视图", "TableValueType": 1, "BindingInfos": [ { "GUID": "74dd4d3e-636e-4f65-acce-33a26d73a725", "BindingInfo": { "TableName": "用户信息视图", "ColumnName": "GIT用户名", "GUID": "b5cb5c70-a2b4-4bd5-9119-de8f051e11e3" }, "ColumnName": "GIT用户名" }, { "GUID": "109cbeb8-ba05-40af-b2a2-020b88398ce7", "BindingInfo": { "TableName": "用户信息视图", "ColumnName": "GIT密码", "GUID": "362d763e-4b69-41aa-8348-46b900979739" }, "ColumnName": "GIT密码" } ], "SqlCondition": { "$type": "ForguncyDataAccess.GeneralCESqlCondition, ForguncyDataAccess", "ColumnBindingInfo": { "TableName": "用户信息视图", "ColumnName": "用户名", "GUID": "2e48d49d-9f9f-4b78-864d-cef6a8cc171f" }, "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=用户名" } }, "TopCount": "1" }, "ID": "261743f5d31b4b9bb40716e2ec8b01b8" }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "ForguncyDataAccess.RelationSqlCondition, ForguncyDataAccess", "SubConditions": [ { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT用户名" } }, "value": "%Null%", "compareType": 1 }, { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT密码" } }, "value": "%Null%", "compareType": 1 } ] }, "CommandList": [ { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "ForguncyDataAccess.RelationSqlCondition, ForguncyDataAccess", "SubConditions": [ { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=Gitee配置.client_id" } }, "value": "%Null%", "compareType": 1 }, { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=Gitee配置.client_secret" } }, "value": "%Null%", "compareType": 1 } ] }, "CommandList": [ { "$type": "CacheOperationCommand.CacheGetCommand, CacheOperationCommand", "CacheKeyStr": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT用户名&\"_\"&\"_Gitee_access_token\"" }, "ParamName": "获取缓存TOKEN" }, { "$type": "Forguncy.Model.ConditionCommand, ServerDesignerCommon", "ConditionAndCommandPairList": [ { "Condition": { "$type": "ForguncyDataAccess.RelationSqlCondition, ForguncyDataAccess", "SubConditions": [ { "$type": "Forguncy.Model.IfCondition, ServerDesignerCommon", "param": { "$type": "Forguncy.Model.IfConditionServerSiteParam, ServerDesignerCommon", "ParamObject": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=获取缓存TOKEN" } }, "value": "%Null%", "compareType": 1 }, { "$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.ReturnCommand, ServerDesignerCommon", "ErrorCode": "0", "Message": "获取缓存TOKOEN成功", "CustomReturns": [ { "ReturnPropertyName": "最新令牌", "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=获取缓存TOKEN" } } ] } ], "ID": "7865b2e7-8ccf-486d-ba5a-68e7d760c331" }, { "CommandList": [ { "$type": "Forguncy.Model.CatchExceptionCommand, ServerDesignerCommon", "TryCommandPart": { "CommandList": [ { "$type": "PostDataToWebApi.PostDataCommand, PostDataToWebApi", "PostData": { "DataItemType": 1, "Data": { "$type": "PostDataToWebApi.ObjectData, PostDataToWebApi", "Data": [ { "Name": "grant_type", "DataItemType": 0, "Data": "password" }, { "Name": "username", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT用户名" } }, { "Name": "password", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT密码" } }, { "Name": "client_id", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=Gitee配置.client_id" } }, { "Name": "client_secret", "DataItemType": 0, "Data": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=Gitee配置.client_secret" } }, { "Name": "scope", "DataItemType": 0, "Data": "user_info projects pull_requests issues notes keys hook groups gists enterprises" } ] } }, "JsonString": "", "WebUrl": "https://gitee.com/oauth/token", "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": "SaveFormData.fillInJSONProperties, SaveFormData", "FullJsonString": "{\r\n \"error\": \"invalid_grant\",\r\n \"error_description\": \"授权方式无效,或者登录回调地址无效、过期或已被撤销\",\r\n \"access_token\": \"5c7c5fe2b1f0fc025c1a38006b6e95f3\",\r\n \"token_type\": \"bearer\",\r\n \"expires_in\": 86400,\r\n \"refresh_token\": \"03be42668ee199713604ff75491eeb0904a665d069de178c6c8f73c0a50a6ab6\",\r\n \"scope\": \"user_info projects pull_requests issues notes keys hook groups gists enterprises\",\r\n \"created_at\": 1718241807\r\n}", "SourceJson": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=result" }, "ResultTo": "RES" }, { "$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": "=RES.error" } }, "value": "%Null%" }, "CommandList": [ { "$type": "CacheOperationCommand.CacheAddCommand, CacheOperationCommand", "CacheKeyStr": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=当前用户.GIT用户名&\"_\"&\"_Gitee_access_token\"" }, "CacheValue": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=RES.access_token" }, "CacheSeconds": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=RES.expires_in" }, "ParamName": "缓存结果" }, { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "0", "Message": "获取最新TOKEN成功", "CustomReturns": [ { "ReturnPropertyName": "最新令牌", "Value": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=RES.access_token" } } ] } ], "ID": "ae11d952-819c-4a9c-8ea5-3d1fa00c2a5b" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=result.error" }, "Message": { "$type": "Forguncy.Model.FormulaReferObject, ServerDesignerCommon", "SerializeProperty": "=result.error_description" }, "CustomReturns": [ { "ReturnPropertyName": "最新令牌" } ] } ], "ID": "49d139cd-c0d1-4bf4-99ef-1904c6842a84" } ] } ] }, "CatchCommandPart": { "CommandList": [ { "$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" }, "CustomReturns": [ { "ReturnPropertyName": "最新令牌" } ] } ] } } ], "ID": "8ddfb90f-3fb6-4561-950d-b1b6cee04bb9" } ] } ], "ID": "ad68ffe5-0b5c-4467-b56f-f066062c4361" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "400", "Message": "未配置Git应用", "CustomReturns": [ { "ReturnPropertyName": "最新令牌" } ] } ], "ID": "e250f7a9-8b5e-4dd9-90a5-d4ec0248c612" } ] } ], "ID": "76875b4b-7d4c-4c17-bd15-bd3a3051819e" }, { "CommandList": [ { "$type": "Forguncy.Model.ReturnCommand, ServerDesignerCommon", "ErrorCode": "400", "Message": "用户未配置Gitee登录账号", "CustomReturns": [ { "ReturnPropertyName": "最新令牌" } ] } ], "ID": "841634f8-211a-4eef-a3a5-6365048ecdaa" } ] } ], "ReturnProperties": [ { "Name": "最新令牌" } ] }