/// <summary>获取用户信息</summary> /// <returns></returns> public override String GetUserInfo() { //return base.GetUserInfo(); if (UnionID.IsNullOrEmpty()) { return(null); } // 如果配置了企业级账号,可以获取更详细信息 var token = _ding_access_token; if (token.IsNullOrEmpty() || _ding_expire < DateTime.Now) { var key = Parameter.GetOrAdd(0, "钉钉", "appkey"); var secret = Parameter.GetOrAdd(0, "钉钉", "appsecret"); _ding_access_token = null; if (!key.Value.IsNullOrEmpty() && !secret.Value.IsNullOrEmpty()) { token = _ding_access_token = GetToken(key.Value, secret.Value); } _ding_expire = DateTime.Now.AddSeconds(7200 - 60); } if (!token.IsNullOrEmpty()) { try { // 根据UnionId换取员工Id var userid = GetUseridByUnionid(token, UnionID); if (!userid.IsNullOrEmpty()) { // 钉钉Id一般不是自己设置的,很乱,不可取 //client.UserName = userid; //client.GetUserInfo(token, userid); GetUserInfo(token, userid); } } catch (AggregateException ex) { // 某些用户不是本团队成员,此处会抛出异常 if (!(ex.GetTrue() is ApiException)) { throw; } } } return(null); }
public override int GetHashCode() { int hash = 1; if (opts_ != null) { hash ^= Opts.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Pwd.Length != 0) { hash ^= Pwd.GetHashCode(); } if (VertPwd != false) { hash ^= VertPwd.GetHashCode(); } if (Ip.Length != 0) { hash ^= Ip.GetHashCode(); } if (Time != 0L) { hash ^= Time.GetHashCode(); } if (Channel != 0) { hash ^= Channel.GetHashCode(); } if (Browser != 0) { hash ^= Browser.GetHashCode(); } if (Platform != 0) { hash ^= Platform.GetHashCode(); } if (UnionID.Length != 0) { hash ^= UnionID.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (Avatar.Length != 0) { hash ^= Avatar.GetHashCode(); } if (Gender != 0) { hash ^= Gender.GetHashCode(); } if (Money != 0) { hash ^= Money.GetHashCode(); } if (Diamoned != 0) { hash ^= Diamoned.GetHashCode(); } if (Rank != 0) { hash ^= Rank.GetHashCode(); } if (Exp != 0) { hash ^= Exp.GetHashCode(); } if (Champions.Length != 0) { hash ^= Champions.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (opts_ != null) { hash ^= Opts.GetHashCode(); } if (GcNID != 0UL) { hash ^= GcNID.GetHashCode(); } if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Ukey != 0) { hash ^= Ukey.GetHashCode(); } if (Channel != 0) { hash ^= Channel.GetHashCode(); } if (Browser != 0) { hash ^= Browser.GetHashCode(); } if (Platform != 0) { hash ^= Platform.GetHashCode(); } if (SessionKey.Length != 0) { hash ^= SessionKey.GetHashCode(); } if (UnionID.Length != 0) { hash ^= UnionID.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (Avatar.Length != 0) { hash ^= Avatar.GetHashCode(); } if (Gender != 0) { hash ^= Gender.GetHashCode(); } if (Money != 0) { hash ^= Money.GetHashCode(); } if (Diamoned != 0) { hash ^= Diamoned.GetHashCode(); } if (Rank != 0) { hash ^= Rank.GetHashCode(); } if (Exp != 0) { hash ^= Exp.GetHashCode(); } if (Champions.Length != 0) { hash ^= Champions.GetHashCode(); } if (ActorID != 0) { hash ^= ActorID.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }