添加群发任务

$obj = new \wechat\Wechat();
$obj->official()->masstask()->create('{
    "guide_account": "xxxxxxxx",
    "task_name": "testtask_name111",
    "task_remark": "testtask_remark111",
    "push_time": 1589010582,
    "openid": [
      "yyyyyyyy"
    ],
    "material": [
      {
        "type": 1,
        "word": "testword"
      },
      {
        "type": 3,
        "media_id": "xxxxxxxxxxxxxx"
      },
      {
        "type": 49,
        "media_id": "xxxxxxxxxxxxxx",
        "title": "test_title",
        "path": "page/index/index",
        "appid": "wxzzzzzzzzzzzz"
      }
    ]
}');

成功结果:

array(2) {
  ["task_id"]=>
  int(1332519773019865000)
  ["openid"]=>
  array(2) {
    [0]=>
    string(6) "xxxxxx"
    [1]=>
    string(6) "yyyyyy"
  }
}

获取群发任务列表

$obj = new \wechat\Wechat();
$obj->official()->masstask()->showlist('{
    "guide_account": "xxxxxxxx",
    "offset":0,
    "limit":1
}');

成功结果:

array(2) {
  ["list"]=>
  array(1) {
    [0]=>
    array(10) {
      ["task_id"]=>
      int(1332519773019865000)
      ["create_time"]=>
      int(1589016638)
      ["update_time"]=>
      int(1589016638)
      ["push_time"]=>
      int(1589010582)
      ["finish_time"]=>
      int(0)
      ["task_name"]=>
      string(16) "testtask_name111"
      ["task_remark"]=>
      string(18) "testtask_remark111"
      ["material"]=>
      array(3) {
        [0]=>
        array(2) {
          ["type"]=>
          int(1)
          ["word"]=>
          string(8) "testword"
        }
        [1]=>
        array(2) {
          ["type"]=>
          int(3)
          ["pic_url"]=>
          string(122) "http://mmbiz.qpic.cn/mmbiz_png/pHhTMtqk90rHY17p2cOXN9uhxMLpugicrGmYpljlNuoMbEjDib1S1nAcib3CC4qHOBqHtlOPYGP6OCuQpL5NDyUUA/0"
        }
        [2]=>
        array(5) {
          ["type"]=>
          int(49)
          ["title"]=>
          string(10) "test_title"
          ["path"]=>
          string(0) ""
          ["appid"]=>
          string(8) "xxxxxxxx"
          ["pic_url"]=>
          string(122) "http://mmbiz.qpic.cn/mmbiz_png/pHhTMtqk90rHY17p2cOXN9uhxMLpugicrGmYpljlNuoMbEjDib1S1nAcib3CC4qHOBqHtlOPYGP6OCuQpL5NDyUUA/0"
        }
      }
      ["buyer_info"]=>
      array(1) {
        [0]=>
        array(2) {
          ["openid"]=>
          string(10) "xxxxxxxxxx"
          ["send_status"]=>
          int(1)
        }
      }
      ["task_status"]=>
      int(1)
    }
  }
  ["total_count"]=>
  int(4)
}

获取指定群发任务信息

$obj = new \wechat\Wechat();
$obj->official()->masstask()->details('{
    "task_id":1332414111522783232
}');

成功结果:

array(10) {
  ["task_id"]=>
  int(1332519773019865000)
  ["create_time"]=>
  int(1589016638)
  ["update_time"]=>
  int(1589016638)
  ["push_time"]=>
  int(1589010582)
  ["finish_time"]=>
  int(0)
  ["task_name"]=>
  string(16) "testtask_name111"
  ["task_remark"]=>
  string(18) "testtask_remark111"
  ["material"]=>
  array(3) {
    [0]=>
    array(2) {
      ["type"]=>
      int(1)
      ["word"]=>
      string(8) "testword"
    }
    [1]=>
    array(2) {
      ["type"]=>
      int(3)
      ["pic_url"]=>
      string(122) "http://mmbiz.qpic.cn/mmbiz_png/pHhTMtqk90rHY17p2cOXN9uhxMLpugicrGmYpljlNuoMbEjDib1S1nAcib3CC4qHOBqHtlOPYGP6OCuQpL5NDyUUA/0"
    }
    [2]=>
    array(5) {
      ["type"]=>
      int(49)
      ["title"]=>
      string(10) "test_title"
      ["path"]=>
      string(0) ""
      ["appid"]=>
      string(8) "xxxxxxxx"
      ["pic_url"]=>
      string(122) "http://mmbiz.qpic.cn/mmbiz_png/pHhTMtqk90rHY17p2cOXN9uhxMLpugicrGmYpljlNuoMbEjDib1S1nAcib3CC4qHOBqHtlOPYGP6OCuQpL5NDyUUA/0"
    }
  }
  ["buyer_info"]=>
  array(1) {
    [0]=>
    array(2) {
      ["openid"]=>
      string(10) "xxxxxxxxxx"
      ["send_status"]=>
      int(1)
    }
  }
  ["task_status"]=>
  int(1)
}

修改群发任务

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->masstask()->update('{
	"task_id": 1332414111522783232,
    "task_name":"testtask_name111",
    "task_remark":"testtask_remark111",
    "push_time": 1589010582,
    "openid":[
        "yyyyyyyy"
    ],
    "material": [
        {
            "type":1,
            "word":"testword"
        },
        {
            "type":3,
            "media_id": "xxxxxxxxxxxxxx"
        },
        {
            "type":49,
            "media_id": "xxxxxxxxxxxxxx",
            "title":"test_title",
            "path":"page/index/index",
            "appid":"wxzzzzzzzzzzzz"
        }
    ]
}');

取消群发任务

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->masstask()->cancel('{
   "task_id": 1332414111522783232
}');

SW-X

企业级 - 高性能 PHP 框架

最后更新:3年前 . 作者-小黄牛

本篇目录