Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
crm_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
82a1f9e4
authored
Nov 18, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加h5留言脚本
parent
b3af516f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
2 deletions
cmd/task/find_goods/main.go
cmd/task/h5_notes/main.go
cmd/task/multi_search/main.go
cmd/task/find_goods/main.go
View file @
82a1f9e4
...
...
@@ -39,7 +39,7 @@ func main () {
logger
.
InitLogger
(
"file"
,
logConfig
)
logger
.
Init
()
// 查看
未下单
任务是否开启
// 查看任务是否开启
task_setup
:=
common
.
GetTaskSetup
(
4
)
//task_setup_details := common.GetTaskSetupDetails(task_setup.Id)
...
...
@@ -108,6 +108,10 @@ func setFindGoods(status, task_id, task_type, task_display_degree int) {
var
salesman
model
.
Salesman
db
.
Get
(
&
salesman
,
"select * from lie_salesman where user_id = ?"
,
feedback
.
Outter_Uid
)
if
salesman
.
Sale_Id
==
0
{
// 若未分配,则跳过
continue
}
db
.
Exec
(
"insert into lie_task_info (user_id, task_id, task_type, task_display_degree, sale_id, create_time, update_time) value (?, ?, ?, ?, "
+
"?, ?, ?)"
,
feedback
.
Outter_Uid
,
task_id
,
task_type
,
task_display_degree
,
salesman
.
Sale_Id
,
current_time
,
current_time
)
db
.
Exec
(
"update lie_feedback set is_add_task = ? where id = ?"
,
1
,
feedback
.
Id
)
...
...
cmd/task/h5_notes/main.go
0 → 100644
View file @
82a1f9e4
package
main
/**
H5留言任务
1. 任务未结束前,此任务唯一,不重复生成
2. 不设置截止时间
*/
import
(
"crm-server/cmd/task/common"
"crm-server/configs"
"crm-server/internal/dao"
"crm-server/internal/model"
"crm-server/internal/service"
"flag"
"fmt"
"github.com/ichunt2019/logger"
"strconv"
"time"
)
// 日志目录
var
LogDir
string
// 解析命令行参数
func
initArgs
()
{
flag
.
StringVar
(
&
LogDir
,
"logDir"
,
""
,
"日志目录"
)
flag
.
Parse
()
}
func
main
()
{
initArgs
()
logConfig
:=
make
(
map
[
string
]
string
)
logConfig
[
"log_path"
]
=
LogDir
+
"/task/h5_notes"
logConfig
[
"log_chan_size"
]
=
"100"
logger
.
InitLogger
(
"file"
,
logConfig
)
logger
.
Init
()
// 查看任务是否开启
task_setup
:=
common
.
GetTaskSetup
(
7
)
setTaskInfo
(
task_setup
.
Status
,
task_setup
.
Id
,
task_setup
.
TaskType
,
task_setup
.
TaskDisplayDegree
)
fmt
.
Println
(
"任务执行完成"
)
}
func
setTaskInfo
(
status
,
task_id
,
task_type
,
task_display_degree
int
)
{
if
status
==
0
||
status
==
-
1
{
// 数据不存在或未开启则直接中断
return
}
db
:=
dao
.
GetNewDb
()
// 获取H5留言的用户
row
,
err
:=
db
.
Queryx
(
"select * from lie_feedback where type = ? and is_add_task = ? order by id desc"
,
11
,
0
)
defer
row
.
Close
()
if
err
!=
nil
{
logger
.
Info
(
"获取H5留言失败: "
,
err
.
Error
())
return
}
for
row
.
Next
()
{
var
feedback
model
.
Feedback
row
.
StructScan
(
&
feedback
)
// 判断该用户是否存在任务记录,若存在则跳过
var
task_info
model
.
TaskInfo
db
.
Get
(
&
task_info
,
"select * from lie_task_info where user_id = ? and status = ? and task_type = ? limit 1"
,
feedback
.
Outter_Uid
,
1
,
7
)
if
task_info
.
Id
!=
0
{
continue
}
// 查看用户是否分配
var
salesman
model
.
Salesman
db
.
Get
(
&
salesman
,
"select * from lie_salesman where user_id = ?"
,
feedback
.
Outter_Uid
)
if
salesman
.
Sale_Id
==
0
{
// 若未分配,则跳过
continue
}
current_time
:=
time
.
Now
()
.
Unix
()
// 当前时间
db
.
Exec
(
"insert into lie_task_info (user_id, task_id, task_type, task_display_degree, sale_id, create_time, update_time) value (?, ?, ?, ?, "
+
"?, ?, ?)"
,
feedback
.
Outter_Uid
,
task_id
,
task_type
,
task_display_degree
,
salesman
.
Sale_Id
,
current_time
,
current_time
)
db
.
Exec
(
"update lie_feedback set is_add_task = ? where id = ?"
,
1
,
feedback
.
Id
)
service
.
DingAlert
(
configs
.
Ding_crm_task_token
,
"任务告警:H5留言任务脚本添加任务记录成功,CRM用户ID:"
+
strconv
.
Itoa
(
feedback
.
Outter_Uid
),
""
)
}
}
\ No newline at end of file
cmd/task/multi_search/main.go
View file @
82a1f9e4
...
...
@@ -36,7 +36,7 @@ func main () {
logger
.
InitLogger
(
"file"
,
logConfig
)
logger
.
Init
()
// 查看
未下单
任务是否开启
// 查看任务是否开启
task_setup
:=
common
.
GetTaskSetup
(
5
)
//task_setup_details := common.GetTaskSetupDetails(task_setup.Id)
//
...
...
@@ -94,6 +94,10 @@ func setMultiSearch(status, task_id, task_type, task_display_degree int) {
var
salesman
model
.
Salesman
db
.
Get
(
&
salesman
,
"select * from lie_salesman where user_id = ?"
,
feedback
.
Outter_Uid
)
if
salesman
.
Sale_Id
==
0
{
// 若未分配,则跳过
continue
}
db
.
Exec
(
"insert into lie_task_info (user_id, task_id, task_type, task_display_degree, sale_id, create_time, update_time) value (?, ?, ?, ?, "
+
"?, ?, ?)"
,
feedback
.
Outter_Uid
,
task_id
,
task_type
,
task_display_degree
,
salesman
.
Sale_Id
,
current_time
,
current_time
)
db
.
Exec
(
"update lie_feedback set is_add_task = ? where id = ?"
,
1
,
feedback
.
Id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment