OrderController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\sj\services\MerchantExtendService;
  4. use bizGhs\express\services\DadaExpressServices;
  5. use bizHd\wx\classes\WxOpenClass;
  6. use bizGhs\admin\classes\AdminClass;
  7. use bizGhs\custom\classes\CustomClass;
  8. use bizGhs\merchant\services\ShopService;
  9. use bizGhs\order\classes\OrderClass;
  10. use bizGhs\order\services\OrderService;
  11. use bizHd\saas\services\RegionService;
  12. use bizGhs\product\classes\ProductClass;
  13. use common\components\dict;
  14. use common\components\dateUtil;
  15. use common\components\httpUtil;
  16. use common\services\xhPayToolService;
  17. use Yii;
  18. use common\components\util;
  19. use common\components\stringUtil;
  20. class OrderController extends BaseController
  21. {
  22. public $guestAccess = ['create-order', 'order-relate', 'fast-pay'];
  23. //订单列表 ssh 2021.1.20
  24. public function actionList()
  25. {
  26. $get = Yii::$app->request->get();
  27. $status = $get['status'] ?? 0;
  28. if (!empty($status)) {
  29. $where['status'] = $status;
  30. }
  31. $where['merchantId'] = $this->sjId;
  32. if (isset($get['shopId'])) {
  33. $shopId = $get['shopId'] ?? 0;
  34. if (!empty($shopId)) {
  35. $where['shopId'] = $this->shopId;
  36. }
  37. } else {
  38. $where['shopId'] = $this->shopId;
  39. }
  40. $searchTime = $get['searchTime'] ?? '';
  41. if (!empty($searchTime)) {
  42. $startTime = $get['startTime'] ?? '';
  43. $endTime = $get['endTime'] ?? '';
  44. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  45. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  46. }
  47. $name = $get['name'] ?? '';
  48. if (!empty($name)) {
  49. if (preg_match("/^[a-zA-Z\s]+$/", $name)) {
  50. $where['customNamePy'] = ['like', $name];
  51. } else {
  52. $where['customName'] = ['like', $name];
  53. }
  54. }
  55. $respond = OrderClass::getOrderList($where);
  56. $shop = $this->shop;
  57. $respond['allNum'] = $shop['totalOrder'] ?? 0;
  58. $respond['unPayNum'] = $shop['unPayOrder'] ?? 0;
  59. $respond['unSendNum'] = $shop['unSendOrder'] ?? 0;
  60. $respond['sendingNum'] = $shop['sendingOrder'] ?? 0;
  61. $respond['finishNum'] = $shop['finishOrder'] ?? 0;
  62. util::success($respond);
  63. }
  64. //商城下单操作 ssh 2021.1.14
  65. public function actionCreateOrder()
  66. {
  67. $post = Yii::$app->request->post();
  68. $shopId = $this->shopId;
  69. $customId = $post['customId'] ?? 0;
  70. $post['customId'] = $customId;
  71. if (!empty($customId)) {
  72. $custom = CustomClass::getCustom($customId);
  73. if (empty($custom)) {
  74. util::fail('客户无效');
  75. }
  76. CustomClass::valid($custom, $this->sjId);
  77. $post['customMobile'] = $custom['mobile'] ?? '';
  78. $customName = $custom['name'] ?? '';
  79. $post['customName'] = $customName;
  80. $post['customNamePy'] = $custom['py'] ?? '';
  81. $post['customAvatar'] = $custom['shortSmallAvatar'] ?? '';
  82. }
  83. $post['shopAdminId'] = $this->shopAdminId;
  84. $shopAdmin = $this->shopAdmin;
  85. $post['shopAdminName'] = $shopAdmin['name'] ?? '';
  86. $post['shopId'] = $shopId;
  87. $post['payWay'] = $this->isWx == true ? 0 : 1;
  88. $post['merchantId'] = $this->sjId;
  89. $post['fromType'] = 1;
  90. $post['prePrice'] = 0.01;
  91. $post['actPrice'] = 0.01;
  92. $post['expressId'] = $post['expressId'] ?? 0;
  93. $post['clearType'] = $post['clearType'] ?? OrderClass::CLEAR_DEBT;
  94. $productJson = $post['product'] ?? '';
  95. if (empty($productJson)) {
  96. util::fail('请选择花材');
  97. }
  98. $productList = json_decode($productJson, true);
  99. if (empty($productList)) {
  100. util::fail('请选择花材');
  101. }
  102. $connection = Yii::$app->db;//事务处理
  103. $transaction = $connection->beginTransaction();
  104. try {
  105. //判断花材有效性
  106. ProductClass::valid($productList, $this->shopId);
  107. $post['product'] = $productList;
  108. $return = OrderClass::addOrder($post, $this->shop);
  109. $transaction->commit();
  110. util::success($return);
  111. } catch (\Exception $e) {
  112. $transaction->rollBack();
  113. Yii::info("下单失败原因:" . $e->getMessage());
  114. util::fail('下单失败');
  115. }
  116. }
  117. //延期支付 ssh 2021.1.19
  118. public function actionDebt()
  119. {
  120. $get = Yii::$app->request->get();
  121. $id = $get['id'] ?? 0;
  122. $info = OrderClass::getOrderInfo($id);
  123. OrderClass::valid($info, $this->shopId);
  124. OrderClass::debt($info, $this->shop);
  125. util::complete();
  126. }
  127. //获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
  128. public function actionWxPay()
  129. {
  130. ini_set('date.timezone', 'Asia/Shanghai');
  131. $post = Yii::$app->request->post();
  132. $couponId = $post['couponId'] ?? 0;
  133. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  134. $order = OrderClass::getByOrderSn($orderSn);
  135. if (empty($order)) {
  136. util::fail('订单号无效');
  137. }
  138. $id = $order['id'];
  139. //支付前验证订单有效性
  140. if (isset($order['adminId']) == false || $order['adminId'] != $this->adminId) {
  141. util::fail('没有权限操作');
  142. }
  143. $name = $order['orderName'] ?? '购买商品';
  144. $totalFee = $order['actPrice'];
  145. //强制使用小程序的miniOpenId
  146. $openId = $this->admin['miniOpenId'];
  147. $typeList = dict::getConfig('capitalType');
  148. $capitalType = $typeList['xhGhsOrder']['id'];
  149. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  150. $wxPayType = 0;
  151. if (httpUtil::isMiniProgram()) {
  152. $wxPayType = 1;
  153. }
  154. $attach = "couponId=" . $couponId . "&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
  155. //订单30分钟后过期
  156. $now = time();
  157. $expireTime = $now + 1800;
  158. $wx = Yii::getAlias("@vendor/weixin");
  159. require_once($wx . '/lib/WxPay.Api.php');
  160. require_once($wx . '/example/WxPay.JsApiPay.php');
  161. $input = new \WxPayUnifiedOrder();
  162. $input->SetBody($name);
  163. $input->SetOut_trade_no($orderSn);
  164. $input->SetTotal_fee($totalFee * 100);
  165. $input->SetTime_start(date("YmdHis", $now));
  166. $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
  167. $input->SetTime_expire(date("YmdHis", $expireTime));
  168. $input->SetNotify_url(Yii::$app->params['ghsHost'] . '/notice/wx-callback/');
  169. $input->SetTrade_type("JSAPI");
  170. //花卉宝代为申请的微信支付
  171. //$merchantExtend = $this->sjExtend;
  172. $merchantExtend = WxOpenClass::getGhsWxInfo();
  173. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  174. $input->SetSub_openid($openId);
  175. } else {
  176. $input->SetOpenid($openId);
  177. }
  178. //强制使用小程序的miniAppId
  179. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  180. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  181. $tools = new \JsApiPay();
  182. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  183. $newParams = json_decode($jsApiParameters, true);
  184. //微信不能修改价格
  185. $current = date("Y-m-d H:i:s");
  186. $updateData = ['deadline' => $current, 'modPrice' => 0];
  187. OrderClass::updateById($id, $updateData);
  188. util::success($newParams);
  189. }
  190. //获取订单详情 ssh 2021.1.21
  191. public function actionDetail()
  192. {
  193. $get = Yii::$app->request->get();
  194. $id = $get['id'] ?? 0;
  195. $info = OrderClass::getOrderInfo($id, true, true, true, false);
  196. OrderClass::valid($info, $this->shopId);
  197. util::success($info);
  198. }
  199. //自取和免发货流程处理 ssh 2021.1.22
  200. public function actionWithoutSend()
  201. {
  202. $get = Yii::$app->request->get();
  203. $id = $get['id'] ?? 0;
  204. $info = OrderClass::getOrderInfo($id);
  205. OrderClass::valid($info, $this->shopId);
  206. OrderClass::withoutSend($info);
  207. util::complete();
  208. }
  209. //本店送 ssh 2021.1.24
  210. public function actionSelfSend()
  211. {
  212. $get = Yii::$app->request->get();
  213. $id = isset($get['id']) ? $get['id'] : 0;
  214. $info = OrderClass::getOrderInfo($id);
  215. OrderClass::valid($info, $this->shopId);
  216. $connection = Yii::$app->db;
  217. $transaction = $connection->beginTransaction();
  218. try {
  219. OrderClass::selfSend($info);
  220. $transaction->commit();
  221. } catch (\Exception $exception) {
  222. $transaction->rollBack();
  223. Yii::info("本店送操作报错:" . $exception->getMessage());
  224. util::fail('操作失败');
  225. }
  226. util::complete();
  227. }
  228. //运费计算 ssh 2021.1.24
  229. public function actionFreight()
  230. {
  231. //2021.3.28 接入达达
  232. $get = Yii::$app->request->get();
  233. $orderId = $get['id'] ?? 0; //订单ID
  234. $customId = $get['customId'] ?? 0;
  235. if (!empty($customId)) {
  236. util::success(['sedCost' => 27]);
  237. }
  238. if (empty($orderId)) {
  239. util::success(['sedCost' => 10]);
  240. }
  241. $province = $get['province'] ?? '';
  242. $city = $get['city'] ?? '';
  243. $address = $get['address'] ?? '';
  244. $floor = $get['floor'] ?? '';
  245. $fullAddress = $province . $city . $address . $floor;
  246. $sendTime = $get['sendTime'] ?? '';
  247. $lat = $get['lat'] ?? '';
  248. $lng = $get['long'] ?? '';
  249. if (empty($lat) || empty($lng) || empty($fullAddress)) {
  250. util::fail('请选择配送地址');
  251. }
  252. if (!empty($sendTime)) {
  253. //配送时间不为空
  254. // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
  255. $sendTimeInt = strtotime($sendTime);
  256. $now = time();
  257. $diff = $sendTimeInt - $now;
  258. //因服务器写入时间,改为至少提前6分钟
  259. if ($diff <= 360) {
  260. util::fail('配送时间至少提前6分钟');
  261. }
  262. }
  263. //更新订单表
  264. $info = OrderClass::getOrderInfo($orderId);
  265. OrderClass::valid($info, $this->shopId);
  266. $expressAddInfo = [
  267. 'province' => $province,
  268. 'city' => $city,
  269. 'address' => $address,
  270. 'floor' => $floor,
  271. 'lat' => $lat,
  272. 'long' => $lng,
  273. 'sendTime' => date('Y-m-d H:i', strtotime($sendTime)),
  274. ];
  275. OrderClass::updateCustomExpressInfo($orderId, $expressAddInfo);
  276. //计算运费
  277. $info['province'] = $province;
  278. $info['city'] = $city;
  279. $info['address'] = $address;
  280. $info['floor'] = $floor;
  281. $info['fullAddress'] = $fullAddress;
  282. $info['lat'] = $lat;
  283. $info['long'] = $lng;
  284. $info['sendTime'] = $expressAddInfo['sendTime'];
  285. $res = DadaExpressServices::queryDeliverFee($info);
  286. util::success(['sedCost' => $res['fee']]);
  287. }
  288. //发快递和第三方配送 ssh 2021.1.24
  289. public function actionThirdSend()
  290. {
  291. $get = Yii::$app->request->get();
  292. $id = isset($get['id']) ? $get['id'] : 0;
  293. $info = OrderClass::getOrderInfo($id);
  294. OrderClass::valid($info, $this->shopId);
  295. $connection = Yii::$app->db;
  296. $transaction = $connection->beginTransaction();
  297. try {
  298. $respond = OrderClass::thirdSend($info, $get);
  299. $transaction->commit();
  300. util::success($respond);
  301. } catch (\Exception $exception) {
  302. $transaction->rollBack();
  303. Yii::info("发快递操作报错:" . $exception->getMessage());
  304. util::fail('操作失败' . $exception->getMessage());
  305. }
  306. }
  307. //确认送达 ssh 2021.1.24
  308. public function actionReach()
  309. {
  310. $get = Yii::$app->request->get();
  311. $id = isset($get['id']) ? $get['id'] : 0;
  312. $info = OrderClass::getOrderInfo($id);
  313. OrderClass::valid($info, $this->shopId);
  314. $connection = Yii::$app->db;
  315. $transaction = $connection->beginTransaction();
  316. try {
  317. OrderClass::reach($info);
  318. $transaction->commit();
  319. } catch (\Exception $exception) {
  320. $transaction->rollBack();
  321. Yii::info("送达操作报错:" . $exception->getMessage());
  322. util::fail('操作失败');
  323. }
  324. util::complete();
  325. }
  326. //快捷付款订单
  327. public function actionFastPay()
  328. {
  329. ini_set('date.timezone', 'Asia/Shanghai');
  330. $post = Yii::$app->request->post();
  331. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  332. $post['shopId'] = 2;
  333. //默认门店订单
  334. $store = isset($post['store']) ? $post['store'] : 1;
  335. $post['store'] = $store;
  336. $fromType = $post['fromType'] ?? 1;
  337. $post['userId'] = $this->adminId;
  338. $admin = $this->admin;
  339. $post['bookName'] = isset($admin['name']) ? $admin['name'] : '';
  340. $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  341. $bookMobile = empty($bookMobile) && isset($admin['mobile']) && !empty($admin['mobile']) ? $admin['mobile'] : $bookMobile;
  342. $post['bookMobile'] = $bookMobile;
  343. $prePrice = round($post['prePrice'], 2);
  344. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  345. $sourceType = 0;
  346. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  347. $actPrice = $discountData['price'];
  348. $post['discountType'] = $discountData['discountType'];
  349. $post['discountAmount'] = $discountData['discountAmount'];
  350. $post['actPrice'] = $actPrice;
  351. $post['payStyle'] = 0;
  352. $post['merchantId'] = $this->sjId;
  353. $now = time();
  354. //订单5分钟后过期
  355. $expireTime = $now + 300;
  356. $post['createTime'] = date("Y-m-d H:i:s", $now);
  357. $post['deadline'] = $expireTime;
  358. if ($actPrice <= 0) {
  359. util::fail('请填写正确的金额');
  360. }
  361. //微信支付订单提交不能修改价格
  362. $post['modPrice'] = $this->isWx ? 0 : 1;
  363. $post['sourceType'] = $sourceType;
  364. $post['goodsNum'] = 1;
  365. $post['fromType'] = $fromType;
  366. $post['product'] = [];
  367. $order = OrderClass::addOrder($post);
  368. $id = $order['id'];
  369. $orderSn = $order['orderSn'];
  370. $merchantId = $this->sjId;
  371. if ($payWay == 0) {
  372. $id = $order['id'];
  373. $name = '购买商品';
  374. $totalFee = $actPrice;
  375. $admin = AdminClass::getAdminById($this->adminId);
  376. //小程序使用miniOpenId
  377. $openId = $admin['miniOpenId'];
  378. $typeList = dict::getConfig('capitalType');
  379. $capitalType = $typeList['xhGhsOrder']['id'];
  380. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  381. $wxPayType = 0;
  382. if (httpUtil::isMiniProgram()) {
  383. $wxPayType = 1;
  384. }
  385. $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&wxPayType=' . $wxPayType;
  386. $wx = Yii::getAlias("@vendor/weixin");
  387. require_once($wx . '/lib/WxPay.Api.php');
  388. require_once($wx . '/example/WxPay.JsApiPay.php');
  389. $input = new \WxPayUnifiedOrder();
  390. $input->SetBody($name);
  391. $input->SetOut_trade_no($orderSn);
  392. $input->SetTotal_fee($totalFee * 100);
  393. $input->SetTime_start(date("YmdHis", $now));
  394. $input->SetAttach($attach);
  395. //设置订单有效期5分钟
  396. $input->SetTime_expire(date("YmdHis", $expireTime));
  397. $input->SetNotify_url(Yii::$app->params['ghsHost'] . '/notice/wx-callback/');
  398. $input->SetTrade_type("JSAPI");
  399. //花卉宝代为申请的微信支付
  400. //$merchantExtend = $this->sjExtend;
  401. $merchantExtend = WxOpenClass::getGhsWxInfo();
  402. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  403. $input->SetSub_openid($openId);
  404. } else {
  405. $input->SetOpenid($openId);
  406. }
  407. //小程序使用miniAppId
  408. if (httpUtil::isMiniProgram()) {
  409. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  410. }
  411. //强制使用小程序的appId
  412. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  413. Yii::info('支付发起使用小程序信息' . json_encode($merchantExtend));
  414. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  415. $tools = new \JsApiPay();
  416. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  417. $newParams = json_decode($jsApiParameters, true);
  418. $newParams['orderId'] = $id;
  419. util::success($newParams);
  420. } elseif ($payWay == 1) {
  421. $extend = MerchantExtendService::getByMerchantId($merchantId);
  422. if (isset($extend['alipayInit']) == false || $extend['alipayInit'] == 0) {
  423. util::fail('支付宝付款即将开通...');
  424. }
  425. $config = [
  426. //应用ID,您的APPID。
  427. 'app_id' => $extend['alipayPId'],
  428. //商户私钥,您的原始格式RSA私钥
  429. 'merchant_private_key' => $extend['alipayKey'],
  430. //异步通知地址
  431. 'notify_url' => Yii::$app->params['ghsHost'] . "/notice/alipay-callback",
  432. //同步跳转
  433. 'return_url' => "",
  434. //编码格式
  435. 'charset' => "UTF-8",
  436. //签名方式
  437. 'sign_type' => "RSA2",
  438. //支付宝网关
  439. 'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
  440. //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  441. 'alipay_public_key' => $extend['alipayPublicKey'],
  442. ];
  443. Yii::info(json_encode($config) . ' aplipay config');
  444. $alipayWap = Yii::getAlias("@vendor/alipayWap");
  445. require_once($alipayWap . '/wappay/service/AlipayTradeService.php');
  446. require_once($alipayWap . '/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php');
  447. $totalFee = $order['actPrice'];
  448. $out_trade_no = $orderSn;//商户订单号,商户网站订单系统中唯一订单号,必填
  449. $subject = '购买商品';//订单名称,必填
  450. $total_amount = $totalFee;//付款金额,必填
  451. $body = '';//商品描述,可空
  452. $timeout_express = "1m";//超时时间
  453. $typeList = dict::getConfig('capitalType');
  454. $capitalType = $typeList['xhGhsOrder']['id'];
  455. $passBackParams = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&merchantId=' . $merchantId;//将流水类型、优惠卷传过去
  456. $passBackParams = urlencode($passBackParams);
  457. $payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
  458. $payRequestBuilder->setBody($body);
  459. $payRequestBuilder->setSubject($subject);
  460. $payRequestBuilder->setOutTradeNo($out_trade_no);
  461. $payRequestBuilder->setTotalAmount($total_amount);
  462. $payRequestBuilder->setTimeExpress($timeout_express);
  463. //在异步通知时将该参数原样返回
  464. $payRequestBuilder->setPassbackParams($passBackParams);
  465. //同步通知
  466. $returnUrl = Yii::$app->params['mallDomain'] . "/#/pages/callback/success?account={$merchantId}&shopId={$shopId}&orderSn={$orderSn}&totalPrice={$totalFee}&pageStatus=3&payDiscountPrice=0&payDiscountType=0";
  467. //异步通知
  468. $notifyUrl = Yii::$app->params['ghsHost'] . "/notice/alipay-callback";
  469. $payResponse = new \AlipayTradeService($config);
  470. $result = $payResponse->wapPay($payRequestBuilder, $returnUrl, $notifyUrl);
  471. //直接将支付宝的html返回给前端
  472. echo $result;
  473. } elseif ($payWay == 2) {
  474. $typeList = dict::getConfig('capitalType');
  475. $capitalType = $typeList['xhGhsOrder']['id'];
  476. $callbackParams = [];
  477. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  478. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  479. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $id, 'balance' => $balance]);
  480. } else {
  481. util::fail('无效的支付方式');
  482. }
  483. }
  484. //下单要用到的相关信息 ssh 2019.12.6
  485. public function actionOrderRelate()
  486. {
  487. $regionTree = RegionService::tree();
  488. $shop = ShopService::getDefaultShop($this->sj);
  489. $freight = ['first' => 5, 'add' => 2];
  490. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  491. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->sj];
  492. util::success($out);
  493. }
  494. //客户欠款的订单 ssh 2021.2.4
  495. public function actionDebtList()
  496. {
  497. $id = Yii::$app->request->get('id', 0);
  498. $info = CustomClass::getCustom($id);
  499. CustomClass::valid($info, $this->sjId);
  500. $where = ['customId' => $id, 'debt' => 1];
  501. $respond = OrderService::getDebtOrderList($where);
  502. $respond['customInfo'] = $info;
  503. util::success($respond);
  504. }
  505. }