WithdrawApi.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. namespace backend\models;
  3. class WithdrawApi extends BaseApi
  4. {
  5. public $apiUrl = 'withdraw';
  6. /**
  7. * 出金列表
  8. * @param array $data
  9. * @return array
  10. */
  11. public function getWithdrawList($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 array $data
  23. * @return array
  24. */
  25. public function addWithdraw($data)
  26. {
  27. $result = $this->post($this->apiUrl . '/create', $data);
  28. if ($result['code'] == 1) {
  29. return $this->returnArray(1, $result['data'], '出金申请成功');
  30. } else {
  31. return $this->returnArray(0, [], $result['message']);
  32. }
  33. }
  34. /**
  35. * 当月出金记录
  36. * @param int $memberId
  37. * @return array
  38. */
  39. public function getMonthWithdraw($memberId)
  40. {
  41. $data = ['memberId' => $memberId];
  42. $result = $this->get($this->apiUrl . '/get-month-withdraw', $data);
  43. if ($result['code'] == 1) {
  44. return $this->returnArray(1, $result['data'], '获取出金记录成功');
  45. } else {
  46. return $this->returnArray(0, [], $result['message']);
  47. }
  48. }
  49. /**
  50. * 统计出金金额 amount+fee
  51. * @param int $type
  52. * @return array
  53. */
  54. public function sumWithdrawByType($type = null)
  55. {
  56. $data['type'] = $type;
  57. $result = $this->get($this->apiUrl . '/sum-withdraw', $data);
  58. if ($result['code'] == 1) {
  59. return $this->returnArray(1, $result['data'], 'SUCCESS');
  60. } else {
  61. return $this->returnArray(0, [], 'FAILED');
  62. }
  63. }
  64. /**
  65. * 统计出金金额 amount
  66. * @param int $type
  67. * @return array
  68. */
  69. public function sumNotFeeByType($type)
  70. {
  71. $data['type'] = $type;
  72. $result = $this->get($this->apiUrl . '/sum-not-fee', $data);
  73. if ($result['code'] == 1) {
  74. return $this->returnArray(1, $result['data'], 'SUCCESS');
  75. } else {
  76. return $this->returnArray(0, [], 'FAILED');
  77. }
  78. }
  79. /**
  80. * 统计出金金额 人民币 amount*rate
  81. * @param int $type
  82. * @return array
  83. */
  84. public function sumRmbByType($type)
  85. {
  86. $data['type'] = $type;
  87. $result = $this->get($this->apiUrl . '/sum-rmb', $data);
  88. if ($result['code'] == 1) {
  89. return $this->returnArray(1, $result['data'], 'SUCCESS');
  90. } else {
  91. return $this->returnArray(0, [], 'FAILED');
  92. }
  93. }
  94. /**
  95. * 出金详情
  96. * @param int $id
  97. * @return array
  98. */
  99. public function detail($id)
  100. {
  101. $data['id'] = $id;
  102. $result = $this->get($this->apiUrl . '/detail', $data);
  103. if ($result['code'] == 1) {
  104. return $this->returnArray(1, $result['data'], 'SUCCESS');
  105. } else {
  106. return $this->returnArray(0, [], 'FAILED');
  107. }
  108. }
  109. /**
  110. * 修改出金记录
  111. * @param int $id
  112. * @param array $post
  113. * @return array
  114. */
  115. public function updateWithdraw($id, $post)
  116. {
  117. $data = $post;
  118. $data['id'] = $id;
  119. $result = $this->post($this->apiUrl . '/update', $data);
  120. if ($result['code'] == 1) {
  121. return $this->returnArray(1, $result['data'], 'SUCCESS');
  122. } else {
  123. return $this->returnArray(0, [], 'FAILED');
  124. }
  125. }
  126. /**
  127. * 出金备注
  128. * @param int $id
  129. * @param string $memo
  130. * @return array
  131. */
  132. public function updateWithdrawMemo($id, $memo)
  133. {
  134. return static::updateWithdraw($id, ['memo' => $memo]);
  135. }
  136. /**
  137. * 出金审核
  138. * @param int $id
  139. * @param int $type
  140. * @param string $admin_name
  141. * @return array
  142. */
  143. public function updateWithdrawType($id, $type, $admin_name = '')
  144. {
  145. $data = [
  146. 'type' => $type,
  147. 'admin_name' => $admin_name,
  148. ];
  149. return static::updateWithdraw($id, $data);
  150. }
  151. /**
  152. * 撤销出金
  153. * @param int $id
  154. * @param int $type
  155. * @param string $admin_name
  156. * @return array
  157. */
  158. public function Revokegold($id, $mt4_id)
  159. {
  160. $data = [
  161. 'id' => $id,
  162. 'mt4_id' => $mt4_id,
  163. ];
  164. $result = $this->post($this->apiUrl . '/revokegold', $data);
  165. if ($result['code'] == 1) {
  166. return $this->returnArray(1, $result['data'], 'SUCCESS');
  167. } else {
  168. return $this->returnArray(0, [], 'FAILED');
  169. }
  170. }
  171. }