|
@@ -5,6 +5,7 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"jy/src/jfw/modules/app/src/app/config"
|
|
@@ -78,11 +79,32 @@ func (s *Activity) Mini(args string) {
|
|
|
|
|
|
// CheckSubscribe 是否关注
|
|
|
func (s *Activity) CheckSubscribe() {
|
|
|
- userInfo := common.ObjToMap(s.Session().Get("user"))
|
|
|
- if userInfo == nil || common.InterfaceToStr((*userInfo)["_id"]) == "" {
|
|
|
- s.ServeJson(api.NewResult(nil, errors.New("需要登录")))
|
|
|
- return
|
|
|
- }
|
|
|
- status := jyutil.IsSubscribe(common.InterfaceToStr((*userInfo)["_id"]))
|
|
|
- s.ServeJson(api.NewResult(status, nil))
|
|
|
+ defer common.Catch()
|
|
|
+ r := func() api.Result {
|
|
|
+ if s.Method() != "POST" {
|
|
|
+ return api.Result{Data: nil, Error_msg: api.Error_msg_1005}
|
|
|
+ }
|
|
|
+ //接收参数
|
|
|
+ // 查询
|
|
|
+ if string(s.Body()) == "" {
|
|
|
+ return api.Result{Data: nil, Error_msg: api.Error_msg_1003}
|
|
|
+ }
|
|
|
+ param := struct {
|
|
|
+ Id string
|
|
|
+ }{}
|
|
|
+ //接收参数
|
|
|
+ err := json.Unmarshal(s.Body(), ¶m)
|
|
|
+ if err != nil || param.Id == "" {
|
|
|
+ return api.Result{Data: nil, Error_msg: api.Error_msg_1003}
|
|
|
+ }
|
|
|
+ auId := param.Id
|
|
|
+ id := common.IntAll(encrypt.SE.DecodeString(auId))
|
|
|
+ if id == 0 {
|
|
|
+ return api.Result{Data: nil, Error_msg: api.Error_msg_1003}
|
|
|
+ }
|
|
|
+ userId, _ := jyutil.GetActivateUser(id)
|
|
|
+ status := jyutil.IsSubscribe(common.InterfaceToStr(userId))
|
|
|
+ return api.Result{Data: status}
|
|
|
+ }()
|
|
|
+ s.ServeJson(r)
|
|
|
}
|