|
@@ -301,12 +301,76 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ //
|
|
|
+ data_spec := p.GetString("data_spec")
|
|
|
+ if data_spec == "standard" {
|
|
|
+ data_spec = "标准字段包"
|
|
|
+ } else if data_spec == "senior" {
|
|
|
+ data_spec = "高级字段包"
|
|
|
+ }
|
|
|
+ user_mail, _ := p.GetSession("DataExportVerifyEmail_val").(string)
|
|
|
+ user_phone, _ := p.GetSession("DataExportVerifyPhone").(string)
|
|
|
+ if user_phone != "" {
|
|
|
+ p.SetSession("DataExportVerifyPhone_val", user_phone) //提交后下次默认带出手机号
|
|
|
+ } else {
|
|
|
+ user_phone, _ = p.GetSession("DataExportVerifyPhone_val").(string)
|
|
|
+ }
|
|
|
//先看有没有创建过预支付订单
|
|
|
oldOrder := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
"user_openid": openId,
|
|
|
"filter_id": id,
|
|
|
- }, "id,order_status,order_code,order_money", "")
|
|
|
+ }, "id,order_status,order_code,order_money,user_mail,user_phone,data_spec,prepay_time", "")
|
|
|
if oldOrder != nil {
|
|
|
+ if user_mail != "" && user_mail != util.ObjToString((*oldOrder)["user_mail"]) {
|
|
|
+ public.Mysql.Update("dataexport_order", map[string]interface{}{
|
|
|
+ "user_openid": openId,
|
|
|
+ "filter_id": id,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "user_mail": user_mail,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if user_phone != "" && user_phone != util.ObjToString((*oldOrder)["user_phone"]) {
|
|
|
+ public.Mysql.Update("dataexport_order", map[string]interface{}{
|
|
|
+ "user_openid": openId,
|
|
|
+ "filter_id": id,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "user_phone": user_phone,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if data_spec != "" && data_spec != util.ObjToString((*oldOrder)["data_spec"]) {
|
|
|
+ //
|
|
|
+ data_count := public.GetDataExportSearchCountUseId(id)
|
|
|
+ if data_count > public.ExConf.MsgMaxCount {
|
|
|
+ data_count = public.ExConf.MsgMaxCount
|
|
|
+ }
|
|
|
+ order_money_, original_price_ := float64(0), float64(0)
|
|
|
+ if data_spec == "标准字段包" {
|
|
|
+ original_price_ = float64(data_count) * public.ExConf.UnitPrice_normal
|
|
|
+ } else if data_spec == "高级字段包" {
|
|
|
+ original_price_ = float64(data_count) * public.ExConf.UnitPrice_senior
|
|
|
+ }
|
|
|
+ order_money_ = float64(original_price_) * public.ExConf.Discount
|
|
|
+ if order_money_ < public.ExConf.OrderMinPrice {
|
|
|
+ order_money_ = public.ExConf.OrderMinPrice
|
|
|
+ }
|
|
|
+ if original_price_ < public.ExConf.OrderMinPrice {
|
|
|
+ original_price_ = public.ExConf.OrderMinPrice
|
|
|
+ }
|
|
|
+ order_money := int(order_money_ * 100)
|
|
|
+ original_price := int(original_price_ * 100)
|
|
|
+ prepayTime, _ := time.ParseInLocation(util.Date_Full_Layout, util.ObjToString((*oldOrder)["prepay_time"]), time.Local)
|
|
|
+ surplus_second := prepayTime.Unix() - 7200 //价格变动 支付二维码更新成超时状态--重新生订单二维码
|
|
|
+ public.Mysql.Update("dataexport_order", map[string]interface{}{
|
|
|
+ "user_openid": openId,
|
|
|
+ "filter_id": id,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "data_spec": data_spec,
|
|
|
+ "order_money": order_money,
|
|
|
+ "original_price": original_price,
|
|
|
+ "prepay_time": util.FormatDateByInt64(&surplus_second, util.Date_Full_Layout),
|
|
|
+ })
|
|
|
+ (*oldOrder)["order_money"] = order_money
|
|
|
+ }
|
|
|
if util.IntAll((*oldOrder)["order_status"]) == 0 {
|
|
|
p.ServeJson(map[string]interface{}{
|
|
|
"status": "y",
|
|
@@ -322,11 +386,7 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- //
|
|
|
- user_mail, _ := p.GetSession("DataExportVerifyEmail_val").(string)
|
|
|
- user_phone, _ := p.GetSession("DataExportVerifyPhone_val").(string)
|
|
|
user_mail_status := p.GetSession("EMVerifySucess").(bool)
|
|
|
- data_spec := p.GetString("data_spec")
|
|
|
pay_way := p.GetString("pay_way")
|
|
|
//
|
|
|
data_count := public.GetDataExportSearchCountUseId(id)
|
|
@@ -334,11 +394,9 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
|
|
|
data_count = public.ExConf.MsgMaxCount
|
|
|
}
|
|
|
order_money_, original_price_ := float64(0), float64(0)
|
|
|
- if data_spec == "standard" {
|
|
|
- data_spec = "标准字段包"
|
|
|
+ if data_spec == "标准字段包" {
|
|
|
original_price_ = float64(data_count) * public.ExConf.UnitPrice_normal
|
|
|
- } else if data_spec == "senior" {
|
|
|
- data_spec = "高级字段包"
|
|
|
+ } else if data_spec == "高级字段包" {
|
|
|
original_price_ = float64(data_count) * public.ExConf.UnitPrice_senior
|
|
|
}
|
|
|
order_money_ = float64(original_price_) * public.ExConf.Discount
|