Memberfund.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. * DSMall多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  9. * 网站地址: http://www.csdeshang.com
  10. * ----------------------------------------------------------------------------
  11. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  12. * 不允许对程序代码以任何形式任何目的的再发布。
  13. * ============================================================================
  14. * 资金控制器
  15. */
  16. class Memberfund extends MobileMember {
  17. public function initialize() {
  18. parent::initialize(); // TODO: Change the autogenerated stub
  19. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/predeposit.lang.php');
  20. }
  21. /**
  22. * @api {POST} api/Memberfund/predepositlog 预存款日志列表
  23. * @apiVersion 1.0.0
  24. * @apiGroup MemberFund
  25. *
  26. * @apiHeader {String} X-DS-KEY 用户授权token
  27. *
  28. * @apiParam {Int} page 页码
  29. * @apiParam {Int} per_page 每页数量
  30. *
  31. * @apiSuccess {String} code 返回码,10000为成功
  32. * @apiSuccess {String} message 返回消息
  33. * @apiSuccess {Object} result 返回数据
  34. * @apiSuccess {Object[]} result.list 预存款记录列表
  35. * @apiSuccess {Int} result.list.lg_addtime 记录时间
  36. * @apiSuccess {String} result.list.lg_addtime_text 记录时间描述
  37. * @apiSuccess {String} result.list.lg_admin_name 管理员名称
  38. * @apiSuccess {Float} result.list.lg_av_amount 变更可用金额
  39. * @apiSuccess {String} result.list.lg_desc 变更描述
  40. * @apiSuccess {Float} result.list.lg_freeze_amount 变更冻结金额
  41. * @apiSuccess {Int} result.list.lg_id 记录ID
  42. * @apiSuccess {Int} result.list.lg_member_id 用户ID
  43. * @apiSuccess {String} result.list.lg_member_name 用户名称
  44. * @apiSuccess {String} result.list.lg_type 记录类型
  45. * @apiSuccess {Int} result.page_total 总页数
  46. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  47. */
  48. public function predepositlog() {
  49. $predeposit_model = model('predeposit');
  50. $where = array();
  51. $where[] = array('lg_member_id', '=', $this->member_info['member_id']);
  52. $where[] = array('lg_av_amount', '<>', 0);
  53. $list = $predeposit_model->getPdLogList($where, $this->pagesize, '*', 'lg_id desc');
  54. if ($list) {
  55. foreach ($list as $k => $v) {
  56. $v['lg_addtime_text'] = @date('Y-m-d H:i:s', $v['lg_addtime']);
  57. $list[$k] = $v;
  58. }
  59. }
  60. $result = array_merge(array('list' => $list), mobile_page($predeposit_model->page_info));
  61. ds_json_encode(10000, '', $result);
  62. }
  63. /**
  64. * @api {POST} api/Memberfund/rcblog 充值卡余额变更日志
  65. * @apiVersion 1.0.0
  66. * @apiGroup MemberFund
  67. *
  68. * @apiHeader {String} X-DS-KEY 用户授权token
  69. *
  70. * @apiParam {Int} page 页码
  71. * @apiParam {Int} per_page 每页数量
  72. *
  73. * @apiSuccess {String} code 返回码,10000为成功
  74. * @apiSuccess {String} message 返回消息
  75. * @apiSuccess {Object} result 返回数据
  76. * @apiSuccess {Object[]} result.log_list 充值卡记录列表 (返回字段参考rcblog)
  77. * @apiSuccess {Int} result.log_list.add_time_text 记录时间
  78. * @apiSuccess {Int} result.page_total 总页数
  79. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  80. */
  81. public function rcblog() {
  82. $rcblog_model = model('rcblog');
  83. $condition = array();
  84. $condition[] = array('member_id','=',$this->member_info['member_id']);
  85. $log_list = $rcblog_model->getRechargecardBalanceLogList($condition, $this->pagesize, 'rcblog_id desc');
  86. if ($log_list) {
  87. foreach ($log_list as $k => $v) {
  88. $v['add_time_text'] = @date('Y-m-d H:i:s', $v['rcblog_addtime']);
  89. $log_list[$k] = $v;
  90. }
  91. }
  92. $result = array_merge(array('log_list' => $log_list), mobile_page($rcblog_model->page_info));
  93. ds_json_encode(10000, '', $result);
  94. }
  95. /**
  96. * @api {POST} api/Memberfund/pdrechargelist 充值明细
  97. * @apiVersion 1.0.0
  98. * @apiGroup MemberFund
  99. *
  100. * @apiHeader {String} X-DS-KEY 用户授权token
  101. *
  102. * @apiParam {Int} page 页码
  103. * @apiParam {Int} per_page 每页数量
  104. *
  105. * @apiSuccess {String} code 返回码,10000为成功
  106. * @apiSuccess {String} message 返回消息
  107. * @apiSuccess {Object} result 返回数据
  108. * @apiSuccess {Object[]} result.list 充值记录列表
  109. * @apiSuccess {Int} result.list.pdr_addtime 记录时间
  110. * @apiSuccess {String} result.list.pdr_addtime_text 记录时间描述
  111. * @apiSuccess {String} result.list.pdr_admin 管理员名称
  112. * @apiSuccess {Float} result.list.pdr_amount 充值金额
  113. * @apiSuccess {Int} result.list.pdr_id 记录ID
  114. * @apiSuccess {Int} result.list.pdr_member_id 用户ID
  115. * @apiSuccess {String} result.list.pdr_member_name 用户名称
  116. * @apiSuccess {String} result.list.pdr_payment_code 支付方式代码
  117. * @apiSuccess {String} result.list.pdr_payment_name 支付方式名称
  118. * @apiSuccess {Int} result.list.pdr_payment_state 支付状态
  119. * @apiSuccess {String} result.list.pdr_payment_state_text 支付状态描述
  120. * @apiSuccess {Int} result.list.pdr_paymenttime 支付时间
  121. * @apiSuccess {String} result.list.pdr_sn 支付单号
  122. * @apiSuccess {String} result.list.pdr_trade_sn 第三方流水号
  123. * @apiSuccess {Int} result.page_total 总页数
  124. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  125. */
  126. public function pdrechargelist() {
  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. $condition = array();
  173. $condition[] = array('pdc_member_id','=',$this->member_info['member_id']);
  174. $predeposit_model = model('predeposit');
  175. $list = $predeposit_model->getPdcashList($condition, $this->pagesize, '*', 'pdc_id desc');
  176. if ($list) {
  177. foreach ($list as $k => $v) {
  178. $v['pdc_addtime_text'] = @date('Y-m-d H:i:s', $v['pdc_addtime']);
  179. $v['pdc_payment_time_text'] = @date('Y-m-d H:i:s', $v['pdc_payment_time']);
  180. $v['pdc_payment_state_text'] = $v['pdc_payment_state'] == 1 ? lang('predeposit_rechargepaysuccess') : lang('predeposit_rechargewaitpaying');
  181. $list[$k] = $v;
  182. }
  183. }
  184. $result = array_merge(array('list' => $list), mobile_page($predeposit_model->page_info));
  185. ds_json_encode(10000, '', $result);
  186. }
  187. /**
  188. * @api {POST} api/Memberfund/rechargecard_add 充值卡充值
  189. * @apiVersion 1.0.0
  190. * @apiGroup MemberFund
  191. *
  192. * @apiHeader {String} X-DS-KEY 用户授权token
  193. *
  194. * @apiParam {String} rc_sn 卡号
  195. *
  196. * @apiSuccess {String} code 返回码,10000为成功
  197. * @apiSuccess {String} message 返回消息
  198. * @apiSuccess {Object} result 返回数据
  199. */
  200. public function rechargecard_add() {
  201. $rc_sn = trim(input('post.rc_sn'));
  202. if (!$rc_sn) {
  203. ds_json_encode(10001, lang('param_error'));
  204. }
  205. try {
  206. $res = model('predeposit')->addRechargecard($rc_sn, array('member_id' => $this->member_info['member_id'], 'member_name' => $this->member_info['member_name']));
  207. if ($res['message']) {
  208. ds_json_encode(10001, $res['message']);
  209. }
  210. } catch (\Exception $e) {
  211. ds_json_encode(10001, $e->getMessage());
  212. }
  213. ds_json_encode(10000, lang('predeposit_recharge_success'), 1);
  214. }
  215. }