public static function getUserNotAdminByuserNameAndPassword($username, $password) { // $user = CtgUserAdmin::findFirst(array("us_name = '{$username}' AND us_password='******' AND us_role=0 AND us_status=1")); $user = CtgUserAdmin::findFirst(array('us_name= :us_name: AND us_password= :us_pass: AND us_role=0 AND us_status=1', 'bind' => array('us_name' => $username, 'us_pass' => $password))); if (!empty($user)) { return $user->toArray(); } return $user; }
public function getTuvanByWhere($where) { $tuvan = self::find(array($where)); $tuvan = $tuvan->toArray(); $array = array(); if (!empty($tuvan)) { foreach ($tuvan as $value) { $user_info = CtgUserAdmin::findFirst(array("us_id = '{$value['ch_user_id']}'")); $user_info = $user_info->toArray(); $value['email'] = $user_info['us_email']; $array[] = $value; } } return $array; }