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