You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace app\common\controller;
  3. /**
  4. * 退款
  5. * Trait Recharge
  6. * @package app\common\controller
  7. */
  8. trait Recharge
  9. {
  10. /**
  11. * 显示资源列表
  12. *
  13. * @return \think\Response
  14. */
  15. public function index()
  16. {
  17. $where = $this->request->getMore([
  18. ['data', ''],
  19. ['paid', ''],
  20. ['nickname', ''],
  21. ]);
  22. $where['store_id'] = 0;
  23. return $this->success($this->services->getRechargeList($where));
  24. }
  25. /**
  26. * 删除指定资源
  27. *
  28. * @param int $id
  29. * @return \think\Response
  30. */
  31. public function delete($id)
  32. {
  33. if (!$id) return $this->fail('缺少参数');
  34. return $this->success($this->services->delRecharge((int)$id) ? '删除成功' : '删除失败');
  35. }
  36. /**
  37. * 获取用户充值数据
  38. * @return array
  39. */
  40. public function user_recharge()
  41. {
  42. $where = $this->request->getMore([
  43. ['data', ''],
  44. ['paid', ''],
  45. ['nickname', ''],
  46. ]);
  47. $where['store_id'] = 0;
  48. return $this->success($this->services->user_recharge($where));
  49. }
  50. /**
  51. * 退款表单
  52. * @param $id
  53. * @return mixed
  54. */
  55. public function refund_edit($id)
  56. {
  57. if (!$id) return $this->fail('数据不存在');
  58. return $this->success($this->services->refund_edit((int)$id));
  59. }
  60. /**
  61. * 退款操作
  62. * @param $id
  63. */
  64. public function refund_update($id)
  65. {
  66. $data = $this->request->postMore([
  67. 'refund_price',
  68. ]);
  69. if (!$id) return $this->fail('数据不存在');
  70. return $this->success($this->services->refund_update((int)$id, $data['refund_price']) ? '退款成功' : '退款失败');
  71. }
  72. }