OrderController.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  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. noticeUtil::push($fullMsg . ' ' . $retCode . ' 编号008', '15280215347');
  353. util::success(['returnStatus' => 'FAILURE', 'returnCode' => $retCode], $msg);
  354. }
  355. } catch (\Exception $e) {
  356. $transaction->rollBack();
  357. util::fail('支付失败');
  358. }
  359. }
  360. //开单操作 ssh 20220316
  361. public function actionCreateOrder()
  362. {
  363. $post = Yii::$app->request->post();
  364. $post['sjId'] = $this->sjId;
  365. $post['shopId'] = $this->shopId;
  366. $post['mainId'] = $this->mainId ?? 0;
  367. $now = time();
  368. $orderValidTime = getenv('ORDER_VALID_TIME') == false ? 600 : getenv('ORDER_VALID_TIME');
  369. $expireTime = $now + $orderValidTime;
  370. $post['deadline'] = $expireTime;
  371. $post['staffId'] = $this->shopAdminId ?? 0;
  372. $post['staffName'] = $this->shopAdmin->name ?? '';
  373. $post['flowerNum'] = isset($post['flowerNum']) && $post['flowerNum'] > 0 ? $post['flowerNum'] : 0;
  374. //默认情况开单员工和收款员工是同个人
  375. $staffId = $this->shopAdminId ?? 0;
  376. $staffName = $this->shopAdmin->name ?? '';
  377. if (isset($post['shopAdminId']) == false || empty($post['shopAdminId'])) {
  378. $post['shopAdminId'] = $staffId;
  379. $post['shopAdminName'] = $staffName;
  380. }
  381. if (isset($post['getStaffId']) == false || empty($post['getStaffId'])) {
  382. $post['getStaffId'] = $staffId;
  383. $post['getStaffName'] = $this->shopAdmin->name ?? '';
  384. }
  385. $groupId = isset($post['groupId']) && !empty($post['groupId']) ? $post['groupId'] : 0;
  386. $post['fromType'] = $post['fromType'] ?? 1;
  387. if ($post['fromType'] == dict::getDict('fromType', 'friend')) {
  388. if (isset($post['bookName']) == false || empty($post['bookName'])) {
  389. util::fail('请填写订花人姓名');
  390. }
  391. }
  392. $customId = isset($post['customId']) && $post['customId'] > 0 ? $post['customId'] : 0;
  393. if (empty($customId)) {
  394. $customId = $this->shop->defaultCustomId ?? 0;
  395. }
  396. $custom = CustomClass::getById($customId);
  397. if (empty($custom)) {
  398. util::fail('没有找到客户哦');
  399. }
  400. $post['customId'] = $customId;
  401. $customName = $custom['name'] ?? '';
  402. $post['customName'] = $customName;
  403. $post['customNamePy'] = stringUtil::py($customName);
  404. if (isset($post['receiveMobile']) && !empty($post['receiveMobile'])) {
  405. if (stringUtil::isMobile($post['receiveMobile']) == false) {
  406. util::fail('请填写正确的收花人手机号');
  407. }
  408. }
  409. if (isset($post['bookMobile']) && !empty($post['bookMobile'])) {
  410. if (stringUtil::isMobile($post['bookMobile']) == false) {
  411. util::fail('请填写正确的订花人手机号');
  412. }
  413. }
  414. $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay');
  415. if (isset($post['isCashier']) && $post['isCashier'] == 1) {
  416. //收银台开单默认到店自取
  417. $post['sendType'] = dict::getDict('sendType', 'shopGet');
  418. }
  419. $productJson = $post['product'] ?? '';
  420. $productList = [];
  421. if (!empty($productJson)) {
  422. $productList = json_decode($productJson, true);
  423. }
  424. if (empty($productList) && empty($groupId)) {
  425. //商家手机上开单并生成制作单
  426. if (isset($post['unitGoodsPrice']) && !empty($post['unitGoodsPrice'])) {
  427. $unitGoodsPrice = $post['unitGoodsPrice'];
  428. if (is_numeric($unitGoodsPrice) == false) {
  429. util::fail('请输入正确的单价');
  430. }
  431. $productList = GoodsClass::orderCreateGoods($post);
  432. }
  433. }
  434. if (empty($productList) && empty($groupId)) {
  435. if (isset($post['lsGoodsPrice']) == false || $post['lsGoodsPrice'] <= 0) {
  436. $lsGoodsPrice = $post['lsGoodsPrice'];
  437. if (is_numeric($lsGoodsPrice) == false) {
  438. util::fail('请输入正确的金额');
  439. }
  440. util::fail('请填写金额或选商品');
  441. }
  442. }
  443. $connection = Yii::$app->db;
  444. $transaction = $connection->beginTransaction();
  445. try {
  446. $post['product'] = $productList;
  447. //阿东开5支老是会出现5扎情况跟踪
  448. ProductClass::adStockCheck($this->shop, $productList);
  449. //3秒内不允许重复开单
  450. $staffId = $this->shopAdminId ?? 0;
  451. $cacheKey = 'hd_create_order_' . $staffId . '_' . $customId;
  452. $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
  453. if (!empty($has)) {
  454. util::fail('稍等5秒再开单');
  455. }
  456. Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
  457. $return = OrderService::createFinishOrder($post, $custom, $hasPay);
  458. $transaction->commit();
  459. //打印小票和语音播报
  460. $id = $return->id ?? 0;
  461. $order = OrderClass::getById($id, true);
  462. if ($order->fromType == 3 || $order->fromType == 4) {
  463. //除了客服号下单和美团下单,其它情况允许打小票
  464. } else {
  465. //前台打小票
  466. OrderClass::onlinePrint($order);
  467. }
  468. //前台提示收款多少钱
  469. ShopExtClass::hdGatheringReport($order);
  470. //前台提醒出示付款码
  471. if (isset($order->status) && $order->status == 1) {
  472. if (isset($post['isCashier']) && $post['isCashier'] == 1) {
  473. ShopExtClass::pleasePayReport($order);
  474. }
  475. }
  476. $shopId = $order->shopId ?? 0;
  477. $shop = ShopClass::getById($shopId, true);
  478. WxMessageClass::gatheringIncomeInform($shop, $order);
  479. //新制作单提示
  480. $shopExt = ShopExtClass::getByCondition(['shopId' => $this->shopId], true);
  481. ShopExtClass::newWorkRemind($shopExt, $order);
  482. util::success($return);
  483. } catch (\Exception $e) {
  484. $transaction->rollBack();
  485. Yii::error("失败原因:" . $e->getMessage());
  486. util::fail('下单失败');
  487. }
  488. }
  489. //下单要用到的相关信息 ssh 2019.12.6
  490. public function actionOrderRelate()
  491. {
  492. $regionTree = RegionService::tree();
  493. $shop = $this->shop->attributes;
  494. $freight = MerchantExtendService::getFreight($this->sjExtend);
  495. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  496. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $shop];
  497. util::success($out);
  498. }
  499. //余额支付 ssh 2019.12.6
  500. public function actionBalancePay()
  501. {
  502. $post = Yii::$app->request->post();
  503. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  504. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  505. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  506. $order = OrderService::getByOrderSn($orderSn);
  507. $userId = $this->adminId;
  508. $user = UserService::getUserInfo($userId);
  509. //验证支付密码是否正确
  510. UserService::validPayPassword($payPassword, $user);
  511. //支付前验证订单有效性
  512. OrderService::checkBeforePay($order);
  513. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  514. $totalFee = $order['prePrice'];
  515. $sourceType = 0;
  516. $discountData = OrderService::getDiscountPrice(['price' => $totalFee, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  517. $actPrice = $discountData['price'];
  518. $callbackParams = [];
  519. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  520. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  521. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'balance' => $balance]);
  522. }
  523. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  524. public function actionWxPay()
  525. {
  526. ini_set('date.timezone', 'Asia/Shanghai');
  527. $post = Yii::$app->request->post();
  528. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  529. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  530. $order = OrderService::getByOrderSn($orderSn);
  531. $orderId = $order['id'];
  532. //验证优惠券是否还有效
  533. if (!empty($couponId)) {
  534. CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
  535. }
  536. //支付前验证订单有效性
  537. OrderService::checkBeforePay($order);
  538. $name = isset($order['orderName']) && !empty($order['orderName']) ? $order['orderName'] : '购买商品';
  539. $totalFee = $order['realPrice'];
  540. //小程序使用miniOpenId
  541. if (httpUtil::isMiniProgram()) {
  542. $openId = $this->user['miniOpenId'];
  543. } else {
  544. $openId = $this->user['openId'];
  545. }
  546. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  547. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  548. $wxPayType = 0;
  549. if (httpUtil::isMiniProgram()) {
  550. $wxPayType = 1;
  551. }
  552. $attach = "couponId=" . $couponId . "&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
  553. //订单30分钟后过期
  554. $now = time();
  555. $expireTime = $now + 1800;
  556. $wx = Yii::getAlias("@vendor/weixin");
  557. require_once($wx . '/lib/WxPay.Api.php');
  558. require_once($wx . '/example/WxPay.JsApiPay.php');
  559. $input = new \WxPayUnifiedOrder();
  560. $input->SetBody($name);
  561. $input->SetOut_trade_no($orderSn);
  562. $input->SetTotal_fee($totalFee * 100);
  563. $input->SetTime_start(date("YmdHis", $now));
  564. $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
  565. $input->SetTime_expire(date("YmdHis", $expireTime));
  566. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  567. $input->SetTrade_type("JSAPI");
  568. //花卉宝代为申请的微信支付
  569. $merchantExtend = $this->sjExtend->attributes;
  570. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  571. $input->SetSub_openid($openId);
  572. } else {
  573. $input->SetOpenid($openId);
  574. }
  575. //小程序使用miniAppId
  576. if (httpUtil::isMiniProgram()) {
  577. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  578. }
  579. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  580. $tools = new \JsApiPay();
  581. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  582. $newParams = json_decode($jsApiParameters, true);
  583. //已请求微信不能修改价格
  584. $updateData = [];
  585. $updateData['modPrice'] = 0;
  586. if (empty($order['deadline'])) {
  587. $updateData['deadline'] = $expireTime;
  588. }
  589. OrderService::updateById($orderId, $updateData);
  590. util::success($newParams);
  591. }
  592. //快捷付款订单
  593. public function actionFastPay()
  594. {
  595. ini_set('date.timezone', 'Asia/Shanghai');
  596. $post = Yii::$app->request->post();
  597. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  598. $shopId = !empty($this->shopId) ? $this->shopId : ShopService::getDefaultShopId($this->sj);
  599. //验证门店是否有效
  600. $shopInfo = ShopService::getById($shopId);
  601. ShopService::valid($shopInfo, $this->sjId);
  602. $post['shopId'] = $shopId;
  603. //默认门店订单
  604. $store = isset($post['store']) ? $post['store'] : 1;
  605. $post['store'] = $store;
  606. //来源 0微信 1支付宝 2小程序 3朋友圈 4美团
  607. $sourceType = $this->isWx ? 0 : 1;
  608. if (httpUtil::isMiniProgram()) {
  609. $sourceType = 2;
  610. }
  611. $sourceType = isset($post['sourceType']) ? $post['sourceType'] : 0;
  612. //兼容旧系统sourceType=3表示朋友圈来源
  613. $fromType = $sourceType == 3 ? 2 : 0;
  614. $fromType = isset($post['fromType']) && !empty($post['fromType']) ? $post['fromType'] : $fromType;
  615. $post['userId'] = $this->adminId;
  616. $custom = $this->custom;
  617. $post['bookName'] = $custom['userName'] ?? '';
  618. $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  619. $bookMobile = empty($bookMobile) && isset($custom['mobile']) && !empty($custom['mobile']) ? $custom['mobile'] : $bookMobile;
  620. $post['bookMobile'] = $bookMobile;
  621. $prePrice = round($post['prePrice'], 2);
  622. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  623. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  624. $actPrice = $discountData['price'];
  625. $post['discountType'] = $discountData['discountType'];
  626. $post['discountAmount'] = $discountData['discountAmount'];
  627. $post['actPrice'] = $actPrice;
  628. $post['realPrice'] = $actPrice;
  629. $post['payStyle'] = 0;
  630. $post['sjId'] = $this->sjId;
  631. $now = time();
  632. $expireTime = $now + 300;//订单5分钟后过期
  633. $post['createTime'] = date("Y-m-d H:i:s", $now);
  634. $post['deadline'] = $expireTime;
  635. if ($actPrice <= 0) {
  636. util::fail('请填写正确的金额');
  637. }
  638. //微信支付订单提交不能修改价格
  639. $post['modPrice'] = $this->isWx ? 0 : 1;
  640. $post['sourceType'] = $sourceType;
  641. $post['goodsNum'] = 1;
  642. $post['fromType'] = $fromType;
  643. $order = OrderService::addOrder($post);
  644. $orderId = $order['id'];
  645. $orderSn = $order['orderSn'];
  646. $sjId = $this->sjId;
  647. if ($payWay == 0) {
  648. $orderId = $order['id'];
  649. $name = '购买商品';
  650. $totalFee = $actPrice;
  651. $user = UserService::getById($this->adminId);
  652. $openId = isset($user['openId']) ? $user['openId'] : 0;
  653. if (httpUtil::isMiniProgram()) {
  654. //小程序使用miniOpenId
  655. $openId = $user['miniOpenId'];
  656. }
  657. if (empty($openId)) {
  658. util::fail('没有找到客户的openId');
  659. }
  660. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  661. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  662. $wxPayType = 0;
  663. if (httpUtil::isMiniProgram()) {
  664. $wxPayType = 1;
  665. }
  666. $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&wxPayType=' . $wxPayType;
  667. $wx = Yii::getAlias("@vendor/weixin");
  668. require_once($wx . '/lib/WxPay.Api.php');
  669. require_once($wx . '/example/WxPay.JsApiPay.php');
  670. $input = new \WxPayUnifiedOrder();
  671. $input->SetBody($name);
  672. $input->SetOut_trade_no($orderSn);
  673. $input->SetTotal_fee($totalFee * 100);
  674. $input->SetTime_start(date("YmdHis", $now));
  675. $input->SetAttach($attach);
  676. //设置订单有效期5分钟
  677. $input->SetTime_expire(date("YmdHis", $expireTime));
  678. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  679. $input->SetTrade_type("JSAPI");
  680. //花卉宝代为申请的微信支付
  681. $merchantExtend = $this->sjExtend->attributes;
  682. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  683. $input->SetSub_openid($openId);
  684. } else {
  685. $input->SetOpenid($openId);
  686. }
  687. //小程序使用miniAppId
  688. if (httpUtil::isMiniProgram()) {
  689. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  690. }
  691. Yii::info('支付发起使用小程序信息' . json_encode($merchantExtend));
  692. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  693. $tools = new \JsApiPay();
  694. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  695. $newParams = json_decode($jsApiParameters, true);
  696. $newParams['orderId'] = $orderId;
  697. util::success($newParams);
  698. } elseif ($payWay == 1) {
  699. $extend = MerchantExtendService::getBySjId($sjId);
  700. if (isset($extend['alipayInit']) == false || $extend['alipayInit'] == 0) {
  701. util::fail('支付宝付款即将开通...');
  702. }
  703. $config = [
  704. //应用ID,您的APPID。
  705. 'app_id' => $extend['alipayPId'],
  706. //商户私钥,您的原始格式RSA私钥
  707. 'merchant_private_key' => $extend['alipayKey'],
  708. //异步通知地址
  709. 'notify_url' => Yii::$app->params['hdHost'] . "/notice/ali-callback",
  710. //同步跳转
  711. 'return_url' => "",
  712. //编码格式
  713. 'charset' => "UTF-8",
  714. //签名方式
  715. 'sign_type' => "RSA2",
  716. //支付宝网关
  717. 'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
  718. //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  719. 'alipay_public_key' => $extend['alipayPublicKey'],
  720. ];
  721. Yii::info(json_encode($config) . ' aplipay config');
  722. $alipayWap = Yii::getAlias("@vendor/alipayWap");
  723. require_once($alipayWap . '/wappay/service/AlipayTradeService.php');
  724. require_once($alipayWap . '/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php');
  725. $totalFee = $order['realPrice'];
  726. $out_trade_no = $orderSn;//商户订单号,商户网站订单系统中唯一订单号,必填
  727. $subject = '购买商品';//订单名称,必填
  728. $total_amount = $totalFee;//付款金额,必填
  729. $body = '';//商品描述,可空
  730. $timeout_express = "1m";//超时时间
  731. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  732. $passBackParams = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&sjId=' . $sjId;//将流水类型、优惠卷传过去
  733. $passBackParams = urlencode($passBackParams);
  734. $payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
  735. $payRequestBuilder->setBody($body);
  736. $payRequestBuilder->setSubject($subject);
  737. $payRequestBuilder->setOutTradeNo($out_trade_no);
  738. $payRequestBuilder->setTotalAmount($total_amount);
  739. $payRequestBuilder->setTimeExpress($timeout_express);
  740. //在异步通知时将该参数原样返回
  741. $payRequestBuilder->setPassbackParams($passBackParams);
  742. //同步通知
  743. $returnUrl = Yii::$app->params['mallDomain'] . "/#/pages/callback/success?account={$sjId}&shopId={$shopId}&orderSn={$orderSn}&totalPrice={$totalFee}&pageStatus=3&payDiscountPrice=0&payDiscountType=0";
  744. //异步通知
  745. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/ali-callback";
  746. $payResponse = new \AlipayTradeService($config);
  747. $result = $payResponse->wapPay($payRequestBuilder, $returnUrl, $notifyUrl);
  748. //直接将支付宝的html返回给前端
  749. echo $result;
  750. } elseif ($payWay == 2) {
  751. //余额支付,验证支付密码是否正确
  752. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  753. $user = UserService::getUserInfo($this->adminId);
  754. UserService::validPayPassword($payPassword, $user);
  755. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  756. $callbackParams = [];
  757. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  758. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  759. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
  760. } else {
  761. util::fail('无效的支付方式');
  762. }
  763. }
  764. //订单评价
  765. public function actionComment()
  766. {
  767. $post = Yii::$app->request->post();
  768. $id = $post['id'];
  769. $order = OrderService::getById($id);
  770. OrderService::valid($order, $this->mainId);
  771. if ($order['grade'] > 0) {
  772. util::fail('您已经评过了');
  773. }
  774. OrderService::comment($post);
  775. util::complete('提交成功');
  776. }
  777. //订单详情 ssh 2019.12.16
  778. public function actionDetail()
  779. {
  780. $id = Yii::$app->request->get('id', 0);
  781. $detail = OrderClass::getFullInfo($id);
  782. OrderService::valid($detail, $this->mainId);
  783. util::success($detail);
  784. }
  785. public function actionList()
  786. {
  787. $get = Yii::$app->request->get();
  788. $search = isset($get['searchText']) ? $get['searchText'] : '';
  789. $searchType = isset($get['searchType']) && is_numeric($get['searchType']) ? $get['searchType'] : '';
  790. $shopId = $this->shopId ?? 0;
  791. if (empty($shopId)) {
  792. //没有登录不显示数据
  793. util::success(['list' => [], 'moreData' => 0, 'shop' => [], 'totalNum' => 0, 'totalPage' => 0]);
  794. }
  795. $where = [];
  796. $where['shopId'] = $shopId;
  797. $status = $get['status'] ?? 0;
  798. if (!empty($status)) {
  799. $where['status'] = $get['status'];
  800. }
  801. $debt = $get['debt'] ?? 2;
  802. if ($debt != 2) {
  803. $where['debt'] = $debt;
  804. }
  805. if (isset($get['shopAdminId']) && !empty($get['shopAdminId'])) {
  806. $where['shopAdminId'] = $get['shopAdminId'];
  807. }
  808. if (!empty($search)) {
  809. if (is_numeric($searchType)) {
  810. if ($searchType == 0) {
  811. $where['actPrice'] = $search;
  812. } elseif ($searchType == 1) {
  813. $where['orderSn'] = $search;
  814. } elseif ($searchType == 2) {
  815. $where['bookMobile'] = $search;
  816. } elseif ($searchType == 3) {
  817. $where['customName'] = ['like', $search];
  818. } else {
  819. $where['actPrice'] = $search;
  820. }
  821. } else {
  822. //兼容旧版本
  823. if (stringUtil::isMobile($search)) {
  824. $where['bookMobile'] = $search;
  825. } else {
  826. $where['orderSn'] = strtoupper($search);
  827. }
  828. }
  829. }
  830. $searchTime = $get['searchTime'] ?? '';
  831. if (!empty($searchTime)) {
  832. $startTime = $get['startTime'] ?? '';
  833. $endTime = $get['endTime'] ?? '';
  834. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  835. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  836. }
  837. $list = OrderService::getOrderList($where);
  838. $list['shop'] = $this->shop->attributes ?? [];
  839. util::success($list);
  840. }
  841. //订单归类 ssh 2019.12.17
  842. public function actionClassify()
  843. {
  844. $post = Yii::$app->request->post();
  845. $id = isset($post['id']) ? $post['id'] : 0;
  846. $order = OrderService::getById($id);
  847. OrderService::valid($order, $this->mainId);
  848. $categoryId = isset($post['categoryId']) ? $post['categoryId'] : $post['categoryId'];
  849. $usageId = isset($post['usageId']) ? $post['usageId'] : $post['usageId'];
  850. OrderService::classify($id, $categoryId, $usageId);
  851. util::complete();
  852. }
  853. //更新配送单 ssh 2019.12.17
  854. public function actionUpdateSheet()
  855. {
  856. $post = Yii::$app->request->post();
  857. $id = isset($post['id']) ? $post['id'] : 0;
  858. unset($post['id']);
  859. $order = OrderService::getById($id);
  860. OrderService::valid($order, $this->mainId);
  861. OrderService::updateSheet($order, $post);
  862. util::complete('提交成功');
  863. }
  864. //商家收款与发货 ssh 2019.12.18
  865. public function actionGathering()
  866. {
  867. $post = Yii::$app->request->post();
  868. $price = isset($post['price']) && is_numeric($post['price']) ? $post['price'] : 0;
  869. $payWay = isset($post['payWay']) && is_numeric($post['payWay']) ? $post['payWay'] : 0;
  870. $userId = isset($post['userId']) ? $post['userId'] : 0;
  871. $userInfo = UserService::getById($userId);
  872. if (empty($userInfo) || $userInfo['sjId'] != $this->sjId) {
  873. util::fail('您选择的客户无效');
  874. }
  875. if ($price <= 0) {
  876. util::fail('请输入金额');
  877. }
  878. $post['prePrice'] = $price;
  879. $post['actPrice'] = $price;
  880. $post['payWay'] = $payWay;
  881. $post['sourceType'] = 1;
  882. $post['userId'] = $userId;
  883. $post['goodsNum'] = 1;
  884. $post['orderName'] = '商品';
  885. $shopId = MerchantService::getDefaultShopId($this->sj);
  886. $post['shopId'] = $shopId;
  887. $order = OrderService::addOrder($post);
  888. $id = $order['id'];
  889. $orderSn = $order['orderSn'];
  890. //流水类型列表
  891. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  892. $callbackParams = [];
  893. switch ($payWay) {
  894. case 0:
  895. xhPayToolService::wxPay($callbackParams, $orderSn, $price, $capitalType, 0);
  896. break;
  897. case 1:
  898. xhPayToolService::alipay($callbackParams, $orderSn, $price, $capitalType, 0, []);
  899. break;
  900. case 2:
  901. xhPayToolService::balancePay($callbackParams, $orderSn, $price, $capitalType, 0);
  902. break;
  903. default:
  904. util::fail('无效支付方式');
  905. }
  906. util::success($order);
  907. }
  908. //免发货管理 ssh 2020.1.6
  909. public function actionWithoutSend()
  910. {
  911. $id = Yii::$app->request->get('id');
  912. $order = OrderService::getById($id);
  913. OrderService::valid($order, $this->mainId);
  914. //配送流程变更
  915. $currentFlow = OrderSendClass::withoutSend($order);
  916. util::success(['currentFlow' => $currentFlow]);
  917. }
  918. //修改价格 ssh 2020.1.6
  919. public function actionUpdatePrice()
  920. {
  921. $id = Yii::$app->request->get('id');
  922. $price = Yii::$app->request->get('price', 1);
  923. $order = OrderService::getById($id);
  924. OrderService::valid($order, $this->mainId);
  925. if (isset($order['modPrice']) && $order['modPrice'] == 0) {
  926. util::fail('已发起支付,不能修改价格');
  927. }
  928. OrderService::updateById($id, ['actPrice' => $price]);
  929. util::complete('修改成功');
  930. }
  931. //配送单 ssh 2020.2.29
  932. public function actionGetDeliverDetail()
  933. {
  934. $id = Yii::$app->request->get('id', 0);
  935. $order = OrderService::getById($id);
  936. OrderService::valid($order, $this->mainId);
  937. $reachDate = isset($order['reachDate']) && !empty($order['reachDate']) ? $order['reachDate'] : '';
  938. $reachPeriodId = $order['reachPeriod'];
  939. $reachPeriodArr = [0 => '上午', 1 => '下午', 2 => '晚上'];
  940. $reachPeriod = isset($reachPeriodArr[$reachPeriodId]) ? $reachPeriodArr[$reachPeriodId] : '';
  941. $bookName = isset($order['bookName']) ? $order['bookName'] : '';
  942. $bookMobile = isset($order['bookMobile']) ? $order['bookMobile'] : '';
  943. if (isset($order['anonymity']) && $order['anonymity'] == 1) {
  944. $bookName = '--';
  945. $bookMobile = '--';
  946. }
  947. $data = [
  948. 'reachDate' => $reachDate . ' ' . $reachPeriod,
  949. 'orderSn' => $order['orderSn'],
  950. 'receiveUserName' => $order['receiveUserName'],
  951. 'receiveMobile' => $order['receiveMobile'],
  952. 'fullAddress' => $order['fullAddress'] . "(" . $order['showAddress'] . ")",
  953. 'cardInfo' => $order['cardInfo'],
  954. 'bookMobile' => $bookMobile,
  955. 'bookName' => $bookName,
  956. 'remark' => $order['remark'],
  957. 'sendNum' => $order['sendNum'],
  958. 'telephone' => 18030142050,
  959. 'printTime' => '',
  960. 'img' => '',
  961. ];
  962. util::success($data);
  963. }
  964. //运费计算 lqh 2021.4.12 暂反回固定
  965. public function actionFreight()
  966. {
  967. util::success(['sedCost' => 10]);
  968. }
  969. }