Home > Mobile >  About WeChat card voucher developing some of the problems
About WeChat card voucher developing some of the problems

Time:10-20

I am such a design: defines two methods, in the background create_card () - the user to create card voucher, return to create id card vouchers, send_card JSSDK delivery to receive card voucher () - users, in send_card create_card () call () to obtain id card vouchers
 
The function create_card ()
{
.
Return $card_id;
}
The function send_card ()
{
.
$this - & gt; Create_card ();
Return array (
'url=& gt; $url,
'jsapi_ticket=& gt; $jsapi_ticket,
'timestamp=& gt; $timestamp,
'nonceStr=& gt; $noncestr,
'signature'=& gt; $signature,
'sign_card=& gt; $sign_card,
'card_id=& gt; $cardId,
'api_ticket=& gt; $api_ticket
);
}

In front of js: first, a post request after the page loads create_card, then injected into the wx. Config, then through the button click event execute wx. AddCard
 
The $(document). Ready (function () {
$.post (' create_card ', 'url: the url', function (res) {
Wx. Config ({
.
JsApiList: [
'addCard', 'scanQRCode'
]
})

})
})

Also normal card voucher can generate, receive, to receive only one there is no problem, but I wanted to put the receive operation on a lottery page, users can draw many times to receive CARDS vouchers, so the question becomes, the second received display card stamps when I was already received, only to reload a page, which is executed again next send_card to receive many times, and if the id card vouchers cached also not line, must be regenerated, so don't want to recreate the card every time stamps? Bosses advice please,,,

CodePudding user response:

My answer,,, I put the create the interface card vouchers in winning and then click the get executed, then put the config injection is also in the click event, so you won't have to refresh the page every time,,, but the new problem appeared again, each coupon if start-up JianKa when put on the card, the newly created card voucher immediately launch from time to time will be not approved, if the cached in advance, then how to deal with card coupons valid?
  • Related