OrderController.php 22 KB

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