Просмотр исходного кода

Merge branch 'develop' into feature/app_dev

* develop:
  增加苹果验证文件
  增加苹果验证文件
  缓存清理优化
  缓存清理优化
  缓存清理优化
  我的推广屏蔽未绑定会员
  我的推广屏蔽未绑定会员
abiao лет назад: 4
Родитель
Сommit
11d8ad1c44

+ 2 - 1
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/generate_controller.go

@@ -173,7 +173,8 @@ func (self *RailsadminController) GenerateXcxQrcode() {
 		wxUser.Save()
 		qrcodeUrl = self.GetFullImgUrl(uploadPath)
 	}
-
+	//消除user,wxuser缓存
+	go wxUser.CleanCache()
 	self.Data["json"] = &Ret{QrcodeUrl: qrcodeUrl}
 	self.ServeJSON()
 }

+ 1 - 6
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/intro_user_controller.go

@@ -1,10 +1,8 @@
 package railsadmin_controller
 
 import (
-	"fmt"
 	"fohow.com/apps"
 	"fohow.com/apps/models/user_model"
-	"fohow.com/cache"
 	"github.com/astaxie/beego"
 	"strconv"
 	"time"
@@ -33,9 +31,6 @@ func (self *RailsadminController) UpdateIntroUser() {
 	inviteList := user_model.GetWxUsersByInviteIdAll(wxUser.Id, false)
 	go user_model.UpdateClass(inviteList, wxUser.Id, wxUser.IntroUserId)
 	//消除user,wxuser缓存
-	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
-	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
-	cache.Cache.Delete(userKey)
-	cache.Cache.Delete(wxUserKey)
+	go wxUser.CleanCache()
 	self.ServeJSON()
 }

+ 1 - 5
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/update_shop_application.go

@@ -7,7 +7,6 @@ import (
 	"fohow.com/apps/models/balance_model"
 	"fohow.com/apps/models/sys_config"
 	"fohow.com/apps/models/user_model"
-	"fohow.com/cache"
 	"github.com/astaxie/beego"
 	"strconv"
 	"time"
@@ -49,10 +48,7 @@ func (self *RailsadminController) UpdateShopApplication() {
 	//helpers.ShopOrderPromotion(shopApplication.Id, wxUser.Id, wxUser.Depart)
 	helpers.CreateShopApplyOrder(shopApplication.Id)
 	//消除user,wxuser缓存
-	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
-	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
-	cache.Cache.Delete(userKey)
-	cache.Cache.Delete(wxUserKey)
+	go wxUser.CleanCache()
 	self.ServeJSON()
 }
 

+ 1 - 4
go/gopath/src/fohow.com/apps/controllers/user_controller/binding_controller.go

@@ -135,10 +135,7 @@ func (self *UserController) BindingTelNew() {
 			self.SetSession(apps.SessionUserKey, user.Id)
 		}
 		//消除user,wxuser缓存
-		userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
-		wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
-		cache.Cache.Delete(userKey)
-		cache.Cache.Delete(wxUserKey)
+		go wxUser.CleanCache()
 	}
 	self.Data["json"] = user
 	self.ServeJSON()

+ 1 - 4
go/gopath/src/fohow.com/apps/controllers/user_controller/user_controller.go

@@ -540,10 +540,7 @@ func (self *UserController) SysUserBind() {
 	}
 
 	//清掉wxuser缓存
-	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
-	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
-	cache.Cache.Delete(userKey)
-	cache.Cache.Delete(wxUserKey)
+	go wxUser.CleanCache()
 	type Ret struct {
 		Result bool `json:"result"`
 	}

+ 1 - 6
go/gopath/src/fohow.com/apps/helpers/intro_helper.go

@@ -1,9 +1,7 @@
 package helpers
 
 import (
-	"fmt"
 	"fohow.com/apps/models/user_model"
-	"fohow.com/cache"
 	"time"
 )
 
@@ -22,8 +20,5 @@ func UpdateIntroUser(wxUser *user_model.WxUser) {
 	inviteList := user_model.GetWxUsersByInviteIdAll(wxUser.Id, false)
 	go user_model.UpdateClass(inviteList, wxUser.Id, wxUser.IntroUserId)
 	//消除user,wxuser缓存
-	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
-	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
-	cache.Cache.Delete(userKey)
-	cache.Cache.Delete(wxUserKey)
+	go wxUser.CleanCache()
 }

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

@@ -215,6 +215,7 @@ func GetMyIntroListByInviteId(inviteId, page, perPage int64, useCache bool) (lis
 			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 or a.invite_id=%d
+			and a.openid!=""
 		ORDER BY
 			a.sale_group DESC
 			LIMIT %d,%d;
@@ -251,7 +252,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 or invite_id=%d  ;", inviteId, inviteId)
+	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where  openid!='' and 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)
@@ -396,6 +397,7 @@ func GetMyMonthIntroListByInviteId(inviteId int64, page, perPage int64, createTi
 			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  or  a.invite_id=%d 
+			 and a.openid!="" 
 		ORDER BY
 			a.sale_group DESC
 			LIMIT %d,%d;
@@ -431,7 +433,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 or invite_id=%d  ;", inviteId, inviteId)
+	sql := fmt.Sprintf("select count(DISTINCT id) as count from wx_users where openid!='' and 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)

+ 10 - 0
go/gopath/src/fohow.com/apps/models/user_model/wx_user.go

@@ -387,6 +387,16 @@ func (self *WxUser) SetInviter(ivId int64) {
 	}
 }
 
+// 清空微信会员缓存
+func (self *WxUser) CleanCache() {
+	//消除user,wxuser缓存
+	userKey := fmt.Sprintf("user.GetByUid[%d]", self.UserId)
+	wxUserKey := cache.GetKey(cache.GetWxUserById, self.Id)
+	beego.BeeLogger.Warn("CleanCache--wxuserkey(%s)", wxUserKey)
+	cache.Cache.Delete(userKey)
+	cache.Cache.Delete(wxUserKey)
+}
+
 func GetCountByWxUserInviter(id int64) int64 {
 	o := orm.NewOrm()
 	i, err := o.QueryTable(new(WxUser)).Filter("invite_id", id).Count()

+ 5 - 0
go/gopath/src/fohow.com/nginx/ngx_test_config

@@ -21,6 +21,11 @@ server {
       #expires  30d;
     }
 
+    location =/apple-app-site-association {
+          root /home/rails/fohow/api/go/gopath/src/fohow.com/static/tapi/;
+          #expires  30d;
+     }
+
     location =/stcXSY70Qh.txt {
       root /home/rails/fohow/api/go/gopath/src/fohow.com/static/tapi/;
       #expires  30d;

+ 1 - 1
go/gopath/src/fohow.com/routers/routes.go

@@ -170,7 +170,7 @@ func init() {
 	beego.Router("/v1/wxuser/info", &user_controller.UserController{}, "put:UpdateWxUserInfo")
 	// 设置微信用户的邀请人
 	beego.Router("/v1/wxuser/inviter/:wx_inviter([0-9]+)", &user_controller.UserController{}, "put:SetWxUserInviter")
-	// 邀请列表
+	// 我的推广接口
 	beego.Router("/v1/invite/:invite_wxid/list", &user_controller.UserController{}, "get:GetInviteList")
 	beego.Router("/v1/invite/:invite_wxid/monthly/list", &user_controller.UserController{}, "get:GetMonthlyInviteList")
 	beego.Router("/v1/invite/:invited_wxid/slist", &user_controller.UserController{}, "get:GetSecInviteList")

+ 15 - 0
go/gopath/src/fohow.com/static/api/apple-app-site-association

@@ -0,0 +1,15 @@
+{
+    "applinks": {
+        "apps": [],
+        "details": [
+            {
+                "appID": "9JA89QQLNQ.com.apple.wwdc",
+                "paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
+            },
+            {
+                "appID": "7M437M38JX.io.fohow.com",
+                "paths": [ "*" ]
+            }
+        ]
+    }
+}

+ 15 - 0
go/gopath/src/fohow.com/static/tapi/apple-app-site-association

@@ -0,0 +1,15 @@
+{
+    "applinks": {
+        "apps": [],
+        "details": [
+            {
+                "appID": "9JA89QQLNQ.com.apple.wwdc",
+                "paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
+            },
+            {
+                "appID": "7M437M38JX.io.fohow.com",
+                "paths": [ "*" ]
+            }
+        ]
+    }
+}