RechargeController.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <?php
  2. namespace hd\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\recharge\classes\RechargeClass;
  5. use biz\shop\classes\ShopClass;
  6. use biz\sj\classes\SjClass;
  7. use bizGhs\custom\classes\CustomClass;
  8. use bizHd\custom\classes\HdClass;
  9. use bizHd\order\classes\OrderClass;
  10. use bizHd\recharge\classes\RechargeSqClass;
  11. use bizHd\wx\classes\WxOpenClass;
  12. use bizMall\wx\classes\WxMiniClass;
  13. use common\components\dateUtil;
  14. use common\components\dict;
  15. use common\components\imgUtil;
  16. use common\components\miniUtil;
  17. use common\components\orderSn;
  18. use common\components\stringUtil;
  19. use common\components\util;
  20. use Yii;
  21. class RechargeController extends BaseController
  22. {
  23. //获取商城端充值页和订单页小程序短链接
  24. public function actionGetMallRechargeShortLink()
  25. {
  26. $get = Yii::$app->request->get();
  27. if (getenv('YII_ENV') == 'dev') {
  28. $ip = Yii::$app->request->getUserIP();
  29. if ($ip == '127.0.0.1') {
  30. util::success(['rechargeAccountLink' => 'www.google.com', 'orderLink' => 'www.google.com']);
  31. }
  32. }
  33. $orderId = $get['orderId'] ?? 0;
  34. $account = $this->shopId;
  35. $page = 'pages/member/recharge?account=' . $account;
  36. $ret = WxMiniClass::getShortLink($page);
  37. $link = $ret['link'] ?? '';
  38. $orderLink = '';
  39. if (!empty($orderId)) {
  40. $order = OrderClass::getById($orderId, true);
  41. if ($order->mainId != $this->mainId) {
  42. util::fail('访问错误');
  43. }
  44. $orderPage = 'pages/order/detail?account=' . $account . '&id=' . $orderId;
  45. $res = WxMiniClass::getShortLink($orderPage);
  46. $orderLink = $res['link'] ?? '';
  47. }
  48. util::success(['rechargeAccountLink' => $link, 'orderLink' => $orderLink]);
  49. }
  50. //获取扫码充值的小程序码
  51. public function actionGetRechargeCode()
  52. {
  53. $shopId = $this->shopId;
  54. $recharge = RechargeSqClass::getAllByCondition(['shopId' => $shopId], 'recharge asc', '*', null); //这里取前面三个放在海报里,对应表名是 xhMemberRecharge 不是 MemberWeal
  55. $merchant = WxOpenClass::getMallWxInfo();
  56. $page = 'pages/member/recharge';
  57. $ptStyle = dict::getDict('ptStyle', 'mall');
  58. $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId;
  59. $imgUrl = miniUtil::generateUnlimitedRechargeMiniCode($merchant, $page, $scene, $ptStyle);
  60. $prefix = imgUtil::getPrefix();
  61. $titleBase64 = stringUtil::ossBase64('扫码充值');
  62. $memberMiniCodeBase64 = stringUtil::ossBase64($imgUrl);
  63. $memberUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image';
  64. $memberUrl .= '/watermark,image_' . $memberMiniCodeBase64 . ',g_north,x_0,y_40';
  65. $memberUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50';
  66. $posterUrl = $prefix . 'poster/recharge_poster.jpg';
  67. // 组合充值海报:将前3条充值活动写入海报对应位置
  68. // 海报尺寸:955x1439;以下坐标为在设计稿上测得的三行“进店充值/获得”数值区大致位置
  69. // 位置从上到下三行,左列为“进店充值”,中列为“获得”
  70. $posterProcess = '?x-oss-process=image';
  71. // 将小程序码放到右下角白色区域,大小与白色区域一致(可按需微调)
  72. $qrWidth = 230; // 白色区域宽度,像素
  73. $qrRightPadding = 144; // 距离右边的留白
  74. $qrBottomPadding = 72; // 距离底部的留白
  75. // 先用 $imgUrl 生成按宽度缩放后的小程序码图片,再拼接到海报
  76. $miniCodeResizeUrl = $imgUrl . (strpos($imgUrl, '?') === false ? '?x-oss-process=image' : '&x-oss-process=image');
  77. $miniCodeResizeUrl .= '/resize,w_' . $qrWidth;
  78. $miniCodeResizeBase64 = stringUtil::ossBase64($miniCodeResizeUrl);
  79. $posterProcess .= '/watermark,image_' . $miniCodeResizeBase64 . ',g_se,x_' . $qrRightPadding . ',y_' . $qrBottomPadding;
  80. $positions = [
  81. ['recharge' => ['x' => 220, 'y' => 655], 'give' => ['x' => 500, 'y' => 655]],
  82. ['recharge' => ['x' => 220, 'y' => 840], 'give' => ['x' => 500, 'y' => 840]],
  83. ['recharge' => ['x' => 220, 'y' => 1020], 'give' => ['x' => 500, 'y' => 1020]],
  84. ];
  85. $fontSize = 50; // 数值字号
  86. if (!empty($recharge)) {
  87. // 先生成同一张图片上的文字水印串,最后再与$posterProcess合并
  88. $textProcess = '';
  89. $topThree = array_slice($recharge, 0, 3);
  90. foreach ($topThree as $index => $val) {
  91. $pos = $positions[$index] ?? null;
  92. if ($pos === null) {
  93. continue;
  94. }
  95. $rechargeText = (string)(intval($val['recharge']) ?? '');
  96. $giveText = (string)(intval($val['give']) ?? '');
  97. if ($rechargeText !== '') {
  98. $rechargeBase64 = stringUtil::ossBase64($rechargeText);
  99. $textProcess .= '/watermark,text_' . $rechargeBase64 . ',g_nw,x_' . $pos['recharge']['x'] . ',y_' . $pos['recharge']['y'] . ',size_' . $fontSize . ',color_333333,type_' . stringUtil::ossBase64('fangzhengheiti');
  100. }
  101. if ($giveText !== '') {
  102. $giveBase64 = stringUtil::ossBase64($giveText);
  103. $textProcess .= '/watermark,text_' . $giveBase64 . ',g_nw,x_' . $pos['give']['x'] . ',y_' . $pos['give']['y'] . ',size_' . $fontSize . ',color_8B0000,type_' . stringUtil::ossBase64('fangzhengheiti');
  104. }
  105. }
  106. $posterProcess .= $textProcess;
  107. }
  108. $posterUrl .= $posterProcess;
  109. $respond = ['imgUrl' => $memberUrl, 'posterUrl' => $posterUrl];
  110. util::success($respond);
  111. }
  112. //手动给客户充值 ssh 20250301
  113. public function actionManRecharge()
  114. {
  115. $post = Yii::$app->request->post();
  116. $shopAdmin = $this->shopAdmin;
  117. if ($shopAdmin->super != 1) {
  118. util::fail('超管才能充值');
  119. }
  120. $staffId = $shopAdmin->id;
  121. $staffName = $shopAdmin->name;
  122. $connection = Yii::$app->db;
  123. $transaction = $connection->beginTransaction();
  124. try {
  125. $payWay = $post['payWay'] ?? 0;
  126. $amount = $post['amount'] ?? 0;
  127. $remark = $post['remark'] ?? '';
  128. $customId = $post['customId'] ?? 0;
  129. $shOrderId = $post['shOrderId'] ?? 0;
  130. $custom = \bizHd\custom\classes\CustomClass::getById($customId, true);
  131. if (empty($custom)) {
  132. util::fail('没有找到客户');
  133. }
  134. //避免重复提交
  135. util::checkRepeatCommit($customId, 4);
  136. $shOrderSn = '';
  137. if (!empty($shOrderId)) {
  138. $shOrder = OrderClass::getById($shOrderId, true);
  139. if ($shOrder->forward != 1) {
  140. util::fail('不是售后付款单');
  141. }
  142. if ($shOrder->mainId != $this->mainId) {
  143. util::fail('不是你的单');
  144. }
  145. //判断是否充值过了
  146. \bizHd\recharge\classes\RechargeClass::checkShOrderRecharge($shOrder);
  147. $shOrderSn = $shOrder->orderSn ?? '';
  148. }
  149. $refundOrderId = $post['refundOrderId'] ?? 0;
  150. $refundOrderSn = '';
  151. if (!empty($refundOrderId)) {
  152. //线下订单售后,充值
  153. $myOrder = OrderClass::getById($refundOrderId, true);
  154. if ($myOrder->mainId != $this->mainId) {
  155. util::fail('不是你的订单');
  156. }
  157. $refundOrderSn = $myOrder->orderSn ?? '';
  158. }
  159. $customName = $custom->name;
  160. $userId = $custom->userId ?? 0;
  161. $hdId = $custom->hdId;
  162. $hd = HdClass::getById($hdId, true);
  163. if (empty($hd)) {
  164. util::fail('花店信息缺失,编号9886');
  165. }
  166. $hdName = $hd->name;
  167. $shopId = $this->shopId;
  168. $mainId = $this->mainId;
  169. $orderSn = orderSn::getRechargeSn();
  170. $rechargeData = [
  171. 'orderSn' => $orderSn,
  172. 'modPrice' => 1,
  173. 'payWay' => $payWay,
  174. 'shopId' => $shopId,
  175. 'mainId' => $mainId,
  176. 'hdId' => $hdId,
  177. 'hdName' => $hdName,
  178. 'onlinePay' => 1,
  179. 'amount' => $amount,
  180. 'staffId' => $staffId,
  181. 'staffName' => $staffName,
  182. 'payStatus' => 0,
  183. 'payTime' => '0000-00-00 00:00:00',
  184. 'status' => 0,
  185. 'remark' => $remark,
  186. 'customId' => $customId,
  187. 'customName' => $customName,
  188. 'userId' => $userId,
  189. 'shOrderId' => $shOrderId,
  190. 'shOrderSn' => $shOrderSn,
  191. 'refundOrderId' => $refundOrderId,
  192. 'refundOrderSn' => $refundOrderSn,
  193. ];
  194. $respond = \bizHd\recharge\classes\RechargeClass::addRecharge($rechargeData);
  195. $id = $respond->id;
  196. $recharge = RechargeClass::getLockById($id);
  197. $params = ['onlinePay' => 1, 'side' => 0];
  198. //充值成功并且销账
  199. \bizHd\recharge\classes\RechargeClass::complete($recharge, $payWay, $params);
  200. $transaction->commit();
  201. util::success($post);
  202. } catch (\Exception $e) {
  203. $transaction->rollBack();
  204. Yii::error("充值失败原因:" . $e->getMessage());
  205. util::fail('充值失败');
  206. }
  207. }
  208. //充值记录 ssh 2021.2.21
  209. public function actionList()
  210. {
  211. $get = Yii::$app->request->get();
  212. $customId = $get['customId'] ?? 0;
  213. $where = ['shopId' => $this->shopId, 'status' => 1];
  214. if (!empty($customId)) {
  215. $custom = \bizHd\custom\classes\CustomClass::getById($customId, true);
  216. if (empty($custom)) {
  217. util::fail('没有找到客户');
  218. }
  219. if ($custom->shopId != $this->shopId) {
  220. util::fail('不是你的客户');
  221. }
  222. $where['customId'] = $customId;
  223. }
  224. $searchTime = $get['searchTime'] ?? '';
  225. if (!empty($searchTime)) {
  226. $startTime = $get['startTime'] ?? '';
  227. $endTime = $get['endTime'] ?? '';
  228. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  229. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  230. }
  231. $channelKey = $get['channelKey'] ?? 'all';
  232. $io = null;
  233. if (isset($get['io']) && $get['io'] !== '') {
  234. if (!in_array((string)$get['io'], ['0', '1'], true)) {
  235. util::fail('io参数错误');
  236. }
  237. $io = (int)$get['io'];
  238. }
  239. $list = \bizHd\recharge\classes\RechargeClass::getRechargeList($where, $channelKey, $io);
  240. util::success($list);
  241. }
  242. //充值统计
  243. public function actionStat()
  244. {
  245. $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
  246. if ($lookMoney == 0) {
  247. util::fail('无法查看');
  248. }
  249. $shopAdmin = $this->shopAdmin;
  250. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  251. util::fail('超管才能查看');
  252. }
  253. // $adminId = $shopAdmin->adminId ?? 0;
  254. // if (in_array($adminId, [2366, 2812, 4004, 3405, 3407])) {
  255. // util::fail('暂无权限');
  256. // }
  257. $get = Yii::$app->request->get();
  258. $data = \bizHd\recharge\classes\RechargeClass::getStatProfile($this->shopId, $get);
  259. util::success($data);
  260. }
  261. //充值记录退款:财务权限;线上原路退,线下扣减客户余额。
  262. public function actionRefund()
  263. {
  264. $staff = $this->shopAdmin;
  265. if (!isset($staff->finance) || intval($staff->finance) === 0) {
  266. util::fail('请有财务权限的人操作');
  267. }
  268. $post = Yii::$app->request->post();
  269. $id = intval($post['id'] ?? 0);
  270. if ($id <= 0) {
  271. util::fail('参数错误');
  272. }
  273. $cacheKey = 'hd_recharge_refund_' . $id;
  274. $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
  275. if (!empty($has)) {
  276. util::fail('请5秒之后再提交');
  277. }
  278. Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 5, 'has']);
  279. $connection = Yii::$app->db;
  280. $transaction = $connection->beginTransaction();
  281. try {
  282. \bizHd\recharge\classes\RechargeClass::refundPaidRecharge($id, $this->shop, $staff);
  283. $transaction->commit();
  284. util::complete('退款成功');
  285. } catch (\Exception $e) {
  286. $transaction->rollBack();
  287. Yii::info('充值退款失败:' . $e->getMessage());
  288. util::fail($e->getMessage() ?: '退款失败');
  289. }
  290. }
  291. //免费续期活动 ssh 2021.2.21
  292. public function actionRenew()
  293. {
  294. $sj = $this->sj->attributes;
  295. $shopId = $sj['parentShopId'] ?? 0;
  296. $shopName = '';
  297. $rechargeNum = getenv('RECHARGE_NUM') == false ? 268 : getenv('RECHARGE_NUM');
  298. if (!empty($shopId)) {
  299. $shop = ShopClass::getShopInfo($shopId);
  300. if (!empty($shop)) {
  301. $shopName = $shop['shopName'] ?? '';
  302. $num = $shop['rechargeNum'] ?? 0;
  303. $rechargeNum += $num;
  304. }
  305. }
  306. $data = [
  307. 'renew' => getenv('RENEW_PRICE') == false ? 1980 : getenv('RENEW_PRICE'),
  308. 'recharge' => getenv('RECHARGE_PRICE') == false ? 5980 : getenv('RECHARGE_PRICE'),
  309. 'shopName' => $shopName,
  310. 'userNum' => $rechargeNum
  311. ];
  312. util::success($data);
  313. }
  314. //续期充值付款 ssh 2021.2.21
  315. public function actionRenewPay()
  316. {
  317. ini_set('date.timezone', 'Asia/Shanghai');
  318. $wxPay = dict::getDict('payWay', 'wxPay');
  319. $price = getenv('RECHARGE_PRICE') == false ? 5980 : getenv('RECHARGE_PRICE');
  320. $shopAdmin = $this->shopAdmin->attributes;
  321. $shopAdminName = $shopAdmin['name'] ?? '';
  322. $data = [
  323. 'amount' => $price,
  324. 'payWay' => $wxPay,
  325. 'sjId' => $this->sjId,
  326. 'sjStyle' => SjClass::STYLE_RETAIL,
  327. 'shopId' => $this->shopId,
  328. 'modPrice' => 0,
  329. 'remark' => '免费续期充值',
  330. 'shopAdminId' => $this->shopAdminId,
  331. 'shopAdminName' => $shopAdminName,
  332. ];
  333. $order = RechargeClass::addOrder($data, true);
  334. $orderSn = $order->orderSn;
  335. $name = $order->orderName ?? '充值';
  336. $totalFee = $order->amount;
  337. if (isset($this->shopAdmin['super']) == false || $this->shopAdmin['super'] != 1) {
  338. util::fail('超级管理员才有权限操作');
  339. }
  340. //强制使用小程序的miniOpenId
  341. $openId = isset($this->admin) && !empty($this->admin) ? $this->admin->miniOpenId : '';
  342. if (empty($openId)) {
  343. util::fail('没有找到openId');
  344. }
  345. $capitalType = dict::getDict('capitalType', 'xhRecharge', 'id');
  346. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  347. $wxPayType = 1;
  348. $ghsId = Yii::$app->request->get('ghsId', 0);
  349. $ghs = GhsClass::getById($ghsId);
  350. GhsClass::valid($ghs, $this->shopId);
  351. $attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType . '&rechargeRenew=1&ghsId=' . $ghsId;
  352. //订单30分钟后过期
  353. $now = time();
  354. $expireTime = $now + 1800;
  355. $wx = Yii::getAlias("@vendor/weixin");
  356. require_once($wx . '/lib/WxPay.Api.php');
  357. require_once($wx . '/example/WxPay.JsApiPay.php');
  358. $input = new \WxPayUnifiedOrder();
  359. $input->SetBody($name);
  360. $input->SetOut_trade_no($orderSn);
  361. $input->SetTotal_fee($totalFee * 100);
  362. $input->SetTime_start(date("YmdHis", $now));
  363. $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
  364. $input->SetTime_expire(date("YmdHis", $expireTime));
  365. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  366. $input->SetTrade_type("JSAPI");
  367. $merchantExtend = WxOpenClass::getWxInfo();
  368. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  369. $input->SetSub_openid($openId);
  370. } else {
  371. $input->SetOpenid($openId);
  372. }
  373. //强制使用小程序的AppId
  374. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  375. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  376. $tools = new \JsApiPay();
  377. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  378. $newParams = json_decode($jsApiParameters, true);
  379. util::success($newParams);
  380. }
  381. //充值送红包 ssh 2021.2.21
  382. public function actionBalance()
  383. {
  384. ini_set('date.timezone', 'Asia/Shanghai');
  385. $get = Yii::$app->request->get();
  386. $ghsId = $get['ghsId'] ?? 0;
  387. $ghsInfo = GhsClass::getById($ghsId, true);
  388. if (empty($ghsInfo)) {
  389. util::fail('没有找到供货商');
  390. }
  391. GhsClass::valid($ghsInfo, $this->shopId);
  392. $ghsShopId = $ghsInfo['shopId'] ?? 0;
  393. $hbInfo = [];
  394. if (empty($hbInfo)) {
  395. util::fail('无效活动');
  396. }
  397. if ($hbInfo->shopId != $ghsShopId) {
  398. util::fail('供货商与充值红包活动不一致');
  399. }
  400. if ($hbInfo->delStatus == 1) {
  401. util::fail('红包已更新,请重新发起充值');
  402. }
  403. $amount = $hbInfo->amount ?? 0;
  404. if ($amount <= 0) {
  405. util::fail('充值金额有问题');
  406. }
  407. $customId = $ghsInfo['customId'] ?? 0;
  408. $custom = CustomClass::getById($customId, true);
  409. $customName = $custom->name ?? '';
  410. $wxPay = dict::getDict('payWay', 'wxPay');
  411. $shopAdmin = $this->shopAdmin->attributes;
  412. $shopAdminName = $shopAdmin['name'] ?? '';
  413. $data = [
  414. 'amount' => $amount,
  415. 'payWay' => $wxPay,
  416. 'sjId' => $this->sjId,
  417. 'sjStyle' => SjClass::STYLE_RETAIL,
  418. 'shopId' => $this->shopId,
  419. 'modPrice' => 0,
  420. 'remark' => '',
  421. 'shopAdminId' => $this->shopAdminId,
  422. 'shopAdminName' => $shopAdminName,
  423. 'hbId' => $hbInfo->id ?? 0,
  424. 'hbAmount' => $hbInfo->hbAmount ?? 0,
  425. 'hbNum' => $hbInfo->num,
  426. 'totalHb' => $hbInfo->totalHb,
  427. 'valid' => $hbInfo->valid,
  428. 'miniExpend' => $hbInfo->miniExpend,
  429. 'ghsId' => $ghsId,
  430. 'ghsShopId' => $ghsShopId,
  431. 'customId' => $customId,
  432. 'customName' => $customName,
  433. ];
  434. $order = RechargeClass::addOrder($data, true);
  435. $orderSn = $order->orderSn;
  436. $name = $order->orderName ?? '充值';
  437. $totalFee = $order->amount;
  438. //强制使用小程序的miniOpenId
  439. $openId = isset($this->admin) && !empty($this->admin) ? $this->admin->miniOpenId : '';
  440. if (empty($openId)) {
  441. util::fail('没有找到openId');
  442. }
  443. $capitalType = dict::getDict('capitalType', 'xhRecharge', 'id');
  444. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  445. $wxPayType = 1;
  446. $attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
  447. //订单30分钟后过期
  448. $now = time();
  449. $expireTime = $now + 1800;
  450. $wx = Yii::getAlias("@vendor/weixin");
  451. require_once($wx . '/lib/WxPay.Api.php');
  452. require_once($wx . '/example/WxPay.JsApiPay.php');
  453. $input = new \WxPayUnifiedOrder();
  454. $input->SetBody($name);
  455. $input->SetOut_trade_no($orderSn);
  456. $input->SetTotal_fee($totalFee * 100);
  457. $input->SetTime_start(date("YmdHis", $now));
  458. $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
  459. $input->SetTime_expire(date("YmdHis", $expireTime));
  460. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  461. $input->SetTrade_type("JSAPI");
  462. $merchantExtend = WxOpenClass::getWxInfo();
  463. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  464. $input->SetSub_openid($openId);
  465. } else {
  466. $input->SetOpenid($openId);
  467. }
  468. //强制使用小程序的AppId
  469. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  470. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  471. $tools = new \JsApiPay();
  472. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  473. $newParams = json_decode($jsApiParameters, true);
  474. util::success($newParams);
  475. }
  476. //续期成功 ssh 2021.2.21
  477. public function actionRenewSuccess()
  478. {
  479. $shop = $this->shop;
  480. $deadline = $shop->deadline ?? '';
  481. $deadline = date("Y-m-d H:i", strtotime($deadline));
  482. util::success(['deadline' => $deadline]);
  483. }
  484. }