Financial.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\system\financial;
  12. use app\common\repositories\system\financial\FinancialRepository;
  13. use crmeb\basic\BaseController;
  14. use think\App;
  15. class Financial extends BaseController
  16. {
  17. public $repository;
  18. public function __construct(App $app, FinancialRepository $repository)
  19. {
  20. parent::__construct($app);
  21. $this->repository = $repository;
  22. }
  23. public function lst()
  24. {
  25. [$page, $limit] = $this->getPage();
  26. $where = $this->request->params(['date','status','financial_type','financial_status','keyword','is_trader','mer_id']);
  27. $data = $this->repository->getAdminList($where,$page,$limit);
  28. return app('json')->success($data);
  29. }
  30. /**
  31. * TODO
  32. * @param $id
  33. * @return \think\response\Json
  34. * @author Qinii
  35. * @day 3/19/21
  36. */
  37. public function detail($id)
  38. {
  39. $data = $this->repository->detail($id);
  40. return app('json')->success($data);
  41. }
  42. /**
  43. * TODO 审核
  44. * @param $id
  45. * @return \think\response\Json
  46. * @author Qinii
  47. * @day 3/19/21
  48. */
  49. public function switchStatus($id)
  50. {
  51. $data = $this->request->params(['status', 'refusal']);
  52. $data['status_time'] = date('Y-m-d H:i:s');
  53. if (($data['status'] == -1)){
  54. if(empty($data['refusal'])) return app('json')->fail('请输入拒绝理由');
  55. $this->repository->cancel(null,$id,$data);
  56. }else{
  57. $this->repository->update($id,['status' => $data['status'],'status_time' => $data['status_time']]);
  58. }
  59. return app('json')->success('审核完成');
  60. }
  61. /**
  62. * TODO 修改凭证
  63. * @param $id
  64. * @return \think\response\Json
  65. * @author Qinii
  66. * @day 3/19/21
  67. */
  68. public function update($id)
  69. {
  70. $image = $this->request->param('image');
  71. if(empty($image)) return app('json')->fail('请上传凭证');
  72. $res = $this->repository->get($id);
  73. if($res['status'] != 1) return app('json')->success('申请未通过审核');
  74. $data['image'] = implode(',',$image);
  75. $data['admin_id'] = $this->request->adminId();
  76. $data['update_time'] = date('Y-m-d H:i:s');
  77. $data['financial_status'] = 1;
  78. $this->repository->update($id,$data);
  79. return app('json')->success('修改完成');
  80. }
  81. public function markForm($id)
  82. {
  83. return app('json')->success(formToData($this->repository->adminMarkForm($id)));
  84. }
  85. public function mark($id)
  86. {
  87. $ret = $this->repository->getWhere([$this->repository->getPk() => $id]);
  88. if(!$ret) return app('json')->fail('数据不存在');
  89. $data = $this->request->params(['admin_mark']);
  90. $this->repository->update($id,$data);
  91. return app('json')->success('备注成功');
  92. }
  93. /**
  94. * TODO 头部统计
  95. * @return \think\response\Json
  96. * @author Qinii
  97. * @day 4/22/21
  98. */
  99. public function title()
  100. {
  101. $ret = $this->repository->getTitle();
  102. return app('json')->success($ret);
  103. }
  104. }