Browse Source

增加循环类任务

master
lijianbin 3 years ago
parent
commit
c04209b7b6
4 changed files with 16 additions and 7 deletions
  1. +1
    -0
      client.dotask.go
  2. +3
    -3
      client.dotask_test.go
  3. +1
    -0
      task.proto
  4. +11
    -4
      variable.go

+ 1
- 0
client.dotask.go View File

@ -6,6 +6,7 @@ import (
"log" "log"
) )
// 完成单次任务
func DoTask(dbname, siteid, userId, task_type string, url ...string) (bool, error) { func DoTask(dbname, siteid, userId, task_type string, url ...string) (bool, error) {
if dbname == "" || userId == "" || task_type == ""{ if dbname == "" || userId == "" || task_type == ""{


+ 3
- 3
client.dotask_test.go View File

@ -5,9 +5,9 @@ import (
) )
func Test_DoTask(t *testing.T) { func Test_DoTask(t *testing.T) {
dbname := "shop_v2_org"
siteid := ""
userid := "2"
dbname := "shop"
siteid := "1198881"
userid := "19"
task_type := "phone" task_type := "phone"
list, err := DoTask(dbname,siteid,userid,task_type) list, err := DoTask(dbname,siteid,userid,task_type)


+ 1
- 0
task.proto View File

@ -18,4 +18,5 @@ message Response {
// rpc方法 // rpc方法
service TaskService { service TaskService {
rpc DoTask (Request) returns (Response); // rpc DoTask (Request) returns (Response); //
rpc DoCycleTask (Request) returns (Response); //
} }

+ 11
- 4
variable.go View File

@ -3,8 +3,15 @@ package taskrpc
var DES_KEY = "task2296" var DES_KEY = "task2296"
type DoTaskParam struct { type DoTaskParam struct {
SiteId string `json:"site_id"`
Dbname string `json:"database"`
Type string `json:"type"`
UserId string `json:"user_id"`
SiteId string `json:"site_id"`
Dbname string `json:"database"`
Type string `json:"type"`
UserId string `json:"user_id"`
}
type DoCycleTaskParam struct {
SiteId string `json:"site_id"`
Dbname string `json:"database"`
TaskId string `json:"task_id"`
UserId string `json:"user_id"`
} }

Loading…
Cancel
Save