field($field) ->order($order) ->paginate(['list_rows' => $pageSize, 'query' => request()->param()]); $page = $list->render(); $data['list'] = $list->toArray()['data']; $data['count'] = $list->total(); $data['last_page'] = $list->toArray()['last_page']; $data['page'] = $page; return $data; } /** * 获取列表 不分页 */ public static function getAllList($where = [], $field = '*', $order = '', $limit = '0') { $data = self::where($where) ->field($field) ->order($order) ->limit($limit) ->select(); return $data; } /** * 获取单条数据 */ public static function getInfo($where = [], $field = '*') { $data = self::where($where) ->field($field) ->find(); return $data; } /** * 根据订单号获取回调信息 */ public static function getByOrderNo($orderNo, $field = '*') { return self::where('order_no', $orderNo) ->field($field) ->find(); } /** * 更新回调状态 */ public static function updateStatus($id, $status, $remark = null) { $data = [ 'status' => $status, 'last_notify_time' => date('Y-m-d H:i:s') ]; if (!is_null($remark)) { $data['remark'] = $remark; } return self::update($data, ['id' => $id]); } /** * 增加重试次数 */ public static function increaseRetryCount($id) { return self::where('id', $id) ->inc('retry_count') ->update([ 'last_notify_time' => date('Y-m-d H:i:s') ]); } }