FeeController.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace addons\AvoidTax\backend\controllers;
  3. use addons\AvoidTax\common\models\TaxOrder;
  4. use addons\AvoidTax\common\service\FeeService;
  5. use addons\AvoidTax\common\service\OrderService;
  6. use common\enums\DownloadEnum;
  7. use common\helpers\csv\CsvExportHelper;
  8. use Yii;
  9. /**
  10. * 手续费相关
  11. *
  12. * Class FeeController
  13. * @package addons\AvoidTax\backend\controllers
  14. */
  15. class FeeController extends BaseController
  16. {
  17. public $enableCsrfValidation = false;
  18. /**
  19. * @var FeeService
  20. */
  21. protected $service;
  22. public function init()
  23. {
  24. parent::init();
  25. $this->service = new FeeService(['mall_id' => $this->mall_id]);
  26. }
  27. /**
  28. * 交易列表
  29. *
  30. * @return
  31. */
  32. public function actionIndex()
  33. {
  34. if ($this->request->isAjax && $this->request->isGet) {
  35. $params = $this->request->getQueryParams();
  36. $list = $this->service->getOrderFeeList($params);
  37. return $this->success('ok', $list);
  38. }
  39. if(Yii::$app->request->post('flag') == 'EXPORT'){
  40. $post = Yii::$app->request->post();
  41. $post['mall_id'] = $this->mall_id;
  42. $filename = '手续费列表-' . date('YmdHis').'_'.rand(10000,99999);
  43. $post['sub_type'] = TaxOrder::SUB_TYPE_TAX;
  44. $res = CsvExportHelper::exportDownLoadCenter($this->mall_id,$filename,DownloadEnum::TYPE_STATISTICS,TaxOrder::class,'exportHandle', $post);
  45. if ($res === false) return $this->error('加入导出任务失败'.CsvExportHelper::getStaticError());
  46. return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!');
  47. }
  48. return $this->render('index');
  49. }
  50. /**
  51. * 详情
  52. *
  53. * @return void
  54. */
  55. public function actionDetail()
  56. {
  57. if ($this->request->isAjax) {
  58. $num = $this->request->get('num');
  59. return $this->success('ok', $this->service->getOrderDetail($num));
  60. }
  61. }
  62. }