OrderController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. $fullAddress = $province . $city . $address . $floor;
  245. $sendTime = $get['sendTime'] ?? '';
  246. $lat = $get['lat'] ?? '';
  247. $lng = $get['long'] ?? '';
  248. if (empty($lat) || empty($lng) || empty($fullAddress)) {
  249. util::fail('请选择配送地址');
  250. }
  251. if (!empty($sendTime)) {
  252. //配送时间不为空
  253. // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
  254. $sendTimeInt = strtotime($sendTime);
  255. $now = time();
  256. $diff = $sendTimeInt - $now;
  257. //因服务器写入时间,改为至少提前6分钟
  258. if ($diff <= 360) {
  259. util::fail('配送时间至少提前6分钟');
  260. }
  261. }
  262. //更新订单表
  263. $info = OrderClass::getOrderInfo($orderId);
  264. OrderClass::valid($info, $this->shopId);
  265. $expressAddInfo = [
  266. 'province' => $province,
  267. 'city' => $city,
  268. 'address' => $address,
  269. 'floor' => $floor,
  270. 'lat' => $lat,
  271. 'long' => $lng,
  272. 'sendTime' => date('Y-m-d H:i', strtotime($sendTime)),
  273. ];
  274. OrderClass::updateCustomExpressInfo($orderId, $expressAddInfo);
  275. //计算运费
  276. $info['province'] = $province;
  277. $info['city'] = $city;
  278. $info['address'] = $address;
  279. $info['floor'] = $floor;
  280. $info['fullAddress'] = $fullAddress;
  281. $info['lat'] = $lat;
  282. $info['long'] = $lng;
  283. $info['sendTime'] = $expressAddInfo['sendTime'];
  284. $res = DadaExpressServices::queryDeliverFee($info);
  285. util::success(['sedCost' => $res['fee']]);
  286. }
  287. //发快递和第三方配送 ssh 2021.1.24
  288. public function actionThirdSend()
  289. {
  290. $get = Yii::$app->request->get();
  291. $id = isset($get['id']) ? $get['id'] : 0;
  292. $info = OrderClass::getOrderInfo($id);
  293. OrderClass::valid($info, $this->shopId);
  294. $connection = Yii::$app->db;
  295. $transaction = $connection->beginTransaction();
  296. try {
  297. $respond = OrderClass::thirdSend($info, $get);
  298. $transaction->commit();
  299. util::success($respond);
  300. } catch (\Exception $exception) {
  301. $transaction->rollBack();
  302. Yii::info("发快递操作报错:" . $exception->getMessage());
  303. util::fail('操作失败' . $exception->getMessage());
  304. }
  305. }
  306. //确认送达 ssh 2021.1.24
  307. public function actionReach()
  308. {
  309. $get = Yii::$app->request->get();
  310. $id = isset($get['id']) ? $get['id'] : 0;
  311. $info = OrderClass::getOrderInfo($id);
  312. OrderClass::valid($info, $this->shopId);
  313. $connection = Yii::$app->db;
  314. $transaction = $connection->beginTransaction();
  315. try {
  316. OrderClass::reach($info);
  317. $transaction->commit();
  318. } catch (\Exception $exception) {
  319. $transaction->rollBack();
  320. Yii::info("送达操作报错:" . $exception->getMessage());
  321. util::fail('操作失败');
  322. }
  323. util::complete();
  324. }
  325. //快捷付款订单
  326. public function actionFastPay()
  327. {
  328. ini_set('date.timezone', 'Asia/Shanghai');
  329. $post = Yii::$app->request->post();
  330. $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
  331. $post['shopId'] = 2;
  332. //默认门店订单
  333. $store = isset($post['store']) ? $post['store'] : 1;
  334. $post['store'] = $store;
  335. $fromType = $post['fromType'] ?? 1;
  336. $post['userId'] = $this->adminId;
  337. $admin = $this->admin;
  338. $post['bookName'] = isset($admin['name']) ? $admin['name'] : '';
  339. $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
  340. $bookMobile = empty($bookMobile) && isset($admin['mobile']) && !empty($admin['mobile']) ? $admin['mobile'] : $bookMobile;
  341. $post['bookMobile'] = $bookMobile;
  342. $prePrice = round($post['prePrice'], 2);
  343. $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
  344. $sourceType = 0;
  345. $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
  346. $actPrice = $discountData['price'];
  347. $post['discountType'] = $discountData['discountType'];
  348. $post['discountAmount'] = $discountData['discountAmount'];
  349. $post['actPrice'] = $actPrice;
  350. $post['payStyle'] = 0;
  351. $post['merchantId'] = $this->sjId;
  352. $now = time();
  353. //订单5分钟后过期
  354. $expireTime = $now + 300;
  355. $post['createTime'] = date("Y-m-d H:i:s", $now);
  356. $post['deadline'] = $expireTime;
  357. if ($actPrice <= 0) {
  358. util::fail('请填写正确的金额');
  359. }
  360. //微信支付订单提交不能修改价格
  361. $post['modPrice'] = $this->isWx ? 0 : 1;
  362. $post['sourceType'] = $sourceType;
  363. $post['goodsNum'] = 1;
  364. $post['fromType'] = $fromType;
  365. $post['product'] = [];
  366. $order = OrderClass::addOrder($post);
  367. $id = $order['id'];
  368. $orderSn = $order['orderSn'];
  369. $merchantId = $this->sjId;
  370. if ($payWay == 0) {
  371. $id = $order['id'];
  372. $name = '购买商品';
  373. $totalFee = $actPrice;
  374. $admin = AdminClass::getAdminById($this->adminId);
  375. //小程序使用miniOpenId
  376. $openId = $admin['miniOpenId'];
  377. $capitalType = dict::getDict('capitalType', 'xhGhsOrder', 'id');
  378. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  379. $wxPayType = 0;
  380. if (httpUtil::isMiniProgram()) {
  381. $wxPayType = 1;
  382. }
  383. $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&wxPayType=' . $wxPayType;
  384. $wx = Yii::getAlias("@vendor/weixin");
  385. require_once($wx . '/lib/WxPay.Api.php');
  386. require_once($wx . '/example/WxPay.JsApiPay.php');
  387. $input = new \WxPayUnifiedOrder();
  388. $input->SetBody($name);
  389. $input->SetOut_trade_no($orderSn);
  390. $input->SetTotal_fee($totalFee * 100);
  391. $input->SetTime_start(date("YmdHis", $now));
  392. $input->SetAttach($attach);
  393. //设置订单有效期5分钟
  394. $input->SetTime_expire(date("YmdHis", $expireTime));
  395. $input->SetNotify_url(Yii::$app->params['ghsHost'] . '/notice/wx-callback/');
  396. $input->SetTrade_type("JSAPI");
  397. //花卉宝代为申请的微信支付
  398. //$merchantExtend = $this->sjExtend;
  399. $merchantExtend = WxOpenClass::getGhsWxInfo();
  400. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  401. $input->SetSub_openid($openId);
  402. } else {
  403. $input->SetOpenid($openId);
  404. }
  405. //小程序使用miniAppId
  406. if (httpUtil::isMiniProgram()) {
  407. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  408. }
  409. //强制使用小程序的appId
  410. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  411. Yii::info('支付发起使用小程序信息' . json_encode($merchantExtend));
  412. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  413. $tools = new \JsApiPay();
  414. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  415. $newParams = json_decode($jsApiParameters, true);
  416. $newParams['orderId'] = $id;
  417. util::success($newParams);
  418. } elseif ($payWay == 1) {
  419. $extend = MerchantExtendService::getByMerchantId($merchantId);
  420. if (isset($extend['alipayInit']) == false || $extend['alipayInit'] == 0) {
  421. util::fail('支付宝付款即将开通...');
  422. }
  423. $config = [
  424. //应用ID,您的APPID。
  425. 'app_id' => $extend['alipayPId'],
  426. //商户私钥,您的原始格式RSA私钥
  427. 'merchant_private_key' => $extend['alipayKey'],
  428. //异步通知地址
  429. 'notify_url' => Yii::$app->params['ghsHost'] . "/notice/ali-callback",
  430. //同步跳转
  431. 'return_url' => "",
  432. //编码格式
  433. 'charset' => "UTF-8",
  434. //签名方式
  435. 'sign_type' => "RSA2",
  436. //支付宝网关
  437. 'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
  438. //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  439. 'alipay_public_key' => $extend['alipayPublicKey'],
  440. ];
  441. Yii::info(json_encode($config) . ' aplipay config');
  442. $alipayWap = Yii::getAlias("@vendor/alipayWap");
  443. require_once($alipayWap . '/wappay/service/AlipayTradeService.php');
  444. require_once($alipayWap . '/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php');
  445. $totalFee = $order['actPrice'];
  446. $out_trade_no = $orderSn;//商户订单号,商户网站订单系统中唯一订单号,必填
  447. $subject = '购买商品';//订单名称,必填
  448. $total_amount = $totalFee;//付款金额,必填
  449. $body = '';//商品描述,可空
  450. $timeout_express = "1m";//超时时间
  451. $capitalType = dict::getDict('capitalType', 'xhGhsOrder', 'id');
  452. $passBackParams = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&merchantId=' . $merchantId;//将流水类型、优惠卷传过去
  453. $passBackParams = urlencode($passBackParams);
  454. $payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
  455. $payRequestBuilder->setBody($body);
  456. $payRequestBuilder->setSubject($subject);
  457. $payRequestBuilder->setOutTradeNo($out_trade_no);
  458. $payRequestBuilder->setTotalAmount($total_amount);
  459. $payRequestBuilder->setTimeExpress($timeout_express);
  460. //在异步通知时将该参数原样返回
  461. $payRequestBuilder->setPassbackParams($passBackParams);
  462. //同步通知
  463. $returnUrl = Yii::$app->params['mallDomain'] . "/#/pages/callback/success?account={$merchantId}&shopId={$shopId}&orderSn={$orderSn}&totalPrice={$totalFee}&pageStatus=3&payDiscountPrice=0&payDiscountType=0";
  464. //异步通知
  465. $notifyUrl = Yii::$app->params['ghsHost'] . "/notice/ali-callback";
  466. $payResponse = new \AlipayTradeService($config);
  467. $result = $payResponse->wapPay($payRequestBuilder, $returnUrl, $notifyUrl);
  468. //直接将支付宝的html返回给前端
  469. echo $result;
  470. } elseif ($payWay == 2) {
  471. $capitalType = dict::getDict('capitalType', 'xhGhsOrder', 'id');
  472. $callbackParams = [];
  473. $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
  474. $balance = isset($respond['balance']) ? $respond['balance'] : 0;
  475. util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $id, 'balance' => $balance]);
  476. } else {
  477. util::fail('无效的支付方式');
  478. }
  479. }
  480. //下单要用到的相关信息 ssh 2019.12.6
  481. public function actionOrderRelate()
  482. {
  483. $regionTree = RegionService::tree();
  484. $shop = ShopService::getDefaultShop($this->sj);
  485. $freight = ['first' => 5, 'add' => 2];
  486. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  487. $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->sj];
  488. util::success($out);
  489. }
  490. //客户欠款的订单 ssh 2021.2.4
  491. public function actionDebtList()
  492. {
  493. $id = Yii::$app->request->get('id', 0);
  494. $info = CustomClass::getCustom($id);
  495. CustomClass::valid($info, $this->sjId);
  496. $where = ['customId' => $id, 'debt' => 1];
  497. $respond = OrderService::getDebtOrderList($where);
  498. $respond['customInfo'] = $info;
  499. util::success($respond);
  500. }
  501. }