|
@@ -535,22 +535,22 @@ func (self *BaseController) Prepare() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/*
|
|
/*
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
- // FIXME : userId 与 wxUserId已统一,故不做userid登录check
|
|
|
|
|
-=======
|
|
|
|
|
- // FIXME : userId 与 wxUserId已统一
|
|
|
|
|
->>>>>>> b24580bdd09b3e2b6278d2deb8d368bb9c21d652
|
|
|
|
|
- if len(self.ExceptCheckUserLoginAction) > 0 {
|
|
|
|
|
- for _, an := range self.ExceptCheckUserLoginAction {
|
|
|
|
|
- if strings.ToLower(an) == "*" || strings.ToLower(an) == strings.ToLower(actionName) {
|
|
|
|
|
- needChkUserLogin = false
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ <<<<<<< HEAD
|
|
|
|
|
+ // FIXME : userId 与 wxUserId已统一,故不做userid登录check
|
|
|
|
|
+ =======
|
|
|
|
|
+ // FIXME : userId 与 wxUserId已统一
|
|
|
|
|
+ >>>>>>> b24580bdd09b3e2b6278d2deb8d368bb9c21d652
|
|
|
|
|
+ if len(self.ExceptCheckUserLoginAction) > 0 {
|
|
|
|
|
+ for _, an := range self.ExceptCheckUserLoginAction {
|
|
|
|
|
+ if strings.ToLower(an) == "*" || strings.ToLower(an) == strings.ToLower(actionName) {
|
|
|
|
|
+ needChkUserLogin = false
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- if needChkUserLogin {
|
|
|
|
|
- checkUserLogin(self.Ctx)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if needChkUserLogin {
|
|
|
|
|
+ checkUserLogin(self.Ctx)
|
|
|
|
|
+ }
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
if needChkWxUserLogin {
|
|
if needChkWxUserLogin {
|
|
@@ -655,3 +655,26 @@ func (self *BaseController) GetCdnFullImgUrl(img string) string {
|
|
|
return fmt.Sprintf("%s/%s", beego.AppConfig.String("AliCDNImgHost"), img)
|
|
return fmt.Sprintf("%s/%s", beego.AppConfig.String("AliCDNImgHost"), img)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// ServeJSON sends a json response with encoding charset.
|
|
|
|
|
+func (c *BaseController) ServeResultJSON(encoding ...bool) {
|
|
|
|
|
+ from := c.GetString("source")
|
|
|
|
|
+ beego.BeeLogger.Warn("from--%s", from)
|
|
|
|
|
+ type Result struct {
|
|
|
|
|
+ Result interface{} `json:"result"`
|
|
|
|
|
+ }
|
|
|
|
|
+ var (
|
|
|
|
|
+ hasIndent = true
|
|
|
|
|
+ hasEncoding = false
|
|
|
|
|
+ )
|
|
|
|
|
+ if beego.AppConfig.String("RunMode") == "prod" {
|
|
|
|
|
+ hasIndent = false
|
|
|
|
|
+ }
|
|
|
|
|
+ if len(encoding) > 0 && encoding[0] == true {
|
|
|
|
|
+ hasEncoding = true
|
|
|
|
|
+ }
|
|
|
|
|
+ if from == beego.AppConfig.String("SourceList") {
|
|
|
|
|
+ c.Data["json"] = &Result{Result: c.Data["json"]}
|
|
|
|
|
+ }
|
|
|
|
|
+ c.Ctx.Output.JSON(c.Data["json"], hasIndent, hasEncoding)
|
|
|
|
|
+}
|