Memberfund.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 资金控制器
  14. */
  15. class Memberfund extends MobileMember {
  16. public function initialize() {
  17. parent::initialize(); // TODO: Change the autogenerated stub
  18. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/predeposit.lang.php');
  19. }
  20. /**
  21. * @api {POST} api/Memberfund/predepositlog 预存款日志列表
  22. * @apiVersion 1.0.0
  23. * @apiGroup MemberFund
  24. *
  25. * @apiHeader {String} X-DS-KEY 用户授权token
  26. *
  27. * @apiParam {Int} page 页码
  28. * @apiParam {Int} per_page 每页数量
  29. *
  30. * @apiSuccess {String} code 返回码,10000为成功
  31. * @apiSuccess {String} message 返回消息
  32. * @apiSuccess {Object} result 返回数据
  33. * @apiSuccess {Object[]} result.list 预存款记录列表
  34. * @apiSuccess {Int} result.list.lg_addtime 记录时间
  35. * @apiSuccess {String} result.list.lg_addtime_text 记录时间描述
  36. * @apiSuccess {String} result.list.lg_admin_name 管理员名称
  37. * @apiSuccess {Float} result.list.lg_av_amount 变更可用金额
  38. * @apiSuccess {String} result.list.lg_desc 变更描述
  39. * @apiSuccess {Float} result.list.lg_freeze_amount 变更冻结金额
  40. * @apiSuccess {Int} result.list.lg_id 记录ID
  41. * @apiSuccess {Int} result.list.lg_member_id 用户ID
  42. * @apiSuccess {String} result.list.lg_member_name 用户名称
  43. * @apiSuccess {String} result.list.lg_type 记录类型
  44. * @apiSuccess {Int} result.page_total 总页数
  45. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  46. */
  47. public function predepositlog() {
  48. $predeposit_model = model('predeposit');
  49. $where = array();
  50. $where[] = array('lg_member_id', '=', $this->member_info['member_id']);
  51. $where[] = array('lg_av_amount', '<>', 0);
  52. $list = $predeposit_model->getPdLogList($where, $this->pagesize, '*', 'lg_id desc');
  53. if ($list) {
  54. foreach ($list as $k => $v) {
  55. $v['lg_addtime_text'] = @date('Y-m-d H:i:s', $v['lg_addtime']);
  56. $list[$k] = $v;
  57. }
  58. }
  59. $result = array_merge(array('list' => $list), mobile_page($predeposit_model->page_info));
  60. ds_json_encode(10000, '', $result);
  61. }
  62. /**
  63. * @api {POST} api/Memberfund/rcblog 充值卡余额变更日志
  64. * @apiVersion 1.0.0
  65. * @apiGroup MemberFund
  66. *
  67. * @apiHeader {String} X-DS-KEY 用户授权token
  68. *
  69. * @apiParam {Int} page 页码
  70. * @apiParam {Int} per_page 每页数量
  71. *
  72. * @apiSuccess {String} code 返回码,10000为成功
  73. * @apiSuccess {String} message 返回消息
  74. * @apiSuccess {Object} result 返回数据
  75. * @apiSuccess {Object[]} result.log_list 充值卡记录列表 (返回字段参考rcblog)
  76. * @apiSuccess {Int} result.log_list.add_time_text 记录时间
  77. * @apiSuccess {Int} result.page_total 总页数
  78. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  79. */
  80. public function rcblog() {
  81. $rcblog_model = model('rcblog');
  82. $condition = array();
  83. $condition[] = array('member_id','=',$this->member_info['member_id']);
  84. $log_list = $rcblog_model->getRechargecardBalanceLogList($condition, $this->pagesize, 'rcblog_id desc');
  85. if ($log_list) {
  86. foreach ($log_list as $k => $v) {
  87. $v['add_time_text'] = @date('Y-m-d H:i:s', $v['rcblog_addtime']);
  88. $log_list[$k] = $v;
  89. }
  90. }
  91. $result = array_merge(array('log_list' => $log_list), mobile_page($rcblog_model->page_info));
  92. ds_json_encode(10000, '', $result);
  93. }
  94. /**
  95. * @api {POST} api/Memberfund/pdrechargelist 充值明细
  96. * @apiVersion 1.0.0
  97. * @apiGroup MemberFund
  98. *
  99. * @apiHeader {String} X-DS-KEY 用户授权token
  100. *
  101. * @apiParam {Int} page 页码
  102. * @apiParam {Int} per_page 每页数量
  103. *
  104. * @apiSuccess {String} code 返回码,10000为成功
  105. * @apiSuccess {String} message 返回消息
  106. * @apiSuccess {Object} result 返回数据
  107. * @apiSuccess {Object[]} result.list 充值记录列表
  108. * @apiSuccess {Int} result.list.pdr_addtime 记录时间
  109. * @apiSuccess {String} result.list.pdr_addtime_text 记录时间描述
  110. * @apiSuccess {String} result.list.pdr_admin 管理员名称
  111. * @apiSuccess {Float} result.list.pdr_amount 充值金额
  112. * @apiSuccess {Int} result.list.pdr_id 记录ID
  113. * @apiSuccess {Int} result.list.pdr_member_id 用户ID
  114. * @apiSuccess {String} result.list.pdr_member_name 用户名称
  115. * @apiSuccess {String} result.list.pdr_payment_code 支付方式代码
  116. * @apiSuccess {String} result.list.pdr_payment_name 支付方式名称
  117. * @apiSuccess {Int} result.list.pdr_payment_state 支付状态
  118. * @apiSuccess {String} result.list.pdr_payment_state_text 支付状态描述
  119. * @apiSuccess {Int} result.list.pdr_paymenttime 支付时间
  120. * @apiSuccess {String} result.list.pdr_sn 支付单号
  121. * @apiSuccess {String} result.list.pdr_trade_sn 第三方流水号
  122. * @apiSuccess {Int} result.page_total 总页数
  123. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  124. */
  125. public function pdrechargelist() {
  126. $condition = array();
  127. $condition[] = array('pdr_member_id','=',$this->member_info['member_id']);
  128. $predeposit_model = model('predeposit');
  129. $list = $predeposit_model->getPdRechargeList($condition, $this->pagesize, '*', 'pdr_id desc');
  130. if ($list) {
  131. foreach ($list as $k => $v) {
  132. $v['pdr_addtime_text'] = @date('Y-m-d H:i:s', $v['pdr_addtime']);
  133. $v['pdr_payment_name'] = get_order_payment_name($v['pdr_payment_code']);
  134. $v['pdr_payment_state_text'] = $v['pdr_payment_state'] == 1 ? lang('predeposit_rechargepaysuccess') : lang('predeposit_rechargewaitpaying');
  135. $list[$k] = $v;
  136. }
  137. }
  138. $result = array_merge(array('list' => $list), mobile_page($predeposit_model->page_info));
  139. ds_json_encode(10000, '', $result);
  140. }
  141. /**
  142. * @api {POST} api/MemberFund/pdcashlist 提现记录
  143. * @apiVersion 1.0.0
  144. * @apiGroup Memberfund
  145. *
  146. * @apiHeader {String} X-DS-KEY 用户授权token
  147. *
  148. * @apiSuccess {String} code 返回码,10000为成功
  149. * @apiSuccess {String} message 返回消息
  150. * @apiSuccess {Object} result 返回数据
  151. * @apiSuccess {Object[]} result.list 提现记录列表
  152. * @apiSuccess {Int} result.list.pdc_addtime 记录时间
  153. * @apiSuccess {String} result.list.pdc_addtime_text 记录时间描述
  154. * @apiSuccess {Float} result.list.pdc_amount 提现金额
  155. * @apiSuccess {String} result.list.pdc_bank_name 提现方式名称
  156. * @apiSuccess {String} result.list.pdc_bank_no 提现账号
  157. * @apiSuccess {String} result.list.pdc_bank_user 提现账号真实姓名
  158. * @apiSuccess {Int} result.list.pdc_id 记录ID
  159. * @apiSuccess {Int} result.list.pdc_member_id 用户ID
  160. * @apiSuccess {String} result.list.pdc_member_name 用户名称
  161. * @apiSuccess {String} result.list.pdc_payment_admin 支付管理员
  162. * @apiSuccess {Int} result.list.pdc_payment_state 支付状态
  163. * @apiSuccess {String} result.list.pdc_payment_state_text 支付状态描述
  164. * @apiSuccess {Int} result.list.pdc_payment_time 支付时间
  165. * @apiSuccess {String} result.list.pdc_payment_time_text 支付时间描述
  166. * @apiSuccess {String} result.list.pdc_sn 支付单号
  167. * @apiSuccess {Int} result.page_total 总页数
  168. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  169. */
  170. public function pdcashlist() {
  171. $condition = array();
  172. $condition[] = array('pdc_member_id','=',$this->member_info['member_id']);
  173. $predeposit_model = model('predeposit');
  174. $list = $predeposit_model->getPdcashList($condition, $this->pagesize, '*', 'pdc_id desc');
  175. if ($list) {
  176. foreach ($list as $k => $v) {
  177. $v['pdc_addtime_text'] = @date('Y-m-d H:i:s', $v['pdc_addtime']);
  178. $v['pdc_payment_time_text'] = @date('Y-m-d H:i:s', $v['pdc_payment_time']);
  179. $v['pdc_payment_state_text'] = $v['pdc_payment_state'] == 1 ? lang('predeposit_rechargepaysuccess') : lang('predeposit_rechargewaitpaying');
  180. $list[$k] = $v;
  181. }
  182. }
  183. $result = array_merge(array('list' => $list), mobile_page($predeposit_model->page_info));
  184. ds_json_encode(10000, '', $result);
  185. }
  186. /**
  187. * @api {POST} api/Memberfund/rechargecard_add 充值卡充值
  188. * @apiVersion 1.0.0
  189. * @apiGroup MemberFund
  190. *
  191. * @apiHeader {String} X-DS-KEY 用户授权token
  192. *
  193. * @apiParam {String} rc_sn 卡号
  194. *
  195. * @apiSuccess {String} code 返回码,10000为成功
  196. * @apiSuccess {String} message 返回消息
  197. * @apiSuccess {Object} result 返回数据
  198. */
  199. public function rechargecard_add() {
  200. $rc_sn = trim(input('post.rc_sn'));
  201. if (!$rc_sn) {
  202. ds_json_encode(10001, lang('param_error'));
  203. }
  204. try {
  205. $res = model('predeposit')->addRechargecard($rc_sn, array('member_id' => $this->member_info['member_id'], 'member_name' => $this->member_info['member_name']));
  206. if ($res['message']) {
  207. ds_json_encode(10001, $res['message']);
  208. }
  209. } catch (\Exception $e) {
  210. ds_json_encode(10001, $e->getMessage());
  211. }
  212. ds_json_encode(10000, lang('predeposit_recharge_success'), 1);
  213. }
  214. }