OrderController.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. <?php
  2. namespace mall\controllers;
  3. use biz\product\classes\ProductClass;
  4. use bizHd\custom\classes\HdClass;
  5. use bizHd\wx\classes\WxOpenClass;
  6. use bizMall\custom\classes\CustomClass;
  7. use bizMall\goods\classes\GoodsClass;
  8. use bizMall\goods\classes\GoodsSettingClass;
  9. use bizMall\item\classes\ItemClass;
  10. use bizMall\order\classes\OrderClass;
  11. use bizMall\order\classes\OrderForwardClass;
  12. use bizMall\order\classes\OrderItemClass;
  13. use bizMall\order\services\OrderService;
  14. use bizMall\promote\services\CouponService;
  15. use bizMall\saas\services\RegionService;
  16. use bizMall\shop\classes\MainClass;
  17. use bizMall\shop\classes\ShopExtClass;
  18. use bizMall\user\services\UserService;
  19. use common\components\dateUtil;
  20. use common\components\dict;
  21. use common\components\imgUtil;
  22. use common\components\noticeUtil;
  23. use common\components\orderSn;
  24. use common\components\stringUtil;
  25. use common\services\xhPayToolService;
  26. use Yii;
  27. use common\components\util;
  28. use common\components\lakala\Lakala;
  29. use common\components\IntraCityExpress;
  30. class OrderController extends BaseController
  31. {
  32. //二维码收款使用
  33. public $guestAccess = ['order-relate', 'fast-pay'];
  34. //记账单列表 ssh 20250627
  35. public function actionDebtList()
  36. {
  37. $get = Yii::$app->request->get();
  38. $id = $get['id'] ?? 0;
  39. $where = [];
  40. $where['userId'] = $this->userId;
  41. if (!empty($id)) {
  42. $hd = \bizMall\hd\classes\HdClass::getById($id, true);
  43. if (empty($hd)) {
  44. util::fail('无效的花店');
  45. }
  46. $where['hdId'] = $id;
  47. }
  48. $where['debt'] = 1;
  49. $searchTime = $get['searchTime'] ?? '';
  50. if (!empty($searchTime)) {
  51. $startTime = $get['startTime'] ?? '';
  52. $endTime = $get['endTime'] ?? '';
  53. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  54. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  55. }
  56. $respond = OrderClass::getDebtList($where);
  57. util::success($respond);
  58. }
  59. //新计算运费
  60. public function actionNewFreight()
  61. {
  62. $post = Yii::$app->request->post();
  63. $hasMap = dict::getDict('hasMap');
  64. if ($hasMap == 0) {
  65. util::fail('暂不支持跑腿功能');
  66. }
  67. $mainData = $this->main;
  68. $wxStoreId = $mainData->wxStoreId ?? '';
  69. if (empty($wxStoreId)) {
  70. util::fail('商家还没有开通跑腿');
  71. }
  72. $cargoName = $post['cargo_name']; // 商品名称
  73. $cargo = [
  74. 'cargo_name' => $cargoName, // 商品名称
  75. 'cargo_weight' => intval($post['weight'] * 1000), // 单位:克 -- 把千克转换为克 ---- 重量(用户未知)-- 大概
  76. 'cargo_price' => intval($post['price'] * 100), // 单位:分 -- 把元转换为分
  77. 'cargo_type' => IntraCityExpress::GOODS_TYPE_FLOWER,
  78. 'cargo_num' => intval($post['package_num'])
  79. ];
  80. $originalLng = doubleval($post['user_lng']);
  81. $originalLat = doubleval($post['user_lat']);
  82. $orderData = [
  83. 'wx_store_id' => $wxStoreId,
  84. 'user_name' => $post['user_name'],
  85. 'user_phone' => $post['user_phone'],
  86. 'user_lng' => $originalLng,
  87. 'user_lat' => $originalLat,
  88. 'user_address' => $post['user_address'],
  89. 'cargo' => $cargo,
  90. ];
  91. //多处有用到这个方法,需修改请同步修改,搜索关键词 intra_city_express_pre_add
  92. $result = IntraCityExpress::preAddOrder($orderData);
  93. if ($result['errcode'] === 0) {
  94. util::success($result, "查询成功");
  95. } else {
  96. Yii::error("运费查询失败:" . json_encode($result));
  97. util::fail('运费查询失败' . json_encode($result));
  98. }
  99. }
  100. //计算运费,请搜索关键词calc_freight,二个方法要合一起 ssh 20221014
  101. public function actionFreight()
  102. {
  103. $get = Yii::$app->request->get();
  104. $shop = $this->shop;
  105. $shopLat = isset($shop->lat) ? $shop->lat : '';
  106. $shopLong = isset($shop->long) ? $shop->long : '';
  107. // 判断地图功能是否正常。0 表示地图定位不可用,全部经纬度数据失效
  108. if (dict::getDict('hasMap') == 0) {
  109. $shopLat = '';
  110. $shopLong = '';
  111. }
  112. if (empty($shopLat) || empty($shopLong)) {
  113. util::success([
  114. 'distance' => 0,
  115. 'showDistance' => 0,
  116. 'fee' => 0,
  117. 'hasMap' => dict::getDict('hasMap'),
  118. 'shop' => 'fail' //门店引起的失败
  119. ]);
  120. }
  121. $userLat = $get['lat'] ?? '';
  122. $userLong = $get['long'] ?? '';
  123. if (empty($userLat) || empty($userLong)) {
  124. util::success([
  125. 'distance' => 0,
  126. 'showDistance' => 0,
  127. 'fee' => 0,
  128. 'hasMap' => dict::getDict('hasMap'),
  129. 'client' => 'fail' //用户端定位失败
  130. ]);
  131. }
  132. $weight = $get['weight'] ?? 0;
  133. if (empty($weight)) {
  134. util::success([
  135. 'distance' => 0,
  136. 'showDistance' => 0,
  137. 'fee' => 0,
  138. 'hasMap' => dict::getDict('hasMap'),
  139. 'weight' => 'fail' //重量不对
  140. ]);
  141. }
  142. //data: {distance: "321", showDistance: "0.3", fee: "12.00"}
  143. $respond = OrderClass::getDistanceFee($userLat, $userLong, $shopLat, $shopLong, $weight);
  144. util::success($respond);
  145. }
  146. //购买花材 ssh 20220511
  147. public function actionBuyItem()
  148. {
  149. $post = Yii::$app->request->post();
  150. $post['sjId'] = $this->sjId;
  151. $post['shopId'] = $this->shopId;
  152. $post['payWay'] = $this->isWx == true ? 0 : 1;
  153. $post['mainId'] = $this->mainId ?? 0;
  154. $post['userId'] = $this->userId ?? 0;
  155. //普莲花艺、叶上花、丰行、小武鲜花、九江云朵、源花汇、紫荆不能在花卉宝下单,多处要同步修改,关键词ls_mall_not_open
  156. $mainId = $this->mainId;
  157. if (getenv('YII_ENV') == 'production') {
  158. if (in_array($mainId, [40057, 7779, 42940, 26374, 10536, 65381])) {
  159. util::fail('暂时无法访问');
  160. }
  161. } else {
  162. if (in_array($mainId, [0, 1])) {
  163. util::fail('暂时无法访问');
  164. }
  165. }
  166. $hdId = $post['hdId'] ?? 0;
  167. $hd = HdClass::getById($hdId, true);
  168. if (empty($hd)) {
  169. util::fail('没有找到花店');
  170. }
  171. if ($hd->shopId != $this->shopId) {
  172. util::fail('不是你的花店');
  173. }
  174. $post['hdName'] = $hd->name ?? '';
  175. $customId = $hd->customId ?? 0;
  176. $custom = CustomClass::getById($customId, true);
  177. if (empty($custom)) {
  178. util::fail('没有找到客户');
  179. }
  180. $customName = $custom->name ?? '';
  181. $post['customId'] = $customId;
  182. $post['customName'] = $customName;
  183. $post['customNamePy'] = stringUtil::py($customName);
  184. $now = time();
  185. //订单30分钟后过期
  186. $expireTime = $now + 1800;
  187. $post['deadline'] = $expireTime;
  188. //商城
  189. $post['fromType'] = dict::getDict('fromType', 'mall');
  190. $productJson = $post['product'] ?? '';
  191. if (empty($productJson) && empty($groupId)) {
  192. util::fail('请选择商品');
  193. }
  194. $productList = json_decode($productJson, true);
  195. if (empty($productList)) {
  196. util::fail('请选择商品');
  197. }
  198. $ids = array_unique(array_filter(array_column($productList, 'productId')));
  199. $productInfoList = productClass::getByIds($ids, null, 'id');
  200. if (!empty($productInfoList)) {
  201. $presellData = [];
  202. $nowTime = strtotime(date("Y-m-d"));
  203. foreach ($productInfoList as $currentInfo) {
  204. if (!isset($currentInfo['mainId']) || $currentInfo['mainId'] != $this->mainId) {
  205. util::fail('只能选择同一家的商品哦');
  206. }
  207. $currentName = $currentInfo['name'] ?? '';
  208. $presell = $currentInfo['presell'] ?? 0;
  209. $presellData[] = $presell;
  210. if ($presell == 1) {
  211. if (empty($post['reachDate'])) {
  212. util::fail('请选择配送或取货日期');
  213. }
  214. $sendTimeWant = $post['reachDate'];
  215. if (strtotime($sendTimeWant) < $nowTime) {
  216. util::fail('不能选择过去时间');
  217. }
  218. $hasDateStr = $currentInfo['presellDate'] ?? [];
  219. $hasDate = explode(',', trim($hasDateStr));
  220. if (empty($hasDate)) {
  221. util::fail('预售日期有问题,请提醒门店');
  222. }
  223. if (!in_array(strtotime($sendTimeWant), $hasDate)) {
  224. util::fail("有预售花材在{$sendTimeWant}没到货");
  225. }
  226. $post['presell'] = 1;
  227. }
  228. }
  229. if (count($productInfoList) != count($ids)) {
  230. util::fail('存在无效商品');
  231. }
  232. $presellData = array_unique($presellData);
  233. if (count($presellData) > 1) {
  234. util::fail('预售和非预售花材不能一起下单');
  235. }
  236. } else {
  237. util::fail('花材不存在');
  238. }
  239. $connection = Yii::$app->db;
  240. $transaction = $connection->beginTransaction();
  241. try {
  242. $orderValidTime = !getenv('ORDER_VALID_TIME') ? 600 : getenv('ORDER_VALID_TIME');
  243. $post['deadline'] = time() + $orderValidTime;
  244. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : date("Y-m-d");
  245. $post['needPrint'] = dict::getDict('needPrint', 'need');
  246. $user = $this->user;
  247. $post['bookMobile'] = $user->mobile ?? '';
  248. $post['bookName'] = $user->name ?? '';
  249. $hasPay = 0;
  250. $modifyPrice = 0;
  251. //各个等级对应的price addPrice字段
  252. $priceMap = \bizGhs\custom\classes\CustomClass::$levelPriceKeyMap;
  253. $addPriceMap = \bizGhs\custom\classes\CustomClass::$levelAddPriceKeyMap;
  254. $totalWeight = 0;
  255. $totalNum = 0;
  256. foreach ($productList as $eleKey => $element) {
  257. $level = 0;
  258. $productId = $element['productId'];
  259. $current = $productInfoList[$productId];
  260. if (empty($current)) {
  261. util::fail('有商品信息没有找到');
  262. }
  263. $price = \bizGhs\product\classes\ProductClass::getFinalPrice($current, $level, $priceMap, $addPriceMap);
  264. $num = $element['num'] ?? 0;
  265. $currentTotal = bcmul($price, $num, 2);
  266. $modifyPrice = bcadd($modifyPrice, $currentTotal, 2);
  267. $productList[$eleKey]['unitPrice'] = $price;
  268. $weight = $current['weight'] ?? 0;
  269. $currentWeight = bcmul($num, $weight, 2);
  270. $totalWeight = bcadd($totalWeight, $currentWeight, 2);
  271. $totalNum = bcadd($totalNum, $num);
  272. }
  273. $post['product'] = $productList;
  274. //不能前端传运费过来,只能通过跑腿接口计算出来
  275. unset($post['sendCost']);
  276. if (isset($post['sendType']) && $post['sendType'] == 2) {
  277. $hasMap = dict::getDict('hasMap');
  278. if ($hasMap == 0) {
  279. util::fail('不能使用跑腿,请选其它方式');
  280. }
  281. $cargoName = '花材'; // 商品名称
  282. $cargo = [
  283. 'cargo_name' => $cargoName, // 商品名称
  284. 'cargo_weight' => intval($totalWeight * 1000), // 单位:克 -- 把千克转换为克 ---- 重量(用户未知)-- 大概
  285. 'cargo_price' => intval($modifyPrice * 100), // 单位:分 -- 把元转换为分
  286. 'cargo_type' => IntraCityExpress::GOODS_TYPE_FLOWER,
  287. 'cargo_num' => $totalNum
  288. ];
  289. $customName = $custom->name;
  290. $customMobile = $custom->mobile;
  291. if (empty($post['long']) || empty($post['lat'])) {
  292. util::fail('位置错误');
  293. }
  294. $originalLng = doubleval($post['long']);
  295. $originalLat = doubleval($post['lat']);
  296. $city = $post['city'] ?? '';
  297. $dist = $post['dist'] ?? '';
  298. $address = $post['address'] ?? '';
  299. $showAddress = $post['showAddress'] ?? '';
  300. $userAddress = $city . $dist . $address . "({$showAddress})";
  301. $main = $this->main;
  302. $shopLat = $shop->lat ?? '';
  303. $shopLong = $shop->long ?? '';
  304. if (empty($shopLat) || empty($shopLong)) {
  305. util::fail('商家门店地址定位未设置,编号263');
  306. }
  307. $wxStoreId = $main->wxStoreId ?? 0;
  308. if (empty($wxStoreId)) {
  309. util::fail('商家还没有开通跑腿功能');
  310. }
  311. $orderData = [
  312. 'wx_store_id' => $wxStoreId,
  313. 'user_name' => $customName,
  314. 'user_phone' => $customMobile,
  315. 'user_lng' => $originalLng,
  316. 'user_lat' => $originalLat,
  317. 'user_address' => $userAddress,
  318. 'cargo' => $cargo,
  319. ];
  320. //多处有用到这个方法,需修改请同步修改,搜索关键词 intra_city_express_pre_add
  321. $result = IntraCityExpress::preAddOrder($orderData);
  322. $errCode = $result['errcode'] ?? 1;
  323. if ($errCode != 0) {
  324. $errMsg = $result['errmsg'] ?? '';
  325. util::fail('获取运费错误:' . $errMsg);
  326. }
  327. $fee = $result['est_fee'] ?? 0;
  328. $distance = $result['distance'] ?? 0;
  329. $sendCost = bcdiv($fee, 100, 2);
  330. $post['sendCost'] = $sendCost;
  331. $post['sendDistance'] = $distance;
  332. noticeUtil::push("运费:{$sendCost} 重量:{$totalWeight} 距离:{$distance} 姓名:{$customName} 手机号 {$customMobile} 经纬 {$originalLng} {$originalLat} 金额:{$modifyPrice} 数量:{$totalNum}", '15280215347');
  333. $modifyPrice = bcadd($modifyPrice, $sendCost, 2);
  334. }
  335. $post['modifyPrice'] = $modifyPrice;
  336. //多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
  337. $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  338. if (isset($return->shopId)) {
  339. if ($return->shopId == 7610) {
  340. if ($return->actPrice < 200) {
  341. if ($return->sendType == 0) {
  342. util::fail('满200元支持送货上门');
  343. }
  344. }
  345. }
  346. }
  347. if ($return->sendType == 2) {
  348. if (in_array($return->shopId, [2, 726, 1490, 13626, 7856, 7688])) {
  349. util::fail('暂时不能使用跑腿');
  350. }
  351. }
  352. $transaction->commit();
  353. $orderSn = $return->orderSn ?? '';
  354. $orderPrice = $return->orderPrice ?? 0;
  355. $id = $return->id ?? 0;
  356. $getPayType = dict::getDict('getPayType');
  357. util::success(['orderSn' => $orderSn, 'totalPrice' => $orderPrice, 'couponId' => 0, 'id' => $id, 'getPayType' => $getPayType]);
  358. } catch (\Exception $e) {
  359. $transaction->rollBack();
  360. Yii::error("失败原因:" . $e->getMessage());
  361. util::fail('下单失败');
  362. }
  363. }
  364. //商城下单操作 ssh 2019.12.3
  365. public function actionCreateOrder()
  366. {
  367. $post = Yii::$app->request->post();
  368. $goodsId = $post['goodsId'] ?? 0;
  369. $goodsNum = isset($post['goodsNum']) && $post['goodsNum'] > 0 ? $post['goodsNum'] : 1;
  370. $sendType = $post['sendType'] ?? dict::getDict('sendType', 'thirdSend');
  371. if (empty($goodsId)) {
  372. util::fail('请选择商品');
  373. }
  374. $mainId = $this->mainId;
  375. $goodsInfo = GoodsClass::getById($goodsId, true);
  376. if (empty($goodsInfo)) {
  377. util::fail('没有找到商品');
  378. }
  379. if ($goodsInfo->mainId != $mainId) {
  380. util::fail('不是你的商品');
  381. }
  382. $stock = $goodsInfo->stock ?? 0;
  383. if ($stock <= 0) {
  384. util::fail('库存不足');
  385. }
  386. //事务处理
  387. $connection = Yii::$app->db;
  388. $transaction = $connection->beginTransaction();
  389. try {
  390. $custom = $this->custom;
  391. if (empty($custom)) {
  392. util::fail('个人信息缺失');
  393. }
  394. $customId = $custom->id ?? 0;
  395. $hd = $this->hd;
  396. $post['customId'] = $customId;
  397. $customName = $custom->name ?? '';
  398. $post['customName'] = $customName;
  399. $post['customNamePy'] = stringUtil::py($customName);
  400. $post['hdId'] = $hd->id ?? 0;
  401. $post['hdName'] = $hd->name ?? '';
  402. $user = $this->user;
  403. $post['bookName'] = $user->name ?? '';
  404. $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  405. $bookMobile = empty($bookMobile) && !empty($user->mobile) ? $user->mobile : $bookMobile;
  406. $post['bookMobile'] = $bookMobile;
  407. $post['payWay'] = 0;
  408. $shop = $this->shop;
  409. $params = [];
  410. $goodsData = $goodsInfo->attributes;
  411. $ret = \bizHd\goods\classes\GoodsClass::getFinalPrice($goodsData, $shop, $custom, $params);
  412. $unitPrice = $ret['price'] ?? 0;
  413. if ($unitPrice <= 0) {
  414. util::fail('没有价格,不能下单哈');
  415. }
  416. //计算总金额
  417. $goodsPrice = $unitPrice * $goodsNum;
  418. //计算运费
  419. $sendDistance = 0;
  420. $sendCost = 0;
  421. if ($sendType == dict::getDict('sendType', 'thirdSend')) {
  422. if (dict::getDict('hasMap') == 0) {
  423. util::fail('不能使用跑腿,请选其它方式');
  424. }
  425. $lat = $post['lat'] ?? '';
  426. $lng = $post['long'] ?? '';
  427. if ((empty($lat) || empty($lng))) { // 当 hasMap 为1时,经纬数据是必要的
  428. util::fail('请填写正确地址');
  429. }
  430. $address = $post['address'] ?? '';
  431. $floor = $post['floor'] ?? '';
  432. $fullAddress = $address . $floor;
  433. $post['fullAddress'] = $fullAddress;
  434. $shopLat = $shop->lat ?? '';
  435. $shopLong = $shop->long ?? '';
  436. if (empty($shopLat) || empty($shopLong)) {
  437. util::fail('商家门店地址定位未设置,编号8966');
  438. }
  439. $weight = $goodsInfo->weight ?? 0;
  440. if ($weight <= 0) {
  441. util::fail('商品没有重量');
  442. }
  443. $totalWeight = bcmul($weight, $goodsNum, 2);
  444. $cargoName = '鲜花'; // 商品名称
  445. $cargo = [
  446. 'cargo_name' => $cargoName, // 商品名称
  447. 'cargo_weight' => intval($totalWeight * 1000), // 单位:克 -- 把千克转换为克 ---- 重量(用户未知)-- 大概
  448. 'cargo_price' => intval($goodsPrice * 100), // 单位:分 -- 把元转换为分
  449. 'cargo_type' => IntraCityExpress::GOODS_TYPE_FLOWER,
  450. 'cargo_num' => $goodsNum
  451. ];
  452. $customName = $custom->name;
  453. $customMobile = $custom->mobile;
  454. if (empty($post['long']) || empty($post['lat'])) {
  455. util::fail('位置错误');
  456. }
  457. $originalLng = doubleval($post['long']);
  458. $originalLat = doubleval($post['lat']);
  459. $city = $post['city'] ?? '';
  460. $dist = $post['dist'] ?? '';
  461. $address = $post['address'] ?? '';
  462. $showAddress = $post['showAddress'] ?? '';
  463. $userAddress = $city . $dist . $address . "({$showAddress})";
  464. $main = $this->main;
  465. $shopLat = $shop->lat ?? '';
  466. $shopLong = $shop->long ?? '';
  467. if (empty($shopLat) || empty($shopLong)) {
  468. util::fail('商家门店地址定位未设置,编号6880');
  469. }
  470. $wxStoreId = $main->wxStoreId ?? 0;
  471. if (empty($wxStoreId)) {
  472. util::fail('商家还没有开通跑腿功能');
  473. }
  474. $orderData = [
  475. 'wx_store_id' => $wxStoreId,
  476. 'user_name' => $customName,
  477. 'user_phone' => $customMobile,
  478. 'user_lng' => $originalLng,
  479. 'user_lat' => $originalLat,
  480. 'user_address' => $userAddress,
  481. 'cargo' => $cargo,
  482. ];
  483. //多处有用到这个方法,需修改请同步修改,搜索关键词 intra_city_express_pre_add
  484. $result = IntraCityExpress::preAddOrder($orderData);
  485. $errCode = $result['errcode'] ?? 1;
  486. if ($errCode != 0) {
  487. $errMsg = $result['errmsg'] ?? '';
  488. util::fail('获取运费错误:' . $errMsg);
  489. }
  490. $fee = $result['est_fee'] ?? 0;
  491. $sendDistance = $result['distance'] ?? 0;
  492. $sendCost = bcdiv($fee, 100, 2);
  493. //免运费的不收运费
  494. if ($goodsInfo->freightType == 1) {
  495. $sendCost = 0;
  496. }
  497. noticeUtil::push("运费:{$sendCost} 重量:{$totalWeight} 距离:{$sendDistance} 姓名:{$customName} 手机号 {$customMobile} 经纬 {$originalLng} {$originalLat} 金额:{$goodsPrice} 数量:{$goodsNum}", '15280215347');
  498. }
  499. $post['sendDistance'] = $sendDistance;
  500. $post['sendCost'] = $sendCost;
  501. $post['sjId'] = $this->sjId;
  502. $post['shopId'] = $this->shopId;
  503. $post['mainId'] = $mainId;
  504. $post['userId'] = $this->userId;
  505. if ($goodsInfo->priceType == 0) {
  506. util::fail('没有价格,不能下单');
  507. }
  508. $modifyPrice = stringUtil::calcAdd($sendCost, $goodsPrice);
  509. //非门店订单
  510. $post['store'] = 0;
  511. $post['modifyPrice'] = $modifyPrice;
  512. //非自取订单考虑配送时间
  513. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : date("Y-m-d");
  514. $sendType = $post['sendType'] ?? 0;
  515. if ($sendType != 1) {
  516. if (empty($post['reachPeriod'])) {
  517. util::fail('请选择配送时间哈');
  518. }
  519. $post['reachTime'] = strtotime($post['reachDate'] . ' ' . $post['reachPeriod']);
  520. }
  521. $now = time();
  522. $expireTime = $now + 1800;//订单30分钟后过期
  523. $post['deadline'] = $expireTime;
  524. $orderSn = orderSn::getOrderSn();
  525. $post['orderSn'] = $orderSn;
  526. $post['fromType'] = dict::getDict('fromType', 'mall');
  527. $post['cash'] = 0;
  528. $post['mainId'] = $mainId;
  529. $post['needPrint'] = dict::getDict('needPrint', 'need');
  530. $hasPay = 0;
  531. $product = [['productId' => $goodsId, 'unitType' => 0, 'property' => 0, 'unitPrice' => $unitPrice, 'num' => $goodsNum]];
  532. $post['product'] = $product;
  533. $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  534. $orderId = $return->id;
  535. $orderSn = $return->orderSn;
  536. $actPrice = $return->actPrice ?? 0;
  537. $transaction->commit();
  538. util::success(['orderSn' => $orderSn, 'totalPrice' => $actPrice, 'couponId' => 0, 'id' => $orderId]);
  539. } catch (Exception $e) {
  540. $transaction->rollBack();
  541. Yii::info("失败原因:" . $e->getMessage());
  542. util::fail('下单失败');
  543. }
  544. }
  545. //下单要用到的相关信息 ssh 2019.12.6
  546. public function actionOrderRelate()
  547. {
  548. $regionTree = RegionService::tree();
  549. //门店名称
  550. $shop = !empty($this->shop) ? $this->shop->attributes : [];
  551. $sjName = $shop['merchantName'] ?? '';
  552. $shopName = $shop['shopName'] ?? '';
  553. $shop['showName'] = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
  554. $avatar = $shop['avatar'] ?? '';
  555. $smallAvatar = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  556. $shop['smallAvatar'] = $smallAvatar;
  557. $freight = ['first' => 5, 'add' => 2];
  558. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  559. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
  560. util::success($out);
  561. }
  562. //余额支付 ssh 20250410
  563. public function actionBalancePay()
  564. {
  565. $post = Yii::$app->request->post();
  566. $orderSn = $post['orderSn'] ?? '';
  567. //避免重复提交
  568. util::checkRepeatCommit($orderSn, 10);
  569. $connection = Yii::$app->db;
  570. $transaction = $connection->beginTransaction();
  571. try {
  572. $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
  573. if (empty($order)) {
  574. util::fail('没有找到订单');
  575. }
  576. if ($order->shopId != $this->shopId) {
  577. util::fail('不是你的订单');
  578. }
  579. $payWay = dict::getDict('payWay', 'balancePay');
  580. \bizHd\order\classes\OrderClass::payAfter($order, $payWay);
  581. $transaction->commit();
  582. util::complete('支付成功');
  583. } catch (\Exception $e) {
  584. $transaction->rollBack();
  585. Yii::error("支付原因:" . $e->getMessage());
  586. util::fail('支付失败');
  587. }
  588. }
  589. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  590. public function actionWxPay()
  591. {
  592. ini_set('date.timezone', 'Asia/Shanghai');
  593. $post = Yii::$app->request->post();
  594. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  595. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  596. $order = OrderService::getByOrderSn($orderSn);
  597. $orderId = $order['id'];
  598. //验证优惠券是否还有效
  599. if (!empty($couponId)) {
  600. CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
  601. }
  602. //支付前验证订单有效性
  603. OrderService::checkBeforePay($order);
  604. $name = !empty($order['orderName']) ? $order['orderName'] : '购买花材';
  605. $shop = $this->shop;
  606. if (empty($shop)) {
  607. util::fail('没有找到门店信息');
  608. }
  609. if (isset($shop->shopName) && !empty($shop->shopName)) {
  610. $name .= '(' . $shop->shopName . ')';
  611. }
  612. $totalFee = $order['mainPay'];
  613. $openId = '';
  614. if (!empty($post['miniOpenId'])) {
  615. $openId = $post['miniOpenId'];
  616. //noticeUtil::push('散客买花时,通过前端获取了openId:' . $openId, '15280215347');
  617. }
  618. if (empty($openId)) {
  619. if (isset($this->user['miniOpenId']) && !empty($this->user['miniOpenId'])) {
  620. $openId = $this->user['miniOpenId'];
  621. //noticeUtil::push('散客买花时,通过数据库获取了openId:' . $openId, '15280215347');
  622. }
  623. }
  624. if (empty($openId)) {
  625. util::fail('没有找到openId');
  626. }
  627. $now = time();
  628. $expireTime = $now + 1800;
  629. $updateData = [];
  630. if (isset($order['modPrice']) && $order['modPrice'] == 0) {
  631. $oldOrderSn = $orderSn;
  632. //老单号需要关单,否则有付款成功的风险,老单号关闭成功了,才能生成新单号
  633. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  634. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  635. $params = [
  636. 'appid' => 'OP00002119',
  637. 'serial_no' => '018b08cfddbd',
  638. 'merchant_no' => $shop->lklSjNo,
  639. 'term_no' => $shop->lklScanTermNo,
  640. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  641. 'lklCertificatePath' => $lklCertificatePath,
  642. ];
  643. $laResource = new Lakala($params);
  644. $closeParams = [
  645. 'orderSn' => $oldOrderSn,
  646. ];
  647. $response = $laResource->close($closeParams);
  648. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  649. $msg = $response['msg'] ?? '';
  650. $lklSjNo = $shop->lklSjNo ?? '';
  651. noticeUtil::push('重点注意,散客买花更换单号没有成功,单号:' . $oldOrderSn . ',关单没有成功,' . $msg . '。商户号:' . $lklSjNo, '15280215347');
  652. util::fail('出错了哦,请重新下一单');
  653. }
  654. $orderSn = orderSn::getOrderSn();
  655. $updateData['orderSn'] = $orderSn;
  656. OrderItemClass::updateByCondition(['orderSn' => $oldOrderSn], ['orderSn' => $orderSn]);
  657. } else {
  658. //已请求的不能再修改价格
  659. $updateData['modPrice'] = 0;
  660. }
  661. if (empty($order['deadline'])) {
  662. $updateData['deadline'] = $expireTime;
  663. }
  664. if (!empty($updateData)) {
  665. OrderService::updateById($orderId, $updateData);
  666. }
  667. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  668. $sjExtend = WxOpenClass::getMallWxInfo();
  669. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  670. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  671. $params = [
  672. 'appid' => 'OP00002119',
  673. 'serial_no' => '018b08cfddbd',
  674. 'merchant_no' => $shop->lklSjNo,
  675. 'term_no' => $shop->lklScanTermNo,
  676. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  677. 'lklCertificatePath' => $lklCertificatePath,
  678. ];
  679. $laResource = new Lakala($params);
  680. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  681. $wxParams = [
  682. 'orderSn' => $orderSn,
  683. 'amount' => $totalFee,
  684. 'capitalType' => $capitalType,
  685. 'notifyUrl' => $notifyUrl,
  686. 'wxAppId' => $sjExtend['miniAppId'],
  687. 'openId' => $openId,
  688. 'subject' => $name,
  689. 'couponId' => $couponId,
  690. ];
  691. $response = $laResource->driveWxPay($wxParams);
  692. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  693. $errMsg = $response['msg'] ?? '';
  694. noticeUtil::push($errMsg, '15280215347');
  695. util::fail('支付失败');
  696. }
  697. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  698. $appId = $newParams['app_id'] ?? '';
  699. $nonceStr = $newParams['nonce_str'] ?? '';
  700. $paySign = $newParams['pay_sign'] ?? '';
  701. $package = $newParams['package'] ?? '';
  702. $signType = $newParams['sign_type'] ?? '';
  703. $timeStamp = $newParams['time_stamp'] ?? '';
  704. $new = [
  705. 'id' => $orderId,
  706. 'appId' => $appId,
  707. 'nonceStr' => $nonceStr,
  708. 'paySign' => $paySign,
  709. 'package' => $package,
  710. 'signType' => $signType,
  711. 'timeStamp' => $timeStamp,
  712. 'orderSn' => $orderSn,
  713. ];
  714. util::success($new);
  715. }
  716. //快捷付款订单
  717. public function actionFastPay()
  718. {
  719. ini_set('date.timezone', 'Asia/Shanghai');
  720. $post = Yii::$app->request->post();
  721. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  722. $shopId = $this->shopId;
  723. $shop = $this->shop;
  724. if (empty($shop)) {
  725. util::fail('没有门店信息');
  726. }
  727. $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  728. $gatheringItem = !empty($ext) ? $ext->gatheringItem : 0;
  729. if (empty($gatheringItem)) {
  730. util::fail('请设置付款用的商品');
  731. }
  732. $gatheringItemInfo = ItemClass::getById($gatheringItem, true);
  733. if (empty($gatheringItemInfo)) {
  734. util::fail('付款用的商品没有设置');
  735. }
  736. $ptItemId = $gatheringItemInfo->itemId ?? 0;
  737. $classId = $gatheringItemInfo->classId ?? 0;
  738. //收款码是否算收入由ext gatherRepeat决定
  739. $post['repeat'] = $ext->gatherRepeat ?? 0;
  740. $customId = $this->customId;
  741. $custom = $this->custom;
  742. $hdId = $this->hdId;
  743. $hd = $this->hd;
  744. if (!empty($customId) && !empty($hdId)) {
  745. //考虑没有登录时的付款
  746. $shop = $this->shop;
  747. $defaultCustomId = $shop->defaultCustomId ?? 0;
  748. if (empty($defaultCustomId)) {
  749. util::fail('请设置快捷开单的客户');
  750. }
  751. $customId = $defaultCustomId;
  752. $custom = CustomClass::getById($defaultCustomId, true);
  753. if (empty($custom)) {
  754. util::fail('请设置快捷客户');
  755. }
  756. $hdId = $custom->hdId;
  757. $hd = \bizMall\hd\classes\HdClass::getById($hdId, true);
  758. if (empty($hd)) {
  759. util::fail('没有花店信息呢!');
  760. }
  761. }
  762. $post['hdId'] = $hdId;
  763. $post['hdName'] = $hd->name ?? '';
  764. $customName = $custom->name ?? '';
  765. $customPy = $custom->py ?? '';
  766. $post['customName'] = $customName;
  767. $post['customNamePy'] = $customPy;
  768. $post['gatheringItem'] = $gatheringItem;
  769. $post['shopId'] = $shopId;
  770. $post['mainId'] = $this->mainId;
  771. $post['sjId'] = $this->sjId;
  772. $post['store'] = 0;
  773. $post['customId'] = $customId;
  774. $user = isset($this->user->attributes) ? $this->user->attributes : [];
  775. $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
  776. $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  777. $bookMobile = empty($bookMobile) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
  778. $post['bookMobile'] = $bookMobile;
  779. $prePrice = round($post['prePrice'], 2);
  780. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  781. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => 0, 'couponId' => $couponId, 'userId' => $this->userId]);
  782. $actPrice = $discountData['price'];
  783. $post['discountType'] = $discountData['discountType'];
  784. $post['discountAmount'] = $discountData['discountAmount'];
  785. $post['orderPrice'] = $actPrice;
  786. $post['actPrice'] = $actPrice;
  787. $post['realPrice'] = $actPrice;
  788. $post['mainPay'] = $actPrice;
  789. $post['modifyPrice'] = $actPrice;
  790. $post['userId'] = $this->userId;
  791. $post['needPrint'] = dict::getDict('needPrint', 'noNeed');
  792. $now = time();
  793. $expireTime = $now + 300;//订单5分钟后过期
  794. $post['createTime'] = date("Y-m-d H:i:s", $now);
  795. $post['deadline'] = $expireTime;
  796. if ($actPrice <= 0) {
  797. util::fail('请填写付款金额');
  798. }
  799. $post['goodsNum'] = 1;
  800. $product = [[
  801. 'productId' => $gatheringItem,
  802. 'bigNum' => 1,
  803. 'smallNum' => '',
  804. 'num' => 1,
  805. 'unitType' => 0,
  806. 'property' => 1,
  807. 'unitPrice' => $actPrice,
  808. 'itemId' => $ptItemId,
  809. 'classId' => $classId
  810. ]];
  811. $post['product'] = $product;
  812. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
  813. $post['onlinePay'] = dict::getDict('onlinePay', 'yes');
  814. //前端未修改时这边做兼容
  815. if (!empty($post['receiveAddress'])) {
  816. $post['address'] = $post['receiveAddress'];
  817. if (!empty($post['receiveProvince'])) {
  818. $post['province'] = $post['receiveProvince'];
  819. }
  820. if (!empty($post['receiveCity'])) {
  821. $post['city'] = $post['receiveCity'];
  822. }
  823. if (!empty($post['receiveFloor'])) {
  824. $post['floor'] = $post['receiveFloor'];
  825. }
  826. if (!empty($post['latitude'])) {
  827. $post['lat'] = $post['latitude'];
  828. }
  829. if (!empty($post['longitude'])) {
  830. $post['long'] = $post['longitude'];
  831. }
  832. $city = $post['receiveCity'] ?? '';
  833. $address = $post['receiveAddress'];
  834. $floor = $post['receiveFloor'] ?? '';
  835. $post['fullAddress'] = $city . $address . $floor;
  836. }
  837. $hasPay = 0;
  838. $post['sendType'] = 1;
  839. $post['orderType'] = 2;//花材订单
  840. $post['dealPrice'] = 1;
  841. $post['fromType'] = 1;
  842. $order = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  843. $orderId = $order->id ?? 0;
  844. $orderSn = $order->orderSn ?? '';
  845. if ($payWay == 0) {
  846. //微信
  847. $name = '购买商品';
  848. $totalFee = $actPrice;
  849. $user = UserService::getById($this->userId);
  850. //小程序使用miniOpenId
  851. $openId = $user['miniOpenId'];
  852. if (empty($openId)) {
  853. $openId = !empty($post['miniOpenId']) ? $post['miniOpenId'] : '';
  854. }
  855. if (empty($openId)) {
  856. util::fail('没有微信信息');
  857. }
  858. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  859. $sjExtend = WxOpenClass::getMallWxInfo();
  860. $shop = $this->shop;
  861. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  862. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  863. $params = [
  864. 'appid' => 'OP00002119',
  865. 'serial_no' => '018b08cfddbd',
  866. 'merchant_no' => $shop->lklSjNo,
  867. 'term_no' => $shop->lklScanTermNo,
  868. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  869. 'lklCertificatePath' => $lklCertificatePath,
  870. ];
  871. $laResource = new Lakala($params);
  872. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  873. $wxParams = [
  874. 'orderSn' => $orderSn,
  875. 'amount' => $totalFee,
  876. 'capitalType' => $capitalType,
  877. 'notifyUrl' => $notifyUrl,
  878. 'wxAppId' => $sjExtend['miniAppId'],
  879. 'openId' => $openId,
  880. 'subject' => $name,
  881. 'couponId' => $couponId,
  882. ];
  883. $response = $laResource->driveWxPay($wxParams);
  884. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  885. $errMsg = $response['msg'] ?? '';
  886. noticeUtil::push($errMsg, '15280215347');
  887. util::fail('支付失败');
  888. }
  889. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  890. $appId = $newParams['app_id'] ?? '';
  891. $nonceStr = $newParams['nonce_str'] ?? '';
  892. $paySign = $newParams['pay_sign'] ?? '';
  893. $package = $newParams['package'] ?? '';
  894. $signType = $newParams['sign_type'] ?? '';
  895. $timeStamp = $newParams['time_stamp'] ?? '';
  896. $new = [
  897. 'id' => $orderId,
  898. 'appId' => $appId,
  899. 'nonceStr' => $nonceStr,
  900. 'paySign' => $paySign,
  901. 'package' => $package,
  902. 'signType' => $signType,
  903. 'timeStamp' => $timeStamp,
  904. 'orderSn' => $orderSn,
  905. ];
  906. util::success($new);
  907. } elseif ($payWay == 1) {
  908. //支付宝
  909. $totalFee = $actPrice;
  910. $subject = '购买花材';
  911. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  912. $shop = $this->shop;
  913. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  914. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  915. $params = [
  916. 'appid' => 'OP00002119',
  917. 'serial_no' => '018b08cfddbd',
  918. 'merchant_no' => $shop->lklSjNo,
  919. 'term_no' => $shop->lklB2BTermNo,
  920. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  921. 'lklCertificatePath' => $lklCertificatePath,
  922. ];
  923. $laResource = new Lakala($params);
  924. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/cash-pay-callback";
  925. $cashParams = [
  926. 'orderSn' => $orderSn,
  927. 'amount' => $totalFee,
  928. 'capitalType' => $capitalType,
  929. 'notifyUrl' => $notifyUrl,
  930. 'subject' => $subject,
  931. ];
  932. $response = $laResource->cashierPay($cashParams);
  933. if (!isset($response['code']) || $response['code'] != '000000') {
  934. util::fail('支付失败了');
  935. }
  936. $url = $response['resp_data']['counter_url'] ? $response['resp_data']['counter_url'] : '';
  937. if (empty($url)) {
  938. util::fail('支付失败');
  939. }
  940. util::success(['url' => $url]);
  941. } elseif ($payWay == 2) {
  942. util::fail('无效的支付方式');
  943. //余额支付,验证支付密码是否正确
  944. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  945. $user = UserService::getUserInfo($this->userId);
  946. UserService::validPayPassword($payPassword, $user);
  947. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  948. $callbackParams = [];
  949. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  950. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  951. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
  952. } else {
  953. util::fail('无效的支付方式');
  954. }
  955. }
  956. //订单列表 ssh 2019.12.12
  957. public function actionList()
  958. {
  959. $get = Yii::$app->request->get();
  960. $status = $get['status'] ?? 0;
  961. $userId = $this->userId;
  962. $where = ['userId' => $userId];
  963. if (!empty($status)) {
  964. $where['status'] = $status;
  965. }
  966. $list = OrderService::getOrderList($where);
  967. util::success($list);
  968. }
  969. //订单评价
  970. public function actionComment()
  971. {
  972. $post = Yii::$app->request->post();
  973. $id = $post['id'];
  974. $order = OrderClass::getById($id);
  975. if ($order['grade'] > 0) {
  976. util::fail('您已经评过了');
  977. }
  978. OrderService::comment($post);
  979. util::complete('提交成功');
  980. }
  981. //订单详情 ssh 2019.12.16
  982. public function actionDetail()
  983. {
  984. $id = Yii::$app->request->get('id', 0);
  985. $detail = OrderClass::getOrderById($id);
  986. $userId = $this->userId;
  987. if ($detail['userId'] != $userId) {
  988. util::fail('不是你的单,不能查看');
  989. }
  990. $shOrderMap = [];
  991. if ($detail['hasForward'] == 1) {
  992. $shOrderMap = OrderForwardClass::getAllByCondition(['orderId' => $id], null, '*');
  993. }
  994. $detail['shOrderMap'] = $shOrderMap;
  995. util::success($detail);
  996. }
  997. //获取详情 ssh 20220512
  998. public function actionInfo()
  999. {
  1000. $sn = Yii::$app->request->get('orderSn', '');
  1001. $detail = OrderClass::getOrderBySn($sn);
  1002. util::success($detail);
  1003. }
  1004. }