Home php教程 php手册 微信卡卷测试代码

微信卡卷测试代码

Jun 07, 2016 am 11:37 AM

微信卡卷测试代码
创建卡卷:public function createcard(){//新建卡卷<br>     $appid=C('APPID');<br>          $appsecret=C('SCRETID');<br>         $asstonek = $this->get_token($appid,$appsecret);<br>         $url = "https://api.weixin.qq.com/card/create?access_token=".$asstonek;<br>         $pjson ='{ "card": {<br> "card_type": "GROUPON",<br> "groupon": {<br> "base_info": {<br> "logo_url":<br> "http://mmbiz.qpic.cn/mmbiz/ibkgH5qOticpLRCYTKmibPW028nOv2YYg42UsK8MWV5fVLRUUTrNyrg3nJgxThaP9tNg1JZXHk88FdLqxmmNq4CHg/0?wx_fmt=jpeg",<br> "brand_name":"海底捞123",<br> "code_type":" CODE_TYPE_TEXT ",<br> "title": "132 元双人火锅套餐",<br> "sub_title": "",<br> "color": "Color010",<br> "notice": "使用时向服务员出示此券",<br> "service_phone": "020-88888888",<br> "description": "不可与其他优惠同享\n 如需团购券发票, 请在消费时向商户提出\n 店内均可<br> 使用,仅限堂食\n 餐前不可打包,餐后未吃完,可打包\n 本团购券不限人数,建议 2 人使用,超过建议人<br> 数须另收酱料费 5 元/位\n 本单谢绝自带酒水饮料",<br> "date_info": {<br> "type": 2,<br> "fixed_term": 30,<br> "fixed_begin_term": 0<br> },<br> "sku": {<br> "quantity": 500000<br> },<br> "get_limit": 3,<br> "use_custom_code": false,<br> "bind_openid": false,<br> "can_share": true,<br> "can_give_friend": true,<br> "location_id_list" : [123, 12321, 345345],<br> "custom_url_name": "立即使用",<br> "custom_url": "http://www.qq.com",<br> "custom_url_sub_title": "6 个汉字 tips",<br> "promotion_url_name": "更多优惠",<br> "promotion_url": "http://www.qq.com",<br> "source": "大众点评"<br> },<br> "deal_detail": "以下锅底 2 选 1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可<br> 选):\n 大锅 1 份 12 元\n 小锅 2 份 16 元\n 以下菜品 2 选 1\n 特级肥牛 1 份 30 元\n 洞庭鮰鱼卷 1 份<br> 20 元\n 其他\n 鲜菇猪肉滑 1 份 18 元\n 金针菇 1 份 16 元\n 黑木耳 1 份 9 元\n 娃娃菜 1 份 8 元\n 冬<br> 瓜 1 份 6 元\n 火锅面 2 个 6 元\n 欢乐畅饮 2 位 12 元\n 自助酱料 2 位 10 元"}<br> }<br> }';<br>  <br>  <br> $re3 = $this->curlp($url,$pjson);<br>         $re3arr = json_decode($re3,true);<br>         dump($re3arr);<br>      <br>     }卡卷领取测试:(二维码)public function tcard(){//卡卷测试<br>     header ( "Content-Type: text/html; charset=UTF-8" );<br>      <br>      <br>         $appid=C('APPID');<br>          $appsecret=C('SCRETID');<br>         $asstonek = $this->get_token($appid,$appsecret);     <br>         $ticket = $this->get_card_ticket($asstonek);<br>         dump($asstonek);<br>         dump($ticket);<br>          <br>          <br>         /*  获取卡卷列表<br>         $url = "https://api.weixin.qq.com/card/batchget?access_token=".$asstonek;<br>         $jsondata = '{"offset":0,"count":10}';<br>         $re = $this->curlp($url,$jsondata);<br>         dump($re);<br>         */<br>          <br>         //  获取卡卷详情<br>         $url3 = "https://api.weixin.qq.com/card/get?access_token=".$asstonek;<br>         $getcardinfo = '{<br> "card_id":"pYKCus2uC2fwIf3STA-agJ_XhqfI"<br> }';<br>  <br>     $re3 = $this->curlp($url3,$getcardinfo);<br>         $re3arr = json_decode($re3,true);<br>         dump($re3arr);<br>         //  status =  CARD_STATUS_VERIFY_OK  卡卷审核通过<br>         //  获取卡卷详情<br>          <br>          <br>         $fcardjson = '{<br> "action_name": "QR_CARD",<br> "action_info": {<br> "card": {<br> "card_id": "pYKCus2uC2fwIf3STA-agJ_XhqfI",<br> "is_unique_code": false ,<br> }<br> }<br> }';<br>  <br> $url2 = "https://api.weixin.qq.com/card/qrcode/create?access_token=".$asstonek;<br> $re2 = $this->curlp($url2,$fcardjson);<br> $re2arr = json_decode($re2,true);<br> $ewmticket = $re2arr['ticket'];<br> if($re2arr['errmsg']!='ok') exit($re2arr['errmsg']);<br> dump($re2arr);<br> echo '<img src="/static/imghw/default1.png" data-src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='.$ewmticket.'" class="lazy" alt="微信卡卷测试代码" >';<br>          <br>          <br>          <br>     }卡卷投放(领取):html5 js apipublic function get_h5_card($data=array()){<br>     $appid=$this->appid;<br>     $appsecret=$this->appsecret;<br>     $asstonek = $this->get_token($appid,$appsecret);     <br>     $ticket = $this->get_card_ticket($asstonek);<br>     $data['api_ticket']=$ticket;<br>     $data['timestamp']=time();<br>     $data['signature'] = self::getSign($data);  <br>     //echo $ticket;<br>     $data2['card_id']=$data['card_id'];<br>     unset($data['api_ticket']);<br>     unset($data['card_id']);<br>     $data2['card_ext']=json_encode($data);<br>     return $data2;<br>     dump($data);<br> }   <br>      <br>  <br> public function tcard1(){//html5 js api 卡卷投放<br>         $card = new \Org\Util\Card('wx37445*******3ae8','6854f901**********4f9a3');<br>         $cardid = 'pYKCus4Tmp_sBh6eiqfG-hN_ySzc';<br>         $data['card_id']=$cardid;<br>         $data['code']='';<br>         $data['openid']='';<br>         $data2 = $card->get_h5_card($data);<br>         $this->assign('carddata',json_encode($data2));<br>         //dump(($data2));<br>         $this->siteDisplay ( 'card' );已封装成类,可随意调用。需要完整代码请联系关注以下公众号联系:

微信卡卷测试代码

另外还有微信红包代码封装成类,可直接调用。需要请联系上面微信号

原文地址: http://shanmao.me/weixin/wei-xin-ka-juan-ce-shi-dai-ma

AD:真正免费,域名+虚机+企业邮箱=0元

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
Go language programming examples: code examples in web development Go language programming examples: code examples in web development Mar 04, 2024 pm 04:54 PM

"Go Language Programming Examples: Code Examples in Web Development" With the rapid development of the Internet, Web development has become an indispensable part of various industries. As a programming language with powerful functions and superior performance, Go language is increasingly favored by developers in web development. This article will introduce how to use Go language for Web development through specific code examples, so that readers can better understand and use Go language to build their own Web applications. 1. Simple HTTP Server First, let’s start with a

Learn about introductory code examples for Python programming Learn about introductory code examples for Python programming Jan 04, 2024 am 10:50 AM

Learn about Python programming with introductory code examples Python is an easy-to-learn, yet powerful programming language. For beginners, it is very important to understand the introductory code examples of Python programming. This article will provide you with some concrete code examples to help you get started quickly. Print HelloWorldprint("HelloWorld") This is the simplest code example in Python. The print() function is used to output the specified content

PHP variables in action: 10 real-life examples of use PHP variables in action: 10 real-life examples of use Feb 19, 2024 pm 03:00 PM

PHP variables store values ​​during program runtime and are crucial for building dynamic and interactive WEB applications. This article takes an in-depth look at PHP variables and shows them in action with 10 real-life examples. 1. Store user input $username=$_POST["username"];$passWord=$_POST["password"]; This example extracts the username and password from the form submission and stores them in variables for further processing. 2. Set the configuration value $database_host="localhost";$database_username="username";$database_pa

Huawei Cloud Edge Computing Interconnection Guide: Java code examples to quickly implement interfaces Huawei Cloud Edge Computing Interconnection Guide: Java code examples to quickly implement interfaces Jul 05, 2023 pm 09:57 PM

Huawei Cloud Edge Computing Interconnection Guide: Java Code Samples to Quickly Implement Interfaces With the rapid development of IoT technology and the rise of edge computing, more and more enterprises are beginning to pay attention to the application of edge computing. Huawei Cloud provides edge computing services, providing enterprises with highly reliable computing resources and a convenient development environment, making edge computing applications easier to implement. This article will introduce how to quickly implement the Huawei Cloud edge computing interface through Java code. First, we need to prepare the development environment. Make sure you have the Java Development Kit installed (

Java implements simple bubble sort code Java implements simple bubble sort code Jan 30, 2024 am 09:34 AM

The simplest code example of Java bubble sort Bubble sort is a common sorting algorithm. Its basic idea is to gradually adjust the sequence to be sorted into an ordered sequence through the comparison and exchange of adjacent elements. Here is a simple Java code example that demonstrates how to implement bubble sort: publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){int

How to use PHP to write inventory management function code in the inventory management system How to use PHP to write inventory management function code in the inventory management system Aug 06, 2023 pm 04:49 PM

How to use PHP to write the inventory management function code in the inventory management system. Inventory management is an indispensable part of many enterprises. For companies with multiple warehouses, the inventory management function is particularly important. By properly managing and tracking inventory, companies can allocate inventory between different warehouses, optimize operating costs, and improve collaboration efficiency. This article will introduce how to use PHP to write code for inventory warehouse management functions, and provide you with relevant code examples. 1. Establish the database before starting to write the code for the inventory warehouse management function.

From beginner to proficient: Code implementation of commonly used data structures in Go language From beginner to proficient: Code implementation of commonly used data structures in Go language Mar 04, 2024 pm 03:09 PM

Title: From Beginner to Mastery: Code Implementation of Commonly Used Data Structures in Go Language Data structures play a vital role in programming and are the basis of programming. In the Go language, there are many commonly used data structures, and mastering the implementation of these data structures is crucial to becoming a good programmer. This article will introduce the commonly used data structures in the Go language and give corresponding code examples to help readers from getting started to becoming proficient in these data structures. 1. Array Array is a basic data structure, a group of the same type

Guidance and Examples: Learn to implement the selection sort algorithm in Java Guidance and Examples: Learn to implement the selection sort algorithm in Java Feb 18, 2024 am 10:52 AM

Java Selection Sorting Method Code Writing Guide and Examples Selection sorting is a simple and intuitive sorting algorithm. The idea is to select the smallest (or largest) element from the unsorted elements each time and exchange it until all elements are sorted. This article will provide a code writing guide for selection sorting, and attach specific Java sample code. Algorithm Principle The basic principle of selection sort is to divide the array to be sorted into two parts, sorted and unsorted. Each time, the smallest (or largest) element is selected from the unsorted part and placed at the end of the sorted part. Repeat the above

See all articles