WH01243 %!s(int64=4) %!d(string=hai) anos
pai
achega
b5bf69fecf

+ 11 - 2
src/jfw/modules/distribution/src/service/action/share.go

@@ -53,11 +53,20 @@ func (this *Share) ProductInfo() error {
 		userId, _ := this.Session().Get("userId").(string)
 		//userId := "5c89fead1c298a4d75fef39e"
 		if userId != "" {
-			if p_data, ok := MQFW.Find("dis_product", `{"s_status":1}`, `{"l_createdate":1}`, nil, false, -1, -1); ok && p_data != nil {
+			partner := Mysql.SelectBySql("SELECT dp.type WHERE dp.uid = ? ", userId)
+			p_data, ok := MQFW.Find("dis_product", `{"s_status":1,"model":1}`, `{"l_createdate":1}`, nil, false, -1, -1);
+			if ((*partner)[0]["type"]).(string) == "2" {
+				p_data, ok = MQFW.Find("dis_product", `{"s_status":1,"model":2}`, `{"l_createdate":1}`, nil, false, -1, -1);
+			}
+			if ok && p_data != nil {
 				//个人累计数据
 				dis_res := *Mysql.SelectBySql("SELECT DISTINCT a.product_name,SUM(a.sale_money) AS t_sale,SUM(a.commission) AS t_com,COUNT(a.product_name) AS t_count FROM dis_sale a  WHERE a.uid = '" + userId + "'  GROUP BY a.product_name")
-				for _, v := range *p_data {
+				for key, v := range *p_data {
 					delete(v, "_id")
+					if (v["s_name"]=="超级订阅企业版"){
+						v["s_name"]="超级订阅"
+						(*p_data)[key]["s_name"]="超级订阅"
+					}
 					for _, dv := range dis_res {
 						if dv["product_name"] == v["s_name"].(string) {
 							v["t_sale"] = util.IntAll(dv["t_sale"])   //销售金额

+ 0 - 1
src/jfw/modules/subscribepay/src/service/vipSubscribeChange.go

@@ -133,7 +133,6 @@ func (this *SubscribeChange) Upgrade() {
 		date_count, date_unit, needRenew := 0, 0, false
 		endUnix := qutil.Int64All((*rData)["l_vip_endtime"])
 		startUnix := qutil.Int64All((*rData)["l_vip_starttime"])
-
 		if timeRenew != "" {
 			var err error
 			date_count, date_unit, err = checkReqDate(timeRenew)

+ 11 - 7
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -67,17 +67,20 @@ func (this *SubVipPayOrder) CreateOrder() {
 		openId := qutil.ObjToString(this.GetSession("s_m_openid"))
 		disWord := this.GetString("disWord")
 		//查询用户是否有分销链接
+		disWordStr:=""
 		userfilter, ok := util.MQFW.FindById("user", userId, "")
 		if ok && userfilter != nil {
 			startTime := qutil.Int64All((*userfilter)["startTime"])
 			endTime := qutil.Int64All((*userfilter)["endTime"])
 			if startTime != 0 {
 				if startTime <= time.Now().Unix() || endTime >= time.Now().Unix() {
-					disWordStr := qutil.ObjToString((*userfilter)["disWord"])
-					disWord = disWordStr
+					disWordStr= qutil.ObjToString((*userfilter)["disWord"])
 				}
 			}
 		}
+		if disWordStr!=""{
+			disWord=disWordStr
+		}
 		req_price, _ := this.GetInteger("price")     //前端展示金额
 		order_phone := this.GetString("order_phone") //p19.3用户信息采集 手机号
 		if disWord == "" {
@@ -89,9 +92,7 @@ func (this *SubVipPayOrder) CreateOrder() {
 			}
 		}
 		now := time.Now()
-
 		userData, oldBuyset, _ := entity.JyVipSubStruct.GetVipDetail(userId)
-
 		pass := func() bool { //校验订单是否合法
 			if orderType == 1 {
 				vipStatus := qutil.IntAll((*userData)["i_vip_status"])
@@ -233,18 +234,21 @@ func (this *SubVipPayOrder) Renew() {
 		disWord := this.GetString("disWord")
 		openId := qutil.ObjToString(this.GetSession("s_m_openid"))
 		req_price, _ := this.GetInteger("price") //前端展示金额
-		//查询用户是否有分销链接
+		//查询用户是否有分销链接、
+		disWordStr:=""
 		userfilter, ok := util.MQFW.FindById("user", userId, "")
 		if ok && userfilter != nil {
 			startTime := qutil.Int64All((*userfilter)["startTime"])
 			endTime := qutil.Int64All((*userfilter)["endTime"])
 			if startTime != 0 {
 				if startTime <= time.Now().Unix() || endTime >= time.Now().Unix() {
-					disWordStr := qutil.ObjToString((*userfilter)["disWord"])
-					disWord = disWordStr
+					disWordStr = qutil.ObjToString((*userfilter)["disWord"])
 				}
 			}
 		}
+		if disWordStr!=""{
+			disWord=disWordStr
+		}
 		if disWord == "" {
 			start_time := TimeProcessing(time.Now().Format(DateFullLayout), -config.Config.TermValidity).Format(DateFullLayout)
 			stop_time := TimeProcessing(time.Now().Format(DateFullLayout), config.Config.TermValidity).Format(DateFullLayout)

+ 9 - 4
src/jfw/modules/weixin/src/wx/wx.go

@@ -400,11 +400,16 @@ func saveUser(u *UserInfo, source, pre, RSource, CSource string) (bool, string,
 		newUser["i_applystatus"] = 1
 		if source!=""{
 			newUser["disWord"] = strings.Split(source, "_")[1]
-			newUser["startTime"] = time.Now().Unix()
-			newUser["endTime"] = time.Now().AddDate(1, 0, 0).Unix()
+			diswordStr:=redis.Get("other",source)
+			startTime:=""
+			if diswordStr!=nil{
+				startTime=strings.Split(fmt.Sprint(diswordStr),"##")[2]
+			}
+			startTimeInt64, _ := strconv.ParseInt(startTime, 10, 64)
+			newUser["startTime"] =startTimeInt64
+			endTime:=time.Unix(startTimeInt64,0)
+			newUser["endTime"] = endTime.AddDate(1, 0, 0).Unix()
 		}
-
-
 		if isJyopUser {
 			newUser["s_registersource"] = "openplatform"
 		}