|
@@ -26,25 +26,26 @@ func init() {
|
|
|
|
|
|
//价格配置文件
|
|
|
type DataexportConfig struct {
|
|
|
- UnitPrice_normal float64 `json:"unitPrice_normal"`
|
|
|
- UnitPrice_senior float64 `json:"unitPrice_senior"`
|
|
|
- Discount float64 `json:"discount"`
|
|
|
- OrderMinPrice float64 `json:"orderMinPrice"`
|
|
|
- MsgMaxCount int `json:"msgMaxCount"`
|
|
|
- Standard_Fields *Dataexport_Field `json:"standard"`
|
|
|
- Senior_Fields *Dataexport_Field `json:"senior"`
|
|
|
- Mail_attach_content string `json:"mail_attach_content"`
|
|
|
- Mail_attach_content_key string `json:"mail_attach_content_key"`
|
|
|
- Mail_notice_content string `json:"mail_notice_content"`
|
|
|
- Mail_notice_title string `json:"mail_notice_title"`
|
|
|
- Mail_retry int `json:"mail_retry"`
|
|
|
- AuditPersons []string `json:"auditPersons"`
|
|
|
- Font Font `json:"font"`
|
|
|
- Mail_invoice_finance_content string `json:"mail_invoice_finance_content"` //to北京财务订单内容
|
|
|
- Mail_order_finance_content string `json:"mail_order_finance_content"` //to北京财务申请发票内容
|
|
|
- Finance_emails []string `json:"finance_emails"`
|
|
|
- Qmxdomain string `json:"qmxdomain"`
|
|
|
- DataReportContent string `json:"dataReportContent"`
|
|
|
+ UnitPrice_normal float64 `json:"unitPrice_normal"`
|
|
|
+ UnitPrice_senior float64 `json:"unitPrice_senior"`
|
|
|
+ Discount float64 `json:"discount"`
|
|
|
+ OrderMinPrice float64 `json:"orderMinPrice"`
|
|
|
+ MsgMaxCount int `json:"msgMaxCount"`
|
|
|
+ Standard_Fields *Dataexport_Field `json:"standard"`
|
|
|
+ Senior_Fields *Dataexport_Field `json:"senior"`
|
|
|
+ Mail_attach_content string `json:"mail_attach_content"`
|
|
|
+ Mail_attach_content_key string `json:"mail_attach_content_key"`
|
|
|
+ Mail_notice_content string `json:"mail_notice_content"`
|
|
|
+ Mail_notice_title string `json:"mail_notice_title"`
|
|
|
+ Mail_retry int `json:"mail_retry"`
|
|
|
+ AuditPersons []string `json:"auditPersons"`
|
|
|
+ Font Font `json:"font"`
|
|
|
+ Mail_invoice_finance_content string `json:"mail_invoice_finance_content"` //to北京财务订单内容
|
|
|
+ Mail_vip_invoice_finance_content string `json:"mail_vip_invoice_finance_content"` //vip订单 to北京财务申请发票内容
|
|
|
+ Mail_order_finance_content string `json:"mail_order_finance_content"` //to北京财务申请发票内容
|
|
|
+ Finance_emails []string `json:"finance_emails"`
|
|
|
+ Qmxdomain string `json:"qmxdomain"`
|
|
|
+ DataReportContent string `json:"dataReportContent"`
|
|
|
}
|
|
|
type Dataexport_Field struct {
|
|
|
Names []string `json:"names"`
|
|
@@ -178,7 +179,7 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
|
|
|
data_spec := qutil.ObjToString((*order)["data_spec"])
|
|
|
data_count := qutil.IntAll((*order)["data_count"])
|
|
|
pay_way := qutil.ObjToString((*order)["pay_way"])
|
|
|
-
|
|
|
+ pay_money := float64(qutil.IntAll((*order)["pay_money"])) / 100
|
|
|
if strings.Contains(pay_way, "wx") {
|
|
|
pay_way = "微信"
|
|
|
} else if strings.Contains(pay_way, "ali") {
|
|
@@ -329,10 +330,84 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
|
|
|
mail_title = "电子发票申请,剑鱼标讯历史数据订单【" + order_code + "】,请查收"
|
|
|
mailcontent = fmt.Sprintf(ExConf.Mail_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, order_code, create_time, pay_time, product_type, isShowTransaction, pay_way, transaction_id, offlineImgSrc, data_spec, data_count, order_money, user_mail, user_phone)
|
|
|
} else if product_type == "VIP订阅导出" {
|
|
|
+ //vip开发票内容
|
|
|
+ subscription_area, industry, subscription_cycle, effective_date := "", "", "", ""
|
|
|
+ city_count := 0
|
|
|
+ filter := qutil.ObjToString((*order)["filter"])
|
|
|
+ vip_starttime := qutil.ObjToString((*order)["vip_starttime"])
|
|
|
+ vip_endtime := qutil.ObjToString((*order)["vip_endtime"])
|
|
|
+ vf := new(VipFilter)
|
|
|
+ err := json.Unmarshal([]byte(filter), &vf)
|
|
|
+ if err == nil && vf != nil {
|
|
|
+ log.Println(vf.Area)
|
|
|
+ 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 nbs.AreaCount != 0 && city_count != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级地区、%d个地市", nbs.AreaCount, city_count)
|
|
|
+ log.Println(subscription_area)
|
|
|
+ } else if nbs.AreaCount == 0 && city_count != 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个地市", city_count)
|
|
|
+ } else if nbs.AreaCount != 0 && city_count == 0 {
|
|
|
+ subscription_area = fmt.Sprintf("%d个省级地区", nbs.AreaCount)
|
|
|
+ } else {
|
|
|
+ subscription_area = "全国"
|
|
|
+ }
|
|
|
+ //行业
|
|
|
+ if nbs.BuyerclassCount != 0 {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ } else if end_year == start_year {
|
|
|
+ month = end_month - start_month
|
|
|
+ }
|
|
|
+ if year == 0 && month > 0 {
|
|
|
+ subscription_cycle = fmt.Sprintf("%d个月", month)
|
|
|
+ } else if year > 0 && month > 0 {
|
|
|
+ subscription_cycle = fmt.Sprintf("%d年%d个月", year, month)
|
|
|
+ } else if year > 0 && month == 0 {
|
|
|
+ subscription_cycle = fmt.Sprintf("%d年", year)
|
|
|
+ }
|
|
|
+ log.Println(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)
|
|
|
+ log.Println(effective_date)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//vip
|
|
|
product_type = "VIP订阅"
|
|
|
- mail_title = "电子发票申请,剑鱼标讯VIP订单【" + order_code + "】,请查收"
|
|
|
- mailcontent = fmt.Sprintf("", bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, order_code, create_time, pay_time, product_type, isShowTransaction, pay_way, transaction_id, offlineImgSrc, data_spec, data_count, order_money, user_mail, user_phone)
|
|
|
+ mail_title = "电子发票申请-[剑鱼标讯]VIP订阅(" + order_code + ")"
|
|
|
+ mailcontent = fmt.Sprintf(ExConf.Mail_vip_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, order_code, create_time, pay_time, pay_way, product_type, pay_money, subscription_area, industry, subscription_cycle, effective_date)
|
|
|
}
|
|
|
}
|
|
|
//发送邮件
|