model = new Refund(); } /** * 退款账户记录 * @param array $where * @return mixed */ public function getPage(array $where){ $field = 'id,refund_no,out_trade_no,type,channel,money,reason,status,create_time,refund_time,close_time,fail_reason,voucher,trade_type,trade_id,refund_type,main_type,main_id'; $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'create_time', 'out_trade_no', 'refund_no', 'status' ], $where)->field($field)->append([ 'type_name', 'status_name' ])->order('create_time desc'); return $this->pageQuery($search_model); } /** * 获取退款详情 * @param string $refund_no * @return array */ public function getDetail(string $refund_no){ $field = 'id,refund_no,out_trade_no,type,channel,money,reason,status,create_time,refund_time,close_time,fail_reason,voucher,trade_type,trade_id,refund_type,main_type,main_id'; return $this->model->where([ ['refund_no', '=', $refund_no ], [ 'site_id', '=', $this->site_id ] ]) ->field($field) ->append([ 'type_name', 'status_name', 'refund_type_name' ]) ->findOrEmpty() ->toArray(); } /** * 支付审核通过 * @param array $data * @return bool */ public function refund(array $data) { return (new CoreRefundService())->refund($this->site_id, $data['refund_no'], $data['voucher'], $data['refund_type'], PayDict::USER, $this->uid); } }