验证数据
This commit is contained in:
@@ -63,7 +63,7 @@ var ArticleCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "release_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("article", data)
|
||||
@@ -79,7 +79,7 @@ var ArticleCtr = Ctr{
|
||||
v["policy"] = that.Db.Get("policy", "tag", Map{"id": v.GetCeilInt("policy_id")})
|
||||
}
|
||||
if v.GetCeilInt("declare_id") > 0 {
|
||||
v["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,tag,status", Map{"id": v.GetCeilInt("declare_id")})
|
||||
v["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,status", Map{"id": v.GetCeilInt("declare_id")})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,15 @@ import (
|
||||
)
|
||||
|
||||
var CompanyCtr = Ctr{
|
||||
"lists": func(that *Context) {
|
||||
companyName := that.Req.FormValue("company_name")
|
||||
if len(companyName) < 2 {
|
||||
|
||||
"search": func(that *Context) {
|
||||
keywords := that.Req.FormValue("keywords")
|
||||
if len(keywords) < 2 {
|
||||
that.Display(0, Slice{})
|
||||
return
|
||||
}
|
||||
res, err := aliyun.Company.GetCompanyList(companyName)
|
||||
|
||||
res, err := aliyun.Company.GetCompanyList(keywords)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
that.Display(0, Slice{})
|
||||
|
||||
@@ -402,7 +402,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "release_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("article", data)
|
||||
@@ -418,7 +418,7 @@ var DeclareCtr = Ctr{
|
||||
// v["declare"]=that.Db.Get("declare","tag",Map{"id":v.GetCeilInt("declare_id")})
|
||||
//}
|
||||
if v.GetCeilInt("declare_id") > 0 {
|
||||
v["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,tag,status", Map{"id": v.GetCeilInt("declare_id")})
|
||||
v["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,status", Map{"id": v.GetCeilInt("declare_id")})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -8,7 +8,7 @@ import (
|
||||
var FavoriteCtr = Ctr{
|
||||
//关注
|
||||
"follow": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -28,9 +28,9 @@ var FavoriteCtr = Ctr{
|
||||
data["type"] = 1
|
||||
|
||||
} else if notifyId != 0 {
|
||||
notify := that.Db.Get("notify", "article_id", Map{"id": notifyId})
|
||||
if notify != nil {
|
||||
data = Map{"notify_id": notifyId, "article_id": notify.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"notify_id": notifyId})
|
||||
if article != nil {
|
||||
data = Map{"notify_id": notifyId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 0
|
||||
@@ -38,9 +38,9 @@ var FavoriteCtr = Ctr{
|
||||
}
|
||||
|
||||
} else if policyId != 0 {
|
||||
policy := that.Db.Get("policy", "article_id", Map{"id": policyId})
|
||||
if policy != nil {
|
||||
data = Map{"policy_id": policyId, "article_id": policy.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"policy_id": policyId})
|
||||
if article != nil {
|
||||
data = Map{"policy_id": policyId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 0
|
||||
@@ -48,9 +48,9 @@ var FavoriteCtr = Ctr{
|
||||
}
|
||||
|
||||
} else if declareId != 0 {
|
||||
declare := that.Db.Get("declare", "article_id", Map{"id": declareId})
|
||||
if declare != nil {
|
||||
data = Map{"declare_id": declareId, "article_id": declare.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"declare_id": declareId})
|
||||
if article != nil {
|
||||
data = Map{"declare_id": declareId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 0
|
||||
@@ -98,7 +98,7 @@ var FavoriteCtr = Ctr{
|
||||
|
||||
//关注
|
||||
"unfollow": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -118,9 +118,9 @@ var FavoriteCtr = Ctr{
|
||||
data["type"] = 1
|
||||
|
||||
} else if notifyId != 0 {
|
||||
notify := that.Db.Get("notify", "article_id", Map{"id": notifyId})
|
||||
if notify != nil {
|
||||
data = Map{"notify_id": notifyId, "article_id": notify.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"notify_id": notifyId})
|
||||
if article != nil {
|
||||
data = Map{"notify_id": notifyId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 1
|
||||
@@ -128,9 +128,9 @@ var FavoriteCtr = Ctr{
|
||||
}
|
||||
} else if policyId != 0 {
|
||||
|
||||
policy := that.Db.Get("policy", "article_id", Map{"id": policyId})
|
||||
if policy != nil {
|
||||
data = Map{"policy_id": policyId, "article_id": policy.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"policy_id": policyId})
|
||||
if article != nil {
|
||||
data = Map{"policy_id": policyId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 1
|
||||
@@ -138,9 +138,9 @@ var FavoriteCtr = Ctr{
|
||||
}
|
||||
|
||||
} else if declareId != 0 {
|
||||
declare := that.Db.Get("declare", "article_id", Map{"id": declareId})
|
||||
if declare != nil {
|
||||
data = Map{"declare_id": declareId, "article_id": declare.GetCeilInt("article_id"), "user_id": that.Session("user_id").Data}
|
||||
article := that.Db.Get("article", "id", Map{"declare_id": declareId})
|
||||
if article != nil {
|
||||
data = Map{"declare_id": declareId, "article_id": article.GetCeilInt("id"), "user_id": that.Session("user_id").Data}
|
||||
favorite = that.Db.Get("favorite", "*", Map{"AND": data})
|
||||
data["modify_time[#]"] = "now()"
|
||||
data["del_flag"] = 1
|
||||
@@ -176,13 +176,13 @@ var FavoriteCtr = Ctr{
|
||||
return
|
||||
}
|
||||
|
||||
that.Display(4, "没有关注")
|
||||
that.Display(0, "没有关注")
|
||||
return
|
||||
},
|
||||
|
||||
"search": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
|
||||
+12
-1
@@ -9,11 +9,22 @@ import (
|
||||
|
||||
// Project 管理端项目
|
||||
var Project = Proj{
|
||||
"article": ArticleCtr,
|
||||
"company": CompanyCtr,
|
||||
"declare": DeclareCtr,
|
||||
"favorite": FavoriteCtr,
|
||||
"lxcx": Lxcx,
|
||||
"matters": MattersCtr,
|
||||
"notify": NotifyCtr,
|
||||
"order": OrderCtr,
|
||||
"policy": PolicyCtr,
|
||||
"provider": ProviderCtr,
|
||||
"sms": Sms,
|
||||
"tag": TagCtr,
|
||||
"user": UserCtr,
|
||||
"websocket": WebsocketCtr,
|
||||
"wechath5": Wechath5,
|
||||
"wechatmini": Wechath5,
|
||||
"provider": ProviderCtr,
|
||||
}
|
||||
|
||||
//生成随机码的6位md5
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
var MattersCtr = Ctr{
|
||||
"create": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -45,7 +45,7 @@ var MattersCtr = Ctr{
|
||||
that.Display(0, re)
|
||||
},
|
||||
"info": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -70,7 +70,7 @@ var MattersCtr = Ctr{
|
||||
},
|
||||
"edit": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -108,7 +108,7 @@ var MattersCtr = Ctr{
|
||||
//用户微信公众号或者小程序登录
|
||||
"search": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ var NotifyCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "release_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("article", data)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
var OrderCtr = Ctr{
|
||||
//创建订单
|
||||
"create": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -110,7 +110,7 @@ var OrderCtr = Ctr{
|
||||
},
|
||||
|
||||
"info": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -138,7 +138,7 @@ var OrderCtr = Ctr{
|
||||
//用户微信公众号或者小程序登录
|
||||
"search": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ var PolicyCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "release_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("article", data)
|
||||
|
||||
@@ -53,6 +53,11 @@ var ProviderCtr = Ctr{
|
||||
data["OR"] = Map{"name[~]": keywords, "title[~]": keywords}
|
||||
}
|
||||
|
||||
tp := that.Req.FormValue("type")
|
||||
if tp != "" {
|
||||
data[tp] = 1
|
||||
}
|
||||
|
||||
policyDeclareFlag := that.Req.FormValue("policy_declare_flag")
|
||||
if policyDeclareFlag != "" {
|
||||
data["policy_declare_flag"] = ObjToInt(policyDeclareFlag)
|
||||
@@ -80,7 +85,7 @@ var ProviderCtr = Ctr{
|
||||
count := that.Db.Count("provider", data)
|
||||
|
||||
res := that.Db.Page(page, pageSize).PageSelect("provider", "id,name,level,discount,avatar,title,description,"+
|
||||
"click_num_base+click_num AS click_num,handle_num_base+handle_num AS handle_num,favorite_num_base+favorite_num AS favorite_num,modify_time", data)
|
||||
"click_num_base+click_num AS click_num,handle_num_base+handle_num AS handle_num,favorite_num_base+favorite_num AS favorite_num,modify_time,policy_declare_flag,intellectual_property_flag,tax_onsulting_flag,law_flag", data)
|
||||
|
||||
that.Display(0, Map{"total": count, "data": res})
|
||||
},
|
||||
|
||||
@@ -9,10 +9,6 @@ var Sms = Ctr{
|
||||
//只允许微信验证过的或者登录成功的发送短信
|
||||
"send": func(that *Context) {
|
||||
|
||||
if len(that.Req.FormValue("token")) != 32 {
|
||||
that.Display(2, "没有授权")
|
||||
return
|
||||
}
|
||||
if that.Session("wechat_id").Data == nil && that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录不可发送短信")
|
||||
return
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
var TagCtr = Ctr{
|
||||
|
||||
"create": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ var UserCtr = Ctr{
|
||||
},
|
||||
//用户微信公众号或者小程序登录
|
||||
"info": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -40,7 +40,7 @@ var UserCtr = Ctr{
|
||||
},
|
||||
|
||||
"edit": func(that *Context) {
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -91,6 +91,6 @@ var UserCtr = Ctr{
|
||||
return
|
||||
}
|
||||
|
||||
that.Display(4, "修改成功")
|
||||
that.Display(0, "修改成功")
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user