123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package common
- import (
- "context"
- "fmt"
- "strings"
- . "app.yhyue.com/moapp/jybase/common"
- "github.com/zeromicro/go-zero/core/logx"
- )
- //人脉通公用方法
- var NetworkCom = &networkCom{}
- type networkCom struct{}
- //根据标签类型获取标签占位
- func (n *networkCom) GetEntTagSeat(labelType int) []string {
- rows, err := ClickhouseConn.Query(context.Background(), `select bitmap_num from information.ent_label where label_type=?`, labelType)
- if err != nil {
- logx.Error(err)
- return nil
- }
- array := []string{}
- for rows.Next() {
- var (
- bitmap_num int8
- )
- if err := rows.Scan(&bitmap_num); err != nil {
- logx.Error(err)
- continue
- }
- array = append(array, fmt.Sprint(bitmap_num))
- }
- rows.Close()
- if err := rows.Err(); err != nil {
- logx.Error(err)
- }
- return array
- }
- //获取我的业态
- func (n *networkCom) GetMyProbusfor(entAccoutId int64) []string {
- datas := CrmMysql.SelectBySql(`select probusfor from crm.config_tenant where account_id=?`, entAccoutId)
- if datas == nil || len(*datas) == 0 {
- return nil
- }
- probusfor := ObjToString((*datas)[0]["probusfor"])
- if probusfor == "" {
- return nil
- }
- return strings.Split(probusfor, ",")
- }
- //
- func (n *networkCom) Count(query string, args ...interface{}) int64 {
- row := ClickhouseConn.QueryRow(context.Background(), query, args...)
- var count uint64
- if err := row.Scan(&count); err != nil {
- logx.Error(err)
- return 0
- }
- return int64(count)
- }
- //
- func (n *networkCom) WhArgs(args []string) (string, []interface{}) {
- newArgs := make([]interface{}, len(args))
- wh := make([]string, len(args))
- for k, v := range args {
- newArgs[k] = v
- wh[k] = "?"
- }
- return strings.Join(wh, ","), newArgs
- }
|