| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- namespace backend\models;
- class WithdrawApi extends BaseApi
- {
- public $apiUrl = 'withdraw';
- /**
- * 出金列表
- * @param array $data
- * @return array
- */
- public function getWithdrawList($data = [])
- {
- $result = $this->get($this->apiUrl . '/index', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], '获取出金记录成功');
- } else {
- return $this->returnArray(0, [], '获取出金记录失败');
- }
- }
- /**
- * 出金申请
- * @param array $data
- * @return array
- */
- public function addWithdraw($data)
- {
- $result = $this->post($this->apiUrl . '/create', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], '出金申请成功');
- } else {
- return $this->returnArray(0, [], $result['message']);
- }
- }
- /**
- * 当月出金记录
- * @param int $memberId
- * @return array
- */
- public function getMonthWithdraw($memberId)
- {
- $data = ['memberId' => $memberId];
- $result = $this->get($this->apiUrl . '/get-month-withdraw', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], '获取出金记录成功');
- } else {
- return $this->returnArray(0, [], $result['message']);
- }
- }
- /**
- * 统计出金金额 amount+fee
- * @param int $type
- * @return array
- */
- public function sumWithdrawByType($type = null)
- {
- $data['type'] = $type;
- $result = $this->get($this->apiUrl . '/sum-withdraw', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], 'SUCCESS');
- } else {
- return $this->returnArray(0, [], 'FAILED');
- }
- }
- /**
- * 统计出金金额 amount
- * @param int $type
- * @return array
- */
- public function sumNotFeeByType($type)
- {
- $data['type'] = $type;
- $result = $this->get($this->apiUrl . '/sum-not-fee', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], 'SUCCESS');
- } else {
- return $this->returnArray(0, [], 'FAILED');
- }
- }
- /**
- * 统计出金金额 人民币 amount*rate
- * @param int $type
- * @return array
- */
- public function sumRmbByType($type)
- {
- $data['type'] = $type;
- $result = $this->get($this->apiUrl . '/sum-rmb', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], 'SUCCESS');
- } else {
- return $this->returnArray(0, [], 'FAILED');
- }
- }
- /**
- * 出金详情
- * @param int $id
- * @return array
- */
- public function detail($id)
- {
- $data['id'] = $id;
- $result = $this->get($this->apiUrl . '/detail', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], 'SUCCESS');
- } else {
- return $this->returnArray(0, [], 'FAILED');
- }
- }
- /**
- * 修改出金记录
- * @param int $id
- * @param array $post
- * @return array
- */
- public function updateWithdraw($id, $post)
- {
- $data = $post;
- $data['id'] = $id;
- $result = $this->post($this->apiUrl . '/update', $data);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], 'SUCCESS');
- } else {
- return $this->returnArray(0, [], 'FAILED');
- }
- }
- /**
- * 出金备注
- * @param int $id
- * @param string $memo
- * @return array
- */
- public function updateWithdrawMemo($id, $memo)
- {
- return static::updateWithdraw($id, ['memo' => $memo]);
- }
- /**
- * 出金审核
- * @param int $id
- * @param int $type
- * @return array
- */
- public function updateWithdrawType($id, $type)
- {
- return static::updateWithdraw($id, ['type' => $type]);
- }
- }
|