Parcourir la source

去掉session判断

abiao il y a 4 ans
Parent
commit
7f107c93fd
22 fichiers modifiés avec 77 ajouts et 197 suppressions
  1. 3 3
      go/gopath/src/fohow.com/apps/controllers/ad_controller/ad_controller.go
  2. 6 6
      go/gopath/src/fohow.com/apps/controllers/address_controller/address_controller.go
  3. 2 2
      go/gopath/src/fohow.com/apps/controllers/article_controller/article_controller.go
  4. 4 4
      go/gopath/src/fohow.com/apps/controllers/balance_controller/balance_controller.go
  5. 5 5
      go/gopath/src/fohow.com/apps/controllers/cent_controller/cent_controller.go
  6. 1 4
      go/gopath/src/fohow.com/apps/controllers/live_controller/live_controller.go
  7. 11 43
      go/gopath/src/fohow.com/apps/controllers/order_controller/cart_controller.go
  8. 18 19
      go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go
  9. 3 3
      go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go
  10. 1 15
      go/gopath/src/fohow.com/apps/controllers/permit_controller/permit_controller.go
  11. 6 6
      go/gopath/src/fohow.com/apps/controllers/pick_address_controller/pick_address_controller.go
  12. 4 4
      go/gopath/src/fohow.com/apps/controllers/poster_controller/poster_controller.go
  13. 1 1
      go/gopath/src/fohow.com/apps/controllers/product_controller/product_controller.go
  14. 1 1
      go/gopath/src/fohow.com/apps/controllers/promotion_controller/promotion_controller.go
  15. 1 1
      go/gopath/src/fohow.com/apps/controllers/share_controller/share_controller.go
  16. 1 1
      go/gopath/src/fohow.com/apps/controllers/sys_controller/sys_controller.go
  17. 5 5
      go/gopath/src/fohow.com/apps/controllers/user_controller/agent_apply_controller.go
  18. 0 14
      go/gopath/src/fohow.com/apps/controllers/user_controller/binding_controller.go
  19. 1 1
      go/gopath/src/fohow.com/apps/controllers/user_controller/invite_controller.go
  20. 0 8
      go/gopath/src/fohow.com/apps/controllers/user_controller/one_click_binding_controller.go
  21. 1 1
      go/gopath/src/fohow.com/apps/controllers/xcx_controller/xcx_controller.go
  22. 2 50
      go/gopath/src/fohow.com/apps/init.go

+ 3 - 3
go/gopath/src/fohow.com/apps/controllers/ad_controller/ad_controller.go

@@ -43,7 +43,7 @@ func (self *AdController) GetItems() {
 	// }
 
 	if adCode == "shop_apply" {
-		wxUId := self.GetCurrentWxUserId()
+		wxUId := self.GetCurrentWxUserIdByToken()
 		wxUser := user_model.GetWxUserById(wxUId, true)
 		if wxUser != nil && wxUser.Rank < 1 {
 			adCode = "user_apply_shop"
@@ -118,7 +118,7 @@ func (self *AdController) Click() {
 	}
 	ad.ClickTimes = ad.ClickTimes + 1
 	ad.Save()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//if wxUser != nil {
 	clickStat := ad_model.GetClickStatByWxUId(ad.Id, wxUId)
 	if clickStat == nil {
@@ -143,7 +143,7 @@ func (self *AdController) Show() {
 	}
 	ad.ShowTimes = ad.ShowTimes + 1
 	ad.Save()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//if wxUser != nil {
 	showStat := ad_model.GetShowStatByWxUId(ad.Id, wxUId)
 	if showStat == nil {

+ 6 - 6
go/gopath/src/fohow.com/apps/controllers/address_controller/address_controller.go

@@ -39,7 +39,7 @@ func (self *AddressController) List() {
 		sort = "created_at"
 	}
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	addresses := address_model.GetUserAddressList(wxUId, sort)
 	self.Data["json"] = addresses
 	self.ServeJSON()
@@ -48,7 +48,7 @@ func (self *AddressController) List() {
 //取默认地址
 func (self *AddressController) DefaultAddress() {
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	address := address_model.GetUserDefaultAddress(wxUId)
 	self.Data["json"] = address
 	self.ServeJSON()
@@ -70,7 +70,7 @@ func (self *AddressController) CreateAddress() {
 		self.ReturnError(404, apps.ParamsRequired, "", nil)
 	}
 	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	addresses := address_model.GetAddressesByWxUId(wxUId)
 	/*	if len(addresses) >= 5 {
@@ -103,7 +103,7 @@ func (self *AddressController) UpdateAddress() {
 	//if item.UserId != uId {
 	//	self.ReturnError(404, apps.NoExist, "", nil)
 	//}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if item.WxUserId != wxUId {
 		self.ReturnError(404, apps.NoExist, "", nil)
 	}
@@ -140,7 +140,7 @@ func (self *AddressController) DeleteAddress() {
 	//if item.UserId != uId {
 	//	self.ReturnError(403, apps.AddressNotMatch, "", nil)
 	//}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if item.WxUserId != wxUId {
 		self.ReturnError(404, apps.NoExist, "", nil)
 	}
@@ -163,7 +163,7 @@ func (self *AddressController) SetDefault() {
 	_id := self.Ctx.Input.Param(":id")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	address := address_model.GetAddressByWxUIdAndId(wxUId, id)
 
 	if address != nil {

+ 2 - 2
go/gopath/src/fohow.com/apps/controllers/article_controller/article_controller.go

@@ -41,7 +41,7 @@ func (self *ArticleController) GetList() {
 		ArticleCat   *article_model.ArticleCat `orm:"-"         json:"article_cat"`
 		ArticleCount int64                     `orm:"-"         json:"article_count"`
 	}
-	articleList := article_model.GetListByCatId(catId, page, perPage, (true && !self.IsDev()))
+	articleList := article_model.GetListByCatId(catId, page, perPage, true && !self.IsDev())
 	articleCat := article_model.GetArticleCatById(catId, true)
 	articleCount := article_model.GetListCountByCatId(catId)
 
@@ -74,7 +74,7 @@ func (self *ArticleController) GetDetail() {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
 	if self.IsWxClient() {
-		wxUId := self.GetCurrentWxUserId()
+		wxUId := self.GetCurrentWxUserIdByToken()
 		if wxUId > 0 {
 			now := time.Now().Unix()
 			k := cache.GetKey(cache.ArticleDetailOpenBenefitByAId, id, wxUId, now)

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

@@ -37,7 +37,7 @@ func (self *BalanceController) GetBalanceInfo() {
 		ShowInviteMode int64 `orm:"-" json:"show_invite_mode"` //是否群主
 	}
 	//user := self.GetCurrentUser(true)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	wxUser := user_model.GetWxUserById(wxUId, true)
 	if wxUser == nil {
 		self.ReturnError(403, apps.UserNeedLogin, "", nil)
@@ -59,7 +59,7 @@ func (self *BalanceController) GetBalanceList() {
 	cache, _ := self.GetBool("cache", false)
 
 	//user := self.GetCurrentUser(cache)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	list := balance_model.GetBalanceListByWxUId(wxUId, page, perPage, cache)
 	count := balance_model.GetBalanceCountByWxUId(wxUId)
@@ -81,7 +81,7 @@ func (self *BalanceController) GetBalanceDetail() {
 	_id := self.Ctx.Input.Param(":id")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	item := balance_model.GetBalanceById(id)
 	if item == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
@@ -247,7 +247,7 @@ func (self *BalanceController) GetTakeCashOrders() {
 	cache, _ := self.GetBool("cache", false)
 
 	//user := self.GetCurrentUser(cache)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	list := balance_model.GetTakeCashOrderListByWxUId(wxUId, page, perPage, cache)
 	listCount := balance_model.GetTakeCashOrderCountByWxUId(wxUId, cache)

+ 5 - 5
go/gopath/src/fohow.com/apps/controllers/cent_controller/cent_controller.go

@@ -45,7 +45,7 @@ func (self *CentController) GetCentInfo() {
 		Total int64 `orm:"-" json:"total"` //余额,单位分
 	}
 	//user := self.GetCurrentUser(true)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//wxUId := int64(1781)
 	wxUser := user_model.GetWxUserById(wxUId, true)
 	if wxUser == nil {
@@ -67,7 +67,7 @@ func (self *CentController) GetCentList() {
 	cache, _ := self.GetBool("cache", false)
 
 	//user := self.GetCurrentUser(cache)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//wxUId := int64(1781)
 	list := cent_model.GetCentBalanceListByWxUId(wxUId, page, perPage, cache)
 	count := cent_model.GetCentBalanceCountByWxUId(wxUId)
@@ -89,7 +89,7 @@ func (self *CentController) GetCentDetail() {
 	_id := self.Ctx.Input.Param(":id")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//wxUId := int64(1781)
 	item := cent_model.GetCentById(id)
 	if item == nil {
@@ -106,7 +106,7 @@ func (self *CentController) GetCentDetail() {
 
 //获得七日签到任务状态
 func (self *CentController) GetSignStatus() {
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	wxUser := user_model.GetWxUserById(wxUId, true)
 	if wxUser == nil {
 		self.ReturnError(403, apps.UserNeedLogin, "", nil)
@@ -195,7 +195,7 @@ func (self *CentController) GetSignStatus() {
 // 每日签到,领取积分
 func (self *CentController) SignEveryday() {
 
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	wxUser := user_model.GetWxUserById(wxUId, true)
 	if wxUser == nil {
 		self.ReturnError(403, apps.UserNeedLogin, "", nil)

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

@@ -56,10 +56,7 @@ func (self *LiveController) Latest() {
 		ListCount int64                   `json:"list_count"`
 	}
 
-	wxUId := self.GetCurrentWxUserId()
-	if wxUId == 0 {
-		wxUId = self.GetCurrentUserIdByToken()
-	}
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	wxUser := user_model.GetWxUserById(wxUId, false)
 	if wxUser == nil {

+ 11 - 43
go/gopath/src/fohow.com/apps/controllers/order_controller/cart_controller.go

@@ -27,8 +27,7 @@ func (self *OrderController) CreateCart() {
 	if count > product.Count {
 		self.ReturnError(403, apps.ProductStockNotEnough, "", nil)
 	}
-	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//店铺专区商品区分
 	if product.Ptype != product_model.TYPE_DIRECT_SALE {
 		self.ReturnError(403, apps.ProductErrorType, "", nil)
@@ -60,7 +59,9 @@ func (self *OrderController) CreateCart() {
 			self.ReturnError(403, []string{apps.SingleOverLimitCount[0], fmt.Sprintf("该商品单次限购%d件", product.SinglePurchLimit)}, "", nil)
 		}
 	}
-	cart := new(order_model.Cart).Create(wxUId, uId, product.Id, count)
+
+	wxUser := self.GetCurrentWxUser(false)
+	cart := new(order_model.Cart).Create(wxUId, wxUser.Id, product.Id, count)
 	result := false
 	if cart != nil {
 		result = true
@@ -87,7 +88,7 @@ func (self *OrderController) ChangeItemNums() {
 	if cartItem == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if cartItem.WxUserId != wxUId {
 		self.ReturnError(403, apps.AccountError, "", nil)
 	}
@@ -118,7 +119,7 @@ func (self *OrderController) ChangeItemState() {
 	if cartItem == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if cartItem.WxUserId != wxUId {
 		self.ReturnError(403, apps.AccountError, "", nil)
 	}
@@ -141,7 +142,7 @@ func (self *OrderController) ChangeItemState() {
 func (self *OrderController) MultChangeItemState() {
 
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	ids := self.GetString("ids")
 	nums := self.GetString("nums")
 
@@ -190,7 +191,7 @@ func (self *OrderController) ChangeAllState() {
 
 	state, _ := self.GetBool("state", false)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	list := order_model.GetCartItemsByWxUserId(wxUId)
 	for _, item := range list {
 		cartItem := order_model.GetCartById(item.Id)
@@ -216,7 +217,7 @@ func (self *OrderController) ChangeAllState() {
 //获取会员购物车信息
 func (self *OrderController) GetCartList() {
 	cache, _ := self.GetBool("cache", true)
-	wxUserId := self.GetCurrentWxUserId()
+	wxUserId := self.GetCurrentWxUserIdByToken()
 	list := order_model.GetCartItemsByWxUserId(wxUserId)
 
 	for _, item := range list {
@@ -287,39 +288,6 @@ func ClearProductCart(userId, productId int64) {
 	}
 }
 
-//获取会员已选购购物车信息
-func (self *OrderController) GetCartBuyList() {
-	cache, _ := self.GetBool("cache", true)
-	uId := self.GetCurrentUserId()
-	isBuy := true
-	list := order_model.GetCartItemsByUserIdAndBuy(uId, isBuy)
-	count := int64(0)
-	total := int64(0)
-	for _, item := range list {
-		count += item.Count
-		product := product_model.GetProductById(item.ProductId, cache)
-		wxUser := user_model.GetWxUserById(item.WxUserId, cache)
-		if wxUser != nil {
-			wxUser.Head = user_model.GetFullImgUrl(wxUser.Head)
-		}
-		item.Cover = product_model.GetCoverByPId(item.ProductId, cache)
-		item.OriginalPrice = product.Price
-		item.ProductName = product.Name
-		item.SeckillStartAt = product.SeckillStart.Unix()
-		item.SeckillEndAt = product.SeckillEnd.Unix()
-		item.SeckilShowPrice = product.SeckilShowPrice
-		total += item.Count * product.Price
-	}
-
-	type Ret struct {
-		List  []*order_model.Cart `json:"list"`
-		Count int64               `json:"count"`
-		Total int64               `json:"total"`
-	}
-	self.Data["json"] = &Ret{Total: total, Count: count, List: list}
-	self.ServeJSON()
-}
-
 //删除购物车产品项
 func (self *OrderController) DeleteItem() {
 	_cid := self.Ctx.Input.Param(":id")
@@ -331,7 +299,7 @@ func (self *OrderController) DeleteItem() {
 	if cartItem == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if cartItem.WxUserId != wxUId {
 		self.ReturnError(403, apps.AccountError, "", nil)
 	}
@@ -348,7 +316,7 @@ func (self *OrderController) DeleteItem() {
 
 //批量删除购物车
 func (self *OrderController) MultChangeItemDelete() {
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	ids := self.GetString("ids")
 	s_arr := strings.Split(ids, ",")
 	for _, s_item := range s_arr {

+ 18 - 19
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -44,8 +44,8 @@ func (self *OrderController) Create() {
 	if product == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
-	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//user := self.GetCurrentUser(true)
 	//黑名单用户返回账户异常
 	//if user.IsBlackUser == 1 {
@@ -82,6 +82,7 @@ func (self *OrderController) Create() {
 	if wxUser == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
+	uId := wxUser.UserId
 	orderType := order_model.ORDER_TYPE_NORMAL
 	//秒杀逻辑: 判断是否处于秒杀时间段内
 	if product.SeckilShowPrice > 0 {
@@ -125,7 +126,7 @@ func (self *OrderController) Create() {
 	}
 	order.Pv = product.Pv * count
 	specialPromotion, specialstr := sys_config.GetSpetialPromotion()
-	if specialPromotion{
+	if specialPromotion {
 		order.Promotions = specialstr
 	}
 	order.Save()
@@ -167,8 +168,7 @@ func (self *OrderController) GetExpressNo() {
 func (self *OrderController) MultipleCreate() {
 	MultreateOrder.Lock()
 	defer MultreateOrder.Unlock()
-	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	ids := self.GetString("ids")
 	nums := self.GetString("nums")
 	if len(nums) <= 0 || len(ids) <= 0 {
@@ -227,7 +227,7 @@ func (self *OrderController) MultipleCreate() {
 	}
 
 	//创建订单
-	order := new(order_model.Order).CreateNew(wxUId, uId,
+	order := new(order_model.Order).CreateNew(wxUId, wxUser.UserId,
 		totalPrice, int64(0), order_model.ORDER_TYPE_NORMAL, wxUser.Depart, order_model.SOURCE_XCX)
 	if order == nil {
 		self.ReturnError(403, apps.CreateOrderFail, "", nil)
@@ -263,7 +263,7 @@ func (self *OrderController) MultipleCreate() {
 	order.TotalPrice = totalPrice
 	order.Freight = freight
 	specialPromotion, specialstr := sys_config.GetSpetialPromotion()
-	if specialPromotion{
+	if specialPromotion {
 		order.Promotions = specialstr
 	}
 	order.Save()
@@ -283,18 +283,19 @@ func (self *OrderController) MultipleCreate() {
 func (self *OrderController) MultShopCreate() {
 	MultShopOrder.Lock()
 	defer MultShopOrder.Unlock()
-	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	ids := self.GetString("ids")
 	nums := self.GetString("nums")
 	if len(nums) <= 0 || len(ids) <= 0 {
 		self.ReturnError(403, apps.NoCart, "", nil)
 	}
 	//非群主店铺专区不能下单
-	wxUser := user_model.GetWxUserByUserId(uId, false)
+	wxUser := self.GetCurrentWxUser(true)
+	uId := wxUser.UserId
 	if wxUser.Rank < int64(2) {
 		self.ReturnError(403, apps.OtherSNotAllow, "", nil)
 	}
+
 	totalPrice := int64(0)
 	//创建订单
 	order := new(order_model.Order).CreateNew(wxUId, uId,
@@ -366,14 +367,13 @@ func (self *OrderController) MultShopCreate() {
 func (self *OrderController) MultCentCreate() {
 	MultCentOrder.Lock()
 	defer MultCentOrder.Unlock()
-	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	ids := self.GetString("ids")
 	nums := self.GetString("nums")
 	if len(nums) <= 0 || len(ids) <= 0 {
 		self.ReturnError(403, apps.NoCart, "", nil)
 	}
-	wxUser := user_model.GetWxUserByUserId(uId, false)
+	wxUser := user_model.GetWxUserById(wxUId, false)
 	if wxUser == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
@@ -435,8 +435,7 @@ func (self *OrderController) MultCentCreate() {
 	}
 
 	//创建订单
-	order := new(order_model.Order).CreateNew(wxUId, uId,
-		totalPrice, int64(0), order_model.ORDER_TYPE_CENT, wxUser.Depart, order_model.SOURCE_XCX)
+	order := new(order_model.Order).CreateNew(wxUId, wxUser.UserId, totalPrice, int64(0), order_model.ORDER_TYPE_CENT, wxUser.Depart, order_model.SOURCE_XCX)
 	if order == nil {
 		self.ReturnError(403, apps.CreateOrderFail, "", nil)
 	}
@@ -550,7 +549,7 @@ func (self *OrderController) WaitCommendList() {
 	perPage := 100
 	cache, _ := self.GetBool("cache", false)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	orders := order_model.GetUserOrders(wxUId, status, page, perPage)
 	count := order_model.GetUserOrdersCount(wxUId, status)
 	var latestOrders []*order_model.Order
@@ -613,7 +612,7 @@ func (self *OrderController) List() {
 	}
 	cache, _ := self.GetBool("cache", false)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	orders := order_model.GetUserOrders(wxUId, order_status, page, perPage)
 	count := order_model.GetUserOrdersCount(wxUId, status)
 	var latestOrders []*order_model.Order
@@ -692,7 +691,7 @@ func (self *OrderController) Operate() {
 	//if uId != o.UserId {
 	//	self.ReturnError(404, apps.OrderNotExist, "", nil)
 	//}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if wxUId != o.WxUserId {
 		self.ReturnError(404, apps.OrderNotExist, "", nil)
 	}
@@ -779,7 +778,7 @@ func (self *OrderController) OrderCommend() {
 		self.ReturnError(404, apps.DetailNotAllow, "", nil)
 	}
 
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	o := order_model.GetOrderById(od.OrderNo, false)
 	if o.WxUserId != wxUId {
 		self.ReturnError(403, apps.AccountError, "", nil)

+ 3 - 3
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -38,8 +38,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
 	var payUrl, tel, addr, concat, allowAddr, allowPro string
 	var payData map[string]string
 	var specialPromotion bool
-	wxUId := self.GetCurrentWxUserId()
-	uId := self.GetCurrentUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	pick_dept_id, _ := self.GetInt64("pick_dept")
 	pick_way, _ := self.GetInt64("pick_way")
 	//地址
@@ -81,6 +80,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
 	if wxUser == nil {
 		self.ReturnError(403, apps.UserNeedLogin, "", nil)
 	}
+	uId := wxUser.UserId
 	//订单状态
 	order := order_model.GetOrderById(oId, false)
 	if order == nil || order.WxUserId != wxUId {
@@ -367,7 +367,7 @@ func (self *PayController) payCentExchange(oId, returnUrl, source, remark string
 	defer payOrder.Unlock()
 	var payUrl string
 	var payData map[string]string
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//地址
 	addressId, _ := self.GetInt64("address_id")
 	address := address_model.GetUserAddressById(addressId)

+ 1 - 15
go/gopath/src/fohow.com/apps/controllers/permit_controller/permit_controller.go

@@ -136,8 +136,6 @@ func (self *PermitController) XcxLogin() {
 		if len(wxUser.Head) > 0 {
 			wxUser.FullHead = self.GetFullImgUrl(wxUser.Head)
 		}
-		self.SetSession(apps.SessionWxUserKey, wxUser.Id)
-		self.SetSession(apps.SessionUserKey, wxUser.UserId)
 	} else {
 		//注册会员
 		ip := self.Ctx.Input.IP()
@@ -163,8 +161,6 @@ func (self *PermitController) XcxLogin() {
 			depart = inviter.Depart
 		}
 		wxUser = new(user_model.WxUser).QuickCreate(key.Openid, key.Unionid, ip, user.Id, inviteId, introUserId, depart)
-		self.SetSession(apps.SessionWxUserKey, wxUser.Id)
-		self.SetSession(apps.SessionUserKey, wxUser.UserId)
 		//赠送积分
 		go helpers.SendCent(wxUser.Id, inviteId)
 	}
@@ -217,9 +213,7 @@ func (self *PermitController) SaveWxuserInfo() {
 		self.ReturnError(403, apps.ParamsError, "", nil)
 	}
 
-	//wxUId := self.GetCurrentWxUserId()
-	wxUId := self.GetCurrentUserIdByToken()
-
+	wxUId := self.GetCurrentWxUserIdByToken()
 	beego.BeeLogger.Info("SaveWxuserInfo wxUId:%d", wxUId)
 
 	wxUser := user_model.GetWxUserById(wxUId, true)
@@ -406,15 +400,7 @@ func (self *PermitController) AfterWxMpLogin() {
 		wxUserGzh.GzhOpenId = mpOpenid
 		go wxUserGzh.UpdateField("GzhOpenId")
 	}
-	if wxUser != nil {
-		self.SetSession(apps.SessionWxUserKey, wxUser.Id)
-	}
 
-	// 如果微信用户已绑定手机,则找出userId,并且赋值给session[userId]
-	if wxUser != nil && wxUser.UserId > 0 {
-		self.SetSession(apps.SessionUserKey, wxUser.UserId)
-		// beego.BeeLogger.Warn("AfterWxAutoLogin, wxUser.UserId=%d", wxUser.UserId)
-	}
 	if cbUrl, ok := cache.Cache.Get(state).(string); ok {
 		if cbUrl == "" {
 			self.Redirect(beego.AppConfig.String("WxHost"), 302)

+ 6 - 6
go/gopath/src/fohow.com/apps/controllers/pick_address_controller/pick_address_controller.go

@@ -33,7 +33,7 @@ func (self *PickAddressController) List() {
 		sort = "created_at"
 	}
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	pic_addresses := address_model.GetUserPickAddressList(wxUId, sort)
 	self.Data["json"] = pic_addresses
 	self.ServeJSON()
@@ -42,7 +42,7 @@ func (self *PickAddressController) List() {
 //取默认地址
 func (self *PickAddressController) DefaultPickAddress() {
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	pic_address := address_model.GetUserDefaultPickAddress(wxUId)
 	self.Data["json"] = pic_address
 	self.ServeJSON()
@@ -60,7 +60,7 @@ func (self *PickAddressController) CreatePickAddress() {
 		self.ReturnError(404, apps.ParamsRequired, "", nil)
 	}
 	uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	pic_addresses := address_model.GetPickAddressesByWxUId(wxUId)
 	/*	if len(pic_addresses) >= 5 {
@@ -93,7 +93,7 @@ func (self *PickAddressController) UpdatePickAddress() {
 	//if item.UserId != uId {
 	//	self.ReturnError(404, apps.NoExist, "", nil)
 	//}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if item.WxUserId != wxUId {
 		self.ReturnError(404, apps.NoExist, "", nil)
 	}
@@ -126,7 +126,7 @@ func (self *PickAddressController) DeletePickAddress() {
 	//if item.UserId != uId {
 	//	self.ReturnError(403, apps.PickAddressNotMatch, "", nil)
 	//}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	if item.WxUserId != wxUId {
 		self.ReturnError(404, apps.NoExist, "", nil)
 	}
@@ -149,7 +149,7 @@ func (self *PickAddressController) SetDefault() {
 	_id := self.Ctx.Input.Param(":id")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	pic_address := address_model.GetPickAddressByWxUIdAndId(wxUId, id)
 
 	if pic_address != nil {

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

@@ -35,7 +35,7 @@ func GetCdnFullImgUrl(img string) string {
 	}
 }
 
-var DEFAULT_HEAD string = "xcx/poster/default_head.png"
+var DEFAULT_HEAD = "xcx/poster/default_head.png"
 
 func (self *PosterController) Init(ctx *context.Context, controllerName, actionName string, app interface{}) {
 	self.BaseController.Init(ctx, controllerName, actionName, app)
@@ -51,7 +51,7 @@ func (self *PosterController) GetPosterXcxQrcode() {
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	useCache, _ := self.GetBool("cache", false)
 
-	wxUid := self.GetCurrentWxUserId()
+	wxUid := self.GetCurrentWxUserIdByToken()
 
 	posterQrcodeRecord := poster_model.GetPosterQrcodeRecordByWIdAndTypeAndRId(wxUid, id, _type, useCache)
 
@@ -115,7 +115,7 @@ func (self *PosterController) UpdatePosterXcxQrcode() {
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	useCache, _ := self.GetBool("cache", false)
 
-	wxUid := self.GetCurrentWxUserId()
+	wxUid := self.GetCurrentWxUserIdByToken()
 
 	posterQrcodeRecord := poster_model.GetPosterQrcodeRecordByWIdAndTypeAndRId(wxUid, id, _type, useCache)
 
@@ -224,7 +224,7 @@ func (self *PosterController) ScanPosterXcxQrcode() {
 	posterQrcodeRecord.ScanTimes = posterQrcodeRecord.ScanTimes + 1
 	posterQrcodeRecord.Save()
 
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	scanRecord := poster_model.GetPosterQrcodeRecordByWxUId(posterQrcodeRecord.Id, wxUId)
 	if scanRecord == nil {
 		go new(poster_model.PosterQrcodeScanRecord).Create(posterQrcodeRecord.Id, wxUId, self.Ctx.Input.IP())

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

@@ -384,7 +384,7 @@ func (self *ProductController) GetNeedShare() {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
 
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	type Ret struct {
 		NeedShare int64 `json:"need_share"`

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

@@ -17,7 +17,7 @@ func (self *PromotionController) GetList() {
 		Presents []*promotion_model.Present `json:"present"`
 		Count    int64                      `json:"count"`
 	}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 
 	promotionList := promotion_model.GetAllNoPatchPresents(wxUId)
 	for _, v := range promotionList {

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

@@ -36,7 +36,7 @@ func (self *ShareController) DoShare() {
 	ri := self.GetString("ri")
 	rp := self.GetString("rp")
 	to := self.GetString("to")
-	uId := self.GetCurrentWxUserId()
+	uId := self.GetCurrentWxUserIdByToken()
 	//wxUser := self.GetCurrentWxUser(true)
 	//if wxUser == nil {
 	//	self.ReturnError(403, apps.WxUserNeedLogin, "", nil)

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

@@ -15,7 +15,7 @@ func (self *SysController) GetCurApplyInfo() {
 	type ApplyInfo struct {
 		Total int64 `orm:"-" json:"total"` //余额,单位分
 	}
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	wxUser := user_model.GetWxUserById(wxUId, true)
 	if wxUser == nil {
 		self.ReturnError(403, apps.UserNeedLogin, "", nil)

+ 5 - 5
go/gopath/src/fohow.com/apps/controllers/user_controller/agent_apply_controller.go

@@ -12,7 +12,7 @@ func (self *UserController) AgentApplication() {
 	mobile := self.GetString("mobile")
 	wxId, _ := self.GetInt64("wx_uid", 0)
 
-	introUserId := self.GetCurrentWxUserId()
+	introUserId := self.GetCurrentWxUserIdByToken()
 	//introUserId := int64(30608)
 	/*	if len(mobile) != 11 {
 		self.ReturnError(404, apps.ParamsError, "", nil)
@@ -55,7 +55,7 @@ func (self *UserController) AgentApplication() {
 func (self *UserController) ComAgentApplication() {
 	_id := self.Ctx.Input.Param(":id")
 	applyId, _ := strconv.ParseInt(_id, 10, 64)
-	introUserId := self.GetCurrentWxUserId()
+	introUserId := self.GetCurrentWxUserIdByToken()
 	//introUserId := int64(30608)
 	record := user_model.GetAgentApplyById(applyId)
 	if record == nil {
@@ -101,7 +101,7 @@ func (self *UserController) GetMyAgentList() {
 	cache, _ := self.GetBool("cache", false)
 
 	//user := self.GetCurrentUser(cache)
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//wxUId := int64(30608)
 	curWxUser := user_model.GetWxUserById(wxUId, true)
 	if curWxUser == nil {
@@ -126,7 +126,7 @@ func (self *UserController) GetAgentDetail() {
 	_id := self.Ctx.Input.Param(":id")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	wxUId := self.GetCurrentWxUserId()
+	wxUId := self.GetCurrentWxUserIdByToken()
 	//wxUId := int64(30608)
 	curWxUser := user_model.GetWxUserById(wxUId, true)
 	if curWxUser == nil {
@@ -185,7 +185,7 @@ func (self *UserController) GetAgentDetailByWxUid() {
 	_id := self.Ctx.Input.Param(":wx_uid")
 	id, _ := strconv.ParseInt(_id, 10, 64)
 	//uId := self.GetCurrentUserId()
-	curId := self.GetCurrentWxUserId()
+	curId := self.GetCurrentWxUserIdByToken()
 	//curId := int64(30608)
 	curWxUser := user_model.GetWxUserById(curId, true)
 	if curWxUser == nil {

+ 0 - 14
go/gopath/src/fohow.com/apps/controllers/user_controller/binding_controller.go

@@ -80,17 +80,6 @@ func (self *UserController) BindingTel() {
 			user.SignupChannelId = cId
 		}
 		user.Save()
-		if user != nil {
-			self.SetSession(apps.SessionUserKey, user.Id)
-		}
-		// sign, template, action := sms_model.GetAliMsgContent(sms_model.LOGIN_PWD)
-		// go sms_model.SendSmsWithAli([]string{tel}, sign, template, action, loginPwd)
-		//go user_model.UpdateIsRegistD5c(user)
-		//go address_model.UpdateAddressUserId(wxUser)
-		//go balance_model.UpdateBalanceUserId(wxUser)
-		//go balance_model.UpdateBalanceOrderUserId(wxUser)
-		//go order_model.UpdateOrderUserId(wxUser)
-		//go exchange_model.UpdateExOrderUser(wxUser)
 	}
 	self.Data["json"] = user
 	self.ServeJSON()
@@ -131,9 +120,6 @@ func (self *UserController) BindingTelNew() {
 		}
 		user.Tel = tel
 		user.Save()
-		if user != nil {
-			self.SetSession(apps.SessionUserKey, user.Id)
-		}
 		//消除user,wxuser缓存
 		go wxUser.CleanCache()
 	}

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

@@ -288,7 +288,7 @@ func (self *UserController) SetWxUserInviter() {
 		return
 	}
 	ivId, _ := strconv.ParseInt(self.Ctx.Input.Param(":wx_inviter"), 10, 64)
-	currectWxUId := self.GetCurrentWxUserId()
+	currectWxUId := self.GetCurrentWxUserIdByToken()
 	if currectWxUId != 0 && ivId != 0 {
 		go helpers.SetInviter(currectWxUId, ivId)
 	}

+ 0 - 8
go/gopath/src/fohow.com/apps/controllers/user_controller/one_click_binding_controller.go

@@ -18,7 +18,6 @@ func (self *UserController) OneClickBindingTel() {
 	if tel == "" {
 		self.ReturnError(403, apps.WxUserNotRegistD5c, "", nil)
 	}
-
 	user := user_model.GetByTel(tel, false)
 	if user != nil {
 		self.ReturnError(403, apps.BindingTelExisted, "", nil)
@@ -47,13 +46,6 @@ func (self *UserController) OneClickBindingTel() {
 		// 	user.SignupChannelId = cId
 		// }
 		user.Save()
-		// sign, template, action := sms_model.GetAliMsgContent(sms_model.LOGIN_PWD)
-		// go sms_model.SendSmsWithAli([]string{tel}, sign, template, action, loginPwd)
-		// 如果微信用户已绑定手机,则找出userId,并且赋值给session[userId]
-		if wxUser != nil && wxUser.UserId > 0 {
-			self.SetSession(apps.SessionWxUserKey, wxUser.Id)
-			self.SetSession(apps.SessionUserKey, wxUser.UserId)
-		}
 	}
 	self.Data["json"] = user
 	self.ServeJSON()

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

@@ -127,7 +127,7 @@ func (self *XcxController) FigureChannel() {
 	cq := channel_xcx_qrcode_model.GetById(id)
 	beego.BeeLogger.Warn("xcx_controller.FigureChannel_(%v)", cq)
 	if cq != nil {
-		wxUId := self.GetCurrentWxUserId()
+		wxUId := self.GetCurrentWxUserIdByToken()
 		if wxUId > 0 {
 			beego.BeeLogger.Warn("xcx_controller.FigureChannel_wxUId_(%d)", wxUId)
 			go new(channel_xcx_qrcode_model.SignUpChannelQrcodeResult).Create(cq.Id, wxUId)

+ 2 - 50
go/gopath/src/fohow.com/apps/init.go

@@ -250,13 +250,8 @@ func (self *BaseController) GetCurrentUser(useCache bool) *user_model.User {
 	return u
 }
 
-func (self *BaseController) GetCurrentWxUserId() int64 {
-	id, _ := self.GetSession(SessionWxUserKey).(int64)
-	return id
-}
-
 func (self *BaseController) GetCurrentWxUser(useCache bool) *user_model.WxUser {
-	id := self.GetCurrentWxUserId()
+	id := self.GetCurrentWxUserIdByToken()
 	if id <= 0 {
 		return nil
 	}
@@ -268,7 +263,7 @@ func (self *BaseController) GetCurrentWxUser(useCache bool) *user_model.WxUser {
 }
 
 //根据token解析userId
-func (self *BaseController) GetCurrentUserIdByToken() int64 {
+func (self *BaseController) GetCurrentWxUserIdByToken() int64 {
 	return getCurrentUserIdByToken(self.Ctx)
 }
 
@@ -358,9 +353,6 @@ func checkWxUserLogin(ctx *context.Context) {
 				}
 				ctx.Output.SetStatus(403)
 				ctx.Output.JSON(errCode, true, true)
-			} else {
-				ctx.Output.Session(SessionUserKey, wxUser.UserId)
-				ctx.Output.Session(SessionWxUserKey, wxUser.Id)
 			}
 		}
 	} else {
@@ -376,46 +368,6 @@ func checkWxUserLogin(ctx *context.Context) {
 	return
 }
 
-func checkUserLogin(ctx *context.Context) {
-	beego.BeeLogger.Info("check user login")
-	userId, ok := ctx.Input.Session(SessionUserKey).(int64)
-	if ok {
-		_, ok := ctx.Input.Session(SessionWxUserKey).(int64)
-		if !ok {
-			beego.BeeLogger.Info("user has login, try to set seesion[wx_user]")
-			// 如果用户登录了,且有绑定了wx_user,则设置微信用户登录
-			wxUser := user_model.GetWxUserByUserId(userId, true)
-			if wxUser != nil {
-				ctx.Output.Session(SessionWxUserKey, wxUser.Id)
-			}
-		}
-	} else {
-		_, ok := ctx.Input.Session(SessionWxUserKey).(int64)
-		if ok {
-			beego.BeeLogger.Info("user not login, wx_user is login,and try to ask user binding tel.")
-			// 如果用户没登录了,但采用微信账户登录,则需要微信用户绑定手机从而创建用户记录
-			errCode := &ErrCode{
-				Code:     UserNeedTel[0],
-				Msg:      UserNeedTel[1],
-				Redirect: fmt.Sprintf("%s/user/binding/state", beego.AppConfig.String("WWWHost")),
-				Data:     nil,
-			}
-			ctx.Output.SetStatus(401)
-			ctx.Output.JSON(errCode, true, true)
-			return
-		}
-		errCode := &ErrCode{
-			Code:     UserNeedLogin[0],
-			Msg:      UserNeedLogin[1],
-			Redirect: "",
-			Data:     nil,
-		}
-		ctx.Output.SetStatus(401)
-		ctx.Output.JSON(errCode, true, true)
-		return
-	}
-}
-
 //检查来自大后台的请求是否为服务器IP
 func CheckIsInvokeFromRailsAdmin(ctx *context.Context) {
 	s := strings.Split(ctx.Request.RemoteAddr, ":")