🍒 refactor(WorkWeixin): 优化服务配置和特性配置校验
This commit is contained in:
parent
0b927e2b58
commit
67b8c7f0e4
@ -55,9 +55,11 @@ public class WorkWxBaseService(
|
||||
public async Task<R> SendAsync<T, R>(T input) where R : BaseWorkWxOutput
|
||||
{
|
||||
var opt = options.Value.WorkWeixin;
|
||||
if (opt == null || string.IsNullOrWhiteSpace(opt.BaseAddress)) throw Oops.Oh("[企业微信] 服务配置缺失");
|
||||
|
||||
var attr = typeof(T).GetCustomAttribute<HttpRemoteApiAttribute>();
|
||||
if (attr == null || string.IsNullOrWhiteSpace(attr.Action) || string.IsNullOrWhiteSpace(attr.Desc))
|
||||
throw Oops.Oh($"接口入参类型({typeof(T).FullName})未正确配置[HttpRemoteApi]特性");
|
||||
if (attr == null || string.IsNullOrWhiteSpace(attr.Action as string))
|
||||
throw Oops.Oh("[企业微信] 接口入参未正确配置[HttpRemoteApi]特性");
|
||||
|
||||
// 拼接请求地址,并设置token
|
||||
var url = opt.BaseAddress + $"/cgi-bin/{attr.Action}?";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user