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'] = 0;
  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. $shop = $this->shop;
  303. $shopLat = $shop->lat ?? '';
  304. $shopLong = $shop->long ?? '';
  305. if (empty($shopLat) || empty($shopLong)) {
  306. util::fail('商家门店地址定位未设置,编号263');
  307. }
  308. $wxStoreId = $main->wxStoreId ?? 0;
  309. if (empty($wxStoreId)) {
  310. util::fail('商家还没有开通跑腿功能');
  311. }
  312. $orderData = [
  313. 'wx_store_id' => $wxStoreId,
  314. 'user_name' => $customName,
  315. 'user_phone' => $customMobile,
  316. 'user_lng' => $originalLng,
  317. 'user_lat' => $originalLat,
  318. 'user_address' => $userAddress,
  319. 'cargo' => $cargo,
  320. ];
  321. //多处有用到这个方法,需修改请同步修改,搜索关键词 intra_city_express_pre_add
  322. $result = IntraCityExpress::preAddOrder($orderData);
  323. $errCode = $result['errcode'] ?? 1;
  324. if ($errCode != 0) {
  325. $errMsg = $result['errmsg'] ?? '';
  326. util::fail('获取运费错误:' . $errMsg);
  327. }
  328. $fee = $result['est_fee'] ?? 0;
  329. $distance = $result['distance'] ?? 0;
  330. $sendCost = bcdiv($fee, 100, 2);
  331. $post['sendCost'] = $sendCost;
  332. $post['sendDistance'] = $distance;
  333. noticeUtil::push("运费:{$sendCost} 重量:{$totalWeight} 距离:{$distance} 姓名:{$customName} 手机号 {$customMobile} 经纬 {$originalLng} {$originalLat} 金额:{$modifyPrice} 数量:{$totalNum}", '15280215347');
  334. $modifyPrice = bcadd($modifyPrice, $sendCost, 2);
  335. }
  336. $post['modifyPrice'] = $modifyPrice;
  337. //多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
  338. $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  339. if (isset($return->shopId)) {
  340. if ($return->shopId == 7610) {
  341. if ($return->actPrice < 200) {
  342. if ($return->sendType == 0) {
  343. util::fail('满200元支持送货上门');
  344. }
  345. }
  346. }
  347. }
  348. if ($return->sendType == 2) {
  349. if (in_array($return->shopId, [2, 726, 1490, 13626, 7856, 7688])) {
  350. util::fail('暂时不能使用跑腿');
  351. }
  352. }
  353. $transaction->commit();
  354. $orderSn = $return->orderSn ?? '';
  355. $orderPrice = $return->orderPrice ?? 0;
  356. $id = $return->id ?? 0;
  357. $getPayType = dict::getDict('getPayType');
  358. util::success(['orderSn' => $orderSn, 'totalPrice' => $orderPrice, 'couponId' => 0, 'id' => $id, 'getPayType' => $getPayType]);
  359. } catch (\Exception $e) {
  360. $transaction->rollBack();
  361. Yii::error("失败原因:" . $e->getMessage());
  362. util::fail('下单失败');
  363. }
  364. }
  365. //商城下单操作 ssh 2019.12.3
  366. public function actionCreateOrder()
  367. {
  368. $post = Yii::$app->request->post();
  369. $goodsId = $post['goodsId'] ?? 0;
  370. $goodsNum = isset($post['goodsNum']) && $post['goodsNum'] > 0 ? $post['goodsNum'] : 1;
  371. $sendType = $post['sendType'] ?? dict::getDict('sendType', 'thirdSend');
  372. if (empty($goodsId)) {
  373. util::fail('请选择商品');
  374. }
  375. $mainId = $this->mainId;
  376. $goodsInfo = GoodsClass::getById($goodsId, true);
  377. if (empty($goodsInfo)) {
  378. util::fail('没有找到商品');
  379. }
  380. if ($goodsInfo->mainId != $mainId) {
  381. util::fail('不是你的商品');
  382. }
  383. $stock = $goodsInfo->stock ?? 0;
  384. if ($stock <= 0) {
  385. util::fail('库存不足');
  386. }
  387. //事务处理
  388. $connection = Yii::$app->db;
  389. $transaction = $connection->beginTransaction();
  390. try {
  391. $custom = $this->custom;
  392. if (empty($custom)) {
  393. util::fail('个人信息缺失');
  394. }
  395. $customId = $custom->id ?? 0;
  396. $hd = $this->hd;
  397. $post['customId'] = $customId;
  398. $customName = $custom->name ?? '';
  399. $post['customName'] = $customName;
  400. $post['customNamePy'] = stringUtil::py($customName);
  401. $post['hdId'] = $hd->id ?? 0;
  402. $post['hdName'] = $hd->name ?? '';
  403. $user = $this->user;
  404. $post['bookName'] = $user->name ?? '';
  405. $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  406. $bookMobile = empty($bookMobile) && !empty($user->mobile) ? $user->mobile : $bookMobile;
  407. $post['bookMobile'] = $bookMobile;
  408. $post['payWay'] = 0;
  409. $shop = $this->shop;
  410. $params = [];
  411. $goodsData = $goodsInfo->attributes;
  412. $ret = \bizHd\goods\classes\GoodsClass::getFinalPrice($goodsData, $shop, $custom, $params);
  413. $unitPrice = $ret['price'] ?? 0;
  414. if ($unitPrice <= 0) {
  415. util::fail('没有价格,不能下单哈');
  416. }
  417. //计算总金额
  418. $goodsPrice = $unitPrice * $goodsNum;
  419. //计算运费
  420. $sendDistance = 0;
  421. $sendCost = 0;
  422. if ($sendType == dict::getDict('sendType', 'thirdSend')) {
  423. if (dict::getDict('hasMap') == 0) {
  424. util::fail('不能使用跑腿,请选其它方式');
  425. }
  426. $lat = $post['lat'] ?? '';
  427. $lng = $post['long'] ?? '';
  428. if ((empty($lat) || empty($lng))) { // 当 hasMap 为1时,经纬数据是必要的
  429. util::fail('请填写正确地址');
  430. }
  431. $address = $post['address'] ?? '';
  432. $floor = $post['floor'] ?? '';
  433. $fullAddress = $address . $floor;
  434. $post['fullAddress'] = $fullAddress;
  435. $shopLat = $shop->lat ?? '';
  436. $shopLong = $shop->long ?? '';
  437. if (empty($shopLat) || empty($shopLong)) {
  438. util::fail('商家门店地址定位未设置,编号8966');
  439. }
  440. $weight = $goodsInfo->weight ?? 0;
  441. if ($weight <= 0) {
  442. util::fail('商品没有重量');
  443. }
  444. $totalWeight = bcmul($weight, $goodsNum, 2);
  445. $cargoName = '鲜花'; // 商品名称
  446. $cargo = [
  447. 'cargo_name' => $cargoName, // 商品名称
  448. 'cargo_weight' => intval($totalWeight * 1000), // 单位:克 -- 把千克转换为克 ---- 重量(用户未知)-- 大概
  449. 'cargo_price' => intval($goodsPrice * 100), // 单位:分 -- 把元转换为分
  450. 'cargo_type' => IntraCityExpress::GOODS_TYPE_FLOWER,
  451. 'cargo_num' => $goodsNum
  452. ];
  453. $customName = $custom->name;
  454. $customMobile = $custom->mobile;
  455. if (empty($post['long']) || empty($post['lat'])) {
  456. util::fail('位置错误');
  457. }
  458. $originalLng = doubleval($post['long']);
  459. $originalLat = doubleval($post['lat']);
  460. $city = $post['city'] ?? '';
  461. $dist = $post['dist'] ?? '';
  462. $address = $post['address'] ?? '';
  463. $showAddress = $post['showAddress'] ?? '';
  464. $userAddress = $city . $dist . $address . "({$showAddress})";
  465. $main = $this->main;
  466. $shopLat = $shop->lat ?? '';
  467. $shopLong = $shop->long ?? '';
  468. if (empty($shopLat) || empty($shopLong)) {
  469. util::fail('商家门店地址定位未设置,编号6880');
  470. }
  471. $wxStoreId = $main->wxStoreId ?? 0;
  472. if (empty($wxStoreId)) {
  473. util::fail('商家还没有开通跑腿功能');
  474. }
  475. $orderData = [
  476. 'wx_store_id' => $wxStoreId,
  477. 'user_name' => $customName,
  478. 'user_phone' => $customMobile,
  479. 'user_lng' => $originalLng,
  480. 'user_lat' => $originalLat,
  481. 'user_address' => $userAddress,
  482. 'cargo' => $cargo,
  483. ];
  484. //多处有用到这个方法,需修改请同步修改,搜索关键词 intra_city_express_pre_add
  485. $result = IntraCityExpress::preAddOrder($orderData);
  486. $errCode = $result['errcode'] ?? 1;
  487. if ($errCode != 0) {
  488. $errMsg = $result['errmsg'] ?? '';
  489. util::fail('获取运费错误:' . $errMsg);
  490. }
  491. $fee = $result['est_fee'] ?? 0;
  492. $sendDistance = $result['distance'] ?? 0;
  493. $sendCost = bcdiv($fee, 100, 2);
  494. //免运费的不收运费
  495. if ($goodsInfo->freightType == 1) {
  496. $sendCost = 0;
  497. }
  498. noticeUtil::push("运费:{$sendCost} 重量:{$totalWeight} 距离:{$sendDistance} 姓名:{$customName} 手机号 {$customMobile} 经纬 {$originalLng} {$originalLat} 金额:{$goodsPrice} 数量:{$goodsNum}", '15280215347');
  499. }
  500. $post['sendDistance'] = $sendDistance;
  501. $post['sendCost'] = $sendCost;
  502. $post['sjId'] = $this->sjId;
  503. $post['shopId'] = $this->shopId;
  504. $post['mainId'] = $mainId;
  505. $post['userId'] = $this->userId;
  506. if ($goodsInfo->priceType == 0) {
  507. util::fail('没有价格,不能下单');
  508. }
  509. $modifyPrice = stringUtil::calcAdd($sendCost, $goodsPrice);
  510. //非门店订单
  511. $post['store'] = 0;
  512. $post['modifyPrice'] = $modifyPrice;
  513. //非自取订单考虑配送时间
  514. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : date("Y-m-d");
  515. $sendType = $post['sendType'] ?? 0;
  516. if ($sendType != 1) {
  517. if (empty($post['reachPeriod'])) {
  518. util::fail('请选择配送时间哈');
  519. }
  520. $post['reachTime'] = strtotime($post['reachDate'] . ' ' . $post['reachPeriod']);
  521. }
  522. $now = time();
  523. $expireTime = $now + 1800;//订单30分钟后过期
  524. $post['deadline'] = $expireTime;
  525. $orderSn = orderSn::getOrderSn();
  526. $post['orderSn'] = $orderSn;
  527. $post['fromType'] = dict::getDict('fromType', 'mall');
  528. $post['cash'] = 0;
  529. $post['mainId'] = $mainId;
  530. $post['needPrint'] = dict::getDict('needPrint', 'need');
  531. $hasPay = 0;
  532. $product = [['productId' => $goodsId, 'unitType' => 0, 'property' => 0, 'unitPrice' => $unitPrice, 'num' => $goodsNum]];
  533. $post['product'] = $product;
  534. $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  535. $orderId = $return->id;
  536. $orderSn = $return->orderSn;
  537. $actPrice = $return->actPrice ?? 0;
  538. $transaction->commit();
  539. util::success(['orderSn' => $orderSn, 'totalPrice' => $actPrice, 'couponId' => 0, 'id' => $orderId]);
  540. } catch (Exception $e) {
  541. $transaction->rollBack();
  542. Yii::info("失败原因:" . $e->getMessage());
  543. util::fail('下单失败');
  544. }
  545. }
  546. //下单要用到的相关信息 ssh 2019.12.6
  547. public function actionOrderRelate()
  548. {
  549. $regionTree = RegionService::tree();
  550. //门店名称
  551. $shop = !empty($this->shop) ? $this->shop->attributes : [];
  552. $sjName = $shop['merchantName'] ?? '';
  553. $shopName = $shop['shopName'] ?? '';
  554. $shop['showName'] = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
  555. $avatar = $shop['avatar'] ?? '';
  556. $smallAvatar = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  557. $shop['smallAvatar'] = $smallAvatar;
  558. $freight = ['first' => 5, 'add' => 2];
  559. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  560. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
  561. util::success($out);
  562. }
  563. //余额支付 ssh 20250410
  564. public function actionBalancePay()
  565. {
  566. $post = Yii::$app->request->post();
  567. $orderSn = $post['orderSn'] ?? '';
  568. //避免重复提交
  569. util::checkRepeatCommit($orderSn, 10);
  570. $connection = Yii::$app->db;
  571. $transaction = $connection->beginTransaction();
  572. try {
  573. $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
  574. if (empty($order)) {
  575. util::fail('没有找到订单');
  576. }
  577. if ($order->shopId != $this->shopId) {
  578. util::fail('不是你的订单');
  579. }
  580. $payWay = dict::getDict('payWay', 'balancePay');
  581. \bizHd\order\classes\OrderClass::payAfter($order, $payWay);
  582. $transaction->commit();
  583. util::complete('支付成功');
  584. } catch (\Exception $e) {
  585. $transaction->rollBack();
  586. Yii::error("支付原因:" . $e->getMessage());
  587. util::fail('支付失败');
  588. }
  589. }
  590. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  591. public function actionWxPay()
  592. {
  593. ini_set('date.timezone', 'Asia/Shanghai');
  594. $post = Yii::$app->request->post();
  595. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  596. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  597. $order = OrderService::getByOrderSn($orderSn);
  598. $orderId = $order['id'];
  599. //验证优惠券是否还有效
  600. if (!empty($couponId)) {
  601. CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
  602. }
  603. //支付前验证订单有效性
  604. OrderService::checkBeforePay($order);
  605. $name = !empty($order['orderName']) ? $order['orderName'] : '购买花材';
  606. $shop = $this->shop;
  607. if (empty($shop)) {
  608. util::fail('没有找到门店信息');
  609. }
  610. if (isset($shop->shopName) && !empty($shop->shopName)) {
  611. $name .= '(' . $shop->shopName . ')';
  612. }
  613. $totalFee = $order['mainPay'];
  614. $openId = '';
  615. if (!empty($post['miniOpenId'])) {
  616. $openId = $post['miniOpenId'];
  617. //noticeUtil::push('散客买花时,通过前端获取了openId:' . $openId, '15280215347');
  618. }
  619. if (empty($openId)) {
  620. if (isset($this->user['miniOpenId']) && !empty($this->user['miniOpenId'])) {
  621. $openId = $this->user['miniOpenId'];
  622. //noticeUtil::push('散客买花时,通过数据库获取了openId:' . $openId, '15280215347');
  623. }
  624. }
  625. if (empty($openId)) {
  626. util::fail('没有找到openId');
  627. }
  628. $now = time();
  629. $expireTime = $now + 1800;
  630. $updateData = [];
  631. if (isset($order['modPrice']) && $order['modPrice'] == 0) {
  632. $oldOrderSn = $orderSn;
  633. //老单号需要关单,否则有付款成功的风险,老单号关闭成功了,才能生成新单号
  634. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  635. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  636. $params = [
  637. 'appid' => 'OP00002119',
  638. 'serial_no' => '018b08cfddbd',
  639. 'merchant_no' => $shop->lklSjNo,
  640. 'term_no' => $shop->lklScanTermNo,
  641. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  642. 'lklCertificatePath' => $lklCertificatePath,
  643. ];
  644. $laResource = new Lakala($params);
  645. $closeParams = [
  646. 'orderSn' => $oldOrderSn,
  647. ];
  648. $response = $laResource->close($closeParams);
  649. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  650. $msg = $response['msg'] ?? '';
  651. $lklSjNo = $shop->lklSjNo ?? '';
  652. noticeUtil::push('重点注意,散客买花更换单号没有成功,单号:' . $oldOrderSn . ',关单没有成功,' . $msg . '。商户号:' . $lklSjNo, '15280215347');
  653. util::fail('出错了哦,请重新下一单');
  654. }
  655. $orderSn = orderSn::getOrderSn();
  656. $updateData['orderSn'] = $orderSn;
  657. OrderItemClass::updateByCondition(['orderSn' => $oldOrderSn], ['orderSn' => $orderSn]);
  658. } else {
  659. //已请求的不能再修改价格
  660. $updateData['modPrice'] = 0;
  661. }
  662. if (empty($order['deadline'])) {
  663. $updateData['deadline'] = $expireTime;
  664. }
  665. if (!empty($updateData)) {
  666. OrderService::updateById($orderId, $updateData);
  667. }
  668. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  669. $sjExtend = WxOpenClass::getMallWxInfo();
  670. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  671. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  672. $params = [
  673. 'appid' => 'OP00002119',
  674. 'serial_no' => '018b08cfddbd',
  675. 'merchant_no' => $shop->lklSjNo,
  676. 'term_no' => $shop->lklScanTermNo,
  677. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  678. 'lklCertificatePath' => $lklCertificatePath,
  679. ];
  680. $laResource = new Lakala($params);
  681. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  682. $wxParams = [
  683. 'orderSn' => $orderSn,
  684. 'amount' => $totalFee,
  685. 'capitalType' => $capitalType,
  686. 'notifyUrl' => $notifyUrl,
  687. 'wxAppId' => $sjExtend['miniAppId'],
  688. 'openId' => $openId,
  689. 'subject' => $name,
  690. 'couponId' => $couponId,
  691. ];
  692. $response = $laResource->driveWxPay($wxParams);
  693. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  694. $errMsg = $response['msg'] ?? '';
  695. noticeUtil::push($errMsg, '15280215347');
  696. util::fail('支付失败');
  697. }
  698. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  699. $appId = $newParams['app_id'] ?? '';
  700. $nonceStr = $newParams['nonce_str'] ?? '';
  701. $paySign = $newParams['pay_sign'] ?? '';
  702. $package = $newParams['package'] ?? '';
  703. $signType = $newParams['sign_type'] ?? '';
  704. $timeStamp = $newParams['time_stamp'] ?? '';
  705. $new = [
  706. 'id' => $orderId,
  707. 'appId' => $appId,
  708. 'nonceStr' => $nonceStr,
  709. 'paySign' => $paySign,
  710. 'package' => $package,
  711. 'signType' => $signType,
  712. 'timeStamp' => $timeStamp,
  713. 'orderSn' => $orderSn,
  714. ];
  715. util::success($new);
  716. }
  717. //快捷付款订单
  718. public function actionFastPay()
  719. {
  720. ini_set('date.timezone', 'Asia/Shanghai');
  721. $post = Yii::$app->request->post();
  722. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  723. $shopId = $this->shopId;
  724. $shop = $this->shop;
  725. if (empty($shop)) {
  726. util::fail('没有门店信息');
  727. }
  728. $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  729. $gatheringItem = !empty($ext) ? $ext->gatheringItem : 0;
  730. if (empty($gatheringItem)) {
  731. util::fail('请设置付款用的商品');
  732. }
  733. $gatheringItemInfo = ItemClass::getById($gatheringItem, true);
  734. if (empty($gatheringItemInfo)) {
  735. util::fail('付款用的商品没有设置');
  736. }
  737. $ptItemId = $gatheringItemInfo->itemId ?? 0;
  738. $classId = $gatheringItemInfo->classId ?? 0;
  739. //收款码是否算收入由ext gatherRepeat决定
  740. $post['repeat'] = $ext->gatherRepeat ?? 0;
  741. $customId = $this->customId;
  742. $custom = $this->custom;
  743. $hdId = $this->hdId;
  744. $hd = $this->hd;
  745. if (!empty($customId) && !empty($hdId)) {
  746. //考虑没有登录时的付款
  747. $shop = $this->shop;
  748. $defaultCustomId = $shop->defaultCustomId ?? 0;
  749. if (empty($defaultCustomId)) {
  750. util::fail('请设置快捷开单的客户');
  751. }
  752. $customId = $defaultCustomId;
  753. $custom = CustomClass::getById($defaultCustomId, true);
  754. if (empty($custom)) {
  755. util::fail('请设置快捷客户');
  756. }
  757. $hdId = $custom->hdId;
  758. $hd = \bizMall\hd\classes\HdClass::getById($hdId, true);
  759. if (empty($hd)) {
  760. util::fail('没有花店信息呢!');
  761. }
  762. }
  763. $post['hdId'] = $hdId;
  764. $post['hdName'] = $hd->name ?? '';
  765. $customName = $custom->name ?? '';
  766. $customPy = $custom->py ?? '';
  767. $post['customName'] = $customName;
  768. $post['customNamePy'] = $customPy;
  769. $post['gatheringItem'] = $gatheringItem;
  770. $post['shopId'] = $shopId;
  771. $post['mainId'] = $this->mainId;
  772. $post['sjId'] = $this->sjId;
  773. $post['store'] = 0;
  774. $post['customId'] = $customId;
  775. $user = isset($this->user->attributes) ? $this->user->attributes : [];
  776. $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
  777. $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  778. $bookMobile = empty($bookMobile) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
  779. $post['bookMobile'] = $bookMobile;
  780. $prePrice = round($post['prePrice'], 2);
  781. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  782. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => 0, 'couponId' => $couponId, 'userId' => $this->userId]);
  783. $actPrice = $discountData['price'];
  784. $post['discountType'] = $discountData['discountType'];
  785. $post['discountAmount'] = $discountData['discountAmount'];
  786. $post['orderPrice'] = $actPrice;
  787. $post['actPrice'] = $actPrice;
  788. $post['realPrice'] = $actPrice;
  789. $post['mainPay'] = $actPrice;
  790. $post['modifyPrice'] = $actPrice;
  791. $post['userId'] = $this->userId;
  792. $post['needPrint'] = dict::getDict('needPrint', 'noNeed');
  793. $now = time();
  794. $expireTime = $now + 300;//订单5分钟后过期
  795. $post['createTime'] = date("Y-m-d H:i:s", $now);
  796. $post['deadline'] = $expireTime;
  797. if ($actPrice <= 0) {
  798. util::fail('请填写付款金额');
  799. }
  800. $post['goodsNum'] = 1;
  801. $product = [[
  802. 'productId' => $gatheringItem,
  803. 'bigNum' => 1,
  804. 'smallNum' => '',
  805. 'num' => 1,
  806. 'unitType' => 0,
  807. 'property' => 1,
  808. 'unitPrice' => $actPrice,
  809. 'itemId' => $ptItemId,
  810. 'classId' => $classId
  811. ]];
  812. $post['product'] = $product;
  813. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
  814. $post['onlinePay'] = dict::getDict('onlinePay', 'yes');
  815. //前端未修改时这边做兼容
  816. if (!empty($post['receiveAddress'])) {
  817. $post['address'] = $post['receiveAddress'];
  818. if (!empty($post['receiveProvince'])) {
  819. $post['province'] = $post['receiveProvince'];
  820. }
  821. if (!empty($post['receiveCity'])) {
  822. $post['city'] = $post['receiveCity'];
  823. }
  824. if (!empty($post['receiveFloor'])) {
  825. $post['floor'] = $post['receiveFloor'];
  826. }
  827. if (!empty($post['latitude'])) {
  828. $post['lat'] = $post['latitude'];
  829. }
  830. if (!empty($post['longitude'])) {
  831. $post['long'] = $post['longitude'];
  832. }
  833. $city = $post['receiveCity'] ?? '';
  834. $address = $post['receiveAddress'];
  835. $floor = $post['receiveFloor'] ?? '';
  836. $post['fullAddress'] = $city . $address . $floor;
  837. }
  838. $hasPay = 0;
  839. $post['sendType'] = 1;
  840. $post['orderType'] = 2;//花材订单
  841. $post['dealPrice'] = 1;
  842. $post['fromType'] = 1;
  843. $order = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  844. $orderId = $order->id ?? 0;
  845. $orderSn = $order->orderSn ?? '';
  846. if ($payWay == 0) {
  847. //微信
  848. $name = '购买商品';
  849. $totalFee = $actPrice;
  850. $user = UserService::getById($this->userId);
  851. //小程序使用miniOpenId
  852. $openId = $user['miniOpenId'];
  853. if (empty($openId)) {
  854. $openId = !empty($post['miniOpenId']) ? $post['miniOpenId'] : '';
  855. }
  856. if (empty($openId)) {
  857. util::fail('没有微信信息');
  858. }
  859. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  860. $sjExtend = WxOpenClass::getMallWxInfo();
  861. $shop = $this->shop;
  862. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  863. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  864. $params = [
  865. 'appid' => 'OP00002119',
  866. 'serial_no' => '018b08cfddbd',
  867. 'merchant_no' => $shop->lklSjNo,
  868. 'term_no' => $shop->lklScanTermNo,
  869. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  870. 'lklCertificatePath' => $lklCertificatePath,
  871. ];
  872. $laResource = new Lakala($params);
  873. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  874. $wxParams = [
  875. 'orderSn' => $orderSn,
  876. 'amount' => $totalFee,
  877. 'capitalType' => $capitalType,
  878. 'notifyUrl' => $notifyUrl,
  879. 'wxAppId' => $sjExtend['miniAppId'],
  880. 'openId' => $openId,
  881. 'subject' => $name,
  882. 'couponId' => $couponId,
  883. ];
  884. $response = $laResource->driveWxPay($wxParams);
  885. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  886. $errMsg = $response['msg'] ?? '';
  887. noticeUtil::push($errMsg, '15280215347');
  888. util::fail('支付失败');
  889. }
  890. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  891. $appId = $newParams['app_id'] ?? '';
  892. $nonceStr = $newParams['nonce_str'] ?? '';
  893. $paySign = $newParams['pay_sign'] ?? '';
  894. $package = $newParams['package'] ?? '';
  895. $signType = $newParams['sign_type'] ?? '';
  896. $timeStamp = $newParams['time_stamp'] ?? '';
  897. $new = [
  898. 'id' => $orderId,
  899. 'appId' => $appId,
  900. 'nonceStr' => $nonceStr,
  901. 'paySign' => $paySign,
  902. 'package' => $package,
  903. 'signType' => $signType,
  904. 'timeStamp' => $timeStamp,
  905. 'orderSn' => $orderSn,
  906. ];
  907. util::success($new);
  908. } elseif ($payWay == 1) {
  909. //支付宝
  910. $totalFee = $actPrice;
  911. $subject = '购买花材';
  912. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  913. $shop = $this->shop;
  914. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  915. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  916. $params = [
  917. 'appid' => 'OP00002119',
  918. 'serial_no' => '018b08cfddbd',
  919. 'merchant_no' => $shop->lklSjNo,
  920. 'term_no' => $shop->lklB2BTermNo,
  921. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  922. 'lklCertificatePath' => $lklCertificatePath,
  923. ];
  924. $laResource = new Lakala($params);
  925. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/cash-pay-callback";
  926. $cashParams = [
  927. 'orderSn' => $orderSn,
  928. 'amount' => $totalFee,
  929. 'capitalType' => $capitalType,
  930. 'notifyUrl' => $notifyUrl,
  931. 'subject' => $subject,
  932. ];
  933. $response = $laResource->cashierPay($cashParams);
  934. if (!isset($response['code']) || $response['code'] != '000000') {
  935. util::fail('支付失败了');
  936. }
  937. $url = $response['resp_data']['counter_url'] ? $response['resp_data']['counter_url'] : '';
  938. if (empty($url)) {
  939. util::fail('支付失败');
  940. }
  941. util::success(['url' => $url]);
  942. } elseif ($payWay == 2) {
  943. util::fail('无效的支付方式');
  944. //余额支付,验证支付密码是否正确
  945. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  946. $user = UserService::getUserInfo($this->userId);
  947. UserService::validPayPassword($payPassword, $user);
  948. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  949. $callbackParams = [];
  950. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  951. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  952. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
  953. } else {
  954. util::fail('无效的支付方式');
  955. }
  956. }
  957. //订单列表 ssh 2019.12.12
  958. public function actionList()
  959. {
  960. $get = Yii::$app->request->get();
  961. $status = $get['status'] ?? 0;
  962. $userId = $this->userId;
  963. $where = ['userId' => $userId];
  964. if (!empty($status)) {
  965. $where['status'] = $status;
  966. }
  967. $list = OrderService::getOrderList($where);
  968. util::success($list);
  969. }
  970. //订单评价
  971. public function actionComment()
  972. {
  973. $post = Yii::$app->request->post();
  974. $id = $post['id'];
  975. $order = OrderClass::getById($id);
  976. if ($order['grade'] > 0) {
  977. util::fail('您已经评过了');
  978. }
  979. OrderService::comment($post);
  980. util::complete('提交成功');
  981. }
  982. //订单详情 ssh 2019.12.16
  983. public function actionDetail()
  984. {
  985. $id = Yii::$app->request->get('id', 0);
  986. $detail = OrderClass::getOrderById($id);
  987. $userId = $this->userId;
  988. if ($detail['userId'] != $userId) {
  989. util::fail('不是你的单,不能查看');
  990. }
  991. $shOrderMap = [];
  992. if ($detail['hasForward'] == 1) {
  993. $shOrderMap = OrderForwardClass::getAllByCondition(['orderId' => $id], null, '*');
  994. }
  995. $detail['shOrderMap'] = $shOrderMap;
  996. util::success($detail);
  997. }
  998. //获取详情 ssh 20220512
  999. public function actionInfo()
  1000. {
  1001. $sn = Yii::$app->request->get('orderSn', '');
  1002. $detail = OrderClass::getOrderBySn($sn);
  1003. util::success($detail);
  1004. }
  1005. }