123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Linq;
- using System.Data;
- using System.Threading;
- using Library;
- using LitJson;
- using System.Collections.Generic;
- namespace MySystem
- {
- public class PrizePushHelper
- {
- public readonly static PrizePushHelper Instance = new PrizePushHelper();
- private PrizePushHelper()
- {
- }
- string NoticeUrl = "https://apigateway.kexiaoshuang.com/v1/kxs/userServer/userAccount/sendPrize";
- //要执行的方法
- public void Do(string batchNo, string prizeName, string prizeCode, decimal prizeAmt, int prizeObjectId, string requestParamField = "")
- {
- try
- {
- Dictionary<string, object> prizeItem = new Dictionary<string, object>();
- prizeItem.Add("prize_date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- prizeItem.Add("prize_name", prizeName);
- prizeItem.Add("prize_code", prizeCode);
- prizeItem.Add("batch_no", batchNo);
- prizeItem.Add("request_param_field", requestParamField);
- List<Dictionary<string, object>> prizeItemList = new List<Dictionary<string, object>>();
- Dictionary<string, object> prizeItemSub = new Dictionary<string, object>();
- prizeItemSub.Add("prize_amount", prizeAmt);
- prizeItemSub.Add("prize_obj", prizeObjectId);
- prizeItemList.Add(prizeItemSub);
- prizeItem.Add("prize_list", prizeItemList);
- string prizeOutContent = Newtonsoft.Json.JsonConvert.SerializeObject(prizeItem);
- function.WriteLog("请求参数:" + prizeOutContent, "奖励通知返回报文");
- string noticeJson = function.PostWebRequest(NoticeUrl, prizeOutContent, "application/json");
- function.WriteLog("返回报文:" + noticeJson + "\n\n\n", "奖励通知返回报文");
- }
- catch(Exception ex)
- {
- LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString() + "\n\n", "奖励通知返回异常");
- }
- }
- }
- }
|