Esempio n. 1
0
        /// <summary>
        /// 获取打卡结果
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public Attendance GetAttendance(string userIdList, DateTime workDateFrom, DateTime workDateTo, int offset, int limit)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var ids = new List <string>();

            ids.Add(userIdList);
            dic.Add("userIdList", ids);
            dic.Add("workDateFrom", workDateFrom.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("workDateTo", workDateTo.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("offset", offset.ToString());
            dic.Add("limit", limit.ToString());

            var response = HttpHelper.Post($"https://oapi.dingtalk.com/attendance/list?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <Attendance>(response.ToString()));
        }
Esempio n. 2
0
        /// <summary>
        /// 获取打卡详情
        /// </summary>
        /// <param name="userIds"></param>
        /// <returns></returns>
        public dynamic GetAttendanceListRecord(string userIdList, DateTime checkDateFrom, DateTime checkDateTo)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var ids = new List <string>();

            ids.Add(userIdList);
            dic.Add("userIds", ids);
            dic.Add("isI18n", "false");
            dic.Add("checkDateFrom", checkDateFrom.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("checkDateTo", checkDateTo.ToString("yyyy-MM-dd HH:mm:ss"));

            var response = HttpHelper.Post($"https://oapi.dingtalk.com/attendance/listRecord?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <dynamic>(response.ToString()));
        }
Esempio n. 3
0
        /// <summary>
        /// 发送工作消息
        /// </summary>
        /// <returns></returns>
        public dynamic GetCorpconversation(string userId, tongjiModel msg)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("agent_id", "248921930");
            dic.Add("userid_list", userId);
            dic.Add("msg", msg);
            var response = HttpHelper.Post($"https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <dynamic>(response.ToString()));
        }
Esempio n. 4
0
        /// <summary>
        /// 获取审批实例
        /// </summary>
        /// <param name="process_instance_id"></param>
        /// <returns></returns>
        public dynamic GetProcessInstance(string process_instance_id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("process_instance_id", process_instance_id);

            var response = HttpHelper.Post($"https://oapi.dingtalk.com/topapi/processinstance/get?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <dynamic>(response.ToString()));
        }
Esempio n. 5
0
        /// <summary>
        /// 批量获取审批实例id
        /// </summary>
        /// <param name="userid_list"></param>
        /// <param name="start_time"></param>
        /// <param name="end_time"></param>
        /// <param name="cursor"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ProcessInstanceResult GetProcessInstanceIds(string userid_list, long start_time, long end_time, int cursor, int size = 10)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("process_code", "PROC-84D8542B-C0D8-4476-9087-A68322D2F8E6");
            dic.Add("userid_list", userid_list);
            dic.Add("start_time", start_time);
            dic.Add("end_time", end_time);
            dic.Add("cursor", cursor);
            dic.Add("size", size);
            var response = HttpHelper.Post($"https://oapi.dingtalk.com/topapi/processinstance/listids?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <ProcessInstanceResult>(response.ToString()));
        }
Esempio n. 6
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <returns></returns>
        public dynamic SendChat(string cid, string content)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();
            var msg = new TextMsg();

            msg.msgtype      = "text";
            msg.text         = new Text();
            msg.text.content = content;
            dic.Add("sender", "0540636631658");
            dic.Add("cid", cid);
            //dic.Add("chatid", "0b261630e9743b229cb12861dd550185");
            dic.Add("msg", JsonHelper.SerializeObject(msg));
            var response = HttpHelper.Post($"https://oapi.dingtalk.com/message/send_to_conversation?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <dynamic>(response.ToString()));
        }
Esempio n. 7
0
        /// <summary>
        /// 查询请假状态
        /// </summary>
        /// <param name="userIdList"></param>
        /// <param name="start_time">开始时间 ,UNIX时间戳,支持最多180天的查询</param>
        /// <param name="end_time"></param>
        /// <param name="offset"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public dynamic Getleavestatus(string userid_list, long start_time, long end_time, int offset, int size)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("userid_list", userid_list);
            dic.Add("start_time", start_time);
            dic.Add("end_time", end_time);
            dic.Add("offset", offset);
            dic.Add("size", size);
            var response = HttpHelper.Post($"https://oapi.dingtalk.com/topapi/attendance/getleavestatus?access_token={_accessToken}", JsonHelper.SerializeObject(dic));

            return(JsonHelper.DeserializeJsonToObject <dynamic>(response.ToString()));
        }