Memberwithdraw.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\admin\controller;
  13. use app\model\member\Withdraw as MemberWithdrawModel;
  14. use app\model\system\Pay;
  15. use app\model\web\Account as AccountModel;
  16. /**
  17. * 会员管理 控制器
  18. */
  19. class Memberwithdraw extends BaseAdmin
  20. {
  21. /**
  22. * 会员提现配置
  23. */
  24. public function config()
  25. {
  26. $config_model = new MemberWithdrawModel();
  27. if (request()->isAjax()) {
  28. if (empty(input("transfer_type"))) {
  29. $transfer_type = "";
  30. } else {
  31. $transfer_type = implode(",", input("transfer_type"));
  32. }
  33. //订单提现
  34. $data = [
  35. 'is_auto_audit' => input('is_audit', 0),//是否需要审核 1 手动审核 2 自动审核
  36. 'rate' => input('rate', 0),//提现手续费比率 (0-100)
  37. 'transfer_type' => $transfer_type,//转账方式,
  38. 'is_auto_transfer' => input('is_auto_transfer', 0),//是否自动转账 1 手动转账 2 自动转账
  39. 'min' => input('min', 0),//提现最低额度
  40. ];
  41. $this->addLog("设置会员提现配置");
  42. $is_use = input("is_use", 0);//是否启用
  43. $res = $config_model->setConfig($data, $is_use);
  44. return $res;
  45. } else {
  46. $this->assign("is_exist", addon_is_exit("memberwithdraw"));
  47. //会员提现
  48. $config_result = $config_model->getConfig();
  49. $this->assign('config', $config_result['data']);
  50. $pay_model = new Pay();
  51. $transfer_type_list = $pay_model->getTransferType();
  52. $this->assign("transfer_type_list", $transfer_type_list);
  53. return $this->fetch('memberwithdraw/config');
  54. }
  55. }
  56. /**
  57. * 会员提现列表
  58. * @return mixed
  59. */
  60. public function lists()
  61. {
  62. $withdraw_model = new MemberWithdrawModel();
  63. if(request()->isAjax()){
  64. $page = input('page', 1);
  65. $page_size = input('page_size', PAGE_LIST_ROWS);
  66. $withdraw_no = input('withdraw_no', '');
  67. $start_date = input('start_date', '');
  68. $end_date = input('end_date', '');
  69. $status = input('status', 'all');//提现状态
  70. $transfer_type = input('transfer_type', '');//提现转账方式
  71. $member_name = input('member_name', '');//提现转账方式
  72. $condition = [];
  73. if(!empty($withdraw_no)){
  74. $condition[] = ['withdraw_no', 'like', '%'.$withdraw_no.'%'];
  75. }
  76. if(!empty($transfer_type)){
  77. $condition[] = ['transfer_type', '=', $transfer_type];
  78. }
  79. if($status != "all"){
  80. $condition[] = ['status', '=', $status];
  81. }
  82. if(!empty($member_name)){
  83. $condition[] = ['member_name', '=', $member_name];
  84. }
  85. if($start_date != '' && $end_date != ''){
  86. $condition[] = ['apply_time', 'between', [strtotime($start_date), strtotime($end_date)]];
  87. }else if($start_date != '' && $end_date == ''){
  88. $condition[] = ['apply_time', '>=', strtotime($start_date)];
  89. }else if($start_date == '' && $end_date != ''){
  90. $condition[] = ['apply_time', '<=', strtotime($end_date)];
  91. }
  92. $order = 'apply_time desc';
  93. return $withdraw_model->getMemberWithdrawPageList($condition, $page, $page_size, $order);
  94. }else {
  95. $this->assign("is_exist", addon_is_exit("memberwithdraw"));
  96. $pay_model = new Pay();
  97. $transfer_type_list = $pay_model->getTransferType();
  98. $this->assign("transfer_type_list", $transfer_type_list);
  99. $account_model = new AccountModel();
  100. $member_balance_sum = $account_model->getMemberBalanceSum();
  101. $this->assign('member_balance_sum',$member_balance_sum['data']);
  102. return $this->fetch("memberwithdraw/lists");
  103. }
  104. }
  105. /**
  106. * 详情
  107. */
  108. public function detail(){
  109. $id = input('id', 0);
  110. $withdraw_model = new MemberWithdrawModel();
  111. $withdraw_info_result = $withdraw_model->getMemberWithdrawInfo([["id", "=", $id]]);
  112. $withdraw_info = $withdraw_info_result["data"];
  113. $this->assign("withdraw_info", $withdraw_info);
  114. return $this->fetch("memberwithdraw/detail");
  115. }
  116. /**
  117. * 同意
  118. * @return array
  119. */
  120. public function agree(){
  121. if(request()->isAjax()){
  122. $id = input('id', 0);
  123. $withdraw_model = new MemberWithdrawModel();
  124. $condition = array(
  125. ["id", "=", $id]
  126. );
  127. $result = $withdraw_model->agree($condition);
  128. return $result;
  129. }
  130. }
  131. /**
  132. * 拒绝
  133. * @return array
  134. */
  135. public function refuse(){
  136. if(request()->isAjax()){
  137. $id = input('id', 0);
  138. $refuse_reason = input('refuse_reason', '');
  139. $withdraw_model = new MemberWithdrawModel();
  140. $condition = array(
  141. ["id", "=", $id]
  142. );
  143. $data = array(
  144. "refuse_reason" => $refuse_reason
  145. );
  146. $result = $withdraw_model->refuse($condition, $data);
  147. return $result;
  148. }
  149. }
  150. /**
  151. * 转账
  152. */
  153. public function transferFinish(){
  154. if(request()->isAjax()){
  155. $id = input('id', 0);
  156. $certificate = input('certificate', '');
  157. $certificate_remark = input('certificate_remark', '');
  158. $withdraw_model = new MemberWithdrawModel();
  159. $condition = array(
  160. ["id", "=", $id]
  161. );
  162. $data = array(
  163. "certificate" => $certificate,
  164. "certificate_remark" => $certificate_remark,
  165. );
  166. $result = $withdraw_model->transferFinish($condition, $data);
  167. return $result;
  168. }
  169. }
  170. }