From c04209b7b6e0e320a23382a2f3a2ae734bec3a1c Mon Sep 17 00:00:00 2001 From: lijianbin <513837235@.qq.com> Date: Tue, 30 Nov 2021 14:11:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AA=E7=8E=AF=E7=B1=BB?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.dotask.go | 1 + client.dotask_test.go | 6 +++--- task.proto | 1 + variable.go | 15 +++++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/client.dotask.go b/client.dotask.go index 8376f7d..1f61ea9 100644 --- a/client.dotask.go +++ b/client.dotask.go @@ -6,6 +6,7 @@ import ( "log" ) +// 完成单次任务 func DoTask(dbname, siteid, userId, task_type string, url ...string) (bool, error) { if dbname == "" || userId == "" || task_type == ""{ diff --git a/client.dotask_test.go b/client.dotask_test.go index 3eef464..aad2f61 100644 --- a/client.dotask_test.go +++ b/client.dotask_test.go @@ -5,9 +5,9 @@ import ( ) func Test_DoTask(t *testing.T) { - dbname := "shop_v2_org" - siteid := "" - userid := "2" + dbname := "shop" + siteid := "1198881" + userid := "19" task_type := "phone" list, err := DoTask(dbname,siteid,userid,task_type) diff --git a/task.proto b/task.proto index e037c8b..5c20183 100644 --- a/task.proto +++ b/task.proto @@ -18,4 +18,5 @@ message Response { // rpc方法 service TaskService { rpc DoTask (Request) returns (Response); // 完成了某项任务 + rpc DoCycleTask (Request) returns (Response); // 完成循环类任务 } \ No newline at end of file diff --git a/variable.go b/variable.go index a7063c0..400f340 100644 --- a/variable.go +++ b/variable.go @@ -3,8 +3,15 @@ package taskrpc var DES_KEY = "task2296" 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"` }