Преглед на файлове

feat:初始化 展会信息

wangshan преди 1 година
родител
ревизия
27e2f7cd72
променени са 9 файла, в които са добавени 96 реда и са изтрити 7 реда
  1. 3 2
      src/config.json
  2. 1 1
      src/config/config.go
  3. 11 0
      src/consts/consts.go
  4. 22 0
      src/entity/entity.go
  5. 37 0
      src/entity/int.go
  6. 3 2
      src/main.go
  7. 3 2
      src/service/action/exhibition.go
  8. 8 0
      src/service/action/info.go
  9. 8 0
      src/util/util.go

+ 3 - 2
src/config.json

@@ -874,8 +874,9 @@
 	"exhibitionTimeOut": 7200,
 	"pointsEtcdConf": {
 		"hosts": [
-			"127.0.0.1:2379"
+			"192.168.3.241:2379",
+			"192.168.3.204:2379"
 		],
-		"key": "resourcescenter.rpc",
+		"key": "resourcescenter.rpc"
 	}
 }

+ 1 - 1
src/config/config.go

@@ -228,7 +228,6 @@ func init() {
 			}
 		}
 	}
-	GetMsgType()
 	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
 	var ctx = gctx.New()
 	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).
@@ -242,6 +241,7 @@ func init() {
 		},
 	})
 	ResourcesRpc = resourcesCenterclient.NewResourcesCenter(resourcesRpcClient)
+	GetMsgType()
 }
 
 func GetMsgType() {

+ 11 - 0
src/consts/consts.go

@@ -1 +1,12 @@
 package consts
+
+import (
+	"fmt"
+	"regexp"
+)
+
+var (
+	MobileReg         = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
+	ExhibitionTable   = "jyactivities.exhibition_info"
+	FindExhibitionSql = fmt.Sprintf(`SELECT * FROM %s `, ExhibitionTable)
+)

+ 22 - 0
src/entity/entity.go

@@ -16,3 +16,25 @@ type FuncResult struct {
 	Error_code int                    `json:"error_code"`
 	Error_msg  string                 `json:"error_msg"`
 }
+
+// 展会信息
+type ExhibitionInfo struct {
+	Code             string `json:"code"`               //'活动代码(唯一性)'
+	InternalName     string `json:"internal_name"`      //'活动名称(内部)'
+	FormalName       string `json:"formal_name"`        //'活动名称(外部)',
+	Address          string `json:"address"`            //'活动地点'
+	StartTime        string `json:"start_time"`         //'活动开始时间'
+	EndTime          string `json:"end_time"`           //活动结束时间'
+	SignStartTime    string `json:"sign_start_time"`    //'签到开始时间'
+	SignEndTime      string `json:"sign_end_time"`      //'签到结束时间'
+	MeetingStartTime string `json:"meeting_start_time"` //'活动会议开始时间'
+	MeetingEndTime   string `json:"meeting_end_time"`   //'活动会议结束时间'
+	Organizer        string `json:"organizer"`          //'主办单位'
+	CoOrganizer      string `json:"co_organizer"`       //'协办单位'
+	Host             string `json:"host"`               //'主持人'
+	Guests           string `json:"guests"`             //'会场嘉宾'
+	Speaker          string `json:"speaker"`            //'演讲嘉宾'
+	SignUpPage       string `json:"sign_up_page"`       //'报名成功地址'
+	SignInPage       string `json:"sign_in_page"`       //'签到成功地址'
+	DetailsPage      string `json:"details_page"`       //'活动详情页面地址',
+}

+ 37 - 0
src/entity/int.go

@@ -0,0 +1,37 @@
+package entity
+
+import (
+	"app.yhyue.com/moapp/jybase/date"
+	"encoding/json"
+	"fmt"
+	"log"
+	. "salesLeads/src/config"
+	"salesLeads/src/consts"
+	"time"
+)
+
+var (
+	ExhibitionMap = map[string]ExhibitionInfo{}
+)
+
+func init() {
+	log.Println("初始化进行中的展会信息")
+	now := time.Now()
+	sql := fmt.Sprintf(` WHERE start_time < '%s' AND end_time > '%s' `, date.FormatDate(&now, date.Date_Full_Layout), date.FormatDate(&now, date.Date_Full_Layout))
+	exhInfos := Base.SelectBySql(fmt.Sprintf("%s%s", consts.FindExhibitionSql, sql))
+	if exhInfos != nil && len(*exhInfos) > 0 {
+		for _, ex := range *exhInfos {
+			b, err := json.Marshal(ex)
+			if err != nil {
+				continue
+			}
+			exhInfo := ExhibitionInfo{}
+			err = json.Unmarshal(b, &exhInfo)
+			if err != nil {
+				continue
+			}
+			ExhibitionMap[exhInfo.Code] = exhInfo
+		}
+	}
+	log.Println(ExhibitionMap)
+}

+ 3 - 2
src/main.go

@@ -4,9 +4,10 @@ import (
 	"net/http"
 	_ "salesLeads/src/a"
 	"salesLeads/src/config"
+	_ "salesLeads/src/entity"
+	_ "salesLeads/src/filter"
 	_ "salesLeads/src/service/action"
-	_ "salesLeads/src/service/filter"
-	_ "salesLeads/src/service/util"
+	_ "salesLeads/src/util"
 
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )

+ 3 - 2
src/service/action/exhibition.go

@@ -1,5 +1,6 @@
 package action
 
+// 高医展等活动
 import (
 	util "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
@@ -19,8 +20,8 @@ import (
 
 var (
 	ExhibitionMap = map[string]bool{}
-	MergeUrlWX    = "/weixin/frontPage/userMerge/free/index"
-	MergeUrlAPP   = "/jyapp/frontPage/userMerge/free/confirm"
+	MergeUrlWX    = "/weixin/frontPage/userMerge/free/index"  //微信账号合并地址
+	MergeUrlAPP   = "/jyapp/frontPage/userMerge/free/confirm" //app账号合并地址
 )
 
 type ExhibitionStruct struct{}

+ 8 - 0
src/service/action/info.go

@@ -75,6 +75,14 @@ func (i *Info) CollectInfo() {
 		mail := qu.ObjToString(infoMap["mail"]) //邮箱
 		if mail != "" && !emailReg.MatchString(mail) {
 			return entity.NewResultSales{Error_code: -1, Error_msg: "邮箱格式有误", Data: false}
+		}
+		//P436
+		exhCode := infoMap["exhCode"] //展会活动代码
+		//if !IsMobile(i.Header("User-Agent")) {
+		//	exhCode = ""
+		//}
+		if exhCode != "" {
+
 		}
 		//获取用户id
 		userid, _ := i.GetSession("userId").(string)

+ 8 - 0
src/util/util.go

@@ -0,0 +1,8 @@
+package util
+
+import "salesLeads/src/consts"
+
+// IsMobile 是否移动端
+func IsMobile(header string) bool {
+	return consts.MobileReg.MatchString(header)
+}