Memberfund.php 9.9 KB

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