OrderController.php 22 KB

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