=', strtotime(date("Y-m-d", time()))]; // $where[] = ['create_time', '<=', strtotime(date("Y-m-d", time())) + 86399]; // } // 创建时间 if (isset($get['start_time']) && $get['start_time'] && isset($get['end_time']) && $get['end_time']) { $where[] = ['create_time', 'between', [strtotime($get['start_time']), strtotime($get['end_time'])]]; // }else{ //// $where[] = ['w.create_time', 'between', Time::today()]; } //var_dump($where); $lists = Card::where($where) ->field('card_number,id,money,create_time,status,update_time') ->page($get['page'], $get['limit']) ->order('id desc') ->select()->toArray(); //var_dump($lists); $count = Card::where($where) ->field('card_number,id,money,status,create_time,update_time') ->order('id desc') ->count(); foreach ($lists as &$item) { // if (empty($item['user'])) { // // 用户不存在 // $user = [ // 'avatar' => '', // 'sn' => '-', // 'nickname' => '-', // ]; // } else { // $user = $item['user']; // } // $item['type_text'] = WithdrawEnum::getTypeDesc($item['type']); $item['status_text'] = CardEnum::getStatusDesc($item['status']); // $item['create_time'] = date('Y-m-d H:i:s', $list['create_time']); // $item['update_time'] = date('Y-m-d H:i:s', $list['update_time']); } return ['count' => $count, 'lists' => $lists]; } public static function getcard($id){ $card = Card::where(['id' => $id])->findOrEmpty(); if($card->isEmpty()) { return []; } return $card->toArray(); } public static function edit($post) { try{ $data = [ 'id' => $post['id'], 'card_number' => $post['card_number'], 'card_secret' => $post['card_secret'], 'money' => $post['money'], 'status' => $post['status'], 'update_time' => time() ]; Card::update($data); return true; }catch(\Exception $e) { self::$error = $e->getMessage(); return false; } } }