|
@@ -341,6 +341,7 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
|
|
|
}
|
|
|
//vip开发票内容
|
|
|
subscription_area, industry, subscription_cycle, effective_date, payment_number := "", "", "", "", ""
|
|
|
+ display_a, display_b, display_c := "none", "none", "none" //a:正常购买 b:续费 c:升级
|
|
|
city_count := 0
|
|
|
filter := qutil.ObjToString((*order)["filter"])
|
|
|
vip_starttime := qutil.ObjToString((*order)["vip_starttime"])
|
|
@@ -350,59 +351,112 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
|
|
|
vf := new(VipFilter)
|
|
|
err := json.Unmarshal([]byte(filter), &vf)
|
|
|
if err == nil && vf != nil {
|
|
|
- vip_area := vf.Area //区域
|
|
|
- vip_ind := vf.Industry //行业
|
|
|
- nbs := JyVipSubStruct.NewBuySet(&vip_area, vip_ind)
|
|
|
- if nbs != nil {
|
|
|
- if nbs.Citys != nil {
|
|
|
- for _, v := range nbs.Citys {
|
|
|
- city_count += v.(int)
|
|
|
+ if vip_type == 2 { //升级查新订单
|
|
|
+ addarea := vf.Addarea //区域
|
|
|
+ addindustry := vf.Addindustry //行业
|
|
|
+ log.Println(addarea)
|
|
|
+ //升级区域显示
|
|
|
+ if (addarea)["no"] != "no" {
|
|
|
+ addarea_upgrade := JyVipSubStruct.NewBuySet(&addarea, addindustry)
|
|
|
+ if addarea_upgrade != nil {
|
|
|
+ if addarea_upgrade.Citys != nil {
|
|
|
+ for _, v := range addarea_upgrade.Citys {
|
|
|
+ city_count += v.(int)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //订阅区域
|
|
|
+ if addarea_upgrade.AreaCount == -1 {
|
|
|
+ subscription_area = "全国"
|
|
|
+ } else {
|
|
|
+ if city_count != 0 && addarea_upgrade.AreaCount == 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个地市", city_count)
|
|
|
+ } else if city_count == 0 && addarea_upgrade.AreaCount != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级区域", addarea_upgrade.AreaCount)
|
|
|
+ } else if city_count != 0 && addarea_upgrade.AreaCount != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级区域、%d个地市", addarea_upgrade.AreaCount, city_count)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- //订阅区域
|
|
|
- if nbs.AreaCount == -1 {
|
|
|
- subscription_area = "全国"
|
|
|
} else {
|
|
|
- if city_count != 0 && nbs.AreaCount == 0 {
|
|
|
- subscription_area = fmt.Sprintf("%d个地市", city_count)
|
|
|
- } else if city_count == 0 && nbs.AreaCount != 0 {
|
|
|
- subscription_area = fmt.Sprintf("%d个省级区域", nbs.AreaCount)
|
|
|
- } else if city_count != 0 && nbs.AreaCount != 0 {
|
|
|
- subscription_area = fmt.Sprintf("%d个省级区域、%d个地市", nbs.AreaCount, city_count)
|
|
|
+ subscription_area = "无"
|
|
|
+ }
|
|
|
+
|
|
|
+ //升级行业显示
|
|
|
+ industry_upgrade := 0
|
|
|
+ if len(addindustry) != 0 {
|
|
|
+ if addindustry[0] != "no" { //等于no 为 无新增区域
|
|
|
+ industry_upgrade = len(addindustry)
|
|
|
+ } else {
|
|
|
+ industry_upgrade = -2 //无新增
|
|
|
}
|
|
|
+ } else {
|
|
|
+ industry_upgrade = -1 //全行业
|
|
|
}
|
|
|
- //行业
|
|
|
- if nbs.BuyerclassCount != -1 {
|
|
|
- industry = fmt.Sprintf("%d个行业", nbs.BuyerclassCount)
|
|
|
+ if industry_upgrade != -1 && industry_upgrade != -2 {
|
|
|
+ industry = fmt.Sprintf("%d个行业", industry_upgrade)
|
|
|
+ } else if industry_upgrade == -2 {
|
|
|
+ industry = "无"
|
|
|
} else {
|
|
|
industry = "全行业"
|
|
|
}
|
|
|
- // 订阅周期 有效日期
|
|
|
- if vip_endtime != "" && vip_starttime != "" {
|
|
|
- year := 0
|
|
|
- month := 0
|
|
|
- //订阅周期
|
|
|
- vip_starttime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_starttime, time.Local)
|
|
|
- vip_endtime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_endtime, time.Local)
|
|
|
- start_year := time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Year()
|
|
|
- end_year := time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Year()
|
|
|
- start_month := int(time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Month())
|
|
|
- end_month := int(time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Month())
|
|
|
- if end_year > start_year {
|
|
|
- if end_month > start_month {
|
|
|
- year = end_year - start_year
|
|
|
- month = end_month - start_month
|
|
|
- } else {
|
|
|
- year = end_year - start_year - 1
|
|
|
- month = 12 + end_month - start_month
|
|
|
- if month == 12 {
|
|
|
- year++
|
|
|
- month = 0
|
|
|
- }
|
|
|
+ } else { //非升级
|
|
|
+ vip_area := vf.Area //区域
|
|
|
+ vip_ind := vf.Industry //行业
|
|
|
+ nbs := JyVipSubStruct.NewBuySet(&vip_area, vip_ind)
|
|
|
+ if nbs != nil {
|
|
|
+ if nbs.Citys != nil {
|
|
|
+ for _, v := range nbs.Citys {
|
|
|
+ city_count += v.(int)
|
|
|
}
|
|
|
- } else if end_year == start_year {
|
|
|
+ }
|
|
|
+ //订阅区域
|
|
|
+ if nbs.AreaCount == -1 {
|
|
|
+ subscription_area = "全国"
|
|
|
+ } else {
|
|
|
+ if city_count != 0 && nbs.AreaCount == 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个地市", city_count)
|
|
|
+ } else if city_count == 0 && nbs.AreaCount != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级区域", nbs.AreaCount)
|
|
|
+ } else if city_count != 0 && nbs.AreaCount != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级区域、%d个地市", nbs.AreaCount, city_count)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //行业
|
|
|
+ if nbs.BuyerclassCount != -1 {
|
|
|
+ industry = fmt.Sprintf("%d个行业", nbs.BuyerclassCount)
|
|
|
+ } else {
|
|
|
+ industry = "全行业"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 订阅周期 有效日期
|
|
|
+ if vip_endtime != "" && vip_starttime != "" {
|
|
|
+ year := 0
|
|
|
+ month := 0
|
|
|
+ //订阅周期
|
|
|
+ vip_starttime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_starttime, time.Local)
|
|
|
+ vip_endtime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_endtime, time.Local)
|
|
|
+ start_year := time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Year()
|
|
|
+ end_year := time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Year()
|
|
|
+ start_month := int(time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Month())
|
|
|
+ end_month := int(time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Month())
|
|
|
+ if end_year > start_year {
|
|
|
+ if end_month > start_month {
|
|
|
+ year = end_year - start_year
|
|
|
month = end_month - start_month
|
|
|
+ } else {
|
|
|
+ year = end_year - start_year - 1
|
|
|
+ month = 12 + end_month - start_month
|
|
|
+ if month == 12 {
|
|
|
+ year++
|
|
|
+ month = 0
|
|
|
+ }
|
|
|
}
|
|
|
+ } else if end_year == start_year {
|
|
|
+ month = end_month - start_month
|
|
|
+ }
|
|
|
+ if vip_type != 2 {
|
|
|
if year == 0 && month > 0 {
|
|
|
subscription_cycle = fmt.Sprintf("%d个月", month)
|
|
|
} else if year > 0 && month > 0 {
|
|
@@ -410,22 +464,34 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
|
|
|
} else if year > 0 && month == 0 {
|
|
|
subscription_cycle = fmt.Sprintf("%d年", year)
|
|
|
}
|
|
|
- //有效日期
|
|
|
- vip_starttime = strings.Replace(vip_starttime[0:10], "-", ".", -1)
|
|
|
- vip_endtime = strings.Replace(vip_endtime[0:10], "-", ".", -1)
|
|
|
- effective_date = fmt.Sprintf("%v-%v", vip_starttime, vip_endtime)
|
|
|
+ } else {
|
|
|
+ log.Println(vf.Cyclecount, "---", vf.Cycleunit)
|
|
|
+ if vf.Cycleunit == 1 {
|
|
|
+ subscription_cycle = fmt.Sprintf("%d年", vf.Cyclecount)
|
|
|
+ } else if vf.Cycleunit == 2 {
|
|
|
+ subscription_cycle = fmt.Sprintf("%d个月", vf.Cyclecount)
|
|
|
+ } else if vf.Cycleunit == -1 {
|
|
|
+ subscription_cycle = "不延期"
|
|
|
+ }
|
|
|
}
|
|
|
+ //有效日期
|
|
|
+ vip_starttime = strings.Replace(vip_starttime[0:10], "-", ".", -1)
|
|
|
+ vip_endtime = strings.Replace(vip_endtime[0:10], "-", ".", -1)
|
|
|
+ effective_date = fmt.Sprintf("%v-%v", vip_starttime, vip_endtime)
|
|
|
}
|
|
|
}
|
|
|
if vip_type == 1 {
|
|
|
product_type = "VIP订阅(续费)"
|
|
|
+ display_b = "block"
|
|
|
} else if vip_type == 2 {
|
|
|
product_type = "VIP订阅(升级)"
|
|
|
+ display_c = "block"
|
|
|
} else {
|
|
|
product_type = "VIP订阅"
|
|
|
+ display_a = "block"
|
|
|
}
|
|
|
mail_title = "电子发票申请-[剑鱼标讯]VIP订阅(" + order_code + ")"
|
|
|
- mailcontent = fmt.Sprintf(ExConf.Mail_vip_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, user_email, order_code, create_time, payment_number, pay_time, pay_way, product_type, pay_money, subscription_area, industry, subscription_cycle, effective_date)
|
|
|
+ mailcontent = fmt.Sprintf(ExConf.Mail_vip_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, user_email, order_code, create_time, payment_number, pay_time, pay_way, product_type, pay_money, display_a, subscription_area, industry, subscription_cycle, display_b, subscription_area, industry, subscription_cycle, display_c, subscription_area, industry, subscription_cycle, effective_date)
|
|
|
}
|
|
|
}
|
|
|
//发送邮件
|