Skip to content

增加用户记录

当用户在商户侧消费时,用户完成了微信先享卡的目标或者获取使用优惠时,商户需要把这个信息同步给微信先享卡平台,用于在微信先享卡小程序展示及先享卡到期后的用户结算。

请求参数类型描述
out_card_codestring商户领卡号
jsonobject声明请求的JSON数据结构
card_template_idstring卡模板ID
objective_completion_recordsobject[]目标完成记录
objective_completion_serial_nostring目标完成流水号
objective_idstring目标ID
completion_timestring目标完成时间
completion_typestring目标完成类型
descriptionstring目标完成描述
completion_countinteger目标完成数量
remarkstring备注说明
reward_usage_recordsobject[]优惠使用记录
reward_usage_serial_nostring优惠使用记录流水号
reward_idstring优惠ID
usage_timestring优惠使用时间
usage_typestring优惠使用类型
descriptionstring优惠使用描述
usage_countinteger数量
amountinteger金额
remarkstring备注说明
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);
返回字典类型描述
空字符串(无返回内容)

参阅 官方文档

Published on the GitHub by TheNorthMemory