Financial.php 3.0 KB

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