新建标签类型

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->lable()->create([
    "tag_name" => "xxxxxxx",
    "tag_values" => [
        "标签1", 
        "标签2"
    ]
]);

删除指定标签类型

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->lable()->delete([
    "tag_name" => "xxxxxxx"
]);

为标签添加可选值

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->lable()->add_option([
    "tag_name" => "xxxxxxx",
    "tag_values" => [
        "标签1", 
        "标签2"
    ]
]);

获取标签和可选值

$obj = new \wechat\Wechat();
$obj->official()->lable()->get();

成功结果:

array(2) {
  [0]=>
  array(2) {
    ["tag_name"]=>
    string(4) "tag4"
    ["tag_values"]=>
    array(1) {
      [0]=>
      string(7) "标签4"
    }
  }
  [1]=>
  array(2) {
    ["tag_name"]=>
    string(4) "tag3"
    ["tag_values"]=>
    array(2) {
      [0]=>
      string(8) "标签33"
      [1]=>
      string(8) "标签22"
    }
  }
}

为客户设置标签

$obj = new \wechat\Wechat();
$obj->official()->lable()->add_user([
    "guide_account" => "wx_account",
    "openid" => "xxxxxxx",
    "tag_value" => "tag1"
]);

成功结果:

true

或者:

array(2) {
  [0]=>
  array(3) {
    ["errcode"]=>
    int(0)
    ["errmsg"]=>
    string(2) "ok"
    ["openid"]=>
    string(7) "xxxxxxx"
  }
  [1]=>
  array(3) {
    ["errcode"]=>
    int(0)
    ["errmsg"]=>
    string(2) "ok"
    ["openid"]=>
    string(8) "yyyyyyyy"
  }
}

查询客户标签

$obj = new \wechat\Wechat();
$obj->official()->lable()->select_user([
    "guide_account" => "wx_account",
    "openid" => "xxxxxxx"
]);

成功结果:

array(2) {
  [0]=>
  string(6) "tag1_1"
  [1]=>
  string(6) "tag2_1"
}

根据标签值筛选客户

$obj = new \wechat\Wechat();
$obj->official()->lable()->query_user([
    "guide_account" => "xxxxxxx",
    "push_count" => 0,
    "tag_values => [
        "tag1_1",
        "tag2_1"
    ]
]);

成功结果:

array(2) {
  [0]=>
  string(6) "xxx1"
  [1]=>
  string(6) "xxx2"
}

删除客户标签

$obj = new \wechat\Wechat();
$obj->official()->lable()->delete_user([
    "guide_account" => "wx_account",
    "openid" => "xxxxxxx",
    "tag_value" => "tag1"
]);

成功结果:

true

或者:

array(2) {
  [0]=>
  array(3) {
    ["errcode"]=>
    int(0)
    ["errmsg"]=>
    string(2) "ok"
    ["openid"]=>
    string(7) "xxxxxxx"
  }
  [1]=>
  array(3) {
    ["errcode"]=>
    int(0)
    ["errmsg"]=>
    string(2) "ok"
    ["openid"]=>
    string(8) "yyyyyyyy"
  }
}

设置自定义客户信息

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->lable()->add_diy_user([
    "guide_account" => "wx_account",
    "openid" => "xxxxxxx",
    "display_tag_list" => [
        "test1",
        "test2"
    ]
]);

获取自定义客户信息

$obj = new \wechat\Wechat();
$obj->official()->lable()->get_diy_user([
    "guide_account" => "张三",
    "openid" => "xxxxxxx"
]);

成功结果:

array(2) {
  [0]=>
  string(6) "test1"
  [1]=>
  string(6) "test2"
}

SW-X

企业级 - 高性能 PHP 框架

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

本篇目录