Browse Source

fix:时间格式修改

duxin 2 months ago
parent
commit
194d8c8806
1 changed files with 9 additions and 10 deletions
  1. 9 10
      src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go

+ 9 - 10
src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go

@@ -48,9 +48,8 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
 		if orderStatus := qu.IntAll((*orderData)["order_status"]); orderStatus == 0 {
 			//中台资源中心更新
 			var (
-				vipEndTime  int64 = 0
-				vipState    int   = 0
-				vip_endtime interface{}
+				vipEndTime int64 = 0
+				vipState   int   = 0
 			)
 			udata := util.Compatible.Select(userId, `{"l_vip_endtime":1,"i_vip_status":1}`)
 			if udata != nil {
@@ -65,10 +64,15 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
 				log.Printf("获取用户%s已购买%s内容异常:%v\n", userId, productType, err)
 				return false
 			}
+			upDetail := map[string]interface{}{
+				"is_service_open":   1,
+				"open_service_time": now.Format(time.DateTime),
+				"service_starttime": now.Format(time.DateTime),
+			}
 			if endTime := gconv.String(filterM["validTime"]); endTime != "" {
 				parsedTime, err := time.Parse("2006-01-02", endTime)
 				if err == nil {
-					vip_endtime = parsedTime.Format("2006-01-02 15:04:05")
+					upDetail["service_endtime"] = parsedTime.Format("2006-01-02 15:04:05")
 				}
 			}
 			if update := util.Mysql.ExecTx("更改支付完成订单服务状态", func(tx *sql.Tx) bool {
@@ -85,12 +89,7 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
 				}
 				if !util.Mysql.UpdateByTx(tx, "jy_order_detail", g.Map{
 					"order_code": orderCode,
-				}, map[string]interface{}{
-					"is_service_open":   1,
-					"open_service_time": now.Format(time.DateTime),
-					"service_starttime": now.Format(time.DateTime),
-					"service_endtime":   vip_endtime,
-				}) {
+				}, upDetail) {
 					return false
 				}
 				return true