OrderController.php 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. <?php
  2. namespace hd\controllers;
  3. use biz\shop\classes\ShopExtClass;
  4. use biz\sj\services\MerchantExtendService;
  5. use biz\sj\services\MerchantService;
  6. use bizHd\custom\classes\CustomClass;
  7. use bizHd\custom\classes\HdClass;
  8. use bizHd\goods\classes\GoodsClass;
  9. use bizHd\merchant\services\ShopService;
  10. use bizHd\order\classes\OrderClass;
  11. use bizHd\order\classes\OrderItemClass;
  12. use bizHd\order\classes\OrderSendClass;
  13. use bizHd\order\services\OrderService;
  14. use bizHd\product\classes\ProductClass;
  15. use bizHd\purchase\classes\PurchaseClass;
  16. use bizHd\saas\services\RegionService;
  17. use bizHd\shop\classes\ShopClass;
  18. use bizHd\user\services\UserService;
  19. use bizHd\work\classes\WorkClass;
  20. use bizHd\wx\classes\WxOpenClass;
  21. use common\components\dict;
  22. use common\components\dateUtil;
  23. use common\components\noticeUtil;
  24. use common\components\orderSn;
  25. use common\components\payUtil;
  26. use common\services\xhPayToolService;
  27. use Yii;
  28. use common\components\util;
  29. use common\components\stringUtil;
  30. use bizHd\promote\services\CouponService;
  31. use common\components\httpUtil;
  32. use biz\wx\classes\WxMessageClass;
  33. use common\components\lakala\Lakala;
  34. class OrderController extends BaseController
  35. {
  36. public $guestAccess = ['order-relate', 'fast-pay', 'create-order', 'list'];
  37. //取消订单 ssh 20221231
  38. public function actionCancel()
  39. {
  40. //避免重复提交
  41. $adminId = $this->adminId;
  42. util::checkRepeatCommit($adminId, 8);
  43. $get = Yii::$app->request->get();
  44. $id = $get['id'] ?? 0;
  45. $order = OrderClass::getById($id, true);
  46. OrderClass::valid($order, $this->mainId);
  47. $deadTime = $order->deadline ?? 0;
  48. $current = time();
  49. $diff = bcsub($deadTime, $current);
  50. if ($diff < 60) {
  51. util::fail('60秒后将自动取消');
  52. }
  53. $connection = Yii::$app->db;
  54. $transaction = $connection->beginTransaction();
  55. try {
  56. OrderClass::setExpire($order, true);
  57. $transaction->commit();
  58. util::complete();
  59. } catch (\Exception $exception) {
  60. $transaction->rollBack();
  61. Yii::info("取消原因:" . $exception->getMessage());
  62. util::fail('取消失败');
  63. }
  64. }
  65. //修改订单 ssh 20220926
  66. public function actionUpdate()
  67. {
  68. $post = Yii::$app->request->post();
  69. $id = $post['id'] ?? 0;
  70. $order = OrderClass::getById($id, true);
  71. OrderClass::valid($order, $this->mainId);
  72. unset($post['id']);
  73. if ($order->status == 3) {
  74. util::fail('订单已配送');
  75. }
  76. if ($order->status == 4) {
  77. util::fail('订单已完成');
  78. }
  79. if ($order->status == 5) {
  80. util::fail('订单已取消');
  81. }
  82. if ($order->fromType == 4) {
  83. util::fail('请在美团APP上修改');
  84. }
  85. $address = $post['address'] ?? '';
  86. $floor = $post['floor'] ?? '';
  87. $post['fullAddress'] = $address . $floor;
  88. OrderClass::updateById($id, $post);
  89. $workList = WorkClass::getAllByCondition(['orderId' => $id], null, '*', null, true);
  90. $remark = $post['remark'] ?? '';
  91. $reachDate = $post['reachDate'] ?? '';
  92. $reachPeriod = $post['reachPeriod'] ?? '';
  93. $cardInfo = $post['cardInfo'] ?? '';
  94. $anonymity = $post['anonymity'] ?? 0;
  95. $bookName = $post['bookName'] ?? '';
  96. if (!empty($workList)) {
  97. foreach ($workList as $work) {
  98. $work->remark = $remark;
  99. $work->reachDate = $reachDate;
  100. $work->reachPeriod = $reachPeriod;
  101. $work->cardInfo = $cardInfo;
  102. $work->anonymity = $anonymity;
  103. $work->bookName = $bookName;
  104. $work->save();
  105. }
  106. }
  107. $shopExt = ShopExtClass::getByCondition(['shopId' => $this->shopId], true);
  108. ShopExtClass::orderUpdateRemind($shopExt, $order);
  109. util::complete();
  110. }
  111. //客户欠款的订单 ssh 2021.2.4
  112. public function actionDebtList()
  113. {
  114. $get = Yii::$app->request->get();
  115. $id = $get['id'] ?? 0;
  116. $info = CustomClass::getById($id, true);
  117. CustomClass::valid($info, $this->shopId);
  118. $where = ['customId' => $id, 'debt' => 1];
  119. $searchTime = $get['searchTime'] ?? '';
  120. if (!empty($searchTime)) {
  121. $startTime = $get['startTime'] ?? '';
  122. $endTime = $get['endTime'] ?? '';
  123. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  124. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  125. }
  126. $list = OrderClass::getAllByCondition($where, 'addTime DESC', ['id', 'orderSn', 'actPrice', 'addTime', 'remainDebtPrice']);
  127. $result = ['customInfo' => $info, 'list' => $list];
  128. util::success($result);
  129. }
  130. //发货
  131. public function actionSend()
  132. {
  133. $get = Yii::$app->request->get();
  134. $id = isset($get['id']) ? $get['id'] : 0;
  135. $order = OrderClass::getById($id, true);
  136. if (empty($order)) {
  137. util::fail('没有找到订单');
  138. }
  139. OrderClass::valid($order, $this->mainId);
  140. if ($order->status != 2) {
  141. util::fail('订单不是待发货状态');
  142. }
  143. $workList = WorkClass::getAllByCondition(['orderId' => $id], null, '*', null, true);
  144. if (!empty($workList)) {
  145. $unComplete = false;
  146. foreach ($workList as $work) {
  147. if ($work->status != 1) {
  148. $unComplete = true;
  149. }
  150. }
  151. if ($unComplete == true) {
  152. util::fail('还有制作单没有完成');
  153. }
  154. }
  155. $order->status = 4;
  156. $order->save();
  157. util::complete('操作成功');
  158. }
  159. //打印订单 ssh 20220601
  160. public function actionPrintOrder()
  161. {
  162. $get = Yii::$app->request->get();
  163. $id = isset($get['id']) ? $get['id'] : 0;
  164. $order = OrderClass::getById($id, true);
  165. if (empty($order)) {
  166. util::fail('没有找到订单');
  167. }
  168. OrderClass::valid($order, $this->mainId);
  169. OrderClass::onlinePrint($order, true);
  170. util::complete();
  171. }
  172. //微信和支付宝付款码支付复查 ssh 20220422
  173. public function actionCodePayCheck()
  174. {
  175. ini_set('date.timezone', 'Asia/Shanghai');
  176. header("Content-type: text/html; charset=utf-8");
  177. $get = Yii::$app->request->get();
  178. $id = isset($get['id']) ? $get['id'] : 0;
  179. $order = OrderClass::getById($id, true);
  180. OrderClass::valid($order, $this->mainId);
  181. $orderSn = $order->orderSn ?? '';
  182. $totalFee = $order->mainPay ?? 0;
  183. if ($order->status == OrderClass::ORDER_STATUS_COMPLETE) {
  184. util::success(['returnStatus' => 'SUCCESS']);
  185. }
  186. if ($order->status != OrderClass::ORDER_STATUS_UN_PAY) {
  187. util::complete('订单不是待付款状态');
  188. }
  189. $connection = Yii::$app->db;
  190. $transaction = $connection->beginTransaction();
  191. try {
  192. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  193. $shop = $this->shop;
  194. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  195. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  196. $params = [
  197. 'appid' => 'OP00002119',
  198. 'serial_no' => '018b08cfddbd',
  199. 'merchant_no' => $shop->lklSjNo,
  200. 'term_no' => $shop->lklScanTermNo,
  201. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  202. 'lklCertificatePath' => $lklCertificatePath,
  203. ];
  204. $laResource = new Lakala($params);
  205. $scanParams = ['orderSn' => $orderSn,];
  206. $response = $laResource->query($scanParams);
  207. if (isset($response['code']) && $response['code'] == 'BBS00000') {
  208. if (isset($response['resp_data']['trade_state']) && $response['resp_data']['trade_state'] == 'SUCCESS') {
  209. $payWayType = dict::getDict('payWay', 'wxPay');
  210. $account_type = $response['resp_data']['account_type'] ?? '';
  211. if ($account_type == 'WECHAT') {
  212. $payWayType = dict::getDict('payWay', 'wxPay');
  213. }
  214. if ($account_type == 'ALIPAY') {
  215. $payWayType = dict::getDict('payWay', 'alipay');
  216. }
  217. $transactionId = $response['resp_data']['trade_no'] ?? '';
  218. $order->onlinePay = dict::getDict('onlinePay', 'yes');
  219. $order->save();
  220. $attach = '';
  221. payUtil::thirdPay($payWayType, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
  222. $transaction->commit();
  223. //打印小票和语音播报
  224. $newOrder = OrderClass::getById($id, true);
  225. OrderClass::onlinePrint($newOrder);
  226. ShopExtClass::hdGatheringReport($newOrder);
  227. $shopId = $newOrder->shopId ?? 0;
  228. $shop = ShopClass::getById($shopId, true);
  229. WxMessageClass::gatheringIncomeInform($shop, $newOrder);
  230. util::success(['returnStatus' => 'SUCCESS']);
  231. } else {
  232. util::complete('未知状态..');
  233. }
  234. }
  235. util::complete('未知状态..');
  236. } catch (\Exception $e) {
  237. $transaction->rollBack();
  238. util::complete('支付失败');
  239. }
  240. }
  241. //微信和支付宝付款码支付 ssh 2021.4.11
  242. public function actionCodePay()
  243. {
  244. ini_set('date.timezone', 'Asia/Shanghai');
  245. header("Content-type: text/html; charset=utf-8");
  246. $get = Yii::$app->request->get();
  247. $id = isset($get['id']) ? $get['id'] : 0;
  248. $version = $get['version'] ?? 0;
  249. $order = OrderClass::getById($id, true);
  250. OrderClass::valid($order, $this->mainId);
  251. $shop = $this->shop;
  252. $sj = $shop->merchantName;
  253. $shopName = $shop->shopName;
  254. $name = $shopName == '首店' ? $sj : $sj . '-' . $shopName;
  255. $authCode = (string)$get['authCode'] ?? '';
  256. if ($version > 0) {
  257. if (empty($authCode)) {
  258. $msg = '没有扫到付款码';
  259. $remind = $msg . "(零售端付款码:{$authCode})" . '(' . $name . ')';
  260. noticeUtil::push($remind . ' 编号005', '15280215347');
  261. util::success(['returnStatus' => 'FAILURE'], $msg);
  262. }
  263. //微信文档说明 https://pay.weixin.qq.com/doc/v2/merchant/4011936234
  264. $wxPattern = '/^(10|11|12|13|14|15)\d{16}$/';
  265. //支付宝文档说明 https://opendocs.alipay.com/open/194/106039/
  266. $aliPattern = '/^(25|26|27|28|29|30)\d{14,22}$/';
  267. if (!preg_match($wxPattern, $authCode) && !preg_match($aliPattern, $authCode)) {
  268. $msg = '付款码错误,请使用微信或支付宝付款码';
  269. $remind = $msg . "(零售端付款码:{$authCode})" . '(' . $name . ')';
  270. //noticeUtil::push($remind . ' 编号009', '15280215347');
  271. util::success(['returnStatus' => 'FAILURE'], $msg);
  272. }
  273. } else {
  274. if (empty($authCode)) {
  275. util::fail('没有获取到支付码');
  276. }
  277. }
  278. $orderSn = $order->orderSn ?? '';
  279. $lsCodePayErrorKey = 'ls_code_pay_error_' . $id;
  280. $hasFailPay = Yii::$app->redis->executeCommand('GET', [$lsCodePayErrorKey]);
  281. //前面有付失败过,要重新生成单号
  282. if (!empty($hasFailPay)) {
  283. $oldOrderSn = $order->orderSn;
  284. $orderSn = orderSn::getOrderSn();
  285. $order->orderSn = $orderSn;
  286. $order->save();
  287. OrderItemClass::updateByCondition(['orderSn' => $oldOrderSn], ['orderSn' => $orderSn]);
  288. }
  289. $subject = '购买花材 ' . $orderSn;
  290. $totalFee = $order->mainPay ?? 0;
  291. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  292. $connection = Yii::$app->db;
  293. $transaction = $connection->beginTransaction();
  294. try {
  295. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  296. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  297. $params = [
  298. 'appid' => 'OP00002119',
  299. 'serial_no' => '018b08cfddbd',
  300. 'merchant_no' => $shop->lklSjNo,
  301. 'term_no' => $shop->lklScanTermNo,
  302. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  303. 'lklCertificatePath' => $lklCertificatePath,
  304. ];
  305. $laResource = new Lakala($params);
  306. $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
  307. $scanParams = [
  308. 'orderSn' => $orderSn,
  309. 'amount' => $totalFee,
  310. 'capitalType' => $capitalType,
  311. 'notifyUrl' => $notifyUrl,
  312. 'subject' => $subject,
  313. 'authCode' => $authCode,
  314. ];
  315. $response = $laResource->scanPay($scanParams);
  316. if (isset($response['code']) && $response['code'] == 'BBS00000') {
  317. $account_type = $response['resp_data']['account_type'] ?? '';
  318. $payWayType = dict::getDict('payWay', 'wxPay');
  319. if ($account_type == 'WECHAT') {
  320. $payWayType = dict::getDict('payWay', 'wxPay');
  321. }
  322. if ($account_type == 'ALIPAY') {
  323. $payWayType = dict::getDict('payWay', 'alipay');
  324. }
  325. $order->payWay = $payWayType;
  326. $transactionId = $response['resp_data']['trade_no'] ?? '';
  327. $order->onlinePay = dict::getDict('onlinePay', 'yes');
  328. $order->save();
  329. $attach = '';
  330. payUtil::thirdPay($payWayType, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
  331. $transaction->commit();
  332. //解决重复通知
  333. $cacheKey = 'hd_shop_order_pay_' . $orderSn;
  334. $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
  335. if (empty($has)) {
  336. Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 300, 'has']);
  337. $newOrder = OrderClass::getById($id, true);
  338. //打印小票
  339. OrderClass::onlinePrint($newOrder);
  340. //语音播报
  341. ShopExtClass::hdGatheringReport($newOrder);
  342. $shopId = $newOrder->shopId ?? 0;
  343. $shop = ShopClass::getById($shopId, true);
  344. WxMessageClass::gatheringIncomeInform($shop, $newOrder);
  345. }
  346. util::success(['returnStatus' => 'SUCCESS']);
  347. } else {
  348. //标记有没付成功的次数,原因有可能是余额不足等
  349. Yii::$app->redis->executeCommand('SETEX', [$lsCodePayErrorKey, 1200, 'hasFail']);
  350. $msg = $response['msg'] ?? '';
  351. $retCode = $response['code'] ?? '';
  352. $fullMsg = $msg . "(零售端付款码:{$authCode})" . '(' . $name . ')';
  353. if ($retCode == 'BBS10000' || $retCode == 'BBS11105') {
  354. $shopId = $order->shopId;
  355. ShopExtClass::remindInputPassword($shopId);
  356. }
  357. //noticeUtil::push($fullMsg . ' ' . $retCode . ' 编号008', '15280215347');
  358. util::success(['returnStatus' => 'FAILURE', 'returnCode' => $retCode], $msg);
  359. }
  360. } catch (\Exception $e) {
  361. $transaction->rollBack();
  362. util::fail('支付失败');
  363. }
  364. }
  365. //开单操作 ssh 20220316
  366. public function actionCreateOrder()
  367. {
  368. $post = Yii::$app->request->post();
  369. $post['sjId'] = $this->sjId;
  370. $post['shopId'] = $this->shopId;
  371. $post['mainId'] = $this->mainId ?? 0;
  372. $now = time();
  373. $orderValidTime = getenv('ORDER_VALID_TIME') == false ? 600 : getenv('ORDER_VALID_TIME');
  374. $expireTime = $now + $orderValidTime;
  375. $post['deadline'] = $expireTime;
  376. $post['staffId'] = $this->shopAdminId ?? 0;
  377. $post['staffName'] = $this->shopAdmin->name ?? '';
  378. $post['flowerNum'] = isset($post['flowerNum']) && $post['flowerNum'] > 0 ? $post['flowerNum'] : 0;
  379. //默认情况开单员工和收款员工是同个人
  380. $staffId = $this->shopAdminId ?? 0;
  381. $staffName = $this->shopAdmin->name ?? '';
  382. if (empty($post['shopAdminId'])) {
  383. $post['shopAdminId'] = $staffId;
  384. $post['shopAdminName'] = $staffName;
  385. }
  386. if (empty($post['getStaffId'])) {
  387. $post['getStaffId'] = $staffId;
  388. $post['getStaffName'] = $this->shopAdmin->name ?? '';
  389. }
  390. $groupId = !empty($post['groupId']) ? $post['groupId'] : 0;
  391. $post['fromType'] = $post['fromType'] ?? 1;
  392. if ($post['fromType'] == dict::getDict('fromType', 'friend')) {
  393. if (empty($post['bookName'])) {
  394. util::fail('请填写订花人姓名');
  395. }
  396. }
  397. $customId = $post['customId'] ?? 0;
  398. $custom = CustomClass::getById($customId, true);
  399. if (empty($custom)) {
  400. util::fail('没有找到客户哦');
  401. }
  402. $hdId = $custom->hdId ?? 0;
  403. $hd = HdClass::getById($hdId, true);
  404. if (empty($hd)) {
  405. util::fail('客户对应的花店信息缺失,编号869');
  406. }
  407. $hdName = $hd->name ?? '';
  408. $post['hdId'] = $hdId;
  409. $post['hdName'] = $hdName;
  410. $post['customId'] = $customId;
  411. $customName = $custom->name ?? '';
  412. $post['customName'] = $customName;
  413. $post['customNamePy'] = stringUtil::py($customName);
  414. if (!empty($post['receiveMobile'])) {
  415. if (!stringUtil::isMobile($post['receiveMobile'])) {
  416. util::fail('请填写正确的收花人手机号');
  417. }
  418. }
  419. if (!empty($post['bookMobile'])) {
  420. if (!stringUtil::isMobile($post['bookMobile'])) {
  421. util::fail('请填写正确的订花人手机号');
  422. }
  423. }
  424. $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay');
  425. if (isset($post['isCashier']) && $post['isCashier'] == 1) {
  426. //收银台开单默认到店自取
  427. $post['sendType'] = dict::getDict('sendType', 'shopGet');
  428. }
  429. $productJson = $post['product'] ?? '';
  430. $productList = [];
  431. if (!empty($productJson)) {
  432. $productList = json_decode($productJson, true);
  433. }
  434. if (empty($productList) && empty($groupId)) {
  435. //商家手机上开单并生成制作单
  436. if (!empty($post['unitGoodsPrice'])) {
  437. $unitGoodsPrice = $post['unitGoodsPrice'];
  438. if (!is_numeric($unitGoodsPrice)) {
  439. util::fail('请输入正确的单价');
  440. }
  441. $productList = GoodsClass::orderCreateGoods($post);
  442. }
  443. }
  444. if (empty($productList) && empty($groupId)) {
  445. if ($post['lsGoodsPrice'] <= 0) {
  446. $lsGoodsPrice = $post['lsGoodsPrice'];
  447. if (!is_numeric($lsGoodsPrice)) {
  448. util::fail('请输入正确的金额');
  449. }
  450. util::fail('请填写金额或选商品');
  451. }
  452. }
  453. $connection = Yii::$app->db;
  454. $transaction = $connection->beginTransaction();
  455. try {
  456. $post['product'] = $productList;
  457. //阿东开5支老是会出现5扎情况跟踪
  458. ProductClass::adStockCheck($this->shop, $productList);
  459. //3秒内不允许重复开单
  460. $staffId = $this->shopAdminId ?? 0;
  461. $cacheKey = 'hd_create_order_' . $staffId . '_' . $customId;
  462. $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
  463. if (!empty($has)) {
  464. util::fail('稍等5秒再开单');
  465. }
  466. Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
  467. $return = OrderService::createFinishOrder($post, $custom, $hasPay);
  468. $transaction->commit();
  469. //打印小票和语音播报
  470. $id = $return->id ?? 0;
  471. $order = OrderClass::getById($id, true);
  472. if ($order->fromType == 3 || $order->fromType == 4) {
  473. //除了客服号下单和美团下单,其它情况允许打小票
  474. } else {
  475. //前台打小票
  476. OrderClass::onlinePrint($order);
  477. }
  478. //前台提示收款多少钱
  479. ShopExtClass::hdGatheringReport($order);
  480. //前台提醒出示付款码
  481. if (isset($order->status) && $order->status == 1) {
  482. if (isset($post['isCashier']) && $post['isCashier'] == 1) {
  483. ShopExtClass::pleasePayReport($order);
  484. }
  485. }
  486. $shopId = $order->shopId ?? 0;
  487. $shop = ShopClass::getById($shopId, true);
  488. WxMessageClass::gatheringIncomeInform($shop, $order);
  489. //新制作单提示
  490. $shopExt = ShopExtClass::getByCondition(['shopId' => $this->shopId], true);
  491. ShopExtClass::newWorkRemind($shopExt, $order);
  492. util::success($return);
  493. } catch (\Exception $e) {
  494. $transaction->rollBack();
  495. Yii::error("失败原因:" . $e->getMessage());
  496. util::fail('下单失败');
  497. }
  498. }
  499. //下单要用到的相关信息 ssh 2019.12.6
  500. public function actionOrderRelate()
  501. {
  502. $regionTree = RegionService::tree();
  503. $shop = $this->shop->attributes;
  504. $freight = MerchantExtendService::getFreight($this->sjExtend);
  505. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  506. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
  507. util::success($out);
  508. }
  509. //余额支付 ssh 2019.12.6
  510. public function actionBalancePay()
  511. {
  512. $post = Yii::$app->request->post();
  513. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  514. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  515. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  516. $order = OrderService::getByOrderSn($orderSn);
  517. $userId = $this->adminId;
  518. $user = UserService::getUserInfo($userId);
  519. //验证支付密码是否正确
  520. UserService::validPayPassword($payPassword, $user);
  521. //支付前验证订单有效性
  522. OrderService::checkBeforePay($order);
  523. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  524. $totalFee = $order['prePrice'];
  525. $sourceType = 0;
  526. $discountData = OrderService::getDiscountPrice(['price' => $totalFee, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  527. $actPrice = $discountData['price'];
  528. $callbackParams = [];
  529. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  530. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  531. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'balance' => $balance]);
  532. }
  533. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  534. public function actionWxPay()
  535. {
  536. ini_set('date.timezone', 'Asia/Shanghai');
  537. $post = Yii::$app->request->post();
  538. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  539. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  540. $order = OrderService::getByOrderSn($orderSn);
  541. $orderId = $order['id'];
  542. //验证优惠券是否还有效
  543. if (!empty($couponId)) {
  544. CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
  545. }
  546. //支付前验证订单有效性
  547. OrderService::checkBeforePay($order);
  548. $name = isset($order['orderName']) && !empty($order['orderName']) ? $order['orderName'] : '购买商品';
  549. $totalFee = $order['realPrice'];
  550. //小程序使用miniOpenId
  551. if (httpUtil::isMiniProgram()) {
  552. $openId = $this->user['miniOpenId'];
  553. } else {
  554. $openId = $this->user['openId'];
  555. }
  556. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  557. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  558. $wxPayType = 0;
  559. if (httpUtil::isMiniProgram()) {
  560. $wxPayType = 1;
  561. }
  562. $attach = "couponId=" . $couponId . "&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
  563. //订单30分钟后过期
  564. $now = time();
  565. $expireTime = $now + 1800;
  566. $wx = Yii::getAlias("@vendor/weixin");
  567. require_once($wx . '/lib/WxPay.Api.php');
  568. require_once($wx . '/example/WxPay.JsApiPay.php');
  569. $input = new \WxPayUnifiedOrder();
  570. $input->SetBody($name);
  571. $input->SetOut_trade_no($orderSn);
  572. $input->SetTotal_fee($totalFee * 100);
  573. $input->SetTime_start(date("YmdHis", $now));
  574. $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
  575. $input->SetTime_expire(date("YmdHis", $expireTime));
  576. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  577. $input->SetTrade_type("JSAPI");
  578. //花卉宝代为申请的微信支付
  579. $merchantExtend = $this->sjExtend->attributes;
  580. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  581. $input->SetSub_openid($openId);
  582. } else {
  583. $input->SetOpenid($openId);
  584. }
  585. //小程序使用miniAppId
  586. if (httpUtil::isMiniProgram()) {
  587. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  588. }
  589. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  590. $tools = new \JsApiPay();
  591. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  592. $newParams = json_decode($jsApiParameters, true);
  593. //已请求微信不能修改价格
  594. $updateData = [];
  595. $updateData['modPrice'] = 0;
  596. if (empty($order['deadline'])) {
  597. $updateData['deadline'] = $expireTime;
  598. }
  599. OrderService::updateById($orderId, $updateData);
  600. util::success($newParams);
  601. }
  602. //快捷付款订单
  603. public function actionFastPay()
  604. {
  605. ini_set('date.timezone', 'Asia/Shanghai');
  606. $post = Yii::$app->request->post();
  607. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  608. $shopId = !empty($this->shopId) ? $this->shopId : ShopService::getDefaultShopId($this->sj);
  609. //验证门店是否有效
  610. $shopInfo = ShopService::getById($shopId);
  611. ShopService::valid($shopInfo, $this->sjId);
  612. $post['shopId'] = $shopId;
  613. //默认门店订单
  614. $store = isset($post['store']) ? $post['store'] : 1;
  615. $post['store'] = $store;
  616. //来源 0微信 1支付宝 2小程序 3朋友圈 4美团
  617. $sourceType = $this->isWx ? 0 : 1;
  618. if (httpUtil::isMiniProgram()) {
  619. $sourceType = 2;
  620. }
  621. $sourceType = isset($post['sourceType']) ? $post['sourceType'] : 0;
  622. //兼容旧系统sourceType=3表示朋友圈来源
  623. $fromType = $sourceType == 3 ? 2 : 0;
  624. $fromType = isset($post['fromType']) && !empty($post['fromType']) ? $post['fromType'] : $fromType;
  625. $post['userId'] = $this->adminId;
  626. $custom = $this->custom;
  627. $post['bookName'] = $custom['userName'] ?? '';
  628. $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  629. $bookMobile = empty($bookMobile) && isset($custom['mobile']) && !empty($custom['mobile']) ? $custom['mobile'] : $bookMobile;
  630. $post['bookMobile'] = $bookMobile;
  631. $prePrice = round($post['prePrice'], 2);
  632. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  633. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  634. $actPrice = $discountData['price'];
  635. $post['discountType'] = $discountData['discountType'];
  636. $post['discountAmount'] = $discountData['discountAmount'];
  637. $post['actPrice'] = $actPrice;
  638. $post['realPrice'] = $actPrice;
  639. $post['payStyle'] = 0;
  640. $post['sjId'] = $this->sjId;
  641. $now = time();
  642. $expireTime = $now + 300;//订单5分钟后过期
  643. $post['createTime'] = date("Y-m-d H:i:s", $now);
  644. $post['deadline'] = $expireTime;
  645. if ($actPrice <= 0) {
  646. util::fail('请填写正确的金额');
  647. }
  648. //微信支付订单提交不能修改价格
  649. $post['modPrice'] = $this->isWx ? 0 : 1;
  650. $post['sourceType'] = $sourceType;
  651. $post['goodsNum'] = 1;
  652. $post['fromType'] = $fromType;
  653. $order = OrderService::addOrder($post);
  654. $orderId = $order['id'];
  655. $orderSn = $order['orderSn'];
  656. $sjId = $this->sjId;
  657. if ($payWay == 0) {
  658. $orderId = $order['id'];
  659. $name = '购买商品';
  660. $totalFee = $actPrice;
  661. $user = UserService::getById($this->adminId);
  662. $openId = isset($user['openId']) ? $user['openId'] : 0;
  663. if (httpUtil::isMiniProgram()) {
  664. //小程序使用miniOpenId
  665. $openId = $user['miniOpenId'];
  666. }
  667. if (empty($openId)) {
  668. util::fail('没有找到客户的openId');
  669. }
  670. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  671. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  672. $wxPayType = 0;
  673. if (httpUtil::isMiniProgram()) {
  674. $wxPayType = 1;
  675. }
  676. $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&wxPayType=' . $wxPayType;
  677. $wx = Yii::getAlias("@vendor/weixin");
  678. require_once($wx . '/lib/WxPay.Api.php');
  679. require_once($wx . '/example/WxPay.JsApiPay.php');
  680. $input = new \WxPayUnifiedOrder();
  681. $input->SetBody($name);
  682. $input->SetOut_trade_no($orderSn);
  683. $input->SetTotal_fee($totalFee * 100);
  684. $input->SetTime_start(date("YmdHis", $now));
  685. $input->SetAttach($attach);
  686. //设置订单有效期5分钟
  687. $input->SetTime_expire(date("YmdHis", $expireTime));
  688. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  689. $input->SetTrade_type("JSAPI");
  690. //花卉宝代为申请的微信支付
  691. $merchantExtend = $this->sjExtend->attributes;
  692. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  693. $input->SetSub_openid($openId);
  694. } else {
  695. $input->SetOpenid($openId);
  696. }
  697. //小程序使用miniAppId
  698. if (httpUtil::isMiniProgram()) {
  699. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  700. }
  701. Yii::info('支付发起使用小程序信息' . json_encode($merchantExtend));
  702. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  703. $tools = new \JsApiPay();
  704. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  705. $newParams = json_decode($jsApiParameters, true);
  706. $newParams['orderId'] = $orderId;
  707. util::success($newParams);
  708. } elseif ($payWay == 1) {
  709. $extend = MerchantExtendService::getBySjId($sjId);
  710. if (isset($extend['alipayInit']) == false || $extend['alipayInit'] == 0) {
  711. util::fail('支付宝付款即将开通...');
  712. }
  713. $config = [
  714. //应用ID,您的APPID。
  715. 'app_id' => $extend['alipayPId'],
  716. //商户私钥,您的原始格式RSA私钥
  717. 'merchant_private_key' => $extend['alipayKey'],
  718. //异步通知地址
  719. 'notify_url' => Yii::$app->params['hdHost'] . "/notice/ali-callback",
  720. //同步跳转
  721. 'return_url' => "",
  722. //编码格式
  723. 'charset' => "UTF-8",
  724. //签名方式
  725. 'sign_type' => "RSA2",
  726. //支付宝网关
  727. 'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
  728. //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  729. 'alipay_public_key' => $extend['alipayPublicKey'],
  730. ];
  731. Yii::info(json_encode($config) . ' aplipay config');
  732. $alipayWap = Yii::getAlias("@vendor/alipayWap");
  733. require_once($alipayWap . '/wappay/service/AlipayTradeService.php');
  734. require_once($alipayWap . '/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php');
  735. $totalFee = $order['realPrice'];
  736. $out_trade_no = $orderSn;//商户订单号,商户网站订单系统中唯一订单号,必填
  737. $subject = '购买商品';//订单名称,必填
  738. $total_amount = $totalFee;//付款金额,必填
  739. $body = '';//商品描述,可空
  740. $timeout_express = "1m";//超时时间
  741. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  742. $passBackParams = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&sjId=' . $sjId;//将流水类型、优惠卷传过去
  743. $passBackParams = urlencode($passBackParams);
  744. $payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
  745. $payRequestBuilder->setBody($body);
  746. $payRequestBuilder->setSubject($subject);
  747. $payRequestBuilder->setOutTradeNo($out_trade_no);
  748. $payRequestBuilder->setTotalAmount($total_amount);
  749. $payRequestBuilder->setTimeExpress($timeout_express);
  750. //在异步通知时将该参数原样返回
  751. $payRequestBuilder->setPassbackParams($passBackParams);
  752. //同步通知
  753. $returnUrl = Yii::$app->params['mallDomain'] . "/#/pages/callback/success?account={$sjId}&shopId={$shopId}&orderSn={$orderSn}&totalPrice={$totalFee}&pageStatus=3&payDiscountPrice=0&payDiscountType=0";
  754. //异步通知
  755. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/ali-callback";
  756. $payResponse = new \AlipayTradeService($config);
  757. $result = $payResponse->wapPay($payRequestBuilder, $returnUrl, $notifyUrl);
  758. //直接将支付宝的html返回给前端
  759. echo $result;
  760. } elseif ($payWay == 2) {
  761. //余额支付,验证支付密码是否正确
  762. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  763. $user = UserService::getUserInfo($this->adminId);
  764. UserService::validPayPassword($payPassword, $user);
  765. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  766. $callbackParams = [];
  767. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  768. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  769. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
  770. } else {
  771. util::fail('无效的支付方式');
  772. }
  773. }
  774. //订单评价
  775. public function actionComment()
  776. {
  777. $post = Yii::$app->request->post();
  778. $id = $post['id'];
  779. $order = OrderService::getById($id);
  780. OrderService::valid($order, $this->mainId);
  781. if ($order['grade'] > 0) {
  782. util::fail('您已经评过了');
  783. }
  784. OrderService::comment($post);
  785. util::complete('提交成功');
  786. }
  787. //订单详情 ssh 2019.12.16
  788. public function actionDetail()
  789. {
  790. $id = Yii::$app->request->get('id', 0);
  791. $detail = OrderClass::getFullInfo($id);
  792. OrderService::valid($detail, $this->mainId);
  793. util::success($detail);
  794. }
  795. public function actionList()
  796. {
  797. $get = Yii::$app->request->get();
  798. $search = isset($get['searchText']) ? $get['searchText'] : '';
  799. $searchType = isset($get['searchType']) && is_numeric($get['searchType']) ? $get['searchType'] : '';
  800. $shopId = $this->shopId ?? 0;
  801. if (empty($shopId)) {
  802. //没有登录不显示数据
  803. util::success(['list' => [], 'moreData' => 0, 'shop' => [], 'totalNum' => 0, 'totalPage' => 0]);
  804. }
  805. $where = [];
  806. $where['shopId'] = $shopId;
  807. $status = $get['status'] ?? 0;
  808. if (!empty($status)) {
  809. $where['status'] = $get['status'];
  810. }
  811. $debt = $get['debt'] ?? 2;
  812. if ($debt != 2) {
  813. $where['debt'] = $debt;
  814. }
  815. if (isset($get['shopAdminId']) && !empty($get['shopAdminId'])) {
  816. $where['shopAdminId'] = $get['shopAdminId'];
  817. }
  818. if (!empty($search)) {
  819. if (is_numeric($searchType)) {
  820. if ($searchType == 0) {
  821. $where['actPrice'] = $search;
  822. } elseif ($searchType == 1) {
  823. $where['orderSn'] = $search;
  824. } elseif ($searchType == 2) {
  825. $where['bookMobile'] = $search;
  826. } elseif ($searchType == 3) {
  827. $where['customName'] = ['like', $search];
  828. } else {
  829. $where['actPrice'] = $search;
  830. }
  831. } else {
  832. //兼容旧版本
  833. if (stringUtil::isMobile($search)) {
  834. $where['bookMobile'] = $search;
  835. } else {
  836. $where['orderSn'] = strtoupper($search);
  837. }
  838. }
  839. }
  840. $searchTime = $get['searchTime'] ?? '';
  841. if (!empty($searchTime)) {
  842. $startTime = $get['startTime'] ?? '';
  843. $endTime = $get['endTime'] ?? '';
  844. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  845. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  846. }
  847. $list = OrderService::getOrderList($where);
  848. $list['shop'] = $this->shop->attributes ?? [];
  849. util::success($list);
  850. }
  851. //订单归类 ssh 2019.12.17
  852. public function actionClassify()
  853. {
  854. $post = Yii::$app->request->post();
  855. $id = isset($post['id']) ? $post['id'] : 0;
  856. $order = OrderService::getById($id);
  857. OrderService::valid($order, $this->mainId);
  858. $categoryId = isset($post['categoryId']) ? $post['categoryId'] : $post['categoryId'];
  859. $usageId = isset($post['usageId']) ? $post['usageId'] : $post['usageId'];
  860. OrderService::classify($id, $categoryId, $usageId);
  861. util::complete();
  862. }
  863. //更新配送单 ssh 2019.12.17
  864. public function actionUpdateSheet()
  865. {
  866. $post = Yii::$app->request->post();
  867. $id = isset($post['id']) ? $post['id'] : 0;
  868. unset($post['id']);
  869. $order = OrderService::getById($id);
  870. OrderService::valid($order, $this->mainId);
  871. OrderService::updateSheet($order, $post);
  872. util::complete('提交成功');
  873. }
  874. //商家收款与发货 ssh 2019.12.18
  875. public function actionGathering()
  876. {
  877. $post = Yii::$app->request->post();
  878. $price = isset($post['price']) && is_numeric($post['price']) ? $post['price'] : 0;
  879. $payWay = isset($post['payWay']) && is_numeric($post['payWay']) ? $post['payWay'] : 0;
  880. $userId = isset($post['userId']) ? $post['userId'] : 0;
  881. $userInfo = UserService::getById($userId);
  882. if (empty($userInfo) || $userInfo['sjId'] != $this->sjId) {
  883. util::fail('您选择的客户无效');
  884. }
  885. if ($price <= 0) {
  886. util::fail('请输入金额');
  887. }
  888. $post['prePrice'] = $price;
  889. $post['actPrice'] = $price;
  890. $post['payWay'] = $payWay;
  891. $post['sourceType'] = 1;
  892. $post['userId'] = $userId;
  893. $post['goodsNum'] = 1;
  894. $post['orderName'] = '商品';
  895. $shopId = MerchantService::getDefaultShopId($this->sj);
  896. $post['shopId'] = $shopId;
  897. $order = OrderService::addOrder($post);
  898. $id = $order['id'];
  899. $orderSn = $order['orderSn'];
  900. //流水类型列表
  901. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  902. $callbackParams = [];
  903. switch ($payWay) {
  904. case 0:
  905. xhPayToolService::wxPay($callbackParams, $orderSn, $price, $capitalType, 0);
  906. break;
  907. case 1:
  908. xhPayToolService::alipay($callbackParams, $orderSn, $price, $capitalType, 0, []);
  909. break;
  910. case 2:
  911. xhPayToolService::balancePay($callbackParams, $orderSn, $price, $capitalType, 0);
  912. break;
  913. default:
  914. util::fail('无效支付方式');
  915. }
  916. util::success($order);
  917. }
  918. //免发货管理 ssh 2020.1.6
  919. public function actionWithoutSend()
  920. {
  921. $id = Yii::$app->request->get('id');
  922. $order = OrderService::getById($id);
  923. OrderService::valid($order, $this->mainId);
  924. //配送流程变更
  925. $currentFlow = OrderSendClass::withoutSend($order);
  926. util::success(['currentFlow' => $currentFlow]);
  927. }
  928. //修改价格 ssh 2020.1.6
  929. public function actionUpdatePrice()
  930. {
  931. $id = Yii::$app->request->get('id');
  932. $price = Yii::$app->request->get('price', 1);
  933. $order = OrderService::getById($id);
  934. OrderService::valid($order, $this->mainId);
  935. if (isset($order['modPrice']) && $order['modPrice'] == 0) {
  936. util::fail('已发起支付,不能修改价格');
  937. }
  938. OrderService::updateById($id, ['actPrice' => $price]);
  939. util::complete('修改成功');
  940. }
  941. //配送单 ssh 2020.2.29
  942. public function actionGetDeliverDetail()
  943. {
  944. $id = Yii::$app->request->get('id', 0);
  945. $order = OrderService::getById($id);
  946. OrderService::valid($order, $this->mainId);
  947. $reachDate = isset($order['reachDate']) && !empty($order['reachDate']) ? $order['reachDate'] : '';
  948. $reachPeriodId = $order['reachPeriod'];
  949. $reachPeriodArr = [0 => '上午', 1 => '下午', 2 => '晚上'];
  950. $reachPeriod = isset($reachPeriodArr[$reachPeriodId]) ? $reachPeriodArr[$reachPeriodId] : '';
  951. $bookName = isset($order['bookName']) ? $order['bookName'] : '';
  952. $bookMobile = isset($order['bookMobile']) ? $order['bookMobile'] : '';
  953. if (isset($order['anonymity']) && $order['anonymity'] == 1) {
  954. $bookName = '--';
  955. $bookMobile = '--';
  956. }
  957. $data = [
  958. 'reachDate' => $reachDate . ' ' . $reachPeriod,
  959. 'orderSn' => $order['orderSn'],
  960. 'receiveUserName' => $order['receiveUserName'],
  961. 'receiveMobile' => $order['receiveMobile'],
  962. 'fullAddress' => $order['fullAddress'] . "(" . $order['showAddress'] . ")",
  963. 'cardInfo' => $order['cardInfo'],
  964. 'bookMobile' => $bookMobile,
  965. 'bookName' => $bookName,
  966. 'remark' => $order['remark'],
  967. 'sendNum' => $order['sendNum'],
  968. 'telephone' => 18030142050,
  969. 'printTime' => '',
  970. 'img' => '',
  971. ];
  972. util::success($data);
  973. }
  974. //运费计算 lqh 2021.4.12 暂反回固定
  975. public function actionFreight()
  976. {
  977. util::success(['sedCost' => 10]);
  978. }
  979. }