提交图片生成任务
根据类型生成图片,结果将通过回调的方式告知,或通过主动查询接口获取生成结果。频率限制:500/s
| 请求参数 | 类型 | 描述 |
|---|---|---|
| json | object | 声明请求的JSON数据结构 |
| brand_id | string | 品牌ID |
| task_id | string | 图片生成的任务ID |
| image_generation_type | string | 图片生成类型COMBINE_IMAGE | CUT_OUT 枚举值之一 |
| combine_image | object | 拼图数据 |
| scope | string | 优惠范围ALL | SINGLE 枚举值之一 |
| type | string | 商品券类型NORMAL | DISCOUNT | EXCHANGE 枚举值之一 |
| usage_mode | string | 使用模式SINGLE | PROGRESSIVE_BUNDLE 枚举值之一 |
| normal_coupon | object | 满减券使用规则 |
| threshold | integer | 门槛金额 |
| discount_amount | integer | 固定减免金额 |
| discount_coupon | object | 折扣券使用规则 |
| threshold | integer | 门槛金额 |
| percent_off | integer | 固定减免百分比 |
| exchange_coupon | object | 兑换券使用规则 |
| threshold | integer | 门槛金额 |
| exchange_price | integer | 固定兑换价格 |
| background_color | string | 背景颜色色值 |
| cut_out | object | 抠图数据 |
| image_url | string | 商品图URL |
php
$instance->v3->marketing->partner->productCoupon->imageGenerationTasks->postAsync([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/marketing/partner/product-coupon/image-generation-tasks')->postAsync([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/marketing/partner/product-coupon/image-generation-tasks']->postAsync([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->marketing->partner->productCoupon->imageGenerationTasks->post([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/marketing/partner/product-coupon/image-generation-tasks')->post([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/marketing/partner/product-coupon/image-generation-tasks']->post([
'json' => [
'brand_id' => '120344',
'task_id' => 'image_generation_task_1',
'image_generation_type' => 'COMBINE_IMAGE',
'combine_image' => [
'scope' => 'ALL',
'type' => 'NORMAL',
'usage_mode' => 'SINGLE',
'normal_coupon' => [
'threshold' => 10000,
'discount_amount' => 1,
],
'discount_coupon' => [
'threshold' => 10000,
'percent_off' => 20,
],
'exchange_coupon' => [
'threshold' => 10000,
'exchange_price' => 20,
],
'background_color' => '#ff5733',
],
'cut_out' => [
'image_url' => 'https://wxpaylogo.qpic.cn/wxpaylogo/example.jpg',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| task_id | string | 图片生成的任务ID |
| brand_id | string | 品牌ID |