فهرست منبع

提交进件时,多张图片处理
处理进件中,各种状态的逻辑

lcl 1 سال پیش
والد
کامیت
9a2924c06e

BIN
.DS_Store


+ 9 - 1
AppStart/Alipay/AlipayFunction.cs

@@ -168,17 +168,25 @@ namespace MySystem
             }
             if (!string.IsNullOrEmpty(ShopScenePicPath))
             {
+                if(ShopScenePicPath.Contains(","))
+                {
+                    ShopScenePicPath = ShopScenePicPath.Split(',')[0];
+                }
                 FileItem ShopScenePic = new FileItem(function.getPath(ShopScenePicPath));
                 request.ShopScenePic = ShopScenePic;
             }
             if (!string.IsNullOrEmpty(ShopSignBoardPicPath))
             {
+                if(ShopSignBoardPicPath.Contains(","))
+                {
+                    ShopSignBoardPicPath = ShopSignBoardPicPath.Split(',')[0];
+                }
                 FileItem ShopSignBoardPic = new FileItem(function.getPath(ShopSignBoardPicPath));
                 request.ShopSignBoardPic = ShopSignBoardPic;
             }
             // FileItem SpecialLicensePic = new FileItem("C:/Downloads/ooopic_963991_7eea1f5426105f9e6069/16365_1271139700.jpg");
             // request.setSpecialLicensePic = "-";
-            // request.Rate = "0.38";
+            request.Rate = "0.38";
             // request.SignAndAuth = true;
             // request.BusinessLicenseNo = "1532501100006302";
             // FileItem BusinessLicensePic = new FileItem("C:/Downloads/ooopic_963991_7eea1f5426105f9e6069/16365_1271139700.jpg");

+ 45 - 16
AppStart/Helper/CheckAlipaySignService.cs

@@ -52,10 +52,16 @@ namespace MySystem
                 JsonData dic = JsonMapper.ToObject(content);
                 if (dic["alipay_open_agent_order_query_response"]["code"].ToString() == "10000")
                 {
+                    // MERCHANT_INFO_HOLD=暂存,提交事务出现业务校验异常时,会暂存申请单信息,可以调用业务接口修正参数,并重新提交
+                    // MERCHANT_AUDITING=审核中,申请信息正在人工审核中
+                    // MERCHANT_CONFIRM=待商户确认,申请信息审核通过,等待联系人确认签约或授权
+                    // MERCHANT_CONFIRM_SUCCESS=商户确认成功,商户同意签约或授权
+                    // MERCHANT_CONFIRM_TIME_OUT=商户超时未确认,如果商户受到确认信息15天内未确认,则需要重新提交申请信息
+                    // MERCHANT_APPLY_ORDER_CANCELED=审核失败或商户拒绝,申请信息审核被驳回,或者商户选择拒绝签约或授权
                     if (dic["alipay_open_agent_order_query_response"]["order_status"].ToString() == "MERCHANT_CONFIRM")
                     {
                         string sign_url = dic["alipay_open_agent_order_query_response"]["confirm_url"].ToString();
-                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount == 0);
+                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                         if (merchantadd != null)
                         {
                             merchantadd.QueryCount = 1;
@@ -75,15 +81,28 @@ namespace MySystem
                     }
                     else if (dic["alipay_open_agent_order_query_response"]["order_status"].ToString() == "MERCHANT_CONFIRM_SUCCESS")
                     {
-                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount < 2);
+                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                         if (merchantadd != null)
                         {
-                            merchantadd.QueryCount = 2;
                             merchantadd.AlipayPid = dic["alipay_open_agent_order_query_response"]["merchant_pid"].ToString();
-                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                            if (merchant != null)
+                            if(dic["alipay_open_agent_order_query_response"]["restrict_infos"].Count > 0)
                             {
-                                merchant.QueryCount = 2;
+                                merchantadd.QueryCount = -1;
+                                merchantadd.AlipayRemark = dic["alipay_open_agent_order_query_response"]["restrict_infos"][0]["restrict_reason"].ToString();
+                                MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                                if (merchant != null)
+                                {
+                                    merchant.QueryCount = -1;
+                                }
+                            }
+                            else
+                            {
+                                merchantadd.QueryCount = 2;
+                                MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                                if (merchant != null)
+                                {
+                                    merchant.QueryCount = 2;
+                                }
                             }
                             db.SaveChanges();
                         }
@@ -93,17 +112,12 @@ namespace MySystem
                         MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                         if (merchantadd != null)
                         {
-                            string Season = function.CheckNull(merchantadd.SeoDescription);
-                            if (string.IsNullOrEmpty(Season))
+                            string reason = "";
+                            if(dic["alipay_open_agent_order_query_response"]["restrict_infos"].Count > 0)
                             {
-                                Season = "Alipay:" + dic["alipay_open_agent_order_query_response"]["reject_reason"].ToString() + ";";
+                                reason = dic["alipay_open_agent_order_query_response"]["restrict_infos"][0]["restrict_reason"].ToString();
                             }
-                            else
-                            {
-                                Season = Regex.Replace(Season, "Alipay:.*?;", "");
-                                Season += "Alipay:" + dic["alipay_open_agent_order_query_response"]["reject_reason"].ToString() + ";";
-                            }
-                            merchantadd.SeoDescription = Season;
+                            merchantadd.AlipayRemark = reason;
                             merchantadd.QueryCount = -1;
                             MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                             if (merchant != null)
@@ -118,10 +132,25 @@ namespace MySystem
                         return "wait";
                     }
                 }
+                else
+                {
+                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                    if (merchantadd != null)
+                    {
+                        merchantadd.QueryCount = -1;
+                        merchantadd.AlipayRemark = dic["alipay_open_agent_order_query_response"]["sub_msg"].ToString();
+                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                        if (merchant != null)
+                        {
+                            merchant.QueryCount = -1;
+                        }
+                        db.SaveChanges();
+                    }
+                }
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "public:merchant:signerr");
+                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "支付宝签约审核队列异常");
             }
             return "";
         }

+ 12 - 79
AppStart/Helper/CheckWeChatSignService.cs

@@ -53,73 +53,31 @@ namespace MySystem
                 if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED")
                 {
                     string sign_url = dic["sign_url"].ToString();
-                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 0);
+                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                     if (merchantadd != null)
                     {
                         merchantadd.Status = 1;
                         merchantadd.SubMchid = dic["sub_mchid"].ToString();
-                        string SignUrlList = function.CheckNull(merchantadd.SeoKeyword);
-                        if (string.IsNullOrEmpty(SignUrlList))
-                        {
-                            SignUrlList = "WeChat:" + sign_url + ";";
-                        }
-                        else
-                        {
-                            SignUrlList += "WeChat:" + sign_url+ ";";
-                        }
-                        merchantadd.SeoKeyword = SignUrlList;
+                        merchantadd.WeChatSignUrl = sign_url;
                         MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                        if (merchantadd.Status > 0 && merchantadd.QueryCount > 0)
+                        if (merchant != null)
                         {
                             merchant.Status = 1;
                         }
                         db.SaveChanges();
                     }
-                    else
-                    {
-                        merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 1);
-                        if (merchantadd != null)
-                        {
-                            merchantadd.SubMchid = dic["sub_mchid"].ToString();
-                            string SignUrlList = function.CheckNull(merchantadd.SeoKeyword);
-                            if (string.IsNullOrEmpty(SignUrlList))
-                            {
-                                SignUrlList = "WeChat:" + sign_url + ";";
-                            }
-                            else
-                            {
-                                SignUrlList += "WeChat:" + sign_url+ ";";
-                            }
-                            merchantadd.SeoKeyword = SignUrlList;
-                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                            if (merchantadd.Status > 0 && merchantadd.QueryCount > 0)
-                            {
-                                merchant.Status = 1;
-                            }
-                            db.SaveChanges();
-                        }
-                    }
                     return "wait";
                 }
                 else if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_CONFIRMED")
                 {
                     string sign_url = dic["sign_url"].ToString();
-                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 0);
+                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                     if (merchantadd != null)
                     {
                         merchantadd.Status = 1;
-                        string SignUrlList = function.CheckNull(merchantadd.SeoKeyword);
-                        if (string.IsNullOrEmpty(SignUrlList))
-                        {
-                            SignUrlList = "WeChat:" + sign_url + ";";
-                        }
-                        else
-                        {
-                            SignUrlList += "WeChat:" + sign_url+ ";";
-                        }
-                        merchantadd.SeoKeyword = SignUrlList;
+                        merchantadd.WeChatSignUrl = sign_url;
                         MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                        if (merchantadd.Status > 0 && merchantadd.QueryCount > 0)
+                        if (merchant != null)
                         {
                             merchant.Status = 1;
                         }
@@ -128,15 +86,14 @@ namespace MySystem
                     return "wait";
                 }
                 else if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_FINISHED")
-                { 
-                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 1);
+                {
+                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                     if (merchantadd != null)
                     {
                         merchantadd.Status = 2;
-                        // merchantadd.SubMchid = dic["sub_mchid"].ToString();
-                        RedisDbconn.Instance.Set("MerchantAddInfo:" + sign.MerchantAddInfoId, merchantadd);
+                        merchantadd.SubMchid = dic["sub_mchid"].ToString();
                         MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                        if (merchantadd.Status == 2 && merchantadd.QueryCount == 2)
+                        if (merchant != null)
                         {
                             merchant.Status = 2;
                         }
@@ -148,17 +105,7 @@ namespace MySystem
                     MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                     if (merchantadd != null)
                     {
-                        string Season = function.CheckNull(merchantadd.SeoDescription);
-                        if (string.IsNullOrEmpty(Season))
-                        {
-                            Season = "WeChat:" + dic["reject_reason"].ToString() + ";";
-                        }
-                        else
-                        {
-                            Season = Regex.Replace(Season, "WeChat:.*?;", "");
-                            Season += "WeChat:" + dic["reject_reason"].ToString() + ";";
-                        }
-                        merchantadd.SeoDescription = Season;
+                        merchantadd.WeChatRemark = dic["reject_reason"].ToString();
                         merchantadd.Status = -1;
                         MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                         if (merchant != null)
@@ -169,23 +116,9 @@ namespace MySystem
                         deletes.Add(sign);
                     }
                 }
-                else if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_AUDITING")
-                {
-                    return "wait";
-                }
                 else
                 {
-                    string sub_mchid = "";
-                    if (dic.ContainsKey("sub_mchid"))
-                    {
-                        sub_mchid = dic["sub_mchid"].ToString();
-                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
-                        if (merchantadd != null)
-                        {
-                            merchantadd.SubMchid = sub_mchid;
-                            db.SaveChanges();
-                        }
-                    }
+                    return "wait";
                 }
             }
             catch (Exception ex)

+ 21 - 38
AppStart/Helper/MerchantConfirmService.cs

@@ -86,14 +86,16 @@ namespace MySystem
                 merchantForMobile.MerchantId = MerchantId;
                 db.SaveChanges();
                 //微信
-                if (Kind == 0 || Kind == 2)
+                if ((Kind == 0 || Kind == 2) && AddInfo.Status <= 0)
                 {
                     string result = WeChatFunction.Instance.MerchantCreate(AddInfo, merchant);
                     if (result.Contains("\"applyment_id\":"))
                     {
                         JsonData jsonObj = JsonMapper.ToObject(result);
                         AddInfo.ApplymentId = jsonObj["applyment_id"].ToString();
+                        AddInfo.WeChatRemark = "";
                         AddInfo.Status = 0;
+                        merchant.Status = 0;
                         db.SaveChanges();
                         List<MerchantSign> signs = RedisDbconn.Instance.GetList<MerchantSign>("MerchantSignList", 1, 10000000);
                         bool op = signs.Any(m => m.BusinessCode == BusinessCode);
@@ -108,7 +110,6 @@ namespace MySystem
                         }
                         signs.Clear();
                         AddInfo.ApplymentId = AddInfo.ApplymentId;
-                        AddInfo.Status = AddInfo.Status;
                         db.SaveChanges();
                     }
                     else if (result.Contains("\"message\":"))
@@ -116,31 +117,22 @@ namespace MySystem
                         JsonData jsonObj = JsonMapper.ToObject(result);
                         AddInfo.Status = -1;
                         merchant.Status = -1;
-                        string Season = function.CheckNull(AddInfo.SeoDescription);
-                        if (string.IsNullOrEmpty(Season))
-                        {
-                            Season = "WeChat:" + jsonObj["message"].ToString() + ";";
-                        }
-                        else
-                        {
-                            Season = Regex.Replace(Season, "WeChat:.*?;", "");
-                            Season += "WeChat:" + jsonObj["message"].ToString() + ";";
-                        }
-                        AddInfo.SeoDescription = Season;
-                        AddInfo.SeoDescription = AddInfo.SeoDescription;
-                        AddInfo.Status = AddInfo.Status;
+                        AddInfo.WeChatRemark = jsonObj["message"].ToString();
                         db.SaveChanges();
                     }
                 }
 
                 //支付宝
-                if (Kind == 0 || Kind == 1)
+                if ((Kind == 0 || Kind == 1) && AddInfo.QueryCount <= 0)
                 {
-                    bool checkAlipay = true;
                     string content = AlipayFunction.Instance.GetBatchNo(AddInfo.IdCardName, AddInfo.MobilePhone, AddInfo.ContactEmail);
                     JsonData json = JsonMapper.ToObject(content);
                     if (json["alipay_open_agent_create_response"]["code"].ToString() == "10000")
                     {
+                        AddInfo.AlipayRemark = "";
+                        AddInfo.QueryCount = 0;
+                        merchant.QueryCount = 0;
+                        db.SaveChanges();
                         string batch_no = json["alipay_open_agent_create_response"]["batch_no"].ToString();
                         string Qualifications = AddInfo.Qualifications;
                         if (!string.IsNullOrEmpty(Qualifications))
@@ -155,6 +147,8 @@ namespace MySystem
                             json = JsonMapper.ToObject(content);
                             if (json["alipay_open_agent_confirm_response"]["code"].ToString() == "10000")
                             {
+                                // AddInfo.AlipayAuthToken = json["alipay_open_agent_confirm_response"]["app_auth_token"].ToString();
+                                db.SaveChanges();
                                 RedisDbconn.Instance.AddList("AlipaySignQueue", new MerchantSign()
                                 {
                                     BusinessCode = batch_no,
@@ -194,36 +188,25 @@ namespace MySystem
                             }
                             else
                             {
-                                checkAlipay = false;
+                                AddInfo.AlipayRemark = json["alipay_open_agent_confirm_response"]["sub_msg"].ToString();
+                                AddInfo.QueryCount = -1;
+                                merchant.QueryCount = -1;
+                                db.SaveChanges();
                             }
                         }
                         else
                         {
-                            checkAlipay = false;
+                            AddInfo.AlipayRemark = json["alipay_open_agent_facetoface_sign_response"]["sub_msg"].ToString();
+                            AddInfo.QueryCount = -1;
+                            merchant.QueryCount = -1;
+                            db.SaveChanges();
                         }
                     }
                     else
                     {
-                        checkAlipay = false;
-                    }
-                    if (!checkAlipay)
-                    {
-                        JsonData jsonObj = JsonMapper.ToObject(content);
+                        AddInfo.AlipayRemark = json["alipay_open_agent_facetoface_sign_response"]["sub_msg"].ToString();
                         AddInfo.QueryCount = -1;
-                        merchant.Status = -1;
-                        string Season = function.CheckNull(AddInfo.SeoDescription);
-                        if (string.IsNullOrEmpty(Season))
-                        {
-                            Season = "Alipay:" + jsonObj["alipay_open_agent_create_response"]["sub_msg"].ToString() + ";";
-                        }
-                        else
-                        {
-                            Season = Regex.Replace(Season, "Alipay:.*?;", "");
-                            Season = "Alipay:" + jsonObj["alipay_open_agent_create_response"]["sub_msg"].ToString() + ";" + Season;
-                        }
-                        AddInfo.SeoDescription = Season;
-                        AddInfo.SeoDescription = AddInfo.SeoDescription;
-                        AddInfo.QueryCount = AddInfo.QueryCount;
+                        merchant.QueryCount = -1;
                         db.SaveChanges();
                     }
                 }

+ 17 - 3
AppStart/WeChatFunction.cs

@@ -127,10 +127,24 @@ namespace MySystem
             biz_store_info.Add("biz_address_code", BizAddress.Code); //门店省市编码
             biz_store_info.Add("biz_store_address", info.BizStoreAddress); //门店地址
             List<string> store_entrance_pic = new List<string>();
-            store_entrance_pic.Add(GetMediaId("/" + info.StoreEntrancePic));
+            if(string.IsNullOrEmpty(info.StoreEntrancePic))
+            {
+                string[] piclist = info.StoreEntrancePic.Split(',');
+                foreach(string sub in piclist)
+                {
+                    store_entrance_pic.Add(GetMediaId("/" + sub));
+                }
+            }
             biz_store_info.Add("store_entrance_pic", store_entrance_pic); //门店门头照片
             List<string> indoor_pic = new List<string>();
-            indoor_pic.Add(GetMediaId("/" + info.IndoorPic));
+            if(string.IsNullOrEmpty(info.IndoorPic))
+            {
+                string[] piclist = info.IndoorPic.Split(',');
+                foreach(string sub in piclist)
+                {
+                    indoor_pic.Add(GetMediaId("/" + sub));
+                }
+            }
             biz_store_info.Add("indoor_pic", indoor_pic); //店内环境照片
             biz_store_info.Add("biz_sub_appid", info.BizSubAppid); //线下场所对应的商家APPID
             sales_info.Add("biz_store_info", biz_store_info); //线下门店场景
@@ -249,7 +263,7 @@ namespace MySystem
                 return_result.Add("applyment_id", jsonObj["applyment_id"].ToString()); //微信支付申请单号
                 return_result.Add("applyment_state", jsonObj["applyment_state"].ToString()); //申请单状态
                 return_result.Add("applyment_state_msg", jsonObj["applyment_state_msg"].ToString()); //申请状态描述
-                if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED")
+                if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED" || jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_FINISHED")
                 {
                     return_result.Add("sub_mchid", jsonObj["sub_mchid"].ToString());
                 }