You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Gdsi-Api/Gdsi/Domain/GdStApi.cs

133 lines
5.6 KiB

using Gdsi.Config;
using Gdsi.Model;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Gdsi.Helper;
namespace Gdsi.Domain
{
public class GdStApi
{
private static string api_9001()
{
string result = "";
var req = new
{
infno = "9001",
msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'),
mdtrtarea_admvs = GdsiConfig.city_code,
insuplc_admdvs = GdsiConfig.city_code,
recer_sys_code = "FD0001",
dev_no = "1",
dev_safe_info = "1",
cainfo = "1",
signtype = "1",
infver = "V1.0",
opter_type = "2",
opter = GdsiConfig.opter,
opter_name = GdsiConfig.opter_name,
inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
fixmedins_code = GdsiConfig.fixmedins_code,
fixmedins_name = GdsiConfig.fixmedins_name,
sign_no = "",
//app_id = "",
//enc_type = "",
input = new
{
signIn = new
{
opter_no = GdsiConfig.opter,
mac = "FE-FC-FE-EF-F7-D2",
ip = "192.168.11.27"
}
}
};
string strReq = JsonConvert.SerializeObject(req);
string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "9001", strReq);
try
{
JObject jObject = JsonConvert.DeserializeObject(strRes) as JObject;
if (jObject["infcode"].ToString() == "0")
{
if (jObject["output"]["signinoutb"]["sign_no"] == null)
{
return result;
}
result = jObject["output"]["signinoutb"]["sign_no"].ToString();
return result;
}
return result;
}
catch
{
return result;
}
}
public static YBR api_1101(YBRequest request)
{
YBR jObject = new YBR();
Info info = new Info();
string signNo = api_9001();
if ("".Equals(signNo))
{
info.Msg = "签到出错";
return null;
}
var req = new
{
infno = "1101",
msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'),
mdtrtarea_admvs = GdsiConfig.city_code,
insuplc_admdvs = GdsiConfig.city_code,
recer_sys_code = "FD0001",
dev_no = "1",
dev_safe_info = "1",
cainfo = "1",
signtype = "SM3",
infver = "V1.0",
opter_type = "2",
opter = GdsiConfig.opter,
opter_name = GdsiConfig.opter_name,
inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
fixmedins_code = GdsiConfig.fixmedins_code,
fixmedins_name = GdsiConfig.fixmedins_name,
sign_no = signNo,
app_id = "",
enc_type = "",
input = new
{
data = new
{
mdtrt_cert_type = request.type,
mdtrt_cert_no = request.value,
card_sn = "",
begntime = "",
psn_cert_type = "",
certno = "",
psn_name = ""
}
}
};
string strReq = JsonConvert.SerializeObject(req);
//string strRes = "{\"output\":{\"idetinfo\":[],\"baseinfo\":{\"certno\":\"440508199405181411\",\"psn_no\":\"44050000000100072823\",\"gend\":\"1\",\"exp_content\":null,\"brdy\":\"1994-05-18\",\"naty\":\"99\",\"psn_cert_type\":\"01\",\"psn_name\":\"郑泓鑫\",\"age\":29.1},\"insuinfo\":[{\"insuplc_admdvs\":\"440599\",\"psn_insu_date\":\"2016-12-01\",\"cvlserv_flag\":\"0\",\"balc\":0,\"emp_name\":\"广东民企人力资源开发服务中心有限公司汕头分公司 \",\"psn_type\":\"11\",\"psn_insu_stas\":\"1\",\"insutype\":\"510\",\"paus_insu_date\":null},{\"insuplc_admdvs\":\"440599\",\"psn_insu_date\":\"2016-12-01\",\"cvlserv_flag\":\"0\",\"balc\":0,\"emp_name\":\"广东民企人力资源开发服务中心有限公司汕头分公司 \",\"psn_type\":\"11\",\"psn_insu_stas\":\"1\",\"insutype\":\"310\",\"paus_insu_date\":null}]},\"infcode\":0,\"warn_msg\":null,\"cainfo\":null,\"err_msg\":null,\"refmsg_time\":\"20230607132859943\",\"signtype\":null,\"respond_time\":\"20230607132900129\",\"inf_refmsgid\":\"440000202306071329000009829207\"}";
string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "1101", strReq);
try
{
jObject = JsonConvert.DeserializeObject<YBR>(strRes);
return jObject;
}
catch (Exception ex)
{
}
return null;
}
}
}