|
@@ -6,7 +6,6 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
@@ -18,19 +17,20 @@ import (
|
|
|
"jy/src/jfw/jyutil"
|
|
|
"jy/src/jfw/site/jySchool"
|
|
|
"math/rand"
|
|
|
+ "regexp"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type NewIndex struct {
|
|
|
*xweb.Action
|
|
|
- newIndex xweb.Mapper `xweb:"/"` //首页改版
|
|
|
- entServerTransfer xweb.Mapper `xweb:"/front/entServerTransfer/(.*)"` //企业服务中转
|
|
|
- appDownload xweb.Mapper `xweb:"/front/appDownload"` //新app下载页面
|
|
|
+ newIndex xweb.Mapper `xweb:"/"` //首页改版
|
|
|
+ routerRelay xweb.Mapper `xweb:"/front/routerRelay/(.*)"` //企业服务中转
|
|
|
+ appDownload xweb.Mapper `xweb:"/front/appDownload"` //新app下载页面
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
- entServerTransferMap map[string]map[bool]string
|
|
|
- BiddingTypeUrl = map[int]string{
|
|
|
+ routerRelayMap map[string]map[bool]string
|
|
|
+ BiddingTypeUrl = map[int]string{
|
|
|
1: "/list/stype/ZBYG.html",
|
|
|
2: "/list/stype/ZBJG.html",
|
|
|
3: "/list/stype/CGYX.html",
|
|
@@ -44,29 +44,100 @@ var (
|
|
|
|
|
|
func init() {
|
|
|
xweb.AddAction(&NewIndex{})
|
|
|
- entServerTransferMap = map[string]map[bool]string{
|
|
|
- "yxgl": map[bool]string{ //【营销管理】根据code判断是否有权限 bi_yx
|
|
|
+ routerRelayMap = map[string]map[bool]string{
|
|
|
+ "yxgl": { //【营销管理】根据code判断是否有权限 bi_yx
|
|
|
true: fmt.Sprintf("/page_workDesktop/work-bench/page?link=%s/succbi/crm_system/app/crm.app/sales_clues.spg", config.Sysconfig["webdomain"].(string)),
|
|
|
false: "/swordfish/frontPage/digitalMarketing/free/index",
|
|
|
},
|
|
|
- "yxt": map[bool]string{ //【医械通】根据code判断是否有权限 lyh_yl_yldy
|
|
|
+ "yxt": { //【医械通】根据code判断是否有权限 lyh_yl_yldy
|
|
|
true: "/page_workDesktop/work-bench/app/big/medical/Credentials",
|
|
|
false: "http://clpages.cn/yxtsjgwyxy",
|
|
|
},
|
|
|
- "khgl": map[bool]string{ //【客户管理】根据code判断是否有权限 bi_yx
|
|
|
+ "khgl": { //【客户管理】根据code判断是否有权限 bi_yx
|
|
|
true: fmt.Sprintf("/page_workDesktop/work-bench/page?link=%s/succbi/crm_system/app/crm.app/sales_clues.spg", config.Sysconfig["webdomain"].(string)),
|
|
|
false: "/swordfish/frontPage/customanage/free/index",
|
|
|
},
|
|
|
- "tbxmgl": map[bool]string{ //【投标项目管理】根据code判断是否有权限 cb_zy_code
|
|
|
- true: "/big/attend_bidding/mine",
|
|
|
+ "tbxmgl": { //【投标项目管理】根据code判断是否有权限 cb_zy_code
|
|
|
+ true: "/page_workDesktop/work-bench/app/big/attend_bidding/mine",
|
|
|
false: "/swordfish/frontPage/biddingProject/free/index",
|
|
|
},
|
|
|
- "nzbg": map[bool]string{ //【年终报告】根据code判断是否有权限
|
|
|
+ "nzbg": { //【年终报告】根据code判断是否有权限
|
|
|
true: fmt.Sprintf("/page_workDesktop/work-bench/page?link=%s/succbi/nzbg/app/nzbg.app/nzbg_entrance_pc.spg", config.Sysconfig["webdomain"].(string)),
|
|
|
- false: "/swordfish/frontPage/AnnualReport/free/index",
|
|
|
+ false: "http://clpages.cn/nzbg",
|
|
|
+ },
|
|
|
+ "xxfb": { //【信息发布】根据登录否判断
|
|
|
+ true: fmt.Sprintf("/page_workDesktop/work-bench/page?link=%s/swordfish/page_web_pc/issued/info", config.Sysconfig["webdomain"].(string)),
|
|
|
+ false: "/swordfish/frontPage/InformationDistribution/free/index",
|
|
|
+ },
|
|
|
+ "scfx": { //【市场分析报告】 根据登录否判断
|
|
|
+ true: "/page_workDesktop/work-bench/app/big/desktop/report_analysis",
|
|
|
+ false: "/big/page/sc",
|
|
|
+ },
|
|
|
+ "qdkz": { //【渠道扩展】 根据大会员权益7判断
|
|
|
+ true: "/swordfish/page_big_pc/potential_cor_list/c",
|
|
|
+ false: "/big/page/yw",
|
|
|
+ },
|
|
|
+ "tbjc": { //【投标决策分析】 根据大会员权益6判断
|
|
|
+ true: "/page_workDesktop/work-bench/app/big/analysis_result",
|
|
|
+ false: "/big/page/tb",
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
+func (nIndex *NewIndex) RouterRelay(code string) {
|
|
|
+ toUrl := func() string {
|
|
|
+ sessVal := nIndex.Session().GetMultiple()
|
|
|
+ accountId := common.Int64All(sessVal["accountId"])
|
|
|
+ if accountId <= 0 { //未登录
|
|
|
+ return routerRelayMap[code][false]
|
|
|
+ }
|
|
|
+ if code == "nzbg" || code == "xxfb" || code == "scfx" {
|
|
|
+ return routerRelayMap[code][true]
|
|
|
+ }
|
|
|
+ entAccountId := common.Int64All(sessVal["entAccountId"])
|
|
|
+ entId := common.Int64All(sessVal["entId"])
|
|
|
+ entUserId := common.Int64All(sessVal["entUserId"])
|
|
|
+ res := config.Middleground.ResourceCenter.Haspowers(accountId, entAccountId, entId, entUserId)
|
|
|
+
|
|
|
+ powerPass := false
|
|
|
+ switch code {
|
|
|
+ case "yxgl", "khgl":
|
|
|
+ for _, pCode := range res.Powers {
|
|
|
+ if pCode == "bi_yx" {
|
|
|
+ powerPass = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case "yxt":
|
|
|
+ for _, pCode := range res.Powers {
|
|
|
+ if pCode == "lyh_yl_yldy" {
|
|
|
+ powerPass = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case "tbxmgl":
|
|
|
+ for _, pCode := range res.Powers {
|
|
|
+ if pCode == "cb_zy_code" {
|
|
|
+ powerPass = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case "tbjc", "qdkz": //大会员权益判断
|
|
|
+ powerRes := config.Middleground.PowerCheckCenter.Check("10000", gconv.String(sessVal["mgoUserId"]), gconv.Int64(sessVal["base_user_id"]), gconv.Int64(sessVal["accountId"]), gconv.Int64(sessVal["entId"]), gconv.Int64(sessVal["positionType"]), gconv.Int64(sessVal["positionId"]))
|
|
|
+ for _, pInt := range powerRes.Member.MemberPowerList {
|
|
|
+ if code == "tbjc" && pInt == 6 {
|
|
|
+ powerPass = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if code == "qdkz" && pInt == 7 {
|
|
|
+ powerPass = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return routerRelayMap[code][powerPass]
|
|
|
+ }()
|
|
|
+ _ = nIndex.Redirect(toUrl)
|
|
|
+}
|
|
|
|
|
|
// NewIndex 新版首页改版
|
|
|
func (nIndex *NewIndex) NewIndex() error {
|
|
@@ -79,14 +150,14 @@ func (nIndex *NewIndex) NewIndex() error {
|
|
|
if userId != "" {
|
|
|
nickname, vipType := gconv.String(sessVal["userName"]), "注册用户"
|
|
|
var endTime int64
|
|
|
+ //来源于接口/user/getSimpleData
|
|
|
+ phone, _ := sessVal["phone"].(string)
|
|
|
+ nickname, _ = common.If(sessVal["s_nickname"] != nil, sessVal["s_nickname"], sessVal["app_name"]).(string)
|
|
|
if nickname == "" {
|
|
|
- nickname = gconv.String(sessVal["s_nickname"])
|
|
|
- }
|
|
|
- if nickname == "" {
|
|
|
- nickname = gconv.String(sessVal["s_jyname"])
|
|
|
- }
|
|
|
- if nickname == "" {
|
|
|
- nickname = gconv.String(sessVal["phone"])
|
|
|
+ var PhoneReg = regexp.MustCompile(`^(100\d{8}|1[3-9]\d{9})$`)
|
|
|
+ if PhoneReg.MatchString(phone) {
|
|
|
+ nickname = string(phone[0:3]) + "****" + string(phone[(len(phone)-4):])
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
powerRes := config.Middleground.PowerCheckCenter.Check("10000", gconv.String(sessVal["mgoUserId"]), gconv.Int64(sessVal["base_user_id"]), gconv.Int64(sessVal["accountId"]), gconv.Int64(sessVal["entId"]), gconv.Int64(sessVal["positionType"]), gconv.Int64(sessVal["positionId"]))
|
|
@@ -113,8 +184,9 @@ func (nIndex *NewIndex) NewIndex() error {
|
|
|
//顶部菜单
|
|
|
nIndex.T["topMenu"] = g.Cfg("index").MustGet(context.Background(), "topMenu").Maps()
|
|
|
//招标公告
|
|
|
+ biddingList, _ := GetRecommendBidZone(5, 8)
|
|
|
nIndex.T["newbids"] = map[string]interface{}{
|
|
|
- "biddingList": NewIndexbids(nIndex.Session(), nIndex.Request),
|
|
|
+ "biddingList": biddingList,
|
|
|
"more": fmt.Sprintf("%s", "/list/stype/ZBGG.html"),
|
|
|
}
|
|
|
//推荐标讯专区
|
|
@@ -172,49 +244,6 @@ func (nIndex *NewIndex) NewIndex() error {
|
|
|
return nIndex.Render("/pc/newIndex.html", &nIndex.T)
|
|
|
}
|
|
|
|
|
|
-func (nIndex *NewIndex) EntServerTransfer(code string) {
|
|
|
- toUrl := func() string {
|
|
|
- sessVal := nIndex.Session().GetMultiple()
|
|
|
- accountId := common.Int64All(sessVal["accountId"])
|
|
|
- if accountId <= 0 { //未登录
|
|
|
- return entServerTransferMap[code][false]
|
|
|
- }
|
|
|
- if code == "nzbg" {
|
|
|
- return entServerTransferMap[code][true]
|
|
|
- }
|
|
|
- entAccountId := common.Int64All(sessVal["entAccountId"])
|
|
|
- entId := common.Int64All(sessVal["entId"])
|
|
|
- entUserId := common.Int64All(sessVal["entUserId"])
|
|
|
- res := config.Middleground.ResourceCenter.Haspowers(accountId, entAccountId, entId, entUserId)
|
|
|
- powerPass := false
|
|
|
- switch code {
|
|
|
- case "yxgl", "khgl":
|
|
|
- for _, pCode := range res.Powers {
|
|
|
- if pCode == "bi_yx" {
|
|
|
- powerPass = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- case "yxt":
|
|
|
- for _, pCode := range res.Powers {
|
|
|
- if pCode == "lyh_yl_yldy" {
|
|
|
- powerPass = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- case "tbxmgl":
|
|
|
- for _, pCode := range res.Powers {
|
|
|
- if pCode == "cb_zy_code" {
|
|
|
- powerPass = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return entServerTransferMap[code][powerPass]
|
|
|
- }()
|
|
|
- _ = nIndex.Redirect(toUrl)
|
|
|
-}
|
|
|
-
|
|
|
func (nIndex *NewIndex) AppDownload() {
|
|
|
nIndex.T["includedInfo"] = GetIncludedInfo()
|
|
|
nIndex.Render("/frontRouter/pc/AppDownload/free/index.html", &nIndex.T)
|
|
@@ -226,49 +255,46 @@ func GetRecommendBidZone(typ int, pageSize int) (list []map[string]interface{},
|
|
|
typ = 1
|
|
|
}
|
|
|
rediskey := fmt.Sprintf("pcIndexRecommendBidZone_%d", typ)
|
|
|
- subtype := ""
|
|
|
+ sql := ""
|
|
|
switch typ {
|
|
|
case 1:
|
|
|
//招标预告
|
|
|
- subtype = "预告"
|
|
|
typs = "招标预告"
|
|
|
+ sql = fmt.Sprintf(" toptype = '%s' ", "预告")
|
|
|
case 2:
|
|
|
//招标中标成交
|
|
|
- subtype = "中标,成交"
|
|
|
typs = "中标成交"
|
|
|
+ sql = fmt.Sprintf(" subtype = '%s' or subtype = '%s' ", "中标", "成交")
|
|
|
case 3:
|
|
|
//采购意向
|
|
|
- subtype = "采购意向"
|
|
|
typs = "采购意向"
|
|
|
+ sql = fmt.Sprintf(" toptype = '%s' ", "采购意向")
|
|
|
case 4:
|
|
|
//拟建
|
|
|
- subtype = "拟建"
|
|
|
typs = "拟建项目"
|
|
|
+ sql = fmt.Sprintf(" toptype = '%s' ", "拟建")
|
|
|
+ case 5:
|
|
|
+ typs = "招标公告"
|
|
|
+ sql = fmt.Sprintf(" toptype = '%s' ", "招标")
|
|
|
}
|
|
|
- if l, ok := redis.Get("newother", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
|
|
|
+ if l, ok := redis.Get(RedisNameNew, rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
|
|
|
list = common.ObjArrToMapArr(l)
|
|
|
+ return list, typs
|
|
|
} else {
|
|
|
- _, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", pageSize, "")
|
|
|
- if lists != nil && len(*lists) >= 5 {
|
|
|
- *lists = (*lists)[0:5]
|
|
|
- for _, v := range *lists {
|
|
|
- v["_id"] = encrypt.CommonEncodeArticle("indexcontent", v["_id"].(string))
|
|
|
- delete(v, "toptype")
|
|
|
- delete(v, "s_subscopeclass")
|
|
|
- tmpdate := v["publishtime"]
|
|
|
- v["publish_time"] = time.Unix(common.Int64All(tmpdate.(float64)), 0).Format("2006-01-02")
|
|
|
- /*if v["budget"] != nil {
|
|
|
- v["budget"] = ConversionMoeny(v["budget"])
|
|
|
- } else if v["bidamount"] != nil {
|
|
|
- v["budget"] = ConversionMoeny(v["bidamount"])
|
|
|
- }*/
|
|
|
- }
|
|
|
+ bidRes, _ := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT bid_id,title,publish_time FROM new_bidList WHERE %s ORDER BY publish_time DESC limit %d`, sql, pageSize))
|
|
|
+ if bidRes.IsEmpty() {
|
|
|
+ return nil, typs
|
|
|
+ }
|
|
|
+ var finalArr []map[string]interface{}
|
|
|
+ for _, m := range bidRes.List() {
|
|
|
+ m["_id"] = encrypt.EncodeArticleId2ByCheck(common.ObjToString(m["bid_id"]))
|
|
|
+ m["publish_time"] = time.Unix(common.Int64All(m["publish_time"]), 0).Format("2006-01-02")
|
|
|
+ finalArr = append(finalArr, m)
|
|
|
|
|
|
- list = *lists
|
|
|
- redis.Put("other", rediskey, list, 2*60*60)
|
|
|
}
|
|
|
+ redis.Put(RedisNameNew, rediskey, finalArr, 24*3600)
|
|
|
+ return finalArr, typs
|
|
|
}
|
|
|
- return list, typs
|
|
|
}
|
|
|
|
|
|
// GetStrategyList 招投标攻略
|
|
@@ -308,7 +334,7 @@ func GetIndexProjectList(typ, pageSize int) (data []map[string]interface{}, type
|
|
|
data = common.ObjArrToMapArr(redisArr)
|
|
|
return
|
|
|
}
|
|
|
- res, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT nbl.bid_id as bid_id,nbl.title as title,nbl.publish_time as publish_time FROM jyseo_test.new_bid_sign nbs LEFT JOIN jyseo_test.new_bidList nbl ON nbs.bid_id = nbl.bid_id WHERE bitmapContains(sign, %d) ORDER BY publish_time DESC LIMIT %d `, typ, pageSize))
|
|
|
+ res, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT nbl.bid_id as bid_id,nbl.title as title,nbl.publish_time as publish_time FROM new_bid_sign nbs LEFT JOIN new_bidList nbl ON nbs.bid_id = nbl.bid_id WHERE bitmapContains(sign, %d) ORDER BY publish_time DESC LIMIT %d `, typ, pageSize))
|
|
|
if err != nil || res.IsEmpty() {
|
|
|
return nil, types
|
|
|
}
|