where($where);} $res['count'] = $model->count(); $res['list'] = array(); if($res['count']>0) { $res['list'] = $model->orderBy('id', 'desc')->skip($offset)->take($limit)->get()->toArray(); } else { return false; } return $res; } public static function getOne($id) { return self::where('id', $id)->first()->toArray(); } public static function add(array $data) { if ($id = DB::table(self::$table)->insertGetId($data)) { return $id; } return false; } public static function modify($where, array $data) { $slide = DB::table(self::$table); if ($slide->where($where)->update($data)) { return true; } return false; } //删除一条记录 public static function remove($id) { if (!self::whereIn('id', explode(',', $id))->delete()) { return false; } return true; } //获取显示平台文字:0pc,1weixin,2app,3wap public static function getTypeText($where) { $res = ''; if($where['type'] === 0) { $res = 'pc'; } elseif($where['type'] === 1) { $res = 'weixin'; } elseif($where['type'] === 2) { $res = 'app'; } elseif($where['type'] === 3) { $res = 'wap'; } return $res; } }