Shopwithdraw.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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\shop\controller;
  13. use app\model\shop\ShopAccount;
  14. use app\model\shop\Shop as ShopModel;
  15. class Shopwithdraw extends BaseShop
  16. {
  17. public function __construct()
  18. {
  19. //执行父类构造函数
  20. parent::__construct();
  21. }
  22. /**
  23. * 申请提现
  24. * */
  25. public function apply()
  26. {
  27. if(request()->isAjax()){
  28. $money = input("apply_money", "");
  29. $shop_account_model = new ShopAccount();
  30. $result = $shop_account_model->applyWithdraw($this->site_id, $money);
  31. return $result;
  32. }
  33. }
  34. /**
  35. * 获取提现记录
  36. */
  37. public function lists()
  38. {
  39. $shop_model = new ShopModel();
  40. //获取店铺的账户信息
  41. $condition = array(
  42. ["site_id", "=", $this->site_id]
  43. );
  44. $shop_info_result = $shop_model->getShopInfo($condition, 'account, account_withdraw,account_withdraw_apply,shop_open_fee,shop_baozhrmb');
  45. $shop_info = $shop_info_result["data"];
  46. //已提现
  47. $this->assign('account_withdraw',number_format($shop_info['account_withdraw'],2,'.' , ''));
  48. //提现中
  49. $this->assign('account_withdraw_apply',number_format($shop_info['account_withdraw_apply'],2,'.' , ''));
  50. if(request()->isAjax()){
  51. $account_model = new ShopAccount();
  52. $page = input('page', 1);
  53. $page_size = input('page_size', PAGE_LIST_ROWS);
  54. $status = input('status','');
  55. $condition[] = ['site_id','=',$this->site_id];
  56. if(!empty($status)){
  57. if($status == 3){//待审核
  58. $condition[] = ['status','=',0];
  59. }else{
  60. $condition[] = ['status','=',$status];
  61. }
  62. }
  63. $start_time = input('start_time','');
  64. $end_time = input('end_time','');
  65. if(!empty($start_time) && empty($end_time)){
  66. $condition[] = ['apply_time','>=',$start_time];
  67. }elseif(empty($start_time) && !empty($end_time)){
  68. $condition[] = ['apply_time','<=',$end_time];
  69. }elseif(!empty($start_time) && !empty($end_time)){
  70. $condition[] = ['apply_time','between',[$start_time,$end_time]];
  71. }
  72. $order = "id desc";
  73. $list = $account_model->getShopWithdrawPageList($condition, $page, $page_size, $order);
  74. return $list;
  75. }
  76. return $this->fetch('shopwithdraw/lists');
  77. }
  78. }