123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using Library;
- using LitJson;
- namespace MySystem.Controllers
- {
- public class HomeController : Controller
- {
- private readonly ILogger<HomeController> _logger;
- public HomeController(ILogger<HomeController> logger)
- {
- _logger = logger;
- }
- public IActionResult Index()
- {
- return View();
- }
- public string test()
- {
- // testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/1", "bind_merchant");
- // testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/8", "un_bind_merchant");
- // testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/236", "change_bind_merchant");
- // testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/4", "sim_charge");
- testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/3", "service_fee");
- testReq("http://idc.pay-api.top/idc-push-api/third/1050056/1560192687980675072/2", "trade");
- return "ok";
- }
- public string testReq(string requrl, string reqkind)
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- if(reqkind == "bind_merchant") obj = bind_merchant();
- if(reqkind == "un_bind_merchant") obj = un_bind_merchant();
- if(reqkind == "change_bind_merchant") obj = change_bind_merchant();
- if(reqkind == "sim_charge") obj = sim_charge();
- if(reqkind == "service_fee") obj = service_fee();
- if(reqkind == "trade") obj = trade();
- string content = EncryptHelper.Encrypt1(obj, "57yJ3T1Btz7LytyL");
- obj = new SortedList<string, string>();
- obj.Add("type", reqkind);
- obj.Add("app_id", "KXS000001");
- obj.Add("notice_id", Guid.NewGuid().ToString());
- obj.Add("timestamp", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8));
- obj.Add("content", content);
- string requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
- function.WriteLog("请求地址:" + requrl);
- function.WriteLog("请求参数:" + requestJson);
- string result = function.PostWebRequest(requrl, requestJson, "application/json");
- function.WriteLog("返回:" + result);
- function.WriteLog("\n\n\n");
- return result;
- }
- private SortedList<string, string> bind_merchant()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("phone", "**********");
- obj.Add("name", "杨洪江");
- obj.Add("supplement_info", "533022********2015");
- obj.Add("agent_id", "039034");
- obj.Add("merch_no", "039331007177057");
- obj.Add("pos_sn", "00005702280118855803");
- obj.Add("device_model", "盒易付H版");
- obj.Add("term_to", "00005702280118855803");
- obj.Add("bind_time", "2023-12-14 16:32:38");
- return obj;
- }
- private SortedList<string, string> un_bind_merchant()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("name", "张**");
- obj.Add("supplement_info", "4307************48");
- obj.Add("agent_id", "88880019");
- obj.Add("merch_no", "LKB50009993529999");
- obj.Add("pos_sn", "LKB1888888");
- obj.Add("device_model", "N101");
- obj.Add("bind_time", "2019-03-12 22:21:50");
- return obj;
- }
- private SortedList<string, string> change_bind_merchant()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("name", "张**");
- obj.Add("supplement_info", "4307************48");
- obj.Add("agent_id", "88880019");
- obj.Add("merch_no", "LKB50009993529999");
- obj.Add("before_pos_sn", "LKB1888888");
- obj.Add("after_pos_sn", "LKB1888888");
- obj.Add("before_device_model", "N101");
- obj.Add("after_device_model", "N102");
- obj.Add("bind_time", "2019-03-12 22:21:50");
- return obj;
- }
- private SortedList<string, string> sim_charge()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("merch_no", "LKB50009993529999");
- obj.Add("agent_id", "88880019");
- obj.Add("pos_sn", "LKB188FBMS78888");
- obj.Add("amount", "9900");
- obj.Add("order_id", "2004190320190312222130116680");
- obj.Add("trans_time", "2019-03-12 22:23:02");
- return obj;
- }
- private SortedList<string, string> service_fee()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("merch_no", "039331007177057");
- obj.Add("agent_id", "039034");
- obj.Add("pos_sn", "00005702280118855803");
- obj.Add("order_id", "20231214H00040601976Y");
- obj.Add("amount", "29900");
- obj.Add("trans_time", "2023-12-14 16:39:43");
- return obj;
- }
- private SortedList<string, string> trade()
- {
- SortedList<string, string> obj = new SortedList<string, string>();
- obj.Add("agent_id", "039034");
- obj.Add("order_id", "20231214H00040608996Y");
- obj.Add("trans_id", "20231214H00040608996Y");
- obj.Add("merch_no", "039331007177057");
- obj.Add("term_no", "00005702280118855803");
- obj.Add("pos_sn", "00005702280118855803");
- obj.Add("amount", "102500");
- obj.Add("trans_time", "2023-12-14 16:54:17");
- obj.Add("ret_code", "00");
- obj.Add("ret_msg", "交易成功");
- obj.Add("fee_amount", "615");
- obj.Add("pay_type", "0");
- obj.Add("card_type", "C");
- obj.Add("trans_type", "31");
- return obj;
- }
- public string push()
- {
- AliyunPushHelper.Instance.DoSomeThing("{\"Account\":\"14726006947\",\"Device\":\"ANDROID\",\"Title\":\"测试推送\",\"Body\":\"客小爽推送功能即将上线\"}");
- AliyunPushHelper.Instance.DoSomeThing("{\"Account\":\"14726006947\",\"Device\":\"IOS\",\"Title\":\"测试推送\",\"Body\":\"客小爽推送功能即将上线\"}");
- return "ok";
- }
- }
- }
|