增加用户记录
当用户在商户侧消费时,用户完成了微信先享卡的目标或者获取使用优惠时,商户需要把这个信息同步给微信先享卡平台,用于在微信先享卡小程序展示及先享卡到期后的用户结算。
请求参数 | 类型 | 描述 |
---|---|---|
out_card_code | string | 商户领卡号 |
json | object | 声明请求的JSON 数据结构 |
card_template_id | string | 卡模板ID |
objective_completion_records | object[] | 目标完成记录 |
objective_completion_serial_no | string | 目标完成流水号 |
objective_id | string | 目标ID |
completion_time | string | 目标完成时间 |
completion_type | string | 目标完成类型 |
description | string | 目标完成描述 |
completion_count | integer | 目标完成数量 |
remark | string | 备注说明 |
reward_usage_records | object[] | 优惠使用记录 |
reward_usage_serial_no | string | 优惠使用记录流水号 |
reward_id | string | 优惠ID |
usage_time | string | 优惠使用时间 |
usage_type | string | 优惠使用类型 |
description | string | 优惠使用描述 |
usage_count | integer | 数量 |
amount | integer | 金额 |
remark | string | 备注说明 |
php
$instance->v3->discountCard->cards->_out_card_code_->addUserRecords->postAsync([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance->chain('v3/discount-card/cards/{out_card_code}/add-user-records')->postAsync([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance['v3/discount-card/cards/{out_card_code}/add-user-records']->postAsync([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$response = $instance->v3->discountCard->cards->_out_card_code_->addUserRecords->post([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance->chain('v3/discount-card/cards/{out_card_code}/add-user-records')->post([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance['v3/discount-card/cards/{out_card_code}/add-user-records']->post([
'out_card_code' => '6e8369071cd942c0476613f9d1ce9ca3',
'json' => [
'card_template_id' => '87789b2f25177433bcbf407e8e471f95',
'objective_completion_records' => [[
'objective_completion_serial_no' => '578354545',
'objective_id' => '123456',
'completion_time' => '2015-05-20T13:29:35.120+08:00',
'completion_type' => 'INCREASE',
'description' => '购买商品',
'completion_count' => 1,
'remark' => '特价商品',
],],
'reward_usage_records' => [[
'reward_usage_serial_no' => '578354',
'reward_id' => '123456',
'usage_time' => '2015-05-20T13:29:35.120+08:00',
'usage_type' => 'INCREASE',
'description' => '购买商品',
'usage_count' => 1,
'amount' => 100,
'remark' => '特价商品',
],],
],
]);
print_r($response->getStatusCode() === 204);
返回字典 | 类型 | 描述 |
---|---|---|
空字符串(无返回内容) |
参阅 官方文档