model = new WithdrawAccountModel(); } /** * 静态化入口 * @return static|null */ public static function make() { if (!self::$instance) { self::$instance = new static(); } return self::$instance; } /** * 获取银行卡列表 * @param $uid 查询参数 * @param string $field * @param string $cache * @return array|mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getListByUser($uid, $type=0, $field = '', $cache=true) { $cacheKey = "caches:temp:withdrawAccount:{$uid}_{$type}" . md5($field); $data = RedisCache::get($cacheKey); if ($data && $cache) { return $data; } $where = ['uid'=> $uid]; if($type){ $where['type'] = $type; } $field = $field ? $field : 'id,name,number,bank_subname,create_time'; $data = $this->model->where($where)->where(['is_del' => 2]) ->field($field) ->select(); $data = $data? $data->toArray() : []; if($data && $cache){ RedisCache::set($cacheKey, $data, 5,10); } return $data; } }