本文整理汇总了PHP中JSSDK::getCardExtPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP JSSDK::getCardExtPackage方法的具体用法?PHP JSSDK::getCardExtPackage怎么用?PHP JSSDK::getCardExtPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSSDK
的用法示例。
在下文中一共展示了JSSDK::getCardExtPackage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
function exchange_online()
{
if (!isWeixinBrowser()) {
$this->error("很遗憾,该页面仅支持微信客户端!");
}
$agent = $_SERVER["HTTP_USER_AGENT"];
$version = (int) substr($agent, strpos($agent, "icroMessenger") + strlen("icroMessenger") + 1, 1);
if ($version < 6) {
//微信版本判断
$this->error("您的微信版本低于6.0,不支持微信卡券功能!");
}
//获取个人中奖信息
$target_id = I('id');
$openId = get_openid();
$token = get_token();
$userInfo = getWeixinUserInfo($openId, $token);
$this->assign('userInfo', $userInfo);
$map['id'] = $target_id;
$Scartch = M('Scratch')->field('use_tips')->where($map)->find();
$this->assign('Scratch', $Scartch);
unset($map);
$map['openid'] = $openId;
$map['token'] = $token;
$map['target_id'] = $target_id;
$map['prize_id'] = array('gt', 0);
$my_prizes = M('sn_code')->where($map)->order('prize_id')->select();
unset($map);
$map['addon'] = 'Scratch';
$map['target_id'] = $target_id;
$prizes = M('prize')->where($map)->order('sort asc')->select();
$my_prizes_sortbyid = array();
foreach ($prizes as $value) {
$my_prizes_sortbyid[$value['id']] = $value;
}
//dump($my_prizes_sortbyid);exit();
vendor('jssdk');
$jssdk = new \JSSDK();
$signPackage = $jssdk->GetSignPackage();
//dump($signPackage);exit();
$this->assign('signPackage', $signPackage);
foreach ($my_prizes as $value) {
//card_id
$value['card_id'] = $my_prizes_sortbyid[$value['prize_id']]['card_id'];
$cardExtPackage = $jssdk->getCardExtPackage($value['card_id']);
$value['cardExtPackage'] = $cardExtPackage;
$my_prizes_sortbyid[$value['prize_id']]['prizes'][] = $value;
}
//dump($my_prizes_sortbyid);exit();
$this->assign('my_prizes', $my_prizes_sortbyid);
//获取对应图片资源
$model_id = 175;
unset($map);
$map['target_id'] = $target_id;
$map['token'] = $token;
$img_res = M(get_table_name($model_id))->where($map)->find();
$this->assign('img_res', $img_res);
$this->display();
}