public function change($parameter_a)
 {
     $product_list = $parameter_a['product_list'] ? $parameter_a['product_list'] : "a:0:{}";
     /*
      * $db = CDatabase::getInstance();
      * $db->query("update sk_admin_group set gname='{$parameter_a['roleName']}',rightList='{$parameter_a['rights']}',product_list='{$product_list}',parent_id='{$parameter_a['parent_id']}' where gid='{$parameter_a['id']}'");
      */
     try {
         $pdo = CDatabase::getDatabase();
         $pdo_runObject = $pdo->prepare("update sk_admin_group set gname=?,rightList=?,product_list=?,parent_id=? where gid=?");
         $pdo_runObject->bindParam(1, $parameter_a['roleName'], PDO::PARAM_STR);
         $pdo_runObject->bindParam(2, $parameter_a['rights'], PDO::PARAM_STR);
         $pdo_runObject->bindParam(3, $product_list, PDO::PARAM_STR);
         $pdo_runObject->bindParam(4, $parameter_a['parent_id'], PDO::PARAM_STR);
         $pdo_runObject->bindParam(5, $parameter_a['id'], PDO::PARAM_INT);
         $result_status = $pdo_runObject->execute();
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
     return $result_status;
 }
 /**
  * 保存对象
  */
 public function save()
 {
     $publicAttributeList = $this->_getAllSetAttribute();
     $tableName = $this->_getTableName();
     $condition = $this->condition;
     $params = $this->params;
     $where = $this->where;
     if (!empty($condition)) {
         $updateStr = '';
         foreach ($publicAttributeList as $key => $val) {
             $updateStr .= '`' . $key . '` = \'' . $val . '\' ,';
         }
         $updateStr = substr($updateStr, 0, -1);
         $dbConfig = CDatabase::$configData[1];
         $tablePre = isset($dbConfig['tablePrefix']) ? $dbConfig['tablePrefix'] : '';
         $updateSql = 'UPDATE `' . $tablePre . $tableName . '` SET ' . $updateStr . ' WHERE ' . $condition;
         $result = CDatabase::getDatabase()->prepare($updateSql)->execute($params);
         if (!$result) {
             throw new CDbException('[查询错误]调用ActiveRecord->save()方法时,执行SQL错误[' . $updateSql . ']');
         }
     } else {
         if (!empty($where)) {
             $result = CDatabase::getInstance()->update()->from($tableName)->value($publicAttributeList)->where($where)->execute();
         } else {
             $result = CDatabase::getInstance()->insert()->from($tableName)->value($publicAttributeList)->execute();
         }
     }
     //$this->_clearAttribute();
     return $result;
 }
 /**
  * 回滚一个事物
  */
 public function rollback()
 {
     //使用主库
     $databaseObject = CDatabase::getDatabase($this->configName, true);
     return $databaseObject->rollback();
 }
 /**
  * 删除资源
  */
 public function Action_delRights()
 {
     $id = $this->Args('id', 'int');
     $status = CModel::factory('adminRightsModel')->delete(array('id' => $id));
     if (false == $status) {
         $errorMessage = CDatabase::getDatabase()->errorInfo();
         $errorMessage = isset($errorMessage[2]) ? $errorMessage[2] : '';
     }
     $this->displayAjax($status, $errorMessage);
 }
 public function change($parameter_a)
 {
     $db = CDatabase::getDatabase();
     // $prepare_re=$db->prepare("update sk_admin_user set username = :username ,email = :email ,status=:status,groupId=:groupId,phone=:phone,truename=:truename where id=:id");
     if (isset($parameter_a['password']) && $parameter_a['password'] != "") {
         $prepare_re = $db->prepare("update sk_admin_user set username = ?,password = ?,email= ?,status= ?,groupId= ?,phone= ?,truename=? where id=?");
         $prepare_re->bindParam(1, $parameter_a['username'], PDO::PARAM_STR);
         $prepare_re->bindParam(2, md5($parameter_a['password']), PDO::PARAM_STR);
         $prepare_re->bindParam(3, $parameter_a['email'], PDO::PARAM_STR);
         $prepare_re->bindParam(4, $parameter_a['status'], PDO::PARAM_STR);
         $prepare_re->bindParam(5, $parameter_a['groupId'], PDO::PARAM_INT);
         $prepare_re->bindParam(6, $parameter_a['phone'], PDO::PARAM_STR);
         $prepare_re->bindParam(7, $parameter_a['truename'], PDO::PARAM_STR);
         $prepare_re->bindParam(8, $parameter_a['id'], PDO::PARAM_STR);
     } else {
         $prepare_re = $db->prepare("update sk_admin_user set username = :username ,email = :email ,status= :status ,groupId= :groupId,phone= :phone,truename= :truename where id= :id");
         $prepare_re->bindParam(":username", $parameter_a['username'], PDO::PARAM_STR);
         $prepare_re->bindParam(":email", $parameter_a['email'], PDO::PARAM_STR);
         $prepare_re->bindParam(":status", $parameter_a['status'], PDO::PARAM_STR);
         $prepare_re->bindParam(":groupId", $parameter_a['groupId'], PDO::PARAM_INT);
         $prepare_re->bindParam(":phone", $parameter_a['phone'], PDO::PARAM_STR);
         $prepare_re->bindParam(":truename", $parameter_a['truename'], PDO::PARAM_STR);
         $prepare_re->bindParam(":id", $parameter_a['id'], PDO::PARAM_STR);
     }
     $result = $prepare_re->execute();
     return $result;
 }