DepositApi.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace backend\models;
  3. class DepositApi extends BaseApi
  4. {
  5. public $apiUrl = 'deposit';
  6. /**
  7. * 入金列表
  8. * @param array $data
  9. * @return array
  10. */
  11. public function getDepositList($data = [])
  12. {
  13. $result = $this->get($this->apiUrl . '/index', $data);
  14. if ($result['code'] == 1) {
  15. return $this->returnArray(1, $result['data'], '获取入金记录成功');
  16. } else {
  17. return $this->returnArray(0, [], '获取入金记录失败');
  18. }
  19. }
  20. /**
  21. * 入金统计
  22. * @param int $type
  23. * @return array
  24. */
  25. public function sumDepositByType($type)
  26. {
  27. $data['type'] = $type;
  28. $result = $this->get($this->apiUrl . '/sum-deposit', $data);
  29. if ($result['code'] == 1) {
  30. return $this->returnArray(1, $result['data'], 'SUCCESS');
  31. } else {
  32. return $this->returnArray(0, [], 'FAILED');
  33. }
  34. }
  35. /**
  36. * 补单
  37. * @param int $id
  38. * @param string $admin_name
  39. * @return array
  40. */
  41. public function patchIntoGold($id, $admin_name = '')
  42. {
  43. $data = [
  44. 'id' => $id,
  45. 'admin_name' => $admin_name,
  46. ];
  47. $result = $this->post($this->apiUrl . '/patch-into-gold', $data);
  48. if ($result['code'] == 1) {
  49. return $this->returnArray(1, $result['data'], 'SUCCESS');
  50. } else {
  51. return $this->returnArray(0, [], 'FAILED');
  52. }
  53. }
  54. /**
  55. * 获取入金配置
  56. * @return array
  57. */
  58. public function getDepositConfig()
  59. {
  60. $result = $this->get($this->apiUrl . '/get-deposit-config');
  61. if ($result['code'] == 1) {
  62. return $this->returnArray(1, $result['data'], 'SUCCESS');
  63. } else {
  64. return $this->returnArray(0, [], 'FAILED');
  65. }
  66. }
  67. /**
  68. * 设置入金配置
  69. * @param string|array $config
  70. * @return array
  71. */
  72. public function setDepositConfig($config)
  73. {
  74. $data = [];
  75. if (is_array($config)) {
  76. $config = json_encode($config, 320);
  77. }
  78. $data['config'] = $config;
  79. $result = $this->post($this->apiUrl . '/set-deposit-config', $data);
  80. if ($result['code'] == 1) {
  81. return $this->returnArray(1, $result['data'], 'SUCCESS');
  82. } else {
  83. return $this->returnArray(0, [], $result['message']);
  84. }
  85. }
  86. }