[HttpPost]
public
async Task<ActionResult> FanliAsync(string appkey)
{
WeixinTBKConfigEntity configEntity = GetConfigEntity(appkey);
if
(configEntity ==
null
)
{
LogHelper.WriteLog(typeof(OtherWechatController),
"appkey接口验证时,appkey不存在"
);
return
Content(
"验证失败。appkey接口验证时,appkey不存在"
);
}
Request.InputStream.Position =
0
;
Stream stream = Request.InputStream;
string json = string.Empty;
if
(stream.Length !=
0
)
{
StreamReader streamreader =
new
StreamReader(stream);
json = streamreader.ReadToEnd();
}
WeChatToolMessage responseMsg =
new
WeChatToolMessage();
if
(string.IsNullOrEmpty(json))
{
return
Json(responseMsg);
}
WeChatToolMessage msg = JsonConvert.DeserializeObject<WeChatToolMessage>(json);
if
(string.IsNullOrEmpty(msg.wxid) || string.IsNullOrEmpty(msg.content))
{
return
Json(responseMsg);
}
string content = msg.content;
string responseStr = string.Empty;
if
(content.Contains(
"yangkeduo.com"
))
{
responseStr = await GetPddCouponAsync(configEntity, msg);
}
else
if
(content.Contains(
"jd.com"
))
{
if
(!string.IsNullOrEmpty(configEntity.JdPID))
{
responseStr = GetJdCoupon(configEntity, msg);
}
}
else
{
responseStr = GetTBKCouponByPassword(configEntity, msg.content);
}
responseMsg.wxid = msg.wxid;
responseMsg.content = responseStr;
return
Json(responseMsg);
}