public static function login_user($user_id = null) { static $user = NULL; if (empty($user)) { if (is_null($user_id)) { $user_id = \Core\Session::get('user_id'); } if (!empty($user_id)) { $user = \DB\Account\User::row(array('user_id' => $user_id)); } } return $user; }
/** * 更改用户状态 */ public function status() { $ids = \Core\URI::kv('ids'); $status = \Core\URI::kv('status', 0); $v = new \Core\Validation(); $v->required($ids)->message('参数不合法'); if (!$v->has_error()) { $id_arr = explode('-', $ids); foreach ($id_arr as $id) { $item = \DB\Account\User::row(array('user_id' => $id)); if (!empty($item)) { $item->user_status = $status; $item->update(); } } } echo json_encode($v->get_error()); exit; }