Parcourir la source

发票回显数据修改

duxin il y a 3 ans
Parent
commit
b7f6482738
1 fichiers modifiés avec 49 ajouts et 5 suppressions
  1. 49 5
      src/jfw/modules/subscribepay/src/service/invoice.go

+ 49 - 5
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -109,16 +109,60 @@ func (this *Invoice) Invoiceswitch() {
 			"code": "1000",
 		})
 	} else {
-		this.ServeJson(map[string]interface{}{
-			"code":   "1001",
-			"messge": "因第三方发票系统升级,开发票功能暂停使用。如有疑问,请咨询客服400-108-6670",
-		})
+		//更新数据 用于回显
+		userId := qutil.ObjToString(this.GetSession("userId"))
+		order_code := this.GetString("order_code")
+		applyBill_company := this.GetString("company")
+		//获取数据
+		applyBill_type := this.GetString("invoice_type") //个人 单位
+		my_email := this.GetString("email")
+		phone_num := this.GetString("phone_num")
+		code := strings.ToUpper(this.GetString("id_num")) //纳税人识别号
+		data := make(map[string]interface{})
+		if userId != "" && my_email != "" && phone_num != "" && order_code != "" {
+			if applyBill_type == "个人" {
+				data["taxpayer_identnum"] = ""
+				data["company_name"] = ""
+			} else {
+				data["taxpayer_identnum"] = code
+				data["company_name"] = applyBill_company
+			}
+			var product_name string
+			u := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": order_code, "user_id": userId, "applyBill_status": map[string]interface{}{"ne": 2}}, "order_money,product_type,pay_way,pay_money,is_backstage_order,billingMode", "")
+			if u != nil {
+				product_name = (*u)["product_type"].(string)
+			}
+			data["product_type"] = product_name
+			data["order_code"] = order_code
+			data["mail"] = my_email
+			data["phone"] = phone_num
+			data["invoice_type"] = applyBill_type
+			data["create_time"] = time.Now().Unix()
+			data["user_id"] = userId
+			status := util.Mysql.Find(dbname, map[string]interface{}{"order_code": order_code, "user_id": userId}, "", "create_time", 0, 0)
+			if len(*status) <= 0 {
+				data["invoice_changed"] = 0
+				data["invoice_status"] = 0
+				util.Mysql.Insert(dbname, data)
+			} else {
+				util.Mysql.Update(dbname, map[string]interface{}{
+					"order_code":      order_code,
+					"user_id":         userId,
+					"invoice_changed": 0,
+				}, data)
+			}
+		}
 	}
+	this.ServeJson(map[string]interface{}{
+		"code":   "1001",
+		"messge": "因第三方发票系统升级,开发票功能暂停使用。如有疑问,请咨询客服400-108-6670",
+	})
 }
 
 func (this *Invoice) Invoiceecho() {
+	order_code := this.GetString("order_code")
 	if userId := qutil.ObjToString(this.GetSession("userId")); userId != "" {
-		u := util.Mysql.FindOne(dbname, map[string]interface{}{"user_id": userId}, "invoice_type,mail,taxpayer_identnum,company_name,phone,url", "create_time desc")
+		u := util.Mysql.FindOne(dbname, map[string]interface{}{"user_id": userId, "order_code": order_code}, "invoice_type,mail,taxpayer_identnum,company_name,phone,url", "create_time desc")
 		if u != nil {
 			this.ServeJson(map[string]interface{}{
 				"status": "success",