duxin 1 жил өмнө
parent
commit
302f6b7e56

+ 15 - 11
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -452,7 +452,7 @@ func (this *Invoice) ShowinvoiceList() {
 	}
 	}
 	invoices := ShowList(order_code)
 	invoices := ShowList(order_code)
 	if invoices != nil && len(invoices) > 0 {
 	if invoices != nil && len(invoices) > 0 {
-		//isIos := util.IsMobileIOS(this.Request.UserAgent())
+		isIos := util.IsMobileIOS(this.Request.UserAgent())
 		var invoiceData []map[string]interface{}
 		var invoiceData []map[string]interface{}
 		for _, data := range invoices {
 		for _, data := range invoices {
 			//是否换过票
 			//是否换过票
@@ -467,13 +467,14 @@ func (this *Invoice) ShowinvoiceList() {
 			isJyEntity := data["invoicing_entity"] != nil && qutil.InterfaceToStr(data["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
 			isJyEntity := data["invoicing_entity"] != nil && qutil.InterfaceToStr(data["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
 			data["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
 			data["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
 			//if url := qutil.InterfaceToStr(data["url"]); url != "" {
 			//if url := qutil.InterfaceToStr(data["url"]); url != "" {
-			//	//ios 移动端
-			//	if isIos {
-			//		//国家税务局-增值税电子发票公共服务平台
-			//		if strings.Contains(url, "tysl.beijing.chinatax") {
-			//			data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
-			//		}
-			//	}
+			//ios 移动端
+			if !isIos {
+				data["url"] = qutil.If(data["source_url"] != nil && qutil.ObjToString(data["source_url"]) != "", data["source_url"], "")
+				//国家税务局-增值税电子发票公共服务平台
+				//if strings.Contains(url, "tysl.beijing.chinatax") {
+				//	data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
+				//}
+			}
 			//}
 			//}
 			isReopen := timeLimit
 			isReopen := timeLimit
 			//var isReopen bool
 			//var isReopen bool
@@ -511,7 +512,7 @@ func (this *Invoice) ShowinvoiceList() {
 func ShowList(order_code string) []map[string]interface{} {
 func ShowList(order_code string) []map[string]interface{} {
 	data := util.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
 	data := util.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
   SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and  b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
   SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and  b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
-) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety not  LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
+) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety is not null and invoice_variety not  LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
 	if data == nil {
 	if data == nil {
 		return nil
 		return nil
 	}
 	}
@@ -526,9 +527,12 @@ func (this *Invoice) NewInvoiceShow() {
 	case "1": //订单回显金额
 	case "1": //订单回显金额
 		data["pay_money"] = ResidueMoney(code)
 		data["pay_money"] = ResidueMoney(code)
 	case "2": //发票信息回显
 	case "2": //发票信息回显
-		invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": encrypt.SE.Decode4Hex(code)}, "id,only_Identifying,order_code,invoice_money,remark,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
+		invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": encrypt.SE.Decode4Hex(code)}, "id,only_Identifying,order_code,invoice_order_code,invoice_money,remark,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
 		if invoice != nil {
 		if invoice != nil {
 			(*invoice)["id"] = code
 			(*invoice)["id"] = code
+			if (*invoice)["invoice_order_code"] != nil {
+				(*invoice)["order_code"] = (*invoice)["invoice_order_code"]
+			}
 			(*invoice)["only_Identifying"] = encrypt.SE.EncodeString(qutil.InterfaceToStr((*invoice)["only_Identifying"]))
 			(*invoice)["only_Identifying"] = encrypt.SE.EncodeString(qutil.InterfaceToStr((*invoice)["only_Identifying"]))
 		}
 		}
 		data["invoice"] = invoice
 		data["invoice"] = invoice
@@ -1198,7 +1202,7 @@ func (this *Invoice) NewReplaceinvoice() {
 				}
 				}
 				if !isMail { //成功发邮件
 				if !isMail { //成功发邮件
 					isMail = true
 					isMail = true
-					sendMail(invoice_type, pCode, company_name, id_num, e_mail, phone, qutil.InterfaceToStr(data["url"]), invoiceContent)
+					sendMail(invoice_type, pCode, company_name, id_num, e_mail, phone, qutil.InterfaceToStr(data["source_url"]), invoiceContent)
 					//InvoiceSendMail(data["mail"].(string), html, "电子发票")
 					//InvoiceSendMail(data["mail"].(string), html, "电子发票")
 				}
 				}
 			case false:
 			case false:

+ 13 - 12
src/jfw/modules/subscribepay/src/util/util.go

@@ -1,25 +1,26 @@
 package util
 package util
 
 
 import (
 import (
-    qutil "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jypkg/compatible"
-    "strings"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jypkg/compatible"
+	"strings"
 )
 )
 
 
 var (
 var (
-    Compatible *compatible.Compatible
+	Compatible *compatible.Compatible
 )
 )
 
 
 func ConfirmIntArr(arr []interface{}) []int {
 func ConfirmIntArr(arr []interface{}) []int {
-    tmp := make([]int, 0)
-    for _, v := range arr {
-        tmp = append(tmp, qutil.IntAll(v))
-    }
-    return tmp
+	tmp := make([]int, 0)
+	for _, v := range arr {
+		tmp = append(tmp, qutil.IntAll(v))
+	}
+	return tmp
 }
 }
 
 
-//移动端ios
+// 移动端ios
 func IsMobileIOS(userAgent string) bool {
 func IsMobileIOS(userAgent string) bool {
-    userAgent = strings.ToLower(userAgent)
-    return strings.Contains(userAgent, "iphone") || strings.Contains(userAgent, "ipad") || strings.Contains(userAgent, "ipod")
+	userAgent = strings.ToLower(userAgent)
+	return mobileReg.MatchString(userAgent)
+	//return strings.Contains(userAgent, "iphone") || strings.Contains(userAgent, "ipad") || strings.Contains(userAgent, "ipod")
 }
 }