model = new Pay(); } /** * 待审核支付记录 * @param array $where * @return mixed */ public function getAuditPage(array $where){ $field = 'id, out_trade_no, type, money, body, voucher, create_time, trade_id, trade_type, status'; $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ], ['type', '=', PayDict::OFFLINEPAY] ])->withSearch([ 'create_time', 'out_trade_no', 'status' ], $where)->field($field)->append([ 'type_name' ])->order('create_time desc'); return $this->pageQuery($search_model); } /** * 获取交易详情 * @param int $id * @return void */ public function getDetail(int $id){ $field = 'id,out_trade_no,trade_type,trade_id,trade_no,body,money,voucher,status,create_time,pay_time,cancel_time,type,channel,fail_reason'; return $this->model->where([ [ 'site_id', '=', $this->site_id ], ['id', '=', $id ] ]) ->field($field) ->append([ 'type_name', 'channel_name', 'status_name' ]) ->findOrEmpty() ->toArray(); } /** * 支付审核通过 * @param string $out_trade_no * @return null */ public function pass(string $out_trade_no) { return (new CoreOfflineService())->pass($this->site_id, $out_trade_no); } /** * 支付审核未通过 * @param string $out_trade_no * @param string $reason */ public function refuse(string $out_trade_no, string $reason) { return (new CoreOfflineService())->refuse($this->site_id, $out_trade_no, $reason); } /** * 统计支付数据 * @param $where * @return int * @throws \think\db\exception\DbException */ public function payCount($where) { return $this->model->where($where)->count(); } }