OrderController.php 44 KB

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