| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com
- * =========================================================
- */
- namespace addon\store\storeapi\controller;
- use addon\store\model\StoreWithdraw;
- use app\storeapi\controller\BaseStoreApi;
- /**
- * 门店结算控制器
- */
- class Withdraw extends BaseStoreApi
- {
- /**
- * 门店申请结算
- */
- public function apply()
- {
- $store_withdraw_model = new StoreWithdraw();
- $money = $this->params[ 'money' ] ?? 0;
- $apply_params = array (
- 'site_id' => $this->site_id,
- 'store_id' => $this->store_id,
- 'money' => $money,
- 'settlement_type' => 'apply'
- );
- $withdraw_result = $store_withdraw_model->apply($apply_params);
- return $this->response($withdraw_result);
- }
- /**
- * 结算记录
- * @return false|string
- */
- public function page()
- {
- $page = $this->params[ 'page' ] ?? 1;
- $page_size = $this->params[ 'page_size' ] ?? PAGE_LIST_ROWS;
- $withdraw_no = $this->params[ 'withdraw_no' ] ?? '';
- $start_date = $this->params[ 'start_date' ] ?? '';
- $end_date = $this->params[ 'end_date' ] ?? '';
- $status = $this->params[ 'status' ] ?? 'all';//提现状态
- $transfer_type = $this->params[ 'transfer_type' ] ?? '';//提现转账方式
- $payment_start_date = $this->params[ 'payment_start_date' ] ?? '';
- $payment_end_time = $this->params[ 'payment_end_time' ] ?? '';
- $settlement_type = $this->params[ 'settlement_type' ] ?? '';
- $condition = [
- [ 'site_id', '=', $this->site_id ],
- [ 'store_id', '=', $this->store_id ]
- ];
- if (!empty($withdraw_no)) {
- $condition[] = [ 'withdraw_no', 'like', '%' . $withdraw_no . '%' ];
- }
- if (!empty($transfer_type)) {
- $condition[] = [ 'transfer_type', '=', $transfer_type ];
- }
- if (!empty($settlement_type)) {
- $condition[] = [ 'settlement_type', '=', $settlement_type ];
- }
- if ($status != 'all') {
- $condition[] = [ 'status', '=', $status ];
- }
- if ($start_date != '' && $end_date != '') {
- $condition[] = [ 'apply_time', 'between', [ strtotime($start_date), strtotime($end_date) ] ];
- } else if ($start_date != '' && $end_date == '') {
- $condition[] = [ 'apply_time', '>=', strtotime($start_date) ];
- } else if ($start_date == '' && $end_date != '') {
- $condition[] = [ 'apply_time', '<=', strtotime($end_date) ];
- }
- if ($payment_start_date != '' && $payment_end_time != '') {
- $condition[] = [ 'transfer_time', 'between', [ strtotime($payment_start_date), strtotime($payment_end_time) ] ];
- } else if ($payment_start_date != '' && $payment_end_time == '') {
- $condition[] = [ 'transfer_time', '>=', strtotime($payment_start_date) ];
- } else if ($payment_start_date == '' && $payment_end_time != '') {
- $condition[] = [ 'transfer_time', '<=', strtotime($payment_end_time) ];
- }
- $order = 'apply_time desc';
- $withdraw_model = new StoreWithdraw();
- $data = $withdraw_model->getStoreWithdrawPageList($condition, $page, $page_size, $order);
- return $this->response($data);
- }
- /**
- * 筛选内容
- * @return false|string
- */
- public function screen()
- {
- $withdraw_model = new StoreWithdraw();
- $data = [
- 'status' => $withdraw_model->status,
- 'settlement_type' => $withdraw_model->settlement_type,
- 'transfer_type_list' => $withdraw_model->getTransferType($this->site_id)
- ];
- return $this->response($this->success($data));
- }
- /**
- * 获取结算详情
- * @return false|string
- */
- public function detail()
- {
- $withdraw_id = $this->params[ 'withdraw_id' ] ?? 0;
- $withdraw_model = new StoreWithdraw();
- $withdraw_info = $withdraw_model->detail([ 'site_id' => $this->site_id, 'store_id' => $this->store_id, 'withdraw_id' => $withdraw_id ]);
- return $this->response($withdraw_info);
- }
- }
|