Exemple #1
0
     }
     $arr = explode('=', $da);
     $post[$arr[0]] = trim($arr[1]);
 }
 $out['errno'] = 1;
 $out['error'] = '';
 $post['logo_url'] = empty($post['logo_url']) ? $setting['logourl'] : trim($post['logo_url']);
 $base = new Card('GENERAL_COUPON', $post);
 if (is_error($base->general_coupon->base_info)) {
     $out['errno'] = 0;
     $out['error'] = $base->general_coupon->base_info['message'];
     exit(json_encode($out));
 }
 $base->get_card()->set_default_detail(urlencode(trim($post['default_detail'])));
 $acc = new coupon($acid);
 $status = $acc->CreateCard($base->toJson());
 if (is_error($status)) {
     $out['errno'] = 0;
     $out['error'] = $status['message'];
     exit(json_encode($out));
 }
 $post['card_id'] = $status['card_id'];
 $post['date_info'] = array('time_type' => $post['time_type'], 'time_limit_start' => $post['time_limit[start]'], 'time_limit_end' => $post['time_limit[end]'], 'deadline' => $post['deadline'], 'limit' => $post['limit']);
 $post['date_info'] = iserializer($post['date_info']);
 if (!empty($post['location-select'])) {
     $location = explode('-', $post['location-select']);
     $post['location_id_list'] = iserializer($location);
 } else {
     $post['location_id_list'] = iserializer(array());
 }
 $post['uniacid'] = $_W['uniacid'];
Exemple #2
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('module', 'coupon', 'location', 'discount', 'display', 'del', 'sync', 'modifystock', 'toggle', 'qr', 'record', 'cash', 'gift', 'groupon', 'general_coupon');
$do = in_array($do, $dos) ? $do : 'post';
$op = trim($_GPC['op']) ? trim($_GPC['op']) : 'post';
$acid = intval($_W['acid']);
load()->classs('coupon');
if ($do == 'post') {
    $data = array('card' => array('card_type' => 'MEMBER_CARD', 'member_card' => array('base_info' => array('logo_url' => urlencode('http://mmbiz.qpic.cn/mmbiz/qYicJhgpqsd37NCqJIqia4KF9o4fmq7NTgnQMd5vBSwn2ibBRQ4wCLr47ohUI6xicWUc7ibxoyJDubnNs3mxnfSXy2g/0'), 'brand_name' => urlencode('商家信息'), 'color' => 'Color080', 'title' => urlencode('折扣券标题'), 'sub_title' => urlencode('折扣券标题'), 'can_share' => true, 'can_give_friend' => true, 'code_type' => 'CODE_TYPE_TEXT', 'notice' => urlencode('操作提示操作提示'), 'description' => urlencode('使用须知使用须知'), 'service_phone' => urlencode('1000000'), 'get_limit' => 100, 'date_info' => array('type' => 'DATE_TYPE_FIX_TIME_RANGE', 'begin_timestamp' => '1439136000', 'end_timestamp' => '1444838400'), 'sku' => array('quantity' => 10000), 'custom_url_name' => urlencode('立即使用'), 'custom_url' => urlencode('http://bbs.012wz.com'), 'custom_url_sub_title' => urlencode('6个汉字tips'), 'promotion_url_name' => urlencode('营销入口1'), 'promotion_url' => urlencode('http://www.012wz.com')), 'supply_bonus' => true, 'supply_balance' => false, 'prerogative' => urlencode('会员卡特权说明'), 'custom_field1' => array('name_type' => 'FIELD_NAME_TYPE_LEVEL', 'url' => urlencode('http://www.012wz.com')), 'activate_url' => urlencode('http://bbs.012wz.com'), 'custom_cell1' => array('name' => urlencode('使用入口2'), 'tips' => urlencode('激活后显示'), 'url' => urlencode('http://bbs.012wz.com')))));
    $acc = new coupon($acid);
    $status = $acc->CreateCard(urldecode(json_encode($data)));
    print_r($status);
}
if ($do == 'update') {
    $data = array('init_bonus' => 100, 'init_balance' => 200, 'membership_number' => 12345678, 'code' => '', 'card_id' => 'pTKzFjtDm_SKwh2vbiLwD2cGO0Ik ', 'custom_field_value1' => '白金会员组');
}