瀏覽代碼

feat:p697新用户注册获取用户定时任务

fuwencai 5 月之前
父節點
當前提交
d79081c1dc

+ 1 - 1
newuserGet/hack/config.yaml

@@ -15,7 +15,7 @@ gfcli:
         descriptionTag: true
         tables: "voice_record"
         group: call
-      - link: "mysql:root:=PDT49#80Z!RVv52_z@tcp(192.168.3.14:4000)/jianyu_subjectdb_test"
+      - link: "mysql:datagroup:Dgrpdb#2024@36@tcp(192.168.3.149:4000)/jianyu_subjectdb_test"
         descriptionTag: true
         tables: "dwd_f_crm_clue_info"
         group: crm

+ 27 - 0
newuserGet/internal/dao/dwd_f_crm_clue_info.go

@@ -0,0 +1,27 @@
+// =================================================================================
+// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
+// =================================================================================
+
+package dao
+
+import (
+	"newuserGet/internal/dao/internal"
+)
+
+// internalDwdFCrmClueInfoDao is an internal type for wrapping the internal DAO implementation.
+type internalDwdFCrmClueInfoDao = *internal.DwdFCrmClueInfoDao
+
+// dwdFCrmClueInfoDao is the data access object for the table dwd_f_crm_clue_info.
+// You can define custom methods on it to extend its functionality as needed.
+type dwdFCrmClueInfoDao struct {
+	internalDwdFCrmClueInfoDao
+}
+
+var (
+	// DwdFCrmClueInfo is a globally accessible object for table dwd_f_crm_clue_info operations.
+	DwdFCrmClueInfo = dwdFCrmClueInfoDao{
+		internal.NewDwdFCrmClueInfoDao(),
+	}
+)
+
+// Add your custom methods and functionality below.

+ 199 - 0
newuserGet/internal/dao/internal/dwd_f_crm_clue_info.go

@@ -0,0 +1,199 @@
+// ==========================================================================
+// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+
+	"github.com/gogf/gf/v2/database/gdb"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+// DwdFCrmClueInfoDao is the data access object for the table dwd_f_crm_clue_info.
+type DwdFCrmClueInfoDao struct {
+	table   string                 // table is the underlying table name of the DAO.
+	group   string                 // group is the database configuration group name of the current DAO.
+	columns DwdFCrmClueInfoColumns // columns contains all the column names of Table for convenient usage.
+}
+
+// DwdFCrmClueInfoColumns defines and stores column names for the table dwd_f_crm_clue_info.
+type DwdFCrmClueInfoColumns struct {
+	Id                     string // 线索ID:UUID
+	Uid                    string // 用户表UUID
+	Userid                 string // 用户userid
+	PositionId             string // 坐席职位ID
+	SeatNumber             string // 坐席号
+	IsAssign               string // 是否分配:0:未分配,公海;1:已分配,私海
+	Comeintime             string // 出入私海的时间
+	ComeintimeOpen         string // 公海入海时间
+	Createtime             string // 线索创建时间:线索生成时间
+	Updatetime             string // 更新时间
+	Cluename               string // 线索名称:COMPANY_NAME
+	TopCluetype            string // 线索来源一级
+	SubCluetype            string // 线索来源二级
+	BusinessScope          string // 业务范围
+	CustomerDemand         string // 客户需求
+	IntendedProducts       string // 意向产品
+	CustomerBudget         string // 客户预算
+	ContactType            string // 联系人类型:决策人,使用人
+	Name                   string // 姓名
+	Phone                  string // 联系方式
+	Sex                    string // 性别:男、女
+	Position               string // 职位
+	Department             string // 部门
+	Industry               string // 所属行业
+	CustomeIndustry        string // 目标客户行业
+	FollowProjectArea      string // 关注项目区域:CODE,关联区域维表
+	Role                   string // 生态角色
+	Trailstatus            string // 线索跟进状态:无意向,已成交......
+	TrailstatusTime        string // 线索状态变更时间
+	TrailTime              string // 最新跟进时间
+	NextTrailTime          string // 下次跟进时间
+	IsTask                 string // 是否加车
+	Tasktime               string // 任务时间
+	Taskstatus             string // 任务状态
+	ComeinsourcePrivate    string // 私海-入海来源
+	Tasksource             string // 入车来源
+	OutTaskTime            string // 退车时间
+	OutTaskStatus          string // 退车状态
+	ComeinsourceOpen       string // 公海-入海来源
+	LevelOpen              string // 公海级别
+	ClueLevel              string // 线索等级
+	TaskTime               string // 加车时间
+	BatchImport            string // 导入批次
+	IsTransfer             string // 是否移交;0:未移交 1:已移交
+	SalespersonNum         string // 销售人员数量
+	StartTrailTime         string // 开始跟进时间
+	Content                string // 最近跟进内容
+	State                  string // 最后通话状态
+	CompanyNature          string // 公司性质,0:非集团公司 1:集团公司
+	CompanyVerification    string // 公司核验,0:不在工商库 1:在工商库
+	Remark                 string // 备注
+	Shuoming               string // uid更新说明
+	FreezeTime             string // 冻结时间
+	LastRingTime           string // 最近外呼时间
+	LastBeginTime          string // 最近接通时间
+	IsUnfollow             string // 是否不再跟进,0:否,1:是
+	UseDemand              string // 使用需求
+	IsArtificiallyModified string // 是否人为修改,0:否,1:是
+	LockStatus             string // 锁定状态,1:已锁定,2:未锁定,3:无需锁定
+	LockPositionId         string // 锁定人职位id,多值
+	LockTime               string // 锁定时间
+	LegalRepresentative    string // 法定代表人
+	Label                  string // 标签 1自动分配2来源变更3其他变更
+	LabelChangeTime        string // 标签变更时间 2024-12-12
+}
+
+// dwdFCrmClueInfoColumns holds the columns for the table dwd_f_crm_clue_info.
+var dwdFCrmClueInfoColumns = DwdFCrmClueInfoColumns{
+	Id:                     "id",
+	Uid:                    "uid",
+	Userid:                 "userid",
+	PositionId:             "position_id",
+	SeatNumber:             "seatNumber",
+	IsAssign:               "is_assign",
+	Comeintime:             "comeintime",
+	ComeintimeOpen:         "comeintime_open",
+	Createtime:             "createtime",
+	Updatetime:             "updatetime",
+	Cluename:               "cluename",
+	TopCluetype:            "top_cluetype",
+	SubCluetype:            "sub_cluetype",
+	BusinessScope:          "business_scope",
+	CustomerDemand:         "customer_demand",
+	IntendedProducts:       "intended_products",
+	CustomerBudget:         "customer_budget",
+	ContactType:            "contact_type",
+	Name:                   "name",
+	Phone:                  "phone",
+	Sex:                    "sex",
+	Position:               "position",
+	Department:             "department",
+	Industry:               "industry",
+	CustomeIndustry:        "custome_industry",
+	FollowProjectArea:      "follow_project_area",
+	Role:                   "role",
+	Trailstatus:            "trailstatus",
+	TrailstatusTime:        "trailstatus_time",
+	TrailTime:              "trail_time",
+	NextTrailTime:          "next_trail_time",
+	IsTask:                 "is_task",
+	Tasktime:               "tasktime",
+	Taskstatus:             "taskstatus",
+	ComeinsourcePrivate:    "comeinsource_private",
+	Tasksource:             "tasksource",
+	OutTaskTime:            "out_task_time",
+	OutTaskStatus:          "out_task_status",
+	ComeinsourceOpen:       "comeinsource_open",
+	LevelOpen:              "level_open",
+	ClueLevel:              "clue_level",
+	TaskTime:               "task_time",
+	BatchImport:            "batch_import",
+	IsTransfer:             "IS_TRANSFER",
+	SalespersonNum:         "salesperson_num",
+	StartTrailTime:         "start_trail_time",
+	Content:                "content",
+	State:                  "STATE",
+	CompanyNature:          "COMPANY_NATURE",
+	CompanyVerification:    "COMPANY_VERIFICATION",
+	Remark:                 "remark",
+	Shuoming:               "shuoming",
+	FreezeTime:             "FREEZE_TIME",
+	LastRingTime:           "last_ring_time",
+	LastBeginTime:          "last_begin_time",
+	IsUnfollow:             "is_unfollow",
+	UseDemand:              "use_demand",
+	IsArtificiallyModified: "is_artificially_modified",
+	LockStatus:             "lock_status",
+	LockPositionId:         "lock_position_id",
+	LockTime:               "lock_time",
+	LegalRepresentative:    "legal_representative",
+	Label:                  "label",
+	LabelChangeTime:        "labelChangeTime",
+}
+
+// NewDwdFCrmClueInfoDao creates and returns a new DAO object for table data access.
+func NewDwdFCrmClueInfoDao() *DwdFCrmClueInfoDao {
+	return &DwdFCrmClueInfoDao{
+		group:   "crm",
+		table:   "dwd_f_crm_clue_info",
+		columns: dwdFCrmClueInfoColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of the current DAO.
+func (dao *DwdFCrmClueInfoDao) DB() gdb.DB {
+	return g.DB(dao.group)
+}
+
+// Table returns the table name of the current DAO.
+func (dao *DwdFCrmClueInfoDao) Table() string {
+	return dao.table
+}
+
+// Columns returns all column names of the current DAO.
+func (dao *DwdFCrmClueInfoDao) Columns() DwdFCrmClueInfoColumns {
+	return dao.columns
+}
+
+// Group returns the database configuration group name of the current DAO.
+func (dao *DwdFCrmClueInfoDao) Group() string {
+	return dao.group
+}
+
+// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
+func (dao *DwdFCrmClueInfoDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rolls back the transaction and returns the error if function f returns a non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note: Do not commit or roll back the transaction in function f,
+// as it is automatically handled by this function.
+func (dao *DwdFCrmClueInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 36 - 16
newuserGet/internal/logic/task.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"errors"
 	"fmt"
+	"github.com/gogf/gf/v2/container/gset"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gtime"
 	"newuserGet/internal/dao"
@@ -55,21 +56,26 @@ func Task(ctx context.Context) {
 			// 过滤销售进程
 			userList = filterTrailStatus(ctx, rules[i], userList)
 		}
-		// 保存用户
-		saveList := []do.NewUserSendLog{}
-		for j := 0; j <= len(userList); j++ {
-			saveList = append(saveList, do.NewUserSendLog{
-				Phone:      userList[j].Phone,
-				UserId:     userList[j].MgoId,
-				CreateTime: gtime.Now(),
-			})
-		}
-		_, err = dao.NewUserSendLog.Ctx(ctx).Data(saveList).Insert()
-		if err != nil {
-			g.Log().Errorf(ctx, "第%v个规则 保存失败 :id-%v name:%v err:%v  %v\n", i, rules[i].Id, rules[i].Name, err, saveList)
-			continue
+		if len(userList) > 0 {
+			// 保存用户
+			saveList := []do.NewUserSendLog{}
+			for j := 0; j <= len(userList); j++ {
+				saveList = append(saveList, do.NewUserSendLog{
+					Phone:      userList[j].Phone,
+					UserId:     userList[j].MgoId,
+					CreateTime: gtime.Now(),
+				})
+			}
+			_, err = dao.NewUserSendLog.Ctx(ctx).Data(saveList).Insert()
+			if err != nil {
+				g.Log().Errorf(ctx, "第%v个规则 保存失败 :id-%v name:%v err:%v  %v\n", i, rules[i].Id, rules[i].Name, err, saveList)
+				continue
+			}
+			g.Log().Infof(ctx, "完成--第%v个规则:id-%v name:%v \n", i, rules[i].Id, rules[i].Name)
+
+		} else {
+			g.Log().Infof(ctx, "第%v个规则:id-%v name:%v  未获取到有效用户 \n", i, rules[i].Id, rules[i].Name)
 		}
-		g.Log().Infof(ctx, "完成--第%v个规则:id-%v name:%v \n", i, rules[i].Id, rules[i].Name)
 
 	}
 
@@ -81,7 +87,7 @@ type User struct {
 }
 
 const (
-	OrSQL          = "SELECT  bitobj from pub_tags.dwd_d_tag ddt WHERE  ddt.id in (%s) "
+	OrSQL          = "SELECT   groupBitmapOrState(bitobj) from pub_tags.dwd_d_tag ddt WHERE  ddt.id in (%s) "
 	BitMapSQL      = "SELECT bitmapAnd((%s),(%s)) as userIds"
 	QueryUserIdSQL = `SELECT
 	DISTINCT dmp.mgoUserId as mgoId,dmp.phone as phone
@@ -123,6 +129,8 @@ func getFromRegisterBehavior(ctx context.Context, rule entity.NewUserSendRule) (
 		return nil, err
 	}
 	g.Log().Info(ctx, userList)
+	g.Log().Info(ctx, "getFromRegisterBehavior 获得用户数量", len(userList))
+
 	return
 }
 
@@ -182,6 +190,7 @@ func filterCallState(ctx context.Context, rule entity.NewUserSendRule, userList
 			}
 		}
 	}
+	g.Log().Info(ctx, "filterCallState 获得用户数量", len(userList))
 	return
 }
 
@@ -193,7 +202,18 @@ func filterTrailStatus(ctx context.Context, rule entity.NewUserSendRule, userLis
 
 	}()
 	for i := 0; i < len(userList); i++ {
-
+		var trailstatus string
+		err := dao.DwdFCrmClueInfo.Ctx(ctx).Fields("trailstatus").Where("userid=?", userList[i]).Order("trailstatus_time desc").Limit(1).Scan(&trailstatus)
+		if err != nil {
+			g.Log().Error(ctx, "查询跟进状态异常", err)
+			continue
+		}
+		// 判断最新跟进状态是否与规则设置的相等
+		trailstatusSet := gset.NewStrSetFrom(strings.Split(rule.Trailstatus, ","), true)
+		if trailstatus != "" && trailstatusSet.Contains(trailstatus) {
+			newUserList = append(newUserList, userList[i])
+		}
 	}
+	g.Log().Info(ctx, "filterCallState 获得用户数量", len(userList))
 	return
 }

+ 79 - 0
newuserGet/internal/model/do/dwd_f_crm_clue_info.go

@@ -0,0 +1,79 @@
+// =================================================================================
+// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package do
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// DwdFCrmClueInfo is the golang structure of table dwd_f_crm_clue_info for DAO operations like Where/Data.
+type DwdFCrmClueInfo struct {
+	g.Meta                 `orm:"table:dwd_f_crm_clue_info, do:true"`
+	Id                     interface{} // 线索ID:UUID
+	Uid                    interface{} // 用户表UUID
+	Userid                 interface{} // 用户userid
+	PositionId             interface{} // 坐席职位ID
+	SeatNumber             interface{} // 坐席号
+	IsAssign               interface{} // 是否分配:0:未分配,公海;1:已分配,私海
+	Comeintime             *gtime.Time // 出入私海的时间
+	ComeintimeOpen         *gtime.Time // 公海入海时间
+	Createtime             *gtime.Time // 线索创建时间:线索生成时间
+	Updatetime             *gtime.Time // 更新时间
+	Cluename               interface{} // 线索名称:COMPANY_NAME
+	TopCluetype            interface{} // 线索来源一级
+	SubCluetype            interface{} // 线索来源二级
+	BusinessScope          interface{} // 业务范围
+	CustomerDemand         interface{} // 客户需求
+	IntendedProducts       interface{} // 意向产品
+	CustomerBudget         interface{} // 客户预算
+	ContactType            interface{} // 联系人类型:决策人,使用人
+	Name                   interface{} // 姓名
+	Phone                  interface{} // 联系方式
+	Sex                    interface{} // 性别:男、女
+	Position               interface{} // 职位
+	Department             interface{} // 部门
+	Industry               interface{} // 所属行业
+	CustomeIndustry        interface{} // 目标客户行业
+	FollowProjectArea      interface{} // 关注项目区域:CODE,关联区域维表
+	Role                   interface{} // 生态角色
+	Trailstatus            interface{} // 线索跟进状态:无意向,已成交......
+	TrailstatusTime        *gtime.Time // 线索状态变更时间
+	TrailTime              *gtime.Time // 最新跟进时间
+	NextTrailTime          *gtime.Time // 下次跟进时间
+	IsTask                 interface{} // 是否加车
+	Tasktime               *gtime.Time // 任务时间
+	Taskstatus             interface{} // 任务状态
+	ComeinsourcePrivate    interface{} // 私海-入海来源
+	Tasksource             interface{} // 入车来源
+	OutTaskTime            *gtime.Time // 退车时间
+	OutTaskStatus          interface{} // 退车状态
+	ComeinsourceOpen       interface{} // 公海-入海来源
+	LevelOpen              interface{} // 公海级别
+	ClueLevel              interface{} // 线索等级
+	TaskTime               *gtime.Time // 加车时间
+	BatchImport            interface{} // 导入批次
+	IsTransfer             interface{} // 是否移交;0:未移交 1:已移交
+	SalespersonNum         interface{} // 销售人员数量
+	StartTrailTime         *gtime.Time // 开始跟进时间
+	Content                interface{} // 最近跟进内容
+	State                  interface{} // 最后通话状态
+	CompanyNature          interface{} // 公司性质,0:非集团公司 1:集团公司
+	CompanyVerification    interface{} // 公司核验,0:不在工商库 1:在工商库
+	Remark                 interface{} // 备注
+	Shuoming               interface{} // uid更新说明
+	FreezeTime             *gtime.Time // 冻结时间
+	LastRingTime           *gtime.Time // 最近外呼时间
+	LastBeginTime          *gtime.Time // 最近接通时间
+	IsUnfollow             interface{} // 是否不再跟进,0:否,1:是
+	UseDemand              interface{} // 使用需求
+	IsArtificiallyModified interface{} // 是否人为修改,0:否,1:是
+	LockStatus             interface{} // 锁定状态,1:已锁定,2:未锁定,3:无需锁定
+	LockPositionId         interface{} // 锁定人职位id,多值
+	LockTime               *gtime.Time // 锁定时间
+	LegalRepresentative    interface{} // 法定代表人
+	Label                  interface{} // 标签 1自动分配2来源变更3其他变更
+	LabelChangeTime        interface{} // 标签变更时间 2024-12-12
+}

+ 77 - 0
newuserGet/internal/model/entity/dwd_f_crm_clue_info.go

@@ -0,0 +1,77 @@
+// =================================================================================
+// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package entity
+
+import (
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// DwdFCrmClueInfo is the golang structure for table dwd_f_crm_clue_info.
+type DwdFCrmClueInfo struct {
+	Id                     int64       `json:"id"                     orm:"id"                       description:"线索ID:UUID"`               // 线索ID:UUID
+	Uid                    string      `json:"uid"                    orm:"uid"                      description:"用户表UUID"`                 // 用户表UUID
+	Userid                 string      `json:"userid"                 orm:"userid"                   description:"用户userid"`                // 用户userid
+	PositionId             int64       `json:"positionId"             orm:"position_id"              description:"坐席职位ID"`                  // 坐席职位ID
+	SeatNumber             string      `json:"seatNumber"             orm:"seatNumber"               description:"坐席号"`                     // 坐席号
+	IsAssign               int64       `json:"isAssign"               orm:"is_assign"                description:"是否分配:0:未分配,公海;1:已分配,私海"`  // 是否分配:0:未分配,公海;1:已分配,私海
+	Comeintime             *gtime.Time `json:"comeintime"             orm:"comeintime"               description:"出入私海的时间"`                 // 出入私海的时间
+	ComeintimeOpen         *gtime.Time `json:"comeintimeOpen"         orm:"comeintime_open"          description:"公海入海时间"`                  // 公海入海时间
+	Createtime             *gtime.Time `json:"createtime"             orm:"createtime"               description:"线索创建时间:线索生成时间"`           // 线索创建时间:线索生成时间
+	Updatetime             *gtime.Time `json:"updatetime"             orm:"updatetime"               description:"更新时间"`                    // 更新时间
+	Cluename               string      `json:"cluename"               orm:"cluename"                 description:"线索名称:COMPANY_NAME"`       // 线索名称:COMPANY_NAME
+	TopCluetype            string      `json:"topCluetype"            orm:"top_cluetype"             description:"线索来源一级"`                  // 线索来源一级
+	SubCluetype            string      `json:"subCluetype"            orm:"sub_cluetype"             description:"线索来源二级"`                  // 线索来源二级
+	BusinessScope          string      `json:"businessScope"          orm:"business_scope"           description:"业务范围"`                    // 业务范围
+	CustomerDemand         string      `json:"customerDemand"         orm:"customer_demand"          description:"客户需求"`                    // 客户需求
+	IntendedProducts       string      `json:"intendedProducts"       orm:"intended_products"        description:"意向产品"`                    // 意向产品
+	CustomerBudget         int         `json:"customerBudget"         orm:"customer_budget"          description:"客户预算"`                    // 客户预算
+	ContactType            string      `json:"contactType"            orm:"contact_type"             description:"联系人类型:决策人,使用人"`           // 联系人类型:决策人,使用人
+	Name                   string      `json:"name"                   orm:"name"                     description:"姓名"`                      // 姓名
+	Phone                  string      `json:"phone"                  orm:"phone"                    description:"联系方式"`                    // 联系方式
+	Sex                    string      `json:"sex"                    orm:"sex"                      description:"性别:男、女"`                  // 性别:男、女
+	Position               string      `json:"position"               orm:"position"                 description:"职位"`                      // 职位
+	Department             string      `json:"department"             orm:"department"               description:"部门"`                      // 部门
+	Industry               string      `json:"industry"               orm:"industry"                 description:"所属行业"`                    // 所属行业
+	CustomeIndustry        string      `json:"customeIndustry"        orm:"custome_industry"         description:"目标客户行业"`                  // 目标客户行业
+	FollowProjectArea      string      `json:"followProjectArea"      orm:"follow_project_area"      description:"关注项目区域:CODE,关联区域维表"`      // 关注项目区域:CODE,关联区域维表
+	Role                   string      `json:"role"                   orm:"role"                     description:"生态角色"`                    // 生态角色
+	Trailstatus            string      `json:"trailstatus"            orm:"trailstatus"              description:"线索跟进状态:无意向,已成交......"`    // 线索跟进状态:无意向,已成交......
+	TrailstatusTime        *gtime.Time `json:"trailstatusTime"        orm:"trailstatus_time"         description:"线索状态变更时间"`                // 线索状态变更时间
+	TrailTime              *gtime.Time `json:"trailTime"              orm:"trail_time"               description:"最新跟进时间"`                  // 最新跟进时间
+	NextTrailTime          *gtime.Time `json:"nextTrailTime"          orm:"next_trail_time"          description:"下次跟进时间"`                  // 下次跟进时间
+	IsTask                 int         `json:"isTask"                 orm:"is_task"                  description:"是否加车"`                    // 是否加车
+	Tasktime               *gtime.Time `json:"tasktime"               orm:"tasktime"                 description:"任务时间"`                    // 任务时间
+	Taskstatus             int         `json:"taskstatus"             orm:"taskstatus"               description:"任务状态"`                    // 任务状态
+	ComeinsourcePrivate    int         `json:"comeinsourcePrivate"    orm:"comeinsource_private"     description:"私海-入海来源"`                 // 私海-入海来源
+	Tasksource             string      `json:"tasksource"             orm:"tasksource"               description:"入车来源"`                    // 入车来源
+	OutTaskTime            *gtime.Time `json:"outTaskTime"            orm:"out_task_time"            description:"退车时间"`                    // 退车时间
+	OutTaskStatus          int         `json:"outTaskStatus"          orm:"out_task_status"          description:"退车状态"`                    // 退车状态
+	ComeinsourceOpen       int         `json:"comeinsourceOpen"       orm:"comeinsource_open"        description:"公海-入海来源"`                 // 公海-入海来源
+	LevelOpen              int         `json:"levelOpen"              orm:"level_open"               description:"公海级别"`                    // 公海级别
+	ClueLevel              string      `json:"clueLevel"              orm:"clue_level"               description:"线索等级"`                    // 线索等级
+	TaskTime               *gtime.Time `json:"taskTime"               orm:"task_time"                description:"加车时间"`                    // 加车时间
+	BatchImport            string      `json:"batchImport"            orm:"batch_import"             description:"导入批次"`                    // 导入批次
+	IsTransfer             int64       `json:"iSTRANSFER"             orm:"IS_TRANSFER"              description:"是否移交;0:未移交 1:已移交"`        // 是否移交;0:未移交 1:已移交
+	SalespersonNum         int         `json:"salespersonNum"         orm:"salesperson_num"          description:"销售人员数量"`                  // 销售人员数量
+	StartTrailTime         *gtime.Time `json:"startTrailTime"         orm:"start_trail_time"         description:"开始跟进时间"`                  // 开始跟进时间
+	Content                string      `json:"content"                orm:"content"                  description:"最近跟进内容"`                  // 最近跟进内容
+	State                  string      `json:"sTATE"                  orm:"STATE"                    description:"最后通话状态"`                  // 最后通话状态
+	CompanyNature          int64       `json:"cOMPANYNATURE"          orm:"COMPANY_NATURE"           description:"公司性质,0:非集团公司 1:集团公司"`     // 公司性质,0:非集团公司 1:集团公司
+	CompanyVerification    int64       `json:"cOMPANYVERIFICATION"    orm:"COMPANY_VERIFICATION"     description:"公司核验,0:不在工商库 1:在工商库"`     // 公司核验,0:不在工商库 1:在工商库
+	Remark                 string      `json:"remark"                 orm:"remark"                   description:"备注"`                      // 备注
+	Shuoming               string      `json:"shuoming"               orm:"shuoming"                 description:"uid更新说明"`                 // uid更新说明
+	FreezeTime             *gtime.Time `json:"fREEZETIME"             orm:"FREEZE_TIME"              description:"冻结时间"`                    // 冻结时间
+	LastRingTime           *gtime.Time `json:"lastRingTime"           orm:"last_ring_time"           description:"最近外呼时间"`                  // 最近外呼时间
+	LastBeginTime          *gtime.Time `json:"lastBeginTime"          orm:"last_begin_time"          description:"最近接通时间"`                  // 最近接通时间
+	IsUnfollow             int         `json:"isUnfollow"             orm:"is_unfollow"              description:"是否不再跟进,0:否,1:是"`          // 是否不再跟进,0:否,1:是
+	UseDemand              string      `json:"useDemand"              orm:"use_demand"               description:"使用需求"`                    // 使用需求
+	IsArtificiallyModified int         `json:"isArtificiallyModified" orm:"is_artificially_modified" description:"是否人为修改,0:否,1:是"`          // 是否人为修改,0:否,1:是
+	LockStatus             int         `json:"lockStatus"             orm:"lock_status"              description:"锁定状态,1:已锁定,2:未锁定,3:无需锁定"` // 锁定状态,1:已锁定,2:未锁定,3:无需锁定
+	LockPositionId         string      `json:"lockPositionId"         orm:"lock_position_id"         description:"锁定人职位id,多值"`              // 锁定人职位id,多值
+	LockTime               *gtime.Time `json:"lockTime"               orm:"lock_time"                description:"锁定时间"`                    // 锁定时间
+	LegalRepresentative    string      `json:"legalRepresentative"    orm:"legal_representative"     description:"法定代表人"`                   // 法定代表人
+	Label                  int         `json:"label"                  orm:"label"                    description:"标签 1自动分配2来源变更3其他变更"`      // 标签 1自动分配2来源变更3其他变更
+	LabelChangeTime        string      `json:"labelChangeTime"        orm:"labelChangeTime"          description:"标签变更时间 2024-12-12"`       // 标签变更时间 2024-12-12
+}

+ 20 - 12
newuserGet/main.go

@@ -1,12 +1,15 @@
 package main
 
 import (
+	"context"
 	//"context"
 	//_ "getuser/internal/packed"
 	//"github.com/gogf/gf/v2/frame/g"
 	//"github.com/gogf/gf/v2/os/gcron"
 	_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
 	_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gcron"
 	"github.com/gogf/gf/v2/os/gctx"
 	"newuserGet/internal/logic"
 )
@@ -14,19 +17,24 @@ import (
 func main() {
 
 	var (
-		//err error
+		err error
 		ctx = gctx.New()
 	)
-	logic.Task(ctx)
+	//logic.Task(ctx)
 	//
-	//	_, err = gcron.AddSingleton(ctx, "* * * * * *", func(ctx context.Context) {
-	//		g.Log().Print(ctx, "doing start")
-	//		logic.Task(ctx)
-	//		g.Log().Print(ctx, "end")
-	//
-	//	})
-	//	if err != nil {
-	//		panic(err)
-	//	}
-	//	select {}
+	taskRun := g.Cfg().MustGet(ctx, "task.taskRun").Bool()
+	if taskRun {
+		cronStr := g.Cfg().MustGet(ctx, "task.cron").String()
+		_, err = gcron.AddSingleton(ctx, cronStr, func(ctx context.Context) {
+			g.Log().Print(ctx, "doing start")
+			logic.Task(ctx)
+			g.Log().Print(ctx, "end")
+
+		})
+		if err != nil {
+			panic(err)
+		}
+	}
+
+	select {}
 }