本文整理汇总了PHP中Card::get_card方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::get_card方法的具体用法?PHP Card::get_card怎么用?PHP Card::get_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::get_card方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
if (empty($da)) {
continue;
}
$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());
示例2: DateInfo
/**
* 创建卡券
* @param $merchant_type : 券类型 *[必填]
* @param $base_info : 基本的卡券字段数据 *[必填]
* @param $extra_data :不同类型卡券特有的字段 *[必填]
* @param $custom_cells:自定义cell
* $custom_cells = array(
* "custom_url_name"=>"xxxxx", //使用场景 【最多5个汉字】
* "custom_url"=>"http://www.xxx.com", //使用场景链接
* "custom_url_sub_title"=>"xxxxxx", //使用场景提示语 【最多6个汉字】
* "promotion_url_name"=>"xxxxx", //营销场景 【最多5个汉字】
* "promotion_url"=>"http://www.xxx.com", //营销场景链接
* "promotion_url_sub_title"=>"xxxxxx" //营销场景提示语 【最多6个汉字】
* );
* 其他参数均为基本卡券字段中的选填项 [非必填]
* @return array
*/
function card_create($merchant_type, $base_data, $extra_data, $location_id_list = "", $sub_title = "", $use_limit = "", $get_limit = "", $url_name_type = "", $custom_cells = false, $source = "", $can_share = true, $can_give_friend = true, $use_custom_code = false, $bind_openid = false)
{
//exit();
$card_type = $this->get_card_type($merchant_type);
//有效期
$date_info = new DateInfo($base_data["date_info"]["type"], $base_data["date_info"]["arg0"], $base_data["date_info"]["arg1"]);
//库存
$sku = new Sku($base_data["sku"]);
//颜色转换
$colorname = "Color010";
$colorinfo = $this->card_getcolors();
foreach ($colorinfo["colors"] as $color) {
if ($color["value"] == $base_data["color"]) {
$colorname = $color["name"];
break;
}
}
//必填基础字段
$code_type = $this->get_code_type($base_data["code_type"]);
$base_info = new BaseInfo($base_data["logo_url"], $base_data["brand_name"], $code_type, $base_data["title"], $colorname, $base_data["notice"], $base_data["service_phone"], $base_data["description"], $date_info, $sku);
$card = new Card($card_type, $base_info);
//选填字段
$base_info->set_location_id_list($location_id_list);
$base_info->set_sub_title($sub_title);
$base_info->set_use_limit($use_limit);
$base_info->set_get_limit($get_limit);
$base_info->set_use_custom_code($use_custom_code);
$base_info->set_bind_openid($bind_openid);
$base_info->set_can_share($can_share);
$base_info->set_can_give_friend($can_give_friend);
$base_info->set_url_name_type($url_name_type);
$base_info->set_source($source);
//自定义cell
if (is_array($custom_cells)) {
$base_info->set_custom_url_name($custom_cells["custom_url_name"]);
$base_info->set_custom_url($custom_cells["custom_url"]);
$base_info->set_custom_url_sub_title($custom_cells["custom_url_sub_title"]);
$base_info->set_promotion_url_name($custom_cells["promotion_url_name"]);
$base_info->set_promotion_url($custom_cells["promotion_url"]);
$base_info->set_promotion_url_sub_title($custom_cells["promotion_url_sub_title"]);
}
//根据卡券类型设置卡券数据
switch ($card_type) {
case $this->CARD_TYPE[0]:
//通用卡
if (!isset($extra_data["default_detail"])) {
exit("default_detail must be set!");
}
$card->get_card()->set_default_detail($extra_data["default_detail"]);
//必填
break;
case $this->CARD_TYPE[1]:
//团购卡
if (!isset($extra_data["deal_detail"])) {
exit("deal_detail must be set!");
}
$card->get_card()->set_deal_detail($extra_data["deal_detail"]);
//必填
break;
case $this->CARD_TYPE[2]:
//折扣卡
if (!isset($extra_data["discount"])) {
exit("discount must be set!");
}
$card->get_card()->set_discount($extra_data["discount"]);
//必填
break;
case $this->CARD_TYPE[3]:
//礼品卡
if (!isset($extra_data["gift"])) {
exit("gift must be set!");
}
$card->get_card()->set_gift($extra_data["gift"]);
//必填
break;
case $this->CARD_TYPE[4]:
//代金券
if (isset($extra_data["least_cost"])) {
$card->get_card()->set_least_cost($extra_data["least_cost"]);
}
if (!isset($extra_data["reduce_cost"])) {
exit("reduce_cost must be set!");
}
//.........这里部分代码省略.........
示例3: createCard
public function createCard($id, $is_edit = 0)
{
$info = M('Member_card_coupon')->where('id=' . $id)->find();
if ($info['company_id'] == 0) {
$company = M('Company')->where('token="' . $info['token'] . '" AND location_id!=0')->order('isbranch ASC')->select();
} else {
$company = M('Company')->where('token="' . $info['token'] . '" AND id=' . $info['company_id'])->select();
}
if (empty($company)) {
return array('errcode' => '-1', 'errmsg' => '商家门店未导入');
exit;
}
$logo_url = $this->getLogoUrl($info['logourl'], $id);
$location_id_list = array();
foreach ($company as $key => $value) {
if ($value['location_id']) {
$location_id_list[] = $value['location_id'];
}
}
switch ($info['type']) {
case '0':
$card_type = 'CASH';
$coupon_type = 2;
break;
case '1':
$card_type = 'GENERAL_COUPON';
$coupon_type = 1;
break;
case '2':
$card_type = 'GIFT';
$coupon_type = 3;
break;
default:
$card_type = 'GENERAL_COUPON';
break;
}
$base_info = new BaseInfo($logo_url['url'], $company[0]['name'], 0, $info['title'], $info['color'], '使用时向店员员出示此券', $company[0]['tel'], $info['info'], new DateInfo(1, intval($info['statdate']), intval($info['enddate'])), new Sku($info['total']));
$base_info->set_sub_title('');
$base_info->set_use_limit(1);
$base_info->set_get_limit(intval($info['people']));
$base_info->set_use_custom_code(false);
$base_info->set_bind_openid(false);
$base_info->set_can_share(false);
$base_info->set_can_give_friend(false);
$base_info->set_location_id_list($location_id_list);
$base_info->set_url_name_type(1);
$base_info->set_custom_url_name('立即使用');
$base_info->set_custom_url(U('Wap/Card/consume', array('token' => $info['token'], 'cardid' => $info['cardid'], 'from' => 'weixin'), '', '', true));
$card = new Card($card_type, $base_info);
switch ($info['type']) {
case '0':
$card->get_card()->set_least_cost($info['least_cost'] * 100);
$card->get_card()->set_reduce_cost($info['reduce_cost'] * 100);
break;
case '1':
$card->get_card()->set_default_detail($company[0]['intro']);
break;
case '2':
$card->get_card()->set_gift($info['gift_name']);
break;
default:
$card->get_card()->set_default_detail($company[0]['intro']);
break;
}
$post_data = $card->toJson();
$url = 'https://api.weixin.qq.com/card/create?access_token=' . $this->access_token;
$res = $this->https_request($url, $post_data);
return $res;
}
示例4: sort
array_push($this->data, (string) $str);
}
function get_signature()
{
sort($this->data, SORT_STRING);
return sha1(implode($this->data));
}
}
//------------------------set base_info-----------------------------
$base_info = new BaseInfo("http://www.supadmin.cn/uploads/allimg/120216/1_120216214725_1.jpg", "海底捞", 0, "132元双人火锅套餐", "Color010", "使用时向服务员出示此券", "020-88888888", "不可与其他优惠同享\n 如需团购券发票,请在消费时向商户提出\n 店内均可使用,仅限堂食\n 餐前不可打包,餐后未吃完,可打包\n 本团购券不限人数,建议2人使用,超过建议人数须另收酱料费5元/位\n 本单谢绝自带酒水饮料", new DateInfo(1, 1397577600, 1399910400), new Sku(50000000));
$base_info->set_sub_title("");
$base_info->set_use_limit(1);
$base_info->set_get_limit(3);
$base_info->set_use_custom_code(false);
$base_info->set_bind_openid(false);
$base_info->set_can_share(true);
$base_info->set_url_name_type(1);
$base_info->set_custom_url("http://www.qq.com");
//---------------------------set_card--------------------------------
$card = new Card("GROUPON", $base_info);
$card->get_card()->set_deal_detail("以下锅底2 选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可选):\n 大锅1 份12 元\n 小锅2 份16 元\n 以下菜品2 选1\n 特级肥牛1 份30 元\n 洞庭鮰鱼卷1 份20元\n 其他\n鲜菇猪肉滑1 份18 元\n 金针菇1 份16 元\n 黑木耳1 份9 元\n 娃娃菜1 份8 元\n 冬瓜1份6 元\n 火锅面2 个6 元\n 欢乐畅饮2 位12 元\n 自助酱料2 位10 元");
//--------------------------to json--------------------------------
echo $card->toJson();
//----------------------check signature------------------------
$signature = new Signature();
$signature->add_data("875e5cc094b78f230b0588c2a5f3c49f");
$signature->add_data("wx57bf46878716c27e");
$signature->add_data("213168808");
$signature->add_data("12345");
$signature->add_data("55555");
echo $signature->get_signature();