Procházet zdrojové kódy

Merge branch 'master' of http://git.hiwavo.com/Fohow/fohow_api

abiao před 4 roky
rodič
revize
68729e38ce

+ 7 - 7
go/gopath/src/fohow.com/apps/models/user_model/invite.go

@@ -214,19 +214,19 @@ func GetMyIntroListByInviteId(inviteId, page, perPage int64, useCache bool) (lis
 			wx_users a
 			LEFT JOIN ( SELECT sum( count ) AS total, sum( amount ) AS amount, benefit_wx_uid AS wx_uid from invite_benefit_orders WHERE 1 group  by benefit_wx_uid ) b ON a.id = b.wx_uid 
 		WHERE
-			a.intro_user_id=%d
+			a.intro_user_id=%d or a.invite_id=%d
 		ORDER BY
 			a.sale_group DESC
 			LIMIT %d,%d;
 	`
-	sql = fmt.Sprintf(sql, inviteId, (page-1)*perPage, perPage)
+	sql = fmt.Sprintf(sql, inviteId, inviteId, (page-1)*perPage, perPage)
 	_, err := o.Raw(sql).QueryRows(&list)
 	if err != nil {
 		beego.BeeLogger.Error("GetMyIntroListByInviteId err=[%s], inviteId id:%d", err, inviteId)
 		return nil
 	}
 	for _, item := range list {
-		beego.BeeLogger.Warn("%v", item)
+		//beego.BeeLogger.Warn("%v", item)
 		item.Head = GetFullImgUrl(item.Head)
 		//代理状态判断---普通会员(status=0),则显示 申请代理
 		if item.ShowInviteMode == 0 {
@@ -251,7 +251,7 @@ func GetMyIntroCountByInviteId(inviteId int64) int64 {
 	}
 	ret := &Ret{}
 	o := orm.NewOrm()
-	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where intro_user_id=%d;", inviteId)
+	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where intro_user_id=%d or invite_id=%d  ;", inviteId, inviteId)
 	err := o.Raw(sql).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetMyIntroCountByInviteId, inviteId:%d, err=[%s]", inviteId, err)
@@ -395,12 +395,12 @@ func GetMyMonthIntroListByInviteId(inviteId int64, page, perPage int64, createTi
 			wx_users a
 			LEFT JOIN ( SELECT sum( count ) AS total, sum( amount ) AS amount, benefit_wx_uid AS wx_uid FROM invite_benefit_orders WHERE date_format(date_add(created_at, interval 8 HOUR), '%s')= ? GROUP BY benefit_wx_uid ) b ON a.id = b.wx_uid 
 		WHERE
-			 a.intro_user_id=%d 
+			 a.intro_user_id=%d  or  a.invite_id=%d 
 		ORDER BY
 			a.sale_group DESC
 			LIMIT %d,%d;
 	`
-	sql = fmt.Sprintf(sql, "%Y%m", inviteId, (page-1)*perPage, perPage)
+	sql = fmt.Sprintf(sql, "%Y%m", inviteId, inviteId, (page-1)*perPage, perPage)
 	_, err := o.Raw(sql, createTime.Format("200601")).QueryRows(&list)
 	if err != nil {
 		beego.BeeLogger.Error("GetIntroListByInnerNoAndTime err=[%s], inviteId:%d, createTime: %s", err, inviteId, createTime.Format("2006-01-02"))
@@ -431,7 +431,7 @@ func GetMyMonthIntroListCount(inviteId int64) int64 {
 	}
 	ret := &Ret{}
 	o := orm.NewOrm()
-	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where intro_user_id=%d  ;", inviteId)
+	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where intro_user_id=%d or invite_id=%d  ;", inviteId, inviteId)
 	err := o.Raw(sql).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetMyMonthIntroListCount, inviteId:%d, err=[%s]", inviteId, err)