UpstreamService.cs 1.55 KB
using Hh.Mes.Common.config;
using Hh.Mes.Common.Json;
using Hh.Mes.POJO.Entity;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.Service.Repository;
using System;
using System.Collections.Generic;
using System.Text;

namespace Hh.Mes.Service.ApiService
{
    public partial class UpstreamService : RepositorySqlSugar<sys_user>
    {
        /// <summary>
        /// 删除=1
        /// </summary>
        public int DeleteFlag = (int)EnumDelete.删除;

        /// <summary>
        /// 新增或更新=0
        /// </summary>
        public int AddOrUpdateFlag = (int)EnumDelete.新增或更新;

        /// <summary>
        /// 获取token true 请求成功 T2是对应的token值,false失败
        /// </summary>
        /// <returns></returns>
        public Tuple<bool, string> GetMomToken()
        {
            var url = GetDictionaryDictValue("UrlMomToken", "GetUrl");
            var jsonData = new
            {
                username = ConfigRead.GetInstance.GetAppsetConnection().AppCustomExtend2, //"esb@P_SYS_COMPANY_393bb2f058ac4a8ba59510a1a228d383",
                password = ConfigRead.GetInstance.GetAppsetConnection().AppCustomExtend3,//"efb03b68f7a0c2a331fc61a491c4b2d7",
                verify = "0"
            };

            var httpResult = HttpMan(url, jsonData, EnumLog.Mom获取Token.ToString());
            if (!httpResult.Status) return new Tuple<bool, string>(false, httpResult.Message);
            var json = DynamicJson.Parse(httpResult.Result);
            return new Tuple<bool, string>(true, json.data.access_token);
        }
    }
}