OrderController.php 44 KB

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