|
@@ -546,10 +546,10 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 注销
|
|
#region 注销
|
|
|
- // 1、未实名创客;
|
|
|
|
|
- // 2、已实名创客,无开通商户;
|
|
|
|
|
- // 3、近7天未在商城下单过商品;
|
|
|
|
|
- // 4、名下无未绑定机具、机具券,无未申请的循环机;
|
|
|
|
|
|
|
+ // 1.创客名下无未绑定机具且没有申请中的机具循环及兑换订单
|
|
|
|
|
+ // 2.创客名下无预发机
|
|
|
|
|
+ // 3.创客名下无分仓及运营中心
|
|
|
|
|
+ // 满足以上全部条件的用户可申请注销,申请后用户二次填写确认填写信息(姓名、手机号、身份证号)即可完成注销
|
|
|
public string Cancel(string UserId)
|
|
public string Cancel(string UserId)
|
|
|
{
|
|
{
|
|
|
Users user = db.Users.FirstOrDefault(m => m.Id == Convert.ToInt32(UserId));
|
|
Users user = db.Users.FirstOrDefault(m => m.Id == Convert.ToInt32(UserId));
|
|
@@ -557,41 +557,82 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
{
|
|
|
if (user.AuthFlag == 1)
|
|
if (user.AuthFlag == 1)
|
|
|
{
|
|
{
|
|
|
- bool check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.BindingState == 1);
|
|
|
|
|
|
|
+ // bool check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.BindingState == 1);
|
|
|
|
|
+ // if (check)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // DateTime checkDate = DateTime.Now.AddDays(-7);
|
|
|
|
|
+ // check = db.Orders.Any(m => m.CreateDate >= checkDate && m.Status > 0 && m.UserId == user.Id);
|
|
|
|
|
+ // if (check)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.IsPurchase == 0);
|
|
|
|
|
+ // if (check)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // check = db.PosCoupons.Any(m => m.UserId == user.Id && m.IsUse == 0);
|
|
|
|
|
+ // if (check)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ bool check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.BindingState == 0);
|
|
|
if (check)
|
|
if (check)
|
|
|
{
|
|
{
|
|
|
- return "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服";
|
|
|
|
|
|
|
+ return "注销失败,未满足条件:名下存在未绑定机具。如有疑问,请联系客服";
|
|
|
}
|
|
}
|
|
|
- DateTime checkDate = DateTime.Now.AddDays(-7);
|
|
|
|
|
- check = db.Orders.Any(m => m.CreateDate >= checkDate && m.Status > 0 && m.UserId == user.Id);
|
|
|
|
|
|
|
+ check = db.MachineApply.Any(m => m.Status == 0 && m.UserId == user.Id);
|
|
|
if (check)
|
|
if (check)
|
|
|
{
|
|
{
|
|
|
- return "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服";
|
|
|
|
|
|
|
+ return "注销失败,未满足条件:名下存在未完成的机具循环兑换订单。如有疑问,请联系客服";
|
|
|
}
|
|
}
|
|
|
- check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.IsPurchase == 0);
|
|
|
|
|
|
|
+ check = db.PreSendStockDetail.Any(m => m.Status == 1 && m.AuthFlag == 0 && m.ToUserId == user.Id);
|
|
|
if (check)
|
|
if (check)
|
|
|
{
|
|
{
|
|
|
- return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
|
|
|
|
+ return "注销失败,未满足条件:名下存在预发机。如有疑问,请联系客服";
|
|
|
}
|
|
}
|
|
|
- check = db.PosCoupons.Any(m => m.UserId == user.Id && m.IsUse == 0);
|
|
|
|
|
|
|
+ if (user.UserType == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "注销失败,未满足条件:名下存在运营中心。如有疑问,请联系客服";
|
|
|
|
|
+ }
|
|
|
|
|
+ check = db.StoreHouse.Any(m => m.Status == 1 && m.UserId == user.Id);
|
|
|
if (check)
|
|
if (check)
|
|
|
{
|
|
{
|
|
|
- return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
|
|
|
|
+ return "注销失败,未满足条件:名下存在分仓。如有疑问,请联系客服";
|
|
|
}
|
|
}
|
|
|
|
|
+ UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
|
|
|
|
|
+ if (forMobile != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ db.Remove(forMobile);
|
|
|
|
|
+ }
|
|
|
|
|
+ UserForMakerCode forCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == user.MakerCode);
|
|
|
|
|
+ if (forCode != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ db.UserForMakerCode.Remove(forCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ user.Status = -1;
|
|
|
|
|
+ user.Mobile += "d";
|
|
|
|
|
+ user.CertId += "d";
|
|
|
}
|
|
}
|
|
|
- UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
|
|
|
|
|
- if (forMobile != null)
|
|
|
|
|
- {
|
|
|
|
|
- db.UserForMobile.Remove(forMobile);
|
|
|
|
|
- }
|
|
|
|
|
- UserForMakerCode forCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == user.MakerCode);
|
|
|
|
|
- if (forCode != null)
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- db.UserForMakerCode.Remove(forCode);
|
|
|
|
|
|
|
+ UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
|
|
|
|
|
+ if (forMobile != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ db.UserForMobile.Remove(forMobile);
|
|
|
|
|
+ }
|
|
|
|
|
+ UserForMakerCode forCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == user.MakerCode);
|
|
|
|
|
+ if (forCode != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ db.UserForMakerCode.Remove(forCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ user.Status = -1;
|
|
|
|
|
+ user.Mobile += "d";
|
|
|
|
|
+ user.CertId += "d";
|
|
|
}
|
|
}
|
|
|
- user.Status = -1;
|
|
|
|
|
- user.Mobile += "d";
|
|
|
|
|
- user.CertId += "d";
|
|
|
|
|
function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
|
|
function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
|
|
|
// TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
|
|
// TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
|
|
|
// TODO: 清除token,token登录返回
|
|
// TODO: 清除token,token登录返回
|