|
@@ -5,24 +5,18 @@
|
|
|
package member
|
|
|
|
|
|
import (
|
|
|
- "fmt"
|
|
|
"github.com/go-xweb/xweb"
|
|
|
"gopkg.in/mgo.v2/bson"
|
|
|
"log"
|
|
|
"net/http"
|
|
|
coreconfig "qfw/coreconfig"
|
|
|
- "qfw/coreutil"
|
|
|
- "qfw/redpackage"
|
|
|
"qfw/util"
|
|
|
"qfw/util/credit"
|
|
|
"qfw/util/elastic"
|
|
|
. "qfw/util/fsw"
|
|
|
"qfw/util/mongodb"
|
|
|
- msg "qfw/util/msg"
|
|
|
"qfw/util/redis"
|
|
|
- qrpc "qfw/util/rpc"
|
|
|
yps "qfw/yellowpage"
|
|
|
- "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -31,141 +25,14 @@ type Yellowpage struct {
|
|
|
*xweb.Action
|
|
|
editEnterprise xweb.Mapper `xweb:"/member/enterprise/edit"` //编辑
|
|
|
showEnterprise xweb.Mapper `xweb:"/member/enterprise/show"` //显示企黄页信息
|
|
|
- dosave xweb.Mapper `xweb:"/member/yellowpage/dosave/enterprise"` //保存企业黄页信息
|
|
|
+ save xweb.Mapper `xweb:"/member/yellowpage/save"` //保存企业黄页信息
|
|
|
upLoadEntImg xweb.Mapper `xweb:"POST /member/yellowpage/upLoadEntImg"` //上传企业相关图片
|
|
|
-
|
|
|
- addService xweb.Mapper `xweb:"/member/yellowpage/add/service/addservice"` //增加服务
|
|
|
- delservice xweb.Mapper `xweb:"POST /member/service/delservice"` //删除数据
|
|
|
- findservice xweb.Mapper `xweb:"POST /member/service/findservice"` //查找要修改数据
|
|
|
- removeservice xweb.Mapper `xweb:"POST /member/service/removeservice"` //下架服务
|
|
|
-
|
|
|
- follow xweb.Mapper `xweb:"POST /member/enterprise/follow"` //关注企业
|
|
|
- isFollowed xweb.Mapper `xweb:"POST /member/enterprise/isFollowed"` //查询关注状态
|
|
|
+ follow xweb.Mapper `xweb:"POST /member/enterprise/follow"` //关注企业
|
|
|
+ isFollowed xweb.Mapper `xweb:"POST /member/enterprise/isFollowed"` //查询关注状态
|
|
|
}
|
|
|
|
|
|
const ESTYPE string = "enterprise"
|
|
|
|
|
|
-//修改前找到此服务
|
|
|
-func (u *Yellowpage) Findservice() error {
|
|
|
- if u.Method() == "POST" {
|
|
|
- id := u.GetString("id")
|
|
|
- res := map[string]interface{}{}
|
|
|
- res["data"] = mongodb.FindById("service", id, `{"id":0}`)
|
|
|
- u.ServeJson(&res)
|
|
|
- }
|
|
|
- return nil
|
|
|
-}
|
|
|
-
|
|
|
-//删除服务
|
|
|
-func (u *Yellowpage) Delservice() error {
|
|
|
- if u.Method() == "POST" {
|
|
|
- if checkuser(u) == false {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "用户没有通过审核",
|
|
|
- })
|
|
|
- return nil
|
|
|
- }
|
|
|
- //判断是否能删除
|
|
|
- id := u.GetString("id")
|
|
|
- entid := u.GetSession("entid")
|
|
|
- index := "service"
|
|
|
- itype := "service"
|
|
|
- query := &map[string]interface{}{
|
|
|
- "_id": bson.ObjectIdHex(id),
|
|
|
- "s_enterpriseid": entid,
|
|
|
- }
|
|
|
- //先删除mongodb中数据
|
|
|
- b, _ := CheckAuth(K{"_id": id})
|
|
|
-
|
|
|
- if b == false {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "删除失败,请确定没有未处理的预约以及用户都已评论!",
|
|
|
- })
|
|
|
- return nil
|
|
|
- }
|
|
|
- flag := mongodb.Del("service", query)
|
|
|
- if flag {
|
|
|
- //再删除elasticsearch中的数据
|
|
|
- redis.DelByCodePattern("enterprise", "service-"+entid.(string)+"-*")
|
|
|
- flag2 := elastic.DelById(index, itype, id)
|
|
|
- if flag2 {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "删除服务成功!",
|
|
|
- })
|
|
|
-
|
|
|
- } else {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "删除服务失败!",
|
|
|
- })
|
|
|
- }
|
|
|
- //Insertservicenames(entid.(string))
|
|
|
- } else {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "删除服务失败!",
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- return nil
|
|
|
-}
|
|
|
-
|
|
|
-//下架服务
|
|
|
-func (u *Yellowpage) Removeservice() error {
|
|
|
- if u.Method() == "POST" {
|
|
|
- //判断用户是否审核通过
|
|
|
- if checkuser(u) == false {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "用户没有通过审核",
|
|
|
- })
|
|
|
- return nil
|
|
|
- }
|
|
|
- //判断是否能下架
|
|
|
- id := u.GetString("id")
|
|
|
- entid := u.GetSession("entid")
|
|
|
- index := "service"
|
|
|
- itype := "service"
|
|
|
- query := &map[string]interface{}{
|
|
|
- "_id": bson.ObjectIdHex(id),
|
|
|
- "s_enterpriseid": entid,
|
|
|
- }
|
|
|
- //先删除mongodb中数据
|
|
|
- b, _ := CheckAuth(K{"_id": id})
|
|
|
-
|
|
|
- if b == false {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "下架失败,请确定没有未处理的预约以及用户都已评论!",
|
|
|
- })
|
|
|
- return nil
|
|
|
- }
|
|
|
- obj := *mongodb.FindOne("service", query)
|
|
|
- if len(obj) > 0 {
|
|
|
- sid := strings.Split(fmt.Sprintf("%s", obj["_id"]), `"`)[1]
|
|
|
- flag := mongodb.Update("service", `{"_id":"`+sid+`"}`, bson.M{"$set": bson.M{"i_status": 1}}, false, false)
|
|
|
- if flag {
|
|
|
- redis.DelByCodePattern("enterprise", "service-"+entid.(string)+"-*")
|
|
|
- //修改elasticsearch中的数据
|
|
|
- isUpdate := elastic.UpdateNewDoc(index, itype, mongodb.FindById("service", sid, nil))
|
|
|
-
|
|
|
- if isUpdate {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "下架成功!",
|
|
|
- })
|
|
|
-
|
|
|
- } else {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "下架服务失败!",
|
|
|
- })
|
|
|
- }
|
|
|
- //Insertservicenames(entid.(string))
|
|
|
- } else {
|
|
|
- u.ServeJson(&map[string]interface{}{
|
|
|
- "msg": "下架服务失败!",
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return nil
|
|
|
-}
|
|
|
-
|
|
|
//我的黄页
|
|
|
func (yp *Yellowpage) ShowEnterprise() error {
|
|
|
//判断用户是否审核通过
|
|
@@ -185,7 +52,7 @@ func (yp *Yellowpage) EditEnterprise() error {
|
|
|
}
|
|
|
|
|
|
//保存企业黄页的信息
|
|
|
-func (yp *Yellowpage) Dosave() error {
|
|
|
+func (yp *Yellowpage) Save() error {
|
|
|
status := "n"
|
|
|
s_persion := Repl(yp.GetString("s_persion"))
|
|
|
//联系人不能为空
|
|
@@ -233,302 +100,6 @@ func (yp *Yellowpage) Dosave() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//显示增加编辑服务页面
|
|
|
-func (yp *Yellowpage) ShowService(id string) error {
|
|
|
- //判断用户是否登录,如果没有登录直接返回首页
|
|
|
- if yp.GetSession("userId") == nil {
|
|
|
- return yp.Redirect("/")
|
|
|
- }
|
|
|
- yp.T["entid"] = id
|
|
|
- yp.T["serviceName"] = "添加产品服务信息"
|
|
|
- yp.T["serviceClassify"] = coreconfig.ServiceClassify
|
|
|
-
|
|
|
- yp.T["entinfo"] = yps.GetEntInfo(id)
|
|
|
- opLocD := yp.GetSession("opLocDistrict")
|
|
|
- yp.T["opLocDistrict"] = opLocD
|
|
|
- return yp.Render("/member/editservice.html", &yp.T)
|
|
|
-}
|
|
|
-
|
|
|
-//编辑服务页面
|
|
|
-func (yp *Yellowpage) EditService(id string) error {
|
|
|
- //判断用户是否登录,如果没有登录直接返回首页
|
|
|
- if yp.GetSession("userId") == nil {
|
|
|
- return yp.Redirect("/")
|
|
|
- }
|
|
|
- //判断用户是否审核通过
|
|
|
- if checkuser(yp) == false {
|
|
|
- return yp.Redirect("/member/accountset/index", http.StatusFound)
|
|
|
- }
|
|
|
- yp.T["serviceName"] = "编辑产品服务信息"
|
|
|
- yp.T["serviceClassify"] = coreconfig.ServiceClassify
|
|
|
-
|
|
|
- opLocD := yp.GetSession("opLocDistrict")
|
|
|
- yp.T["opLocDistrict"] = opLocD
|
|
|
-
|
|
|
- res := mongodb.FindById("service", id, `{"id":0}`)
|
|
|
- //res["f_price"] = fmt.Sprintf("%.2f", res["f_price"])
|
|
|
- yp.T["service"] = &res
|
|
|
- tmp := (*res)
|
|
|
- serentid := tmp["s_enterpriseid"].(string)
|
|
|
- //格式化价格
|
|
|
- if tmp["f_price"] == nil {
|
|
|
- yp.T["price"] = 0
|
|
|
- } else {
|
|
|
- price := fmt.Sprintf("%.2f", tmp["f_price"])
|
|
|
- yp.T["price"] = price
|
|
|
- }
|
|
|
-
|
|
|
- yp.T["entinfo"] = yps.GetEntInfo(serentid)
|
|
|
- yp.T["entid"] = serentid
|
|
|
- //根据服务ID获取服务信息
|
|
|
-
|
|
|
- return yp.Render("/member/editservice.html", &yp.T)
|
|
|
-}
|
|
|
-
|
|
|
-//编辑与保存企业黄页中添加服务信息
|
|
|
-func (yp *Yellowpage) AddService() error {
|
|
|
- var info string = "保存成功"
|
|
|
- var status string = "y"
|
|
|
- var isshows = ""
|
|
|
-
|
|
|
- enterpriseid := yp.GetSession("entid").(string)
|
|
|
- enterprisename := yp.GetSession("entname").(string)
|
|
|
- //行政区划
|
|
|
- opLocD := yp.GetSession("opLocDistrict")
|
|
|
- identType := yp.GetSession("identType")
|
|
|
- comauthenttype := yp.GetSession("comauthenttype")
|
|
|
- serviceid := yp.GetString("serviceid")
|
|
|
- sname := Repl(yp.GetString("servicename"))
|
|
|
- firstservicetype := Repl(yp.GetString("s_firstservicetype"))
|
|
|
- secondservicetype := Repl(yp.GetString("s_secondservicetype"))
|
|
|
- phone := yp.GetString("s_phone")
|
|
|
- province := yp.GetString("province")
|
|
|
- city := yp.GetString("city")
|
|
|
- area := yp.GetString("area")
|
|
|
-
|
|
|
- //当只选择了省
|
|
|
- if len(city) == 1 || len(city) == 0 {
|
|
|
- opLocD = province
|
|
|
- } else {
|
|
|
- opLocD = area
|
|
|
- }
|
|
|
- //是否只选择了市
|
|
|
- if len(area) == 1 || len(area) == 0 {
|
|
|
- opLocD = city
|
|
|
- } else {
|
|
|
- opLocD = area
|
|
|
- }
|
|
|
-
|
|
|
- userid := yp.GetSession("userId")
|
|
|
- username := yp.GetString("username")
|
|
|
- images := yp.GetString("imgurl")
|
|
|
- price, _ := yp.GetFloat("s_price")
|
|
|
- s_introduvtion := Repl(yp.GetStringComm("s_introduvtion"))
|
|
|
- //获取复选框中的信息
|
|
|
- isshow := yp.GetSlice("isshow")
|
|
|
- for _, v := range isshow {
|
|
|
- isshows = v + "," + isshows
|
|
|
- }
|
|
|
- doc := make(map[string]interface{})
|
|
|
- doc["s_name"] = sname
|
|
|
- doc["s_pservicecode"] = firstservicetype
|
|
|
- doc["s_servicecode"] = secondservicetype
|
|
|
- doc["s_name"] = sname
|
|
|
- //检面议是否选中
|
|
|
- if price == 0 {
|
|
|
- doc["s_pricemy"] = "1"
|
|
|
- } else {
|
|
|
- doc["f_price"] = price
|
|
|
- doc["s_pricemy"] = "0"
|
|
|
- }
|
|
|
- doc["f_price"] = price
|
|
|
- doc["s_introduction"] = s_introduvtion
|
|
|
- doc["s_createuserid"] = userid
|
|
|
- doc["s_createusername"] = username
|
|
|
- doc["s_images"] = images
|
|
|
- doc["l_createdate"] = time.Now().Unix()
|
|
|
- //时间戳
|
|
|
- doc["l_timestamp"] = time.Now().Unix()
|
|
|
- if len(serviceid) == 0 {
|
|
|
- //点击数
|
|
|
- doc["i_hits"] = 0
|
|
|
- //预约数
|
|
|
- doc["i_appcounts"] = 0
|
|
|
- //成交数
|
|
|
- doc["i_sales"] = 0
|
|
|
- //评论数
|
|
|
- doc["i_comments"] = 0
|
|
|
- //总分
|
|
|
- doc["i_score"] = 0
|
|
|
- }
|
|
|
-
|
|
|
- //企业信息
|
|
|
- doc["s_enterpriseid"] = enterpriseid
|
|
|
- doc["s_enterprisename"] = enterprisename
|
|
|
- doc["s_phone"] = phone
|
|
|
- doc["s_isshow"] = isshows
|
|
|
- doc["s_opLocDistrict"] = opLocD //行政区划代码
|
|
|
- doc["i_identType"] = identType //认证状态
|
|
|
- doc["i_comauthenttype"] = comauthenttype //企业认证标识:1:营业执照;2:企业名片;3:企业邮箱
|
|
|
- doc["i_status"] = 0
|
|
|
- var tempFlag = false
|
|
|
- //当服务ID不为空的时候执行编辑方法
|
|
|
- if len(serviceid) > 0 {
|
|
|
- docSet := map[string]interface{}{
|
|
|
- "$set": doc,
|
|
|
- }
|
|
|
- //更新服务
|
|
|
- //判断是否能删除
|
|
|
-
|
|
|
- b, _ := CheckAuth(K{"_id": serviceid})
|
|
|
- if b == false {
|
|
|
- return nil
|
|
|
- }
|
|
|
-
|
|
|
- flag := mongodb.Update("service", "{'_id':'"+serviceid+"'}", &docSet, false, false)
|
|
|
- //更新企业表,服务表
|
|
|
- if flag {
|
|
|
- //将数据存到elastic中
|
|
|
- doc["_id"] = serviceid
|
|
|
- tempFlag = true
|
|
|
- //更新服务表到elastic
|
|
|
- elastic.UpdateNewDoc("service", "service", mongodb.FindById("service", serviceid, nil))
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- doc["i_status"] = 0
|
|
|
- _id := mongodb.Save("service", doc)
|
|
|
- doc["_id"] = _id
|
|
|
- tempFlag = len(_id) > 0
|
|
|
- //发服务送积分
|
|
|
- if tempFlag {
|
|
|
- if credit.AIsHasDo(credit.A_FFW, util.Int64All(yp.GetSession("credit_a"))) {
|
|
|
- credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.B_FFW, "B", nil, yp.Action)
|
|
|
- } else {
|
|
|
- credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.A_FFW, "A", nil, yp.Action)
|
|
|
- credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.B_FFW, "B", nil, yp.Action)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- currentuser := mongodb.FindById("user", yp.GetSession("userId").(string), nil)
|
|
|
- if len(*currentuser) != 0 && (*currentuser)["s_provider"] == nil {
|
|
|
- mongodb.Update("user", `{"_id":"`+yp.GetSession("userId").(string)+`"}`, `{"$set":{"s_provider":1}}`, true, false)
|
|
|
- }
|
|
|
- if tempFlag {
|
|
|
- //删除缓存信息
|
|
|
- redis.Del("enterprise", "enterpriseInfo_"+enterpriseid)
|
|
|
- redis.DelByCodePattern("enterprise", "service-"+enterpriseid+"-*")
|
|
|
- //将数据存到elastic中
|
|
|
- flag2 := elastic.UpdateNewDoc("service", "service", doc)
|
|
|
- //Insertservicenames(enterpriseid)
|
|
|
- if !flag2 {
|
|
|
- status = "n"
|
|
|
- }
|
|
|
- } else {
|
|
|
- status = "n"
|
|
|
- }
|
|
|
- //如果是新增操作,进入发红包逻辑
|
|
|
- if len(serviceid) == 0 && tempFlag && false {
|
|
|
- //活动有效日期
|
|
|
- valid := time.Now().After(time.Unix(coreconfig.RedPackage.StartDate, 0)) && time.Now().Before(time.Unix(coreconfig.RedPackage.EndDate, 0))
|
|
|
- //判断用户是否是第一次发服务
|
|
|
- valid = valid && mongodb.Count("service", `{"s_createuserid":"`+userid.(string)+`"}`) == 1
|
|
|
- //判断注册日期,必须在活动日期之间
|
|
|
- if valid {
|
|
|
- userInfo := mongodb.FindById("user", userid.(string), `{"l_registedate":1,"s_m_openid":1,"i_identificationtype":1,"i_identificationway":1}`)
|
|
|
- var openid, nickName string
|
|
|
- if nickNameTmp := yp.GetSession("nickName"); nickNameTmp != nil && nickNameTmp.(string) != "" {
|
|
|
- nickName = nickNameTmp.(string)
|
|
|
- } else {
|
|
|
- nickName = enterprisename
|
|
|
- }
|
|
|
- if openidTmp := (*userInfo)["s_m_openid"]; openidTmp != nil && openidTmp.(string) != "" {
|
|
|
- openid = openidTmp.(string)
|
|
|
- } else {
|
|
|
- valid = false
|
|
|
- }
|
|
|
- if l_registedate, ok := (*userInfo)["l_registedate"].(int64); valid && ok {
|
|
|
- registeDate := time.Unix(l_registedate, 0)
|
|
|
- //必须是活动期间注册的用户
|
|
|
- valid = registeDate.After(time.Unix(coreconfig.RedPackage.StartDate, 0)) && registeDate.Before(time.Unix(coreconfig.RedPackage.EndDate, 0))
|
|
|
- //认证通过
|
|
|
- valid = valid && util.IntAll((*userInfo)["i_identificationway"]) == 1
|
|
|
- //个人认证不发红包
|
|
|
- valid = valid && util.IntAll((*userInfo)["i_identificationtype"]) != 2
|
|
|
- //判断该用户是否有红包记录,如果没有并且之前验证通过就发红包
|
|
|
- valid = valid && mongodb.Count("redpackage", `{"s_openid":"`+openid+`"}`) == 0
|
|
|
- } else {
|
|
|
- valid = false
|
|
|
- }
|
|
|
- if valid {
|
|
|
- //第一次发红包
|
|
|
- yp.SetSession("firstredtype", "y")
|
|
|
- go func() {
|
|
|
- //发微信消息
|
|
|
- title := coreconfig.RedPackage.Weixin["successtitle"].(string)
|
|
|
- remark := coreconfig.RedPackage.Weixin["successremark"].(string)
|
|
|
- detail := coreconfig.RedPackage.Weixin["sendname"].(string)
|
|
|
- coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: title, Detail: detail, Remark: remark})
|
|
|
- //邮件过来的用户才可以发红包
|
|
|
- if promotion := mongodb.FindOne("promotion_log", `{"s_uid":"`+userid.(string)+`"}`); promotion != nil && len(*promotion) > 0 && (*promotion)["s_type"] != nil && (*promotion)["s_type"].(string) == "email" {
|
|
|
- //红包一天内5000个,0:00--8:00之间不能发红包
|
|
|
- today := time.Now()
|
|
|
- if today.After(time.Date(today.Year(), today.Month(), today.Day(), 8, 0, 0, 0, time.Local)) && mongodb.Count("redpackage", bson.M{"i_year": today.Year(), "i_month": today.Month(), "i_day": today.Day()}) <= 5000 {
|
|
|
- amount := redpackage.GetAmount() * 100 //“元”转换为“分”,程序随机获取的红包金额以“元”为单位,微信红包以“分”为单位
|
|
|
- bm := qrpc.BonusMsg{Mchbillno: fmt.Sprint(today.Unix()),
|
|
|
- Sendname: coreconfig.RedPackage.Weixin["sendname"].(string),
|
|
|
- Reopenid: openid,
|
|
|
- Totalamount: amount,
|
|
|
- Totalnum: 1,
|
|
|
- Wishing: coreconfig.RedPackage.Weixin["wishing"].(string),
|
|
|
- Actname: coreconfig.RedPackage.Weixin["actname"].(string),
|
|
|
- Remark: coreconfig.RedPackage.Weixin["remark"].(string),
|
|
|
- }
|
|
|
- //红包发送成功
|
|
|
- if coreutil.PayBonus(&bm) {
|
|
|
- //发站内消息
|
|
|
- m := &msg.Msg{
|
|
|
- Msgtype: 1,
|
|
|
- Title: coreconfig.RedPackage.Msg["title"].(string),
|
|
|
- Content: coreconfig.RedPackage.Msg["content"].(string),
|
|
|
- ReceiveId: userid.(string),
|
|
|
- }
|
|
|
- m.SaveMsg()
|
|
|
- //保存红包成功记录
|
|
|
- redpackage := make(bson.M)
|
|
|
- redpackage["s_userid"] = userid.(string)
|
|
|
- redpackage["s_username"] = nickName
|
|
|
- redpackage["s_openid"] = openid
|
|
|
- redpackage["s_billno"] = bm.Mchbillno
|
|
|
- redpackage["s_name"] = bm.Actname
|
|
|
- redpackage["i_amount"] = amount
|
|
|
- redpackage["l_createdate"] = today.Unix()
|
|
|
- redpackage["i_year"] = today.Year()
|
|
|
- redpackage["i_month"] = today.Month()
|
|
|
- redpackage["i_day"] = today.Day()
|
|
|
- mongodb.Save("redpackage", redpackage)
|
|
|
- }
|
|
|
- } else {
|
|
|
- //保存红包失败记录
|
|
|
- redpackage := make(bson.M)
|
|
|
- redpackage["s_userid"] = userid.(string)
|
|
|
- redpackage["s_username"] = nickName
|
|
|
- redpackage["s_openid"] = openid
|
|
|
- redpackage["l_createdate"] = today.Unix()
|
|
|
- redpackage["i_year"] = today.Year()
|
|
|
- redpackage["i_month"] = today.Month()
|
|
|
- redpackage["i_day"] = today.Day()
|
|
|
- mongodb.Save("reissueredpackage", redpackage)
|
|
|
- }
|
|
|
- }
|
|
|
- }()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return yp.Write("{\"info\":\"" + info + "\",\"status\":\"" + status + "\"}")
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
//将服务名拼成字符串存入企业表
|
|
|
func Insertservicenames(enterpriseid string) bool {
|
|
@@ -634,7 +205,7 @@ func (yp *Yellowpage) Follow() error {
|
|
|
status = "y"
|
|
|
}
|
|
|
} else {
|
|
|
- if mongodb.Count("follow_enterprise", `{"s_userid":"`+userId+`"}`) >= 10 {
|
|
|
+ if mongodb.Count("follow_enterprise", `{"s_userid":"`+userId+`"}`) >= coreconfig.SysConfig.FollowEnterprise {
|
|
|
status = "m"
|
|
|
} else if mongodb.Count("follow_enterprise", `{"s_userid":"`+userId+`","s_entid":"`+entId+`"}`) == 0 {
|
|
|
userInfo := yp.GetSession("userInfo").(*map[string]interface{})
|