$itemid = $_GET[‘num_iid’];
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new TbkItemInfoGetRequest;
$req->setFields(“num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick”);
$req->setPlatform(“1”);
r
e
q
−
>
s
e
t
N
u
m
I
i
d
s
(
"
"
.
req->setNumIids("".
req−>setNumIids("".itemid."");
$resp =
c
−
>
e
x
e
c
u
t
e
(
c->execute(
c−>execute(req);
r
e
s
p
=
j
s
o
n
d
e
c
o
d
e
(
j
s
o
n
e
n
c
o
d
e
(
resp =json_decode(json_encode(
resp=jsondecode(jsonencode(resp), true);
$detail = $resp[‘results’][‘n_tbk_item’];
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new TbkCouponGetRequest;
r
e
q
−
>
s
e
t
M
e
(
"
"
.
req->setMe("".
req−>setMe(""._GET[‘e’]."");
$resp =
c
−
>
e
x
e
c
u
t
e
(
c->execute(
c−>execute(req);
r
e
s
p
=
j
s
o
n
d
e
c
o
d
e
(
j
s
o
n
e
n
c
o
d
e
(
resp =json_decode(json_encode(
resp=jsondecode(jsonencode(resp), true);
$quan = $resp[‘data’];
if($_G[‘charset’] !== ‘utf-8’){
o
t
h
e
r
=
a
u
t
o
c
h
a
r
s
e
t
(
other = auto_charset(
other=autocharset(other);
d
e
t
a
i
l
=
a
u
t
o
c
h
a
r
s
e
t
(
detail = auto_charset(
detail=autocharset(detail);
}
$detail = $detail[‘0’];
$src = ‘source/plugin/zhuzhu_taobao/static/image/’;
$font = “source/plugin/zhuzhu_taobao/static/font/fzltcxhjw.ttf”;
$arial = “source/plugin/zhuzhu_taobao/static/font/arialbd.ttf”;
$title = $detail[‘title’];
$quan = $quan[‘coupon_amount’];
$value = $detail[‘zk_final_price’];
$price =
v
a
l
u
e
−
value-
value−quan;
if(strlen($quan) == ‘1’){
KaTeX parse error: Double superscript at position 11: quan = ' '̲.quan;
}elseif(strlen($quan) == ‘2’){
KaTeX parse error: Double superscript at position 10: quan = ' '̲.quan;
}
if(substr($detail[‘pict_url’], 0, 5) == ‘https’) {
g
o
o
d
s
=
′
h
t
t
p
′
.
l
t
r
i
m
(
goods = 'http'.ltrim(
goods=′http′.ltrim(detail[‘pict_url’], ‘https’);
} else {
$goods = $detail[‘pict_url’];
}
require_once libfile(‘function/code’, ‘plugin/zhuzhu_taobao’);
$url =
G
[
′
s
i
t
e
u
r
l
′
]
.
"
/
p
l
u
g
i
n
.
p
h
p
?
i
d
=
z
h
u
z
h
u
t
a
o
b
a
o
_G['siteurl']."/plugin.php?id=zhuzhu_taobao%26mod=jump_url%26num_iid=".
G[′siteurl′]."/plugin.php?id=zhuzhutaobaoitemid."%26e=".str_replace(" “,”+", $_GET[‘e’]);
KaTeX parse error: Expected 'EOF', got '&' at position 65: …php?format=json&̲url=".url);
s
h
o
r
t
u
r
l
=
j
s
o
n
d
e
c
o
d
e
(
short_url = json_decode(
shorturl=jsondecode(short_url,true);
$short_url = $short_url[‘url’];
$filename = ‘source/plugin/zhuzhu_taobao/static/QRcode.png’;
Q
R
=
Q
R
c
o
d
e
:
:
p
n
g
(
QR = QRcode::png(
QR=QRcode::png(short_url,$filename,‘L’, ‘7.3’, ‘0’);
g
o
o
d
s
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
j
p
e
g
(
goods = imagecreatefromjpeg(
goods=imagecreatefromjpeg(goods);
q
c
o
d
e
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
p
n
g
(
qcode = imagecreatefrompng(
qcode=imagecreatefrompng(filename);
q
i
m
g
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
j
p
e
g
(
q_img = imagecreatefromjpeg(
qimg=imagecreatefromjpeg(src.“img_quan.jpg”);
q
k
u
a
n
g
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
j
p
e
g
(
q_kuang = imagecreatefromjpeg(
qkuang=imagecreatefromjpeg(src.“img_kuang.jpg”);
q
s
h
e
n
g
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
j
p
e
g
(
q_sheng = imagecreatefromjpeg(
qsheng=imagecreatefromjpeg(src.“img_sheng.jpg”);
if($_G[‘charset’] !== ‘utf-8’){
t
i
t
l
e
=
d
i
c
o
n
v
(
title = diconv(
title=diconv(title, “GB2312”, “UTF-8”);
}
$title = autowrap(12, 0, $font, $title, 250);
$detail = imagecreatetruecolor(820, 1100);
c
o
l
o
r
=
i
m
a
g
e
c
o
l
o
r
A
l
l
o
c
a
t
e
(
color = imagecolorAllocate(
color=imagecolorAllocate(detail,255,255,255);
imagefill(
d
e
t
a
i
l
,
0
,
0
,
detail ,0 ,0 ,
detail,0,0,color);
b
l
a
c
k
=
i
m
a
g
e
c
o
l
o
r
a
l
l
o
c
a
t
e
(
black = imagecolorallocate(
black=imagecolorallocate(detail, 0, 0, 0);
w
h
i
t
e
=
i
m
a
g
e
c
o
l
o
r
a
l
l
o
c
a
t
e
(
white = imagecolorallocate(
white=imagecolorallocate(detail, 255,255,255);
imagettftext($detail, 24, 0, 20, 870, $black, $font, t i t l e ) ; i m a g e c o p y m e r g e ( title); imagecopymerge( title);imagecopymerge(detail, g o o d s , 10 , 10 , 0 , 0 , 800 , 800 , 100 ) ; i m a g e c o p y m e r g e ( goods, 10, 10, 0, 0, 800, 800, 100); imagecopymerge( goods,10,10,0,0,800,800,100);imagecopymerge(detail, q s h e n g , 40 , 960 , 0 , 0 , 450 , 120 , 100 ) ; i m a g e t t f t e x t ( q_sheng, 40, 960, 0, 0, 450, 120, 100); imagettftext( qsheng,40,960,0,0,450,120,100);imagettftext(detail, 44, 0, 285, 1028, $white, $arial, p r i c e ) ; i m a g e t t f t e x t ( price); imagettftext( price);imagettftext(detail, 28, 0, 108, 1045, $white, $arial, q u a n ) ; i m a g e t t f t e x t ( quan); imagettftext( quan);imagettftext(detail, 25, 0, 295, 1063, imagecolorallocate($detail, 255,255,255), $font, v a l u e ) ; i m a g e t t f t e x t ( value); imagettftext( value);imagettftext(detail, 25, 0, 296, 1063, imagecolorallocate($detail, 255,255,255), $font, v a l u e ) ; i m a g e c o p y m e r g e ( value); imagecopymerge( value);imagecopymerge(detail, q k u a n g , 580 , 840 , 0 , 0 , 210 , 260 , 100 ) ; i m a g e c o p y m e r g e ( q_kuang, 580, 840, 0, 0, 210, 260, 100); imagecopymerge( qkuang,580,840,0,0,210,260,100);imagecopymerge(detail, $qcode, 594, 854, 0, 0, 182, 182, 100);
header(“Content-type: image/jpeg”);
imagejpeg($detail);