Poster.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\seckill\model;
  11. use addon\postertemplate\model\PosterTemplate as PosterTemplateModel;
  12. use app\model\BaseModel;
  13. use app\model\system\Site;
  14. use app\model\upload\Upload;
  15. use app\model\web\Config;
  16. use extend\Poster as PosterExtend;
  17. /**
  18. * 海报生成类
  19. */
  20. class Poster extends BaseModel
  21. {
  22. /**
  23. * 商品海报
  24. */
  25. public function goods($app_type, $page, $qrcode_param, $promotion_type, $site_id)
  26. {
  27. try {
  28. $goods_info = $this->getGoodsInfo($qrcode_param[ 'id' ]);
  29. if (empty($goods_info)) return $this->error('未获取到商品信息');
  30. $qrcode_param[ 'id' ] = $qrcode_param[ 'seckillId' ];
  31. unset($qrcode_param[ 'seckillId' ]);
  32. $qrcode_info = $this->getGoodsQrcode($app_type, $page, $qrcode_param, $promotion_type, $site_id);
  33. if ($qrcode_info[ 'code' ] < 0) return $qrcode_info;
  34. //判断海报是否存在或停用
  35. $template_info = $this->getTemplateInfo($goods_info[ 'template_id' ]);
  36. if (!empty($qrcode_param[ 'source_member' ])) {
  37. $member_info = $this->getMemberInfo($qrcode_param[ 'source_member' ]);
  38. }
  39. $upload_config_model = new Config();
  40. $upload_config_result = $upload_config_model->getDefaultImg($site_id);
  41. $site_model = new Site();
  42. $condition = array (
  43. [ "site_id", "=", $site_id ]
  44. );
  45. $site_info = $site_model->getSiteInfo($condition);
  46. if (empty($goods_info[ 'template_id' ]) || empty($template_info) || $template_info[ 'template_status' ] == 0) {
  47. $poster_width = 720;
  48. $poster_height = 1150;
  49. $poster = new PosterExtend($poster_width, $poster_height);
  50. $option = [
  51. [
  52. 'action' => 'setBackground', // 设背景色
  53. 'data' => [255, 255, 255]
  54. ],
  55. [
  56. 'action' => 'imageCopy', // 写入商品图
  57. 'data' => [
  58. explode(',', $goods_info['sku_image'])[0] ?? '',
  59. 50,
  60. 165,
  61. 620,
  62. 620,
  63. 'square',
  64. true,
  65. 1
  66. ]
  67. ],
  68. [
  69. 'action' => 'imageText', // 写入商品名称
  70. 'data' => [
  71. $goods_info['sku_name'],
  72. 22,
  73. [35, 35, 35],
  74. 50,
  75. 915,
  76. 360,
  77. 2,
  78. true,
  79. 1
  80. ]
  81. ],
  82. [
  83. 'action' => 'imageCopy', // 写入商品二维码
  84. 'data' => [
  85. $qrcode_info['data']['path'],
  86. 435,
  87. 825,
  88. 240,
  89. 240,
  90. 'square',
  91. 0,
  92. 1
  93. ]
  94. ],
  95. [
  96. 'action' => 'imageText', // 写入提示
  97. 'data' => [
  98. '长按识别二维码',
  99. 19,
  100. [102, 102, 102],
  101. 465,
  102. 1110,
  103. 490,
  104. 1,
  105. 1,
  106. 1
  107. ]
  108. ],
  109. [
  110. 'action' => 'imageText', // 写入商品价格单位
  111. 'data' => [
  112. '秒杀价:¥',
  113. 22,
  114. [255, 0, 0],
  115. 50,
  116. 860,
  117. 490,
  118. 2,
  119. true,
  120. 1
  121. ]
  122. ],
  123. [
  124. 'action' => 'imageText', // 写入商品价格
  125. 'data' => [
  126. $goods_info['seckill_price'],
  127. 30,
  128. [255, 0, 0],
  129. 188,
  130. 862,
  131. 490,
  132. 2,
  133. true,
  134. 1
  135. ]
  136. ],
  137. ];
  138. if (!empty($member_info)) {
  139. $member_option = [
  140. [
  141. 'action' => 'imageCircularCopy', // 写入用户头像
  142. 'data' => [
  143. !empty($member_info['headimg']) ? $member_info['headimg'] : $upload_config_result[ 'data' ][ 'value' ][ 'head' ],
  144. 50,
  145. 30,
  146. 100,
  147. 100
  148. ]
  149. ],
  150. [
  151. 'action' => 'imageText', // 写入分享人昵称
  152. 'data' => [
  153. $member_info['nickname'],
  154. 22,
  155. [10, 10, 10],
  156. 170,
  157. 80,
  158. 580,
  159. 1,
  160. 1,
  161. 1
  162. ]
  163. ],
  164. [
  165. 'action' => 'imageText', // 写入分享人昵称
  166. 'data' => [
  167. '限时秒杀,抢到就是赚到',
  168. 18,
  169. [102, 102, 102],
  170. 170,
  171. 115,
  172. 580,
  173. 1,
  174. 1,
  175. 1
  176. ]
  177. ]
  178. ];
  179. $option = array_merge($option, $member_option);
  180. }
  181. } else {
  182. $condition = [
  183. [ 'template_id', '=', $goods_info[ 'template_id' ] ],
  184. [ 'site_id', '=', $site_id ]
  185. ];
  186. $poster_template_model = new PosterTemplateModel();
  187. $poster_data = $poster_template_model->getPosterTemplateInfo($condition);
  188. $poster_data[ 'data' ][ 'template_json' ] = json_decode($poster_data[ 'data' ][ 'template_json' ], true);
  189. $poster_width = 720;
  190. $poster_height = 1280;
  191. $poster = new PosterExtend($poster_width, $poster_height);
  192. $fontRate = 0.725; // 20px 等于 14.5磅,换算比率 1px = 0.725磅
  193. if (!empty($poster_data[ 'data' ][ 'background' ])) {
  194. list($width, $height, $type, $attr) = getimagesize(img($poster_data[ 'data' ][ 'background' ]));
  195. $height = 720 * $height / $width;
  196. $back_ground = [
  197. 'action' => 'imageCopy', // 写入背景图
  198. 'data' => [
  199. img($poster_data[ 'data' ][ 'background' ]),
  200. 0,
  201. 0,
  202. $poster_width,
  203. $height,
  204. 'square',
  205. true,
  206. 1
  207. ]
  208. ];
  209. } else {
  210. $back_ground = [
  211. 'action' => 'setBackground', // 设背景色
  212. 'data' => [ 255, 255, 255 ]
  213. ];
  214. }
  215. $ground = [
  216. [
  217. 'action' => 'setBackground',
  218. 'data' => [ 255, 255, 255 ]
  219. ]
  220. ];
  221. $option = [
  222. $back_ground,
  223. [
  224. 'action' => 'imageText', // 写入店铺名称
  225. 'data' => [
  226. $site_info[ 'data' ][ 'site_name' ],
  227. $poster_data[ 'data' ][ 'template_json' ][ 'store_name_font_size' ] * $fontRate * 2,
  228. hex2rgb($poster_data[ 'data' ][ 'template_json' ][ 'store_name_color' ]),
  229. $poster_data[ 'data' ][ 'template_json' ][ 'store_name_left' ] * 2,
  230. ( $poster_data[ 'data' ][ 'template_json' ][ 'store_name_top' ] + $poster_data[ 'data' ][ 'template_json' ][ 'store_name_font_size' ] ) * 2,
  231. $poster_data[ 'data' ][ 'template_json' ][ 'store_name_width' ] * 2,
  232. $poster_data[ 'data' ][ 'template_json' ][ 'store_name_height' ] * 2,
  233. true,
  234. $poster_data[ 'data' ][ 'template_json' ][ 'store_name_is_show' ]
  235. ]
  236. ],
  237. [
  238. 'action' => 'imageCopy', // 店铺logo
  239. 'data' => [
  240. !empty($site_info[ 'data' ][ 'logo_square' ]) ? $site_info[ 'data' ][ 'logo_square' ] : getUrl() . '/app/shop/view/public/img/shop_logo.png',
  241. $poster_data[ 'data' ][ 'template_json' ][ 'store_logo_left' ] * 2,
  242. $poster_data[ 'data' ][ 'template_json' ][ 'store_logo_top' ] * 2,
  243. $poster_data[ 'data' ][ 'template_json' ][ 'store_logo_width' ] * 2,
  244. $poster_data[ 'data' ][ 'template_json' ][ 'store_logo_height' ] * 2,
  245. 'square',
  246. true,
  247. $poster_data[ 'data' ][ 'template_json' ][ 'store_logo_is_show' ]
  248. ]
  249. ],
  250. [
  251. 'action' => 'imageCopy', // 写入商品图
  252. 'data' => [
  253. $goods_info[ 'sku_image' ],
  254. $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_left' ] * 2,
  255. $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_top' ] * 2,
  256. $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_width' ] * 2,
  257. $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_height' ] * 2,
  258. !empty($poster_data[ 'data' ][ 'template_json' ][ 'goods_img_shape' ]) ? $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_shape' ] : 'square',
  259. 0,
  260. $poster_data[ 'data' ][ 'template_json' ][ 'goods_img_is_show' ]
  261. ]
  262. ],
  263. [
  264. 'action' => 'imageText', // 写入商品名称
  265. 'data' => [
  266. $goods_info[ 'sku_name' ],
  267. $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_font_size' ] * $fontRate * 2,
  268. hex2rgb($poster_data[ 'data' ][ 'template_json' ][ 'goods_name_color' ]),
  269. $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_left' ] * 2,
  270. ( $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_top' ] + $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_font_size' ] ) * 2,
  271. $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_width' ] * 2,
  272. 1,//文本行数 $poster_data['data']['template_json']['goods_name_height']*2,
  273. true,
  274. $poster_data[ 'data' ][ 'template_json' ][ 'goods_name_is_show' ]
  275. ]
  276. ],
  277. [
  278. 'action' => 'imageCopy', // 写入商品二维码
  279. 'data' => [
  280. $qrcode_info[ 'data' ][ 'path' ],
  281. $poster_data[ 'data' ][ 'qrcode_left' ] * 2,
  282. $poster_data[ 'data' ][ 'qrcode_top' ] * 2,
  283. $poster_data[ 'data' ][ 'qrcode_width' ] * 2,
  284. $poster_data[ 'data' ][ 'qrcode_height' ] * 2,
  285. 'square',
  286. 0,
  287. 1
  288. ]
  289. ],
  290. [
  291. 'action' => 'imageText', // 写入商品价格
  292. 'data' => [
  293. '¥' . $goods_info[ 'seckill_price' ],
  294. $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_font_size' ] * $fontRate * 2,
  295. hex2rgb($poster_data[ 'data' ][ 'template_json' ][ 'goods_price_color' ]),
  296. $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_left' ] * 2,
  297. ( $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_top' ] + $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_font_size' ] ) * 2,
  298. $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_width' ] * 2,
  299. $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_height' ] * 2,
  300. true,
  301. $poster_data[ 'data' ][ 'template_json' ][ 'goods_price_is_show' ]
  302. ]
  303. ],
  304. ];
  305. if ($goods_info['price'] ==0 ){
  306. $line = '一一一';
  307. }else{
  308. $line = '一一一一';
  309. }
  310. $market_price = [
  311. [
  312. 'action' => 'imageText', // 写入商品划线价格
  313. 'data' => [
  314. '¥' . $goods_info[ 'price' ],
  315. $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_font_size' ] * $fontRate * 2,
  316. hex2rgb($poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_color' ]),
  317. $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_left' ] * 2,
  318. ( $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_top' ] + $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_font_size' ] ) * 2,
  319. $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_width' ] * 2,
  320. $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_height' ] * 2,
  321. true,
  322. $poster_data[ 'data' ][ 'template_json' ][ 'goods_market_price_is_show' ] ?? 0
  323. ]
  324. ],
  325. [
  326. 'action' => 'imageText', // 写入线
  327. 'data' => [
  328. $line,
  329. $poster_data['data']['template_json']['goods_market_price_font_size']*$fontRate*2,
  330. hex2rgb($poster_data['data']['template_json']['goods_market_price_color']),
  331. $poster_data['data']['template_json']['goods_market_price_left']*2-5,
  332. ($poster_data['data']['template_json']['goods_market_price_top']+$poster_data['data']['template_json']['goods_market_price_font_size'])*2,
  333. $poster_data['data']['template_json']['goods_market_price_width']*2,
  334. $poster_data['data']['template_json']['goods_market_price_height']*2,
  335. true,
  336. $poster_data['data']['template_json']['goods_market_price_is_show']
  337. ]
  338. ],
  339. ];
  340. $option = array_merge($option, $market_price);
  341. if (!empty($member_info)) {
  342. $member_option = [
  343. [
  344. 'action' => 'imageCopy', // 写入用户头像
  345. 'data' => [
  346. !empty($member_info[ 'headimg' ]) ? $member_info[ 'headimg' ] : $upload_config_result[ 'data' ][ 'value' ][ 'head' ],
  347. $poster_data[ 'data' ][ 'template_json' ][ 'headimg_left' ] * 2,
  348. $poster_data[ 'data' ][ 'template_json' ][ 'headimg_top' ] * 2,
  349. $poster_data[ 'data' ][ 'template_json' ][ 'headimg_width' ] * 2,
  350. $poster_data[ 'data' ][ 'template_json' ][ 'headimg_height' ] * 2,
  351. !empty($poster_data[ 'data' ][ 'template_json' ][ 'headimg_shape' ]) ? $poster_data[ 'data' ][ 'template_json' ][ 'headimg_shape' ] : 'square',
  352. 0,
  353. $poster_data[ 'data' ][ 'template_json' ][ 'headimg_is_show' ]
  354. ]
  355. ],
  356. [
  357. 'action' => 'imageText', // 写入分享人昵称
  358. 'data' => [
  359. $member_info[ 'nickname' ],
  360. $poster_data[ 'data' ][ 'template_json' ][ 'nickname_font_size' ] * $fontRate * 2,
  361. hex2rgb($poster_data[ 'data' ][ 'template_json' ][ 'nickname_color' ]),
  362. $poster_data[ 'data' ][ 'template_json' ][ 'nickname_left' ] * 2,
  363. ( $poster_data[ 'data' ][ 'template_json' ][ 'nickname_top' ] + $poster_data[ 'data' ][ 'template_json' ][ 'nickname_font_size' ] ) * 2,
  364. $poster_data[ 'data' ][ 'template_json' ][ 'nickname_width' ] * 2,
  365. $poster_data[ 'data' ][ 'template_json' ][ 'nickname_height' ] * 2,
  366. 0,
  367. $poster_data[ 'data' ][ 'template_json' ][ 'nickname_is_show' ]
  368. ]
  369. ],
  370. ];
  371. $option = array_merge($ground, $option, $member_option);
  372. }
  373. }
  374. $option_res = $poster->create($option);
  375. if (is_array($option_res)) return $option_res;
  376. $res = $option_res->jpeg('upload/poster/goods', 'goods_' . $promotion_type . '_' . $qrcode_param[ 'id' ] . '_' . $qrcode_param[ 'source_member' ] . '_' . time() . '_' . $app_type);
  377. if ($res[ 'code' ] == 0) {
  378. $upload = new Upload($site_id);
  379. $cloud_res = $upload->fileCloud($res[ 'data' ][ 'path' ]);
  380. if ($cloud_res[ 'code' ] >= 0) {
  381. return $this->success([ "path" => $cloud_res[ 'data' ] ]);
  382. } else {
  383. return $this->error();
  384. }
  385. }
  386. return $res;
  387. } catch (\Exception $e) {
  388. return $this->error($e->getMessage() . $e->getFile() . $e->getLine());
  389. }
  390. }
  391. /**
  392. * 获取用户信息
  393. * @param unknown $member_id
  394. */
  395. private function getMemberInfo($member_id)
  396. {
  397. $info = model('member')->getInfo([ 'member_id' => $member_id ], 'nickname,headimg');
  398. return $info;
  399. }
  400. /**
  401. * 获取商品信息
  402. * @param unknown $sku_id
  403. */
  404. private function getGoodsInfo($id)
  405. {
  406. $alias = 'npsg';
  407. $join = [
  408. [ 'goods_sku ngs', 'npsg.sku_id = ngs.sku_id', 'inner' ]
  409. ];
  410. $field = 'ngs.sku_name,ngs.introduction,ngs.sku_image,ngs.sku_id,npsg.seckill_price, npsg.seckill_id,ngs.template_id,ngs.price';
  411. $info = model('promotion_seckill_goods')->getInfo([ 'npsg.goods_id' => $id ], $field, $alias, $join);
  412. return $info;
  413. }
  414. /**
  415. * 获取商品二维码
  416. * @param unknown $app_type 请求类型
  417. * @param unknown $page uniapp页面路径
  418. * @param unknown $qrcode_param 二维码携带参数
  419. * @param string $promotion_type 活动类型 null为无活动
  420. */
  421. private function getGoodsQrcode($app_type, $page, $qrcode_param, $promotion_type, $site_id)
  422. {
  423. $res = event('Qrcode', [
  424. 'site_id' => $site_id,
  425. 'app_type' => $app_type,
  426. 'type' => 'create',
  427. 'data' => $qrcode_param,
  428. 'page' => $page,
  429. 'qrcode_path' => 'upload/qrcode/goods',
  430. 'qrcode_name' => 'goods_' . $promotion_type . '_' . $qrcode_param[ 'id' ] . '_' . $qrcode_param[ 'source_member' ] . '_' . $site_id,
  431. ], true);
  432. return $res;
  433. }
  434. /**
  435. * 获取海报信息
  436. * @param unknown $template_id
  437. */
  438. private function getTemplateInfo($template_id)
  439. {
  440. $info = model('poster_template')->getInfo([ 'template_id' => $template_id ], 'template_id,template_status');
  441. return $info;
  442. }
  443. /**
  444. * 分享图片
  445. * @param $page
  446. * @param $qrcode_param
  447. * @param $site_id
  448. * @return array|\extend\multitype|PosterExtend|string|string[]
  449. */
  450. public function shareImg($page, $qrcode_param, $site_id)
  451. {
  452. try {
  453. $goods_info = $this->getGoodsInfo($qrcode_param[ 'id' ]);
  454. if (empty($goods_info)) return $this->error('未获取到商品信息');
  455. $poster_width = 600;
  456. $poster_height = 480;
  457. $poster = new PosterExtend($poster_width, $poster_height);
  458. $option = [
  459. [
  460. 'action' => 'setBackground', // 设背景色
  461. 'data' => [ 255, 255, 255 ]
  462. ],
  463. [
  464. 'action' => 'imageCopy', // 商品图
  465. 'data' => [
  466. $goods_info[ 'sku_image' ],
  467. 30,
  468. 145,
  469. 200,
  470. 200,
  471. 'square',
  472. 50,
  473. 1
  474. ]
  475. ],
  476. [
  477. 'action' => 'imageText', // 写入商品名称
  478. 'data' => [
  479. $goods_info[ 'sku_name' ],
  480. 22,
  481. [ 51, 51, 51 ],
  482. 250,
  483. 190,
  484. 330,
  485. 2,
  486. false,
  487. 1
  488. ]
  489. ],
  490. [
  491. 'action' => 'imageText', // 写入商品价格
  492. 'data' => [
  493. '秒杀价:¥',
  494. 15,
  495. [ 255, 0, 0 ],
  496. 250,
  497. 300,
  498. 300,
  499. 2,
  500. false,
  501. 1
  502. ]
  503. ],
  504. [
  505. 'action' => 'imageText', // 写入商品价格
  506. 'data' => [
  507. $goods_info[ 'seckill_price' ],
  508. 30,
  509. [ 255, 0, 0 ],
  510. 345,
  511. 300,
  512. 300,
  513. 2,
  514. false,
  515. 1,
  516. PUBLIC_PATH . 'static/font/custom.ttf'
  517. ]
  518. ],
  519. [
  520. 'action' => 'imageText', // 写入商品原价
  521. 'data' => [
  522. '原 价:¥',
  523. 15,
  524. [ 153, 153, 153 ],
  525. 250,
  526. 340,
  527. 300,
  528. 2,
  529. false,
  530. 1
  531. ]
  532. ],
  533. [
  534. 'action' => 'imageText', // 写入商品原价
  535. 'data' => [
  536. $goods_info[ 'price' ],
  537. 16,
  538. [ 153, 153, 153 ],
  539. 345,
  540. 338,
  541. 300,
  542. 2,
  543. false,
  544. 1,
  545. PUBLIC_PATH . 'static/font/custom.ttf',
  546. ]
  547. ],
  548. // 划线(两条线)
  549. [
  550. 'action' => 'imageline',
  551. 'data' => [
  552. 325,
  553. 330,
  554. 325 + imagettfbbox(16, 0, PUBLIC_PATH . 'static/font/custom.ttf', '¥ ' . $goods_info[ 'price' ])[ 2 ],
  555. 330,
  556. [ 153, 153, 153 ],
  557. ]
  558. ],
  559. [
  560. 'action' => 'imageline',
  561. 'data' => [
  562. 325,
  563. 331,
  564. 325 + imagettfbbox(16, 0, PUBLIC_PATH . 'static/font/custom.ttf', '¥ ' . $goods_info[ 'price' ])[ 2 ],
  565. 331,
  566. [ 153, 153, 153 ],
  567. ]
  568. ],
  569. [
  570. 'action' => 'imageCopy', // 背景图
  571. 'data' => [
  572. img('upload/share_img/bg/seckill_1.png'),
  573. 0,
  574. 0,
  575. 600,
  576. 480,
  577. 'square',
  578. 0,
  579. 1
  580. ]
  581. ],
  582. ];
  583. $option_res = $poster->create($option);
  584. if (is_array($option_res)) {
  585. return $option_res;
  586. }
  587. $res = $option_res->jpeg('upload/share_img/seckill_' . $goods_info[ 'seckill_id' ], 'sku_' . $goods_info[ 'sku_id' ]);
  588. return $res;
  589. } catch (\Exception $e) {
  590. return $this->error($e->getMessage());
  591. }
  592. }
  593. }