Explorar o código

Merge branch 'master' into feature/v2.4.13

lianbingjie %!s(int64=2) %!d(string=hai) anos
pai
achega
9433baadb0

+ 17 - 0
src/order/orderManageController.go

@@ -1235,6 +1235,7 @@ func CreateBigOrder(context *admin.Context) (interface{}, error) {
 		code := fmt.Sprintf("%s%s", time.Now().Format("150405"), qutil.GetRandom(6))
 		var status error
 		param.CreatePerson = context.User.Username
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 		if param.CreateType == 1 {
 			status = NewBigOrder(subStatus, dateType, startdate, enddate, userId, code, sName, &param)
 		} else if param.CreateType == 2 {
@@ -1353,6 +1354,10 @@ func UpdateBigOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		if res["user_phone"] != param.Phone {
 			userData, ok := util.MQFW.FindOne("user", map[string]interface{}{"s_phone": param.Phone})
 			memberStatus := 0
@@ -1504,6 +1509,8 @@ func UpdateBigOrder(context *admin.Context) (interface{}, error) {
 		var status error
 		if param.CreateType == 1 {
 			status = UpdateNewBigOrder(subStatus, dateType, now, startdate, enddate, userId, code, sName, &param, returnStatus)
+		} else {
+			util.JysqlDB.Update("dataexport_order", map[string]interface{}{"order_code": code}, map[string]interface{}{"sale_time": param.SaleTime})
 		}
 		if status == nil {
 			// 判断是否需要修改用户类型
@@ -1946,6 +1953,7 @@ func CreateSubOrder(context *admin.Context) (interface{}, error) {
 	}
 	param.BuySubject = "1" //大会员补充包/子账号 均为购买个体
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	if param.Phone != "" {
 		userId, memberStatus := "", 0
 		bigStart, bigEnd, pay_sub_num, free_sub_num := int64(0), int64(0), 0, 0
@@ -2184,6 +2192,10 @@ func UpdateSubOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		//处理回款状态
 		//原来实收金额
 		payMoney := qutil.IntAll(qutil.If(res["pay_money"] == "", 0, res["pay_money"]))
@@ -2400,6 +2412,7 @@ func CreateSupplyOrder(context *admin.Context) (interface{}, error) {
 	}
 	param.BuySubject = "1" //大会员补充包/子账号 均为购买个体
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	if param.Phone != "" {
 		userId := ""
 		bigStart, bigEnd, memberStatus := int64(0), int64(0), 0
@@ -2691,6 +2704,10 @@ func UpdateSupplyOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		//处理回款状态
 		//原来实收金额
 		payMoney := qutil.IntAll(qutil.If(res["pay_money"] == "", 0, res["pay_money"]))

+ 0 - 2
src/order/orderManageService.go

@@ -3718,7 +3718,6 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 	filter, _ := json.Marshal(filterMap)
 	agreementTime := time.Unix(param.AgreementTime, 0)
 	serverMap := GetServerPid()
-	log.Println("serverMap", serverMap)
 	if param.BigPayMoney > -1 {
 		paramOrder := map[string]interface{}{
 			"order_money":    param.BigMoney + param.SubMoney + param.SupplyMoney,
@@ -5324,7 +5323,6 @@ func ParentDownload(rdata *[]map[string]interface{}) string {
 func GetServerPid() map[int]int {
 	pidMap := map[int]int{}
 	datas := util.JysqlDB.Find("bigmember_service", map[string]interface{}{"i_status": 0}, "id,i_pid", "", 0, 0)
-	log.Println("bigmember_service:", datas)
 	if datas != nil && len(*datas) > 0 {
 		for _, v := range *datas {
 			if v["i_pid"] != nil {

+ 9 - 1
src/order/otherOrderController.go

@@ -184,6 +184,7 @@ func CreateOtherOrder(context *admin.Context) (interface{}, error) {
 		return nil, err
 	}
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	code := fmt.Sprintf("%s%s", time.Now().Format("150405"), qutil.GetRandom(6))
 
 	if param.ProductType == "企业商机管理" {
@@ -366,6 +367,10 @@ func UpdateOtherOrder(context *admin.Context) (interface{}, error) {
 		}
 		util.JysqlDB.Update("dataexport_order", map[string]interface{}{"order_code": qutil.ObjToString(param.OrderCode)}, map[string]interface{}{"user_phone": param.Phone, "user_id": userId})
 	}
+	//若业绩时间改变,时分秒改为当前时分秒
+	if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+	}
 
 	//处理订单状态
 	//原来实收金额
@@ -590,10 +595,13 @@ func UpdateOrder(context *admin.Context) (interface{}, error) {
 		return nil, errors.New("缺少销售渠道")
 	}
 	param.CreatePerson = context.User.Username
+	if param.SaleTime != "" {
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+	}
 	insertData := map[string]interface{}{
 		"salesperson":          param.SalesPerson,
 		"salesperson_id":       param.SalesPersonId,
-		"sale_time":            qutil.If(param.SaleTime == "", nil, param.SaleTime), // 业务统计时间,   // 业务统计时间
+		"sale_time":            qutil.If(param.SaleTime == "", nil, param.SaleTime), // 业务统计时间
 		"distribution_channel": param.SalesChannel,
 		"last_update_person":   param.CreatePerson,
 		"last_update_time":     qutil.NowFormat(qutil.Date_Full_Layout),