This commit is contained in:
2024-05-10 14:45:54 +08:00
parent ba518ac354
commit 98c1cad987
12 changed files with 581 additions and 44 deletions
+45 -3
View File
@@ -88,7 +88,7 @@ namespace BLL
var tempData = new
{
access_token,
touser = getUser.OpenId,
touser = getUser.OpenId,
template_id = Const.WX_TemplateID,
page = "pages/index/index",
data = new
@@ -102,11 +102,53 @@ namespace BLL
lang = "zh_CN",
};
string joson = JsonConvert.SerializeObject(tempData);
string messages= APIGetHttpService.Http(url, "POST", contenttype, null, joson);
string messages = APIGetHttpService.Http(url, "POST", contenttype, null, joson);
//// 记录
SaveSysHttpLog(getUser.UserName, url+ "$joson$" + joson , messages);
SaveSysHttpLog(getUser.UserName, url + "$joson$" + joson, messages);
return messages;
}
else if (getUser == null)
{
var person = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == userId);
if (person != null)
{
var user = Funs.DB.Sys_User.FirstOrDefault(x => x.IdentityCard == person.IdentityCard);
if (user != null && !string.IsNullOrEmpty(user.OpenId))
{
string miniprogram_state = ConfigurationManager.AppSettings["miniprogram_state"];
if (string.IsNullOrEmpty(miniprogram_state))
{
miniprogram_state = "formal";
}
//miniprogram_state = "developer";
string contenttype = "application/json;charset=utf-8";
string url = $"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={access_token}";
var tempData = new
{
access_token,
touser = user.OpenId,
template_id = Const.WX_TemplateID,
page = "pages/index/index",
data = new
{
thing2 = new { value = thing2 },
name1 = new { value = name1 },
date3 = new { value = date3 }//,
//date6 = new { value = thing6 }
},
miniprogram_state,
lang = "zh_CN",
};
string joson = JsonConvert.SerializeObject(tempData);
string messages = APIGetHttpService.Http(url, "POST", contenttype, null, joson);
//// 记录
SaveSysHttpLog(user.UserName, url + "$joson$" + joson, messages);
return messages;
}
}
return "openId is null";
}
else
{
return "openId is null";