OrderController.php 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  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('商家门店地址定位未设置');
  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('商家门店地址定位未设置');
  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('商家门店地址定位未设置');
  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. noticeUtil::push("运费:{$sendCost} 重量:{$totalWeight} 距离:{$sendDistance} 姓名:{$customName} 手机号 {$customMobile} 经纬 {$originalLng} {$originalLat} 金额:{$goodsPrice} 数量:{$goodsNum}", '15280215347');
  494. }
  495. $post['sendDistance'] = $sendDistance;
  496. $post['sendCost'] = $sendCost;
  497. $post['sjId'] = $this->sjId;
  498. $post['shopId'] = $this->shopId;
  499. $post['mainId'] = $mainId;
  500. $post['userId'] = $this->userId;
  501. if ($goodsInfo->priceType == 0) {
  502. util::fail('没有价格,不能下单');
  503. }
  504. $modifyPrice = stringUtil::calcAdd($sendCost, $goodsPrice);
  505. //非门店订单
  506. $post['store'] = 0;
  507. $post['modifyPrice'] = $modifyPrice;
  508. //非自取订单考虑配送时间
  509. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : date("Y-m-d");
  510. $sendType = $post['sendType'] ?? 0;
  511. if ($sendType != 1) {
  512. if (empty($post['reachPeriod'])) {
  513. util::fail('请选择配送时间哈');
  514. }
  515. $post['reachTime'] = strtotime($post['reachDate'] . ' ' . $post['reachPeriod']);
  516. }
  517. $now = time();
  518. $expireTime = $now + 1800;//订单30分钟后过期
  519. $post['deadline'] = $expireTime;
  520. $orderSn = orderSn::getOrderSn();
  521. $post['orderSn'] = $orderSn;
  522. $post['fromType'] = dict::getDict('fromType', 'mall');
  523. $post['cash'] = 0;
  524. $post['mainId'] = $mainId;
  525. $post['needPrint'] = dict::getDict('needPrint', 'need');
  526. $hasPay = 0;
  527. $product = [['productId' => $goodsId, 'unitType' => 0, 'property' => 0, 'unitPrice' => $unitPrice, 'num' => $goodsNum]];
  528. $post['product'] = $product;
  529. $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  530. $orderId = $return->id;
  531. $orderSn = $return->orderSn;
  532. $actPrice = $return->actPrice ?? 0;
  533. $transaction->commit();
  534. util::success(['orderSn' => $orderSn, 'totalPrice' => $actPrice, 'couponId' => 0, 'id' => $orderId]);
  535. } catch (Exception $e) {
  536. $transaction->rollBack();
  537. Yii::info("失败原因:" . $e->getMessage());
  538. util::fail('下单失败');
  539. }
  540. }
  541. //下单要用到的相关信息 ssh 2019.12.6
  542. public function actionOrderRelate()
  543. {
  544. $regionTree = RegionService::tree();
  545. //门店名称
  546. $shop = !empty($this->shop) ? $this->shop->attributes : [];
  547. $sjName = $shop['merchantName'] ?? '';
  548. $shopName = $shop['shopName'] ?? '';
  549. $shop['showName'] = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
  550. $avatar = $shop['avatar'] ?? '';
  551. $smallAvatar = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  552. $shop['smallAvatar'] = $smallAvatar;
  553. $freight = ['first' => 5, 'add' => 2];
  554. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  555. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
  556. util::success($out);
  557. }
  558. //余额支付 ssh 20250410
  559. public function actionBalancePay()
  560. {
  561. $post = Yii::$app->request->post();
  562. $orderSn = $post['orderSn'] ?? '';
  563. //避免重复提交
  564. util::checkRepeatCommit($orderSn, 10);
  565. $connection = Yii::$app->db;
  566. $transaction = $connection->beginTransaction();
  567. try {
  568. $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
  569. if (empty($order)) {
  570. util::fail('没有找到订单');
  571. }
  572. if ($order->shopId != $this->shopId) {
  573. util::fail('不是你的订单');
  574. }
  575. $payWay = dict::getDict('payWay', 'balancePay');
  576. \bizHd\order\classes\OrderClass::payAfter($order, $payWay);
  577. $transaction->commit();
  578. util::complete('支付成功');
  579. } catch (\Exception $e) {
  580. $transaction->rollBack();
  581. Yii::error("支付原因:" . $e->getMessage());
  582. util::fail('支付失败');
  583. }
  584. }
  585. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  586. public function actionWxPay()
  587. {
  588. ini_set('date.timezone', 'Asia/Shanghai');
  589. $post = Yii::$app->request->post();
  590. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  591. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  592. $order = OrderService::getByOrderSn($orderSn);
  593. $orderId = $order['id'];
  594. //验证优惠券是否还有效
  595. if (!empty($couponId)) {
  596. CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
  597. }
  598. //支付前验证订单有效性
  599. OrderService::checkBeforePay($order);
  600. $name = !empty($order['orderName']) ? $order['orderName'] : '购买花材';
  601. $shop = $this->shop;
  602. if (empty($shop)) {
  603. util::fail('没有找到门店信息');
  604. }
  605. if (isset($shop->shopName) && !empty($shop->shopName)) {
  606. $name .= '(' . $shop->shopName . ')';
  607. }
  608. $totalFee = $order['mainPay'];
  609. $openId = '';
  610. if (!empty($post['miniOpenId'])) {
  611. $openId = $post['miniOpenId'];
  612. //noticeUtil::push('散客买花时,通过前端获取了openId:' . $openId, '15280215347');
  613. }
  614. if (empty($openId)) {
  615. if (isset($this->user['miniOpenId']) && !empty($this->user['miniOpenId'])) {
  616. $openId = $this->user['miniOpenId'];
  617. //noticeUtil::push('散客买花时,通过数据库获取了openId:' . $openId, '15280215347');
  618. }
  619. }
  620. if (empty($openId)) {
  621. util::fail('没有找到openId');
  622. }
  623. $now = time();
  624. $expireTime = $now + 1800;
  625. $updateData = [];
  626. if (isset($order['modPrice']) && $order['modPrice'] == 0) {
  627. $oldOrderSn = $orderSn;
  628. //老单号需要关单,否则有付款成功的风险,老单号关闭成功了,才能生成新单号
  629. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  630. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  631. $params = [
  632. 'appid' => 'OP00002119',
  633. 'serial_no' => '018b08cfddbd',
  634. 'merchant_no' => $shop->lklSjNo,
  635. 'term_no' => $shop->lklScanTermNo,
  636. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  637. 'lklCertificatePath' => $lklCertificatePath,
  638. ];
  639. $laResource = new Lakala($params);
  640. $closeParams = [
  641. 'orderSn' => $oldOrderSn,
  642. ];
  643. $response = $laResource->close($closeParams);
  644. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  645. $msg = $response['msg'] ?? '';
  646. $lklSjNo = $shop->lklSjNo ?? '';
  647. noticeUtil::push('重点注意,散客买花更换单号没有成功,单号:' . $oldOrderSn . ',关单没有成功,' . $msg . '。商户号:' . $lklSjNo, '15280215347');
  648. util::fail('出错了哦,请重新下一单');
  649. }
  650. $orderSn = orderSn::getOrderSn();
  651. $updateData['orderSn'] = $orderSn;
  652. OrderItemClass::updateByCondition(['orderSn' => $oldOrderSn], ['orderSn' => $orderSn]);
  653. } else {
  654. //已请求的不能再修改价格
  655. $updateData['modPrice'] = 0;
  656. }
  657. if (empty($order['deadline'])) {
  658. $updateData['deadline'] = $expireTime;
  659. }
  660. if (!empty($updateData)) {
  661. OrderService::updateById($orderId, $updateData);
  662. }
  663. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  664. $sjExtend = WxOpenClass::getMallWxInfo();
  665. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  666. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  667. $params = [
  668. 'appid' => 'OP00002119',
  669. 'serial_no' => '018b08cfddbd',
  670. 'merchant_no' => $shop->lklSjNo,
  671. 'term_no' => $shop->lklScanTermNo,
  672. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  673. 'lklCertificatePath' => $lklCertificatePath,
  674. ];
  675. $laResource = new Lakala($params);
  676. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  677. $wxParams = [
  678. 'orderSn' => $orderSn,
  679. 'amount' => $totalFee,
  680. 'capitalType' => $capitalType,
  681. 'notifyUrl' => $notifyUrl,
  682. 'wxAppId' => $sjExtend['miniAppId'],
  683. 'openId' => $openId,
  684. 'subject' => $name,
  685. 'couponId' => $couponId,
  686. ];
  687. $response = $laResource->driveWxPay($wxParams);
  688. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  689. $errMsg = $response['msg'] ?? '';
  690. noticeUtil::push($errMsg, '15280215347');
  691. util::fail('支付失败');
  692. }
  693. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  694. $appId = $newParams['app_id'] ?? '';
  695. $nonceStr = $newParams['nonce_str'] ?? '';
  696. $paySign = $newParams['pay_sign'] ?? '';
  697. $package = $newParams['package'] ?? '';
  698. $signType = $newParams['sign_type'] ?? '';
  699. $timeStamp = $newParams['time_stamp'] ?? '';
  700. $new = [
  701. 'id' => $orderId,
  702. 'appId' => $appId,
  703. 'nonceStr' => $nonceStr,
  704. 'paySign' => $paySign,
  705. 'package' => $package,
  706. 'signType' => $signType,
  707. 'timeStamp' => $timeStamp,
  708. 'orderSn' => $orderSn,
  709. ];
  710. util::success($new);
  711. }
  712. //快捷付款订单
  713. public function actionFastPay()
  714. {
  715. ini_set('date.timezone', 'Asia/Shanghai');
  716. $post = Yii::$app->request->post();
  717. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  718. $shopId = $this->shopId;
  719. $shop = $this->shop;
  720. if (empty($shop)) {
  721. util::fail('没有门店信息');
  722. }
  723. $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  724. $gatheringItem = !empty($ext) ? $ext->gatheringItem : 0;
  725. if (empty($gatheringItem)) {
  726. util::fail('请设置付款用的商品');
  727. }
  728. $gatheringItemInfo = ItemClass::getById($gatheringItem, true);
  729. if (empty($gatheringItemInfo)) {
  730. util::fail('付款用的商品没有设置');
  731. }
  732. $ptItemId = $gatheringItemInfo->itemId ?? 0;
  733. $classId = $gatheringItemInfo->classId ?? 0;
  734. //收款码是否算收入由ext gatherRepeat决定
  735. $post['repeat'] = $ext->gatherRepeat ?? 0;
  736. $customId = $this->customId;
  737. $custom = $this->custom;
  738. $hdId = $this->hdId;
  739. $hd = $this->hd;
  740. if (!empty($customId) && !empty($hdId)) {
  741. //考虑没有登录时的付款
  742. $shop = $this->shop;
  743. $defaultCustomId = $shop->defaultCustomId ?? 0;
  744. if (empty($defaultCustomId)) {
  745. util::fail('请设置快捷开单的客户');
  746. }
  747. $customId = $defaultCustomId;
  748. $custom = CustomClass::getById($defaultCustomId, true);
  749. if (empty($custom)) {
  750. util::fail('请设置快捷客户');
  751. }
  752. $hdId = $custom->hdId;
  753. $hd = \bizMall\hd\classes\HdClass::getById($hdId, true);
  754. if (empty($hd)) {
  755. util::fail('没有花店信息呢!');
  756. }
  757. }
  758. $post['hdId'] = $hdId;
  759. $post['hdName'] = $hd->name ?? '';
  760. $customName = $custom->name ?? '';
  761. $customPy = $custom->py ?? '';
  762. $post['customName'] = $customName;
  763. $post['customNamePy'] = $customPy;
  764. $post['gatheringItem'] = $gatheringItem;
  765. $post['shopId'] = $shopId;
  766. $post['mainId'] = $this->mainId;
  767. $post['sjId'] = $this->sjId;
  768. $post['store'] = 0;
  769. $post['customId'] = $customId;
  770. $user = isset($this->user->attributes) ? $this->user->attributes : [];
  771. $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
  772. $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  773. $bookMobile = empty($bookMobile) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
  774. $post['bookMobile'] = $bookMobile;
  775. $prePrice = round($post['prePrice'], 2);
  776. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  777. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => 0, 'couponId' => $couponId, 'userId' => $this->userId]);
  778. $actPrice = $discountData['price'];
  779. $post['discountType'] = $discountData['discountType'];
  780. $post['discountAmount'] = $discountData['discountAmount'];
  781. $post['orderPrice'] = $actPrice;
  782. $post['actPrice'] = $actPrice;
  783. $post['realPrice'] = $actPrice;
  784. $post['mainPay'] = $actPrice;
  785. $post['modifyPrice'] = $actPrice;
  786. $post['userId'] = $this->userId;
  787. $post['needPrint'] = dict::getDict('needPrint', 'noNeed');
  788. $now = time();
  789. $expireTime = $now + 300;//订单5分钟后过期
  790. $post['createTime'] = date("Y-m-d H:i:s", $now);
  791. $post['deadline'] = $expireTime;
  792. if ($actPrice <= 0) {
  793. util::fail('请填写付款金额');
  794. }
  795. $post['goodsNum'] = 1;
  796. $product = [[
  797. 'productId' => $gatheringItem,
  798. 'bigNum' => 1,
  799. 'smallNum' => '',
  800. 'num' => 1,
  801. 'unitType' => 0,
  802. 'property' => 1,
  803. 'unitPrice' => $actPrice,
  804. 'itemId' => $ptItemId,
  805. 'classId' => $classId
  806. ]];
  807. $post['product'] = $product;
  808. $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
  809. $post['onlinePay'] = dict::getDict('onlinePay', 'yes');
  810. //前端未修改时这边做兼容
  811. if (!empty($post['receiveAddress'])) {
  812. $post['address'] = $post['receiveAddress'];
  813. if (!empty($post['receiveProvince'])) {
  814. $post['province'] = $post['receiveProvince'];
  815. }
  816. if (!empty($post['receiveCity'])) {
  817. $post['city'] = $post['receiveCity'];
  818. }
  819. if (!empty($post['receiveFloor'])) {
  820. $post['floor'] = $post['receiveFloor'];
  821. }
  822. if (!empty($post['latitude'])) {
  823. $post['lat'] = $post['latitude'];
  824. }
  825. if (!empty($post['longitude'])) {
  826. $post['long'] = $post['longitude'];
  827. }
  828. $city = $post['receiveCity'] ?? '';
  829. $address = $post['receiveAddress'];
  830. $floor = $post['receiveFloor'] ?? '';
  831. $post['fullAddress'] = $city . $address . $floor;
  832. }
  833. $hasPay = 0;
  834. $post['sendType'] = 1;
  835. $post['orderType'] = 2;//花材订单
  836. $post['dealPrice'] = 1;
  837. $post['fromType'] = 1;
  838. $order = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
  839. $orderId = $order->id ?? 0;
  840. $orderSn = $order->orderSn ?? '';
  841. if ($payWay == 0) {
  842. //微信
  843. $name = '购买商品';
  844. $totalFee = $actPrice;
  845. $user = UserService::getById($this->userId);
  846. //小程序使用miniOpenId
  847. $openId = $user['miniOpenId'];
  848. if (empty($openId)) {
  849. $openId = !empty($post['miniOpenId']) ? $post['miniOpenId'] : '';
  850. }
  851. if (empty($openId)) {
  852. util::fail('没有微信信息');
  853. }
  854. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  855. $sjExtend = WxOpenClass::getMallWxInfo();
  856. $shop = $this->shop;
  857. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  858. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  859. $params = [
  860. 'appid' => 'OP00002119',
  861. 'serial_no' => '018b08cfddbd',
  862. 'merchant_no' => $shop->lklSjNo,
  863. 'term_no' => $shop->lklScanTermNo,
  864. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  865. 'lklCertificatePath' => $lklCertificatePath,
  866. ];
  867. $laResource = new Lakala($params);
  868. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
  869. $wxParams = [
  870. 'orderSn' => $orderSn,
  871. 'amount' => $totalFee,
  872. 'capitalType' => $capitalType,
  873. 'notifyUrl' => $notifyUrl,
  874. 'wxAppId' => $sjExtend['miniAppId'],
  875. 'openId' => $openId,
  876. 'subject' => $name,
  877. 'couponId' => $couponId,
  878. ];
  879. $response = $laResource->driveWxPay($wxParams);
  880. if (!isset($response['code']) || $response['code'] != 'BBS00000') {
  881. $errMsg = $response['msg'] ?? '';
  882. noticeUtil::push($errMsg, '15280215347');
  883. util::fail('支付失败');
  884. }
  885. $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
  886. $appId = $newParams['app_id'] ?? '';
  887. $nonceStr = $newParams['nonce_str'] ?? '';
  888. $paySign = $newParams['pay_sign'] ?? '';
  889. $package = $newParams['package'] ?? '';
  890. $signType = $newParams['sign_type'] ?? '';
  891. $timeStamp = $newParams['time_stamp'] ?? '';
  892. $new = [
  893. 'id' => $orderId,
  894. 'appId' => $appId,
  895. 'nonceStr' => $nonceStr,
  896. 'paySign' => $paySign,
  897. 'package' => $package,
  898. 'signType' => $signType,
  899. 'timeStamp' => $timeStamp,
  900. 'orderSn' => $orderSn,
  901. ];
  902. util::success($new);
  903. } elseif ($payWay == 1) {
  904. //支付宝
  905. $totalFee = $actPrice;
  906. $subject = '购买花材';
  907. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  908. $shop = $this->shop;
  909. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  910. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  911. $params = [
  912. 'appid' => 'OP00002119',
  913. 'serial_no' => '018b08cfddbd',
  914. 'merchant_no' => $shop->lklSjNo,
  915. 'term_no' => $shop->lklB2BTermNo,
  916. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  917. 'lklCertificatePath' => $lklCertificatePath,
  918. ];
  919. $laResource = new Lakala($params);
  920. $notifyUrl = Yii::$app->params['mallHost'] . "/notice/cash-pay-callback";
  921. $cashParams = [
  922. 'orderSn' => $orderSn,
  923. 'amount' => $totalFee,
  924. 'capitalType' => $capitalType,
  925. 'notifyUrl' => $notifyUrl,
  926. 'subject' => $subject,
  927. ];
  928. $response = $laResource->cashierPay($cashParams);
  929. if (!isset($response['code']) || $response['code'] != '000000') {
  930. util::fail('支付失败了');
  931. }
  932. $url = $response['resp_data']['counter_url'] ? $response['resp_data']['counter_url'] : '';
  933. if (empty($url)) {
  934. util::fail('支付失败');
  935. }
  936. util::success(['url' => $url]);
  937. } elseif ($payWay == 2) {
  938. util::fail('无效的支付方式');
  939. //余额支付,验证支付密码是否正确
  940. $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
  941. $user = UserService::getUserInfo($this->userId);
  942. UserService::validPayPassword($payPassword, $user);
  943. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  944. $callbackParams = [];
  945. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  946. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  947. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
  948. } else {
  949. util::fail('无效的支付方式');
  950. }
  951. }
  952. //订单列表 ssh 2019.12.12
  953. public function actionList()
  954. {
  955. $get = Yii::$app->request->get();
  956. $status = $get['status'] ?? 0;
  957. $userId = $this->userId;
  958. $where = ['userId' => $userId];
  959. if (!empty($status)) {
  960. $where['status'] = $status;
  961. }
  962. $list = OrderService::getOrderList($where);
  963. util::success($list);
  964. }
  965. //订单评价
  966. public function actionComment()
  967. {
  968. $post = Yii::$app->request->post();
  969. $id = $post['id'];
  970. $order = OrderClass::getById($id);
  971. if ($order['grade'] > 0) {
  972. util::fail('您已经评过了');
  973. }
  974. OrderService::comment($post);
  975. util::complete('提交成功');
  976. }
  977. //订单详情 ssh 2019.12.16
  978. public function actionDetail()
  979. {
  980. $id = Yii::$app->request->get('id', 0);
  981. $detail = OrderClass::getOrderById($id);
  982. $userId = $this->userId;
  983. if ($detail['userId'] != $userId) {
  984. util::fail('不是你的单,不能查看');
  985. }
  986. $shOrderMap = [];
  987. if ($detail['hasForward'] == 1) {
  988. $shOrderMap = OrderForwardClass::getAllByCondition(['orderId' => $id], null, '*');
  989. }
  990. $detail['shOrderMap'] = $shOrderMap;
  991. util::success($detail);
  992. }
  993. //获取详情 ssh 20220512
  994. public function actionInfo()
  995. {
  996. $sn = Yii::$app->request->get('orderSn', '');
  997. $detail = OrderClass::getOrderBySn($sn);
  998. util::success($detail);
  999. }
  1000. }