IndexController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers\keloop;
  8. use app\models\Store;
  9. use app\models\Option;
  10. use app\models\Order;
  11. use app\constants\OptionSetting;
  12. use app\modules\admin\models\keloop\KeloopForm;
  13. /**
  14. * Class GoodsController
  15. * @package app\modules\admin\controllers
  16. */
  17. class IndexController extends BaseController
  18. {
  19. public $supplier_id = 0;
  20. public function actionTest() {
  21. // $res = KeloopForm::getFundUrl(84, ['shop_id' => '1']);
  22. $delivery_res = KeloopForm::order_created(84, 12292);
  23. $order = Order::findOne(12080);
  24. $addr = json_decode($order->address_data, true);
  25. $getFee = KeloopForm::getFee(84, $addr['longitude'], $addr['latitude']);
  26. $getCouriers = KeloopForm::getCouriers(84);
  27. $getMerchants = KeloopForm::getMerchants(84);
  28. $getTeamInfo = KeloopForm::getTeamInfo(84);
  29. $getFundUrl = KeloopForm::getFundUrl(84);
  30. return $this->asJson([$delivery_res, $getFee, $getTeamInfo, $getFundUrl, $getCouriers, $getMerchants]);
  31. }
  32. public function actionConf() {
  33. $store_id = get_store_id();
  34. $conf = KeloopForm::conf($store_id);
  35. $getFundUrl = KeloopForm::getFundUrl($store_id);
  36. return $this->asJson([
  37. 'code' => 0,
  38. 'data' => [
  39. 'conf' => $conf,
  40. 'getFundUrl' => $getFundUrl,
  41. '$getTeamInfo' => KeloopForm::getTeamInfo($store_id),
  42. '$getCouriers' => KeloopForm::getCouriers($store_id),
  43. '$getMerchants' => KeloopForm::getMerchants($store_id),
  44. ],
  45. ]);
  46. }
  47. public function actionConfSave(){
  48. $store_id = get_store_id();
  49. $conf = input_params('conf');
  50. if(!is_array($conf)){
  51. $conf = json_decode($conf, true);
  52. }
  53. $res = [];
  54. KeloopForm::saveConf($store_id, $conf, $res);
  55. return $this->asJson($res);
  56. }
  57. public function actionOrderList() {
  58. $store_id = get_store_id();
  59. $params = all_params();
  60. $res = KeloopForm::orderList($store_id, $params);
  61. return $this->asJson($res);
  62. }
  63. public function actionOrderErrList() {
  64. $store_id = get_store_id();
  65. $res = KeloopForm::orderErrList($store_id);
  66. return $this->asJson($res);
  67. }
  68. public function actionOrderErrRecreate() {
  69. $store_id = get_store_id();
  70. $id = input_params('id');
  71. $res = KeloopForm::orderErrRecreate($store_id, $id);
  72. return $this->asJson($res);
  73. }
  74. public function actionOrderFee() {
  75. $store_id = get_store_id();
  76. $order_id = input_params('order_id');
  77. $res = KeloopForm::orderFee($store_id, $order_id);
  78. return $this->asJson($res);
  79. }
  80. public function actionOrderCancel() {
  81. $store_id = get_store_id();
  82. $order_id = input_params('order_id');
  83. $reason = input_params('reason');
  84. $res = KeloopForm::order_canceled($store_id, $order_id, $reason, 2);
  85. return $this->asJson($res);
  86. }
  87. public function actionMealOutOrder() {
  88. $store_id = get_store_id();
  89. $trade_no = input_params('trade_no');
  90. $res = KeloopForm::mealOutOrder($store_id, $trade_no, time());
  91. return $this->asJson($res);
  92. }
  93. public function actionGetOrderInfo() {
  94. $store_id = get_store_id();
  95. $trade_no = input_params('trade_no');
  96. $res = KeloopForm::getOrderInfo($store_id, $trade_no, 0);
  97. return $this->asJson($res);
  98. }
  99. public function actionGetCourierTag() {
  100. $store_id = get_store_id();
  101. $trade_no = input_params('trade_no');
  102. $res = KeloopForm::getCourierTag($store_id, $trade_no);
  103. return $this->asJson($res);
  104. }
  105. public function actionGetOrderLog() {
  106. $store_id = get_store_id();
  107. $trade_no = input_params('trade_no');
  108. $res = KeloopForm::getOrderLog($store_id, $trade_no);
  109. return $this->asJson($res);
  110. }
  111. }