Browse Source

Merge branch 'DuGuYang' into develop

lcl 1 year ago
parent
commit
be8557965c

+ 19 - 14
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -135,7 +135,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
-        
+
 
 
 
@@ -243,10 +243,10 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             string SnNo = data["Sn"].ToString(); //码牌SN
             // string Machine = data["Machine"].ToString();
-            if(SnNo.Length > 20)
+            if (SnNo.Length > 20)
             {
                 SnNo = System.Web.HttpUtility.UrlDecode(SnNo);
-                if(!SnNo.EndsWith("="))
+                if (!SnNo.EndsWith("="))
                 {
                     SnNo += "=";
                 }
@@ -274,14 +274,19 @@ namespace MySystem.Areas.Api.Controllers.v1
             PosMachinesTwo pos = PosMachinesTwoDbconn.Instance.Get(SnNo) ?? new PosMachinesTwo();
             // PosMachines machine = PosMachinesDbconn.Instance.Get(qrcode.SnId) ?? new PosMachines();
             // if (machine.BindMerchantId == 0) machine.BindMerchantId = 1; // TODO: 需要绑定二维码
-            if(pos.OpId == 1)
+            if (pos.OpId == 1)
             {
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantInfo();
+                //商户未激活也能支付(365服务费)
+                // if (merchant.IsAct == 0)
+                // {
+                //     return Json(new AppResultJson() { Status = "-1", Info = "支付失败,商户尚未激活,请前往来客吧商户版激活后使用" });
+                // }
                 MerchantAddInfo merchantAdd = MerchantAddInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantAddInfo();
                 MerchantParamSet merchantset = MerchantParamSetDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantParamSet();
                 string openid = "";
                 if (PayMode == 1)
-                { 
+                {
                     openid = new AlipayFunction(_accessor.HttpContext).GetAlipayUserId(Code);
                     if (openid.Contains("|"))
                     {
@@ -321,7 +326,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 maindb.SaveChanges();
                 string OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                 bool ActFlag = merchantset.IsAll == 1 ? false : true;
-                if(PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
+                if (PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
                 {
                     ActFlag = false;
                 }
@@ -350,7 +355,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 });
                 maindb.SaveChanges();
                 if (PayMode == 1)
-                { 
+                {
                     string backString = new AlipayFunction(_accessor.HttpContext).CreateTrade(OrderNo, merchant.Name, PayMoney, openid, merchantAdd.AlipayAuthToken, SpHost + "/api/alipay/notice");
                     JsonData obj = JsonMapper.ToObject(backString);
                     if (obj["alipay_trade_create_response"]["code"].ToString() == "10000")
@@ -360,7 +365,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         Obj.Add("tradeNo", tradeNo);
                     }
                     else
-                    { 
+                    {
                         Obj.Add("respCode", obj["alipay_trade_create_response"]["code"].ToString());
                         Obj.Add("tradeNo", "");
                         return new AppResultJson() { Status = "-1", Info = obj["alipay_trade_create_response"]["sub_msg"].ToString(), Data = Obj };
@@ -409,13 +414,13 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["id"].ToString()));
             ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
-            if(order != null)
+            if (order != null)
             {
                 List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
-                if(suborders.Count > 0)
+                if (suborders.Count > 0)
                 {
                     ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
-                    if(suborder != null)
+                    if (suborder != null)
                     {
                         order.CurDivi = suborder.CurDivi;
                         maindb.SaveChanges();
@@ -443,13 +448,13 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["id"].ToString()));
             ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
-            if(order != null)
+            if (order != null)
             {
                 List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
-                if(suborders.Count > 0)
+                if (suborders.Count > 0)
                 {
                     ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
-                    if(suborder == null)
+                    if (suborder == null)
                     {
                         RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId, order);
                     }

+ 11 - 1
Areas/Api/Controllers/v1/MainServer/MerchantParamSetController.cs

@@ -31,6 +31,12 @@ namespace MySystem.Areas.Api.Controllers.v1
         {
             value = DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
+            var merchant = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            if (merchant.Id > 0 && merchant.IsAct == 0)
+            {
+                return Json(new AppResultJson() { Status = "-1", Info = "商户尚未激活,不能开启活动" });
+            }
             Dictionary<string, object> Obj = DetailDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
         }
@@ -110,6 +116,10 @@ namespace MySystem.Areas.Api.Controllers.v1
             }
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
             MerchantInfo merchant = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id);
+            if (merchant.Id > 0 && merchant.IsAct == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "商户尚未激活,不能开启活动配置活动参数" };
+            }
             MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + merchant.Mobile);
             if (mobilecheck == null)
             {
@@ -122,7 +132,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             RedisDbconn.Instance.Clear("MobileCodeCheck:" + merchant.Mobile);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantParamSet query = maindb.MerchantParamSet.FirstOrDefault(m => m.Id == Id);
-            if(query == null)
+            if (query == null)
             {
                 query = maindb.MerchantParamSet.Add(new MerchantParamSet()
                 {