wangchuanjin vor 9 Jahren
Ursprung
Commit
fcf13ef9de

+ 1 - 1
common/src/qfw/util/elastic/elasticutil.go

@@ -604,7 +604,7 @@ func ConverData(ent *map[string]interface{}) map[string]interface{} {
 	tmp2["OpLocDistrictName"] = getLoc(tmpLoc, &LocCity)
 
 	tmp2["RecCap"] = tmp["RecCap"]
-	tmp2["RegCap"] = tmp["RegCap"]
+	tmp2["excDirect"] = tmp["excDirect"]
 	tmp2["IndustryPhy"] = tmp["IndustryPhy"]
 	tmp2["IndustryPhyName"] = tmp["IndustryPhyName"]
 	tmp2["RegOrg"] = tmp["RegOrg"]

+ 2 - 1
core/src/config.json

@@ -36,5 +36,6 @@
 	"entMongodbServers": "192.168.3.18:27090",
 	"entMongodbPoolSize": 5,
     "entMongodbName": "qfw",
-	"entMongodbAlias":"B"
+	"entMongodbAlias":"B",
+	"followEnterprise":10
 }

+ 1 - 0
core/src/qfw/coreconfig/SysConfig.go

@@ -31,6 +31,7 @@ type config struct {
 	EntMongodbPoolSize int         `json:"entMongodbPoolSize"`
 	EntMongodbName     string      `json:"entMongodbName"`
 	EntMongodbAlias    string      `json:"entMongodbAlias"`
+	FollowEnterprise   int         `json:"followEnterprise"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 1 - 0
core/src/qfw/member/member.go

@@ -54,4 +54,5 @@ func init() {
 	xweb.AddAction(&BidManage{})
 	xweb.AddAction(&MyAppointment{})
 	xweb.AddAction(&OrderManage{})
+	xweb.AddAction(&Service{})
 }

+ 448 - 0
core/src/qfw/member/service.go

@@ -0,0 +1,448 @@
+/******服务的增正删改*******/
+package member
+
+import (
+	"fmt"
+	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
+	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"
+	"strings"
+	"time"
+)
+
+type Service struct {
+	*xweb.Action
+	save   xweb.Mapper `xweb:"/member/service/save"`        //增加服务
+	del    xweb.Mapper `xweb:"POST /member/service/delete"` //删除数据
+	find   xweb.Mapper `xweb:"POST /member/service/find"`   //查找要修改数据
+	remove xweb.Mapper `xweb:"POST /member/service/remove"` //下架服务
+	edit   xweb.Mapper `xweb:"/member/service/edit/(.*)"`   //编辑
+	add    xweb.Mapper `xweb:"/member/service/add"`         //详情
+}
+
+//编辑与保存企业黄页中添加服务信息
+func (yp *Service) Save() error {
+	//判断用户是否审核通过
+	if yp.GetSession("identWay") != 1 {
+		yp.ServeJson(&map[string]interface{}{
+			"msg": "用户没有通过审核",
+		})
+		return nil
+	}
+	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 (u *Service) Del() error {
+	if u.Method() == "POST" {
+		if u.GetSession("identWay") != 1 {
+			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 *Service) Remove() error {
+	if u.Method() == "POST" {
+		//判断用户是否审核通过
+		if u.GetSession("identWay") != 1 {
+			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 (u *Service) Find() 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 (yp *Service) Edit(id string) error {
+	//此处需要增加判断,是自己的服务才可以编辑
+
+	//判断用户是否审核通过
+	if yp.GetSession("identWay") != 1 {
+		return yp.Redirect("/member/accountset/index")
+	}
+	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["entid"] = serentid
+	//根据服务ID获取服务信息
+	return yp.Render("/member/editservice.html", &yp.T)
+}
+
+//显示增加编辑服务页面
+func (yp *Service) Add() error {
+	if yp.GetSession("identWay") != 1 {
+		return yp.Redirect("/member/accountset/index")
+	}
+	yp.T["entid"] = yp.GetSession("entid")
+	yp.T["serviceName"] = "添加产品服务信息"
+	yp.T["serviceClassify"] = coreconfig.ServiceClassify
+	opLocD := yp.GetSession("opLocDistrict")
+	yp.T["opLocDistrict"] = opLocD
+	return yp.Render("/member/editservice.html", &yp.T)
+}

+ 5 - 434
core/src/qfw/member/yellowpage.go

@@ -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{})

+ 1 - 1
core/src/qfw/search/searchService.go

@@ -502,7 +502,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 			"s_synopsis":{"force_source": true},
 			"stock":{"force_source": true}
         }
-    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar"]
+    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","excDirect"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 			`,"sort":[` + sort + `] }`

+ 1 - 1
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -47,7 +47,7 @@ func FormatDate(src *interface{}) string {
 }
 
 func GetEntInfo(id string) map[string]interface{} {
-	res := mongodbutil.FindById("enterprise", cf.SysConfig.EntMongodbAlias, cf.SysConfig.EntMongodbName, id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1,"SourceType":1, "Nb_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1,"staffinfo":1,"RegCapCurName":1}`)
+	res := mongodbutil.FindById("enterprise", cf.SysConfig.EntMongodbAlias, cf.SysConfig.EntMongodbName, id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1,"SourceType":1, "Nb_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1,"staffinfo":1,"RegCapCurName":1,"excDirect":1}`)
 	if res != nil && len(*res) > 0 {
 		opl, _ := (*res)["OpLocDistrict"].(string)
 		if len(opl) >= 2 {

+ 9 - 3
core/src/web/staticres/css/entcommunity.css

@@ -395,10 +395,10 @@ a:focus, a:hover{
 	margin-right: 60px;
 }
 .entinfo-page .b-com-head .b-com-second>span{
-	margin-right: 30px;
+	margin-right: 15px;
 }
 .entinfo-page .b-com-head .b-com-second a{
-	color: rgb(22, 160, 134);
+	color: #a0a0a0;
 }
 .entinfo-page .b-com-head .b-com-second .glyphicon{
 	color: #FF5A5F;
@@ -470,15 +470,16 @@ a:focus, a:hover{
 .entinfo-follow,.b-pcshare{
 	display: inline-block;
 	vertical-align: top;
+	font-size: 14px;
 }
 .entinfo-follow span{
 	margin-right: 3px;
+	font-size: 16px !important;
 }
 .entinfo-follow{
 	margin-top: 10px;
 	display: inline-block;
 	vertical-align: top;
-	font-size: 16px;
 	color: rgb(160, 160, 160);
 	margin-right: 10px;
 	cursor: pointer;
@@ -486,6 +487,11 @@ a:focus, a:hover{
 .entinfo-follow.ent-followed>span,.entinfo-follow.ent-followed{
 	color: #56C4B0 !important;
 }
+.entinfo-page .servicelink{
+    color: #57C4B0 !important;
+	margin-left: 10px;
+	font-size: 14px !important;
+}
 /********************企业画像**********************/
 .entinfo-basicinfo .b-com-content{
 	padding-top: 60px !important;

+ 1 - 1
core/src/web/staticres/js/entportrait.js

@@ -159,7 +159,7 @@ $(function(){
 				alert("网址格式不正确!");
 				return;
 			}
-			$.post("/member/yellowpage/dosave/enterprise",formNode.serialize(),function(r){
+			$.post("/member/yellowpage/save",formNode.serialize(),function(r){
 				if(r.status == "personError"){
 					alert("请输入联系人!");
 				}else if(r.status == "y"){

+ 1 - 1
core/src/web/templates/enterprise/detail.html

@@ -74,7 +74,7 @@
 						{{end}}
 					{{end}}
 				{{end}}
-				{{if .T.serviceCount}}<a>服务信息列表</a>{{end}}
+				{{if .T.serviceCount}}<a>服务信息</a><i class="servicelink glyphicon xiayibu"></i>{{end}}
 			</div>
 			{{if eq .T.editFlag 2}}
 			<form class="b-editEnt-form" id="editForm">

+ 6 - 7
core/src/web/templates/member/authentication.html

@@ -22,14 +22,13 @@
 			{{include "/common/authentication.html"}}
 		{{else}}
 		<div class="panel-title-out">
-		    <i class="glyphicon shimingrenzheng" style="color:#FF5A5F;"></i><span>实名认证</span>
+		    <i class="glyphicon qmx-icon-shimingrenzheng" style="font-size: 22px;"></i><span>实名认证</span>
 		</div>
-		<div class="panel panel-default member-panel-middle">
-			<div class="panel-body">
-				<div class="text-primary text-center">
-					{{if eq $identWay 1}}{{printf "%v" (index (session "userInfo") "s_enterprisename")}}您已经认证通过!{{else if eq $identWay 2}}您提交的申请正在审核,请等待!{{end}}
-					<a href="/member/show/memberindex">返回继续其他操作</a>
-				</div>
+		<div class="a-line"></div>
+		<div class="member-panel-middle">
+			<div class="text-primary text-center">
+				{{if eq $identWay 1}}{{printf "%v" (index (session "userInfo") "s_enterprisename")}}您已经认证通过!{{else if eq $identWay 2}}您提交的申请正在审核,请等待!{{end}}
+				<a href="/member/show/memberindex">返回继续其他操作</a>
 			</div>
 		</div>
 		{{end}}

+ 1 - 1
core/src/web/templates/member/editservice.html

@@ -294,7 +294,7 @@ function btnAddServices(){
     var t = new Date().getTime();
     //表单验证
 	var validForm = bindValidForm({
-		url: "/member/yellowpage/add/service/addservice?_new="+t,
+		url: "/member/service/add?_new="+t,
 		ajaxPost:true,
 		beforeSubmit:function(curform){
 			

+ 2 - 2
core/src/web/templates/member/servermanager.html

@@ -372,7 +372,7 @@ function delservice(obj){
     	if(r==true){
 		$.ajax({    
         type:'post',        
-        url:'/member/service/delservice',    
+        url:'/member/service/delete',    
         data:{"id":id},    
         cache:true,    
         dataType:'json',    
@@ -389,7 +389,7 @@ function findservice(obj){
 //	alert(id);
 		$.ajax({    
         type:'post',        
-        url:'/member/service/findservice',    
+        url:'/member/service/find',    
         data:{"id":id},    
         cache:false,    
         dataType:'json',