淘宝信息

This commit is contained in:
“wanyongkang”
2021-03-25 19:29:14 +08:00
parent 10c6e91819
commit 063dcc29f9
2 changed files with 105 additions and 11 deletions

View File

@@ -570,33 +570,47 @@ namespace Home.Controllers
[HttpPost, AllowAnonymous]
public async Task<IActionResult> TaoBao()
{
Func<string, Task<bool>> process = async (data) =>
Func<string, Task<string>> process = async (data) =>
{
var notifyOrder = data.FromJsonTo<TaoBaoNotifyModel>();
LogHelper.Info("TaoBao process");
if (notifyOrder == null || notifyOrder.Tid.NotHas())
return false;
return "";
if (m_ScoreService.ExistTaoBaoScore(notifyOrder.Tid))
return true;
return "";
// var phone = notifyOrder.ReceiverMobile.NotHas() ? notifyOrder.ReceiverPhone : notifyOrder.ReceiverMobile;
// if (phone.NotHas()) return false;
var userEntity = await m_UserService.Query(m => m.TaoBao == notifyOrder.BuyerNick).FirstOrDefaultAsync();
var phone = notifyOrder.BuyerNick;
string pas_result = "";
Random rd = new Random(Guid.NewGuid().GetHashCode());
for (int i = 0; i < 6; i++)
{
int rnd = rd.Next(0, 9);
pas_result += rnd.ToString();
}
Console.WriteLine("==================================================================");
string msg = "";
if (userEntity == null)
{
userEntity = new User()
{
CreateType = UserCreateType.TaoBaoRegist,
LoginCode = phone,
Password = "1234",
Password = pas_result,
Phone = phone,
TaoBao= notifyOrder.BuyerNick,
id_code=""
};
var ret = await m_UserService.Regist(userEntity);
if (ret.Code != ResultCode.C_SUCCESS) return false;
msg = "您好打开网址juip.com登录会员名"+phone+""+notifyOrder.Payment+"元已充值到此账户),密码:"+pas_result+"。登录后点击网站上方的-产品购买,即可完成开通或续费。淘宝付款将随机赠送优惠券,欢迎您多来淘宝下单";
if (ret.Code != ResultCode.C_SUCCESS) return msg;
} else {
phone = userEntity.Phone;
@@ -604,6 +618,8 @@ namespace Home.Controllers
userEntity.TaoBao= notifyOrder.BuyerNick;
await m_UserService.Update(userEntity);
}
msg = "您好,"+notifyOrder.Payment+"元已充值到充值到您的会员中,会员号为:"+userEntity.LoginCode+"打开网址juip.com登录后点击网站上方的-产品购买,即可完成开通或续费。淘宝付款将随机赠送优惠券,欢迎您多来淘宝下单";
}
var amountInfo = new UpdateAmountRequest()
@@ -624,7 +640,15 @@ namespace Home.Controllers
await m_TaoBaoService.Add(taobaoEntity);
return retAmount.Code == ResultCode.C_SUCCESS;
// await Task.Delay(3000);
// Console.WriteLine("===================================================================");
// var send_msg_info = await m_TaoBaoService.SengMsg(notifyOrder.Tid,msg);
// Console.WriteLine("===================================================================");
// Console.WriteLine(send_msg_info);
// Console.WriteLine("===================================================================");
return msg;
};
Func<string, Task<bool>> refunds = async (data) =>
{
@@ -649,7 +673,7 @@ namespace Home.Controllers
var info = "";
if (aopic == 2){
info = await m_TaoBaoService.ReceivedMsg(this.Request, process);
} else if(aopic == 256){
} else if(aopic == 256){//退款
var his_order= m_TaoBaoRefundService.Query(m => m.Tid == refundInfos.Tid).FirstOrDefault();
if (his_order == null){
info = await m_TaoBaoRefundService.ReceivedRefundMsg(this.Request, refunds);