diff --git a/TT/protected/controllers/AdminController.php b/TT/protected/controllers/AdminController.php
index b208944..2292b68 100644
--- a/TT/protected/controllers/AdminController.php
+++ b/TT/protected/controllers/AdminController.php
@@ -15,7 +15,6 @@ class AdminController extends Controller{
*/
public function actionAdd(){
if(Yii::app()->request->isPostRequest){
-
$oldadmin = IMAdmin::model()->find(array(
'order' => 'id DESC',
'limit' => 1,
@@ -27,17 +26,17 @@ public function actionAdd(){
$oldadmin->pwd = md5($data['newpwd1']);
$oldadmin->updated = time();
if($oldadmin->update()){
- $this->showAlert('success','操作成功');
- $this->getAdminCache();
- }else{
- $this->showAlert('fail','操作失败');
- echo $admin->getErrors();
- }
+ $this->showAlert('success','操作成功');
+ $this->getAdminCache();
+ }else{
+ $this->showAlert('fail','操作失败');
+ //echo $admin->getErrors();
+ }
}else{
- $this->showAlert('fail','2次密码不一致');
+ $this->showAlert('fail','2次密码不一致');
}
}else{
- $this->showAlert('fail','原始密码错误');
+ $this->showAlert('fail','原始密码错误');
}
}
diff --git a/TT/protected/controllers/ConfigController.php b/TT/protected/controllers/ConfigController.php
index 97a69e4..2808681 100644
--- a/TT/protected/controllers/ConfigController.php
+++ b/TT/protected/controllers/ConfigController.php
@@ -27,19 +27,12 @@ public function actionAdd(){
if(empty($oldconfig)){
$config = new IMConfig();
$config->attributes = $data;
- if($config->save()){
- echo '
添加成功
';
- }else{
- echo '添加成功
';
- }
-
+ $config->save();
+ $this->showAlert('success','添加成功');
}else{
$oldconfig->attributes = $data;
- if($oldconfig->update()){
- echo '修改成功
';
- }else{
- echo '修改成功
';
- }
+ $oldconfig->update();
+ $this->showAlert('success','添加成功');
}
}
$this->render('add',array(
@@ -83,12 +76,11 @@ public function actionDel($id){
if(empty($id))
return;
-
$count = IMDepartment::model()->deleteByPk($id);
if($count > 0){
- echo '添加成功
';
+ $this->showAlert('success','删除成功');
}else{
- echo '添加成功
';
+ $this->showAlert('fail','删除失败');
}
}
@@ -111,7 +103,7 @@ public function actionEdit($id){
$time = time();
$depart->updated = $time;
if($depart->update()){
- echo '修改成功
';
+ $this->showAlert('success','删除成功');
$departs = IMDepartment::model()->findAll(array(
'condition' => 'status = 0',
));
@@ -127,7 +119,7 @@ public function actionEdit($id){
if(!empty($cache))
Yii::app()->cache->set('cache_depart',$cache);
}else{
- echo '修改失败
';
+ $this->showAlert('fail','删除失败');
}
}
$users = Yii::app()->cache->get('cache_user');
@@ -154,4 +146,4 @@ public function actionJson(){
}
- }
\ No newline at end of file
+ }
diff --git a/TT/protected/controllers/DepartController.php b/TT/protected/controllers/DepartController.php
index 5aae76c..f3733fa 100644
--- a/TT/protected/controllers/DepartController.php
+++ b/TT/protected/controllers/DepartController.php
@@ -16,11 +16,10 @@ class DepartController extends Controller{
public function actionAdd(){
if(Yii::app()->request->isPostRequest){
-
+ $time = time();
$depart = new IMDepartment();
$data = Yii::app()->request->getPost('data');
$depart->attributes = $data;
- $time = time();
$depart->created = $time;
$depart->updated = $depart->created;
@@ -57,10 +56,10 @@ public function actionList($page = 1){
$pager->currentPage = 1;
$list = IMDepartment::model()->findAll(array(
- 'condition' => 'status = 0',
- 'order' => 'id DESC',
- 'offset' => $pager->getCurrentPage()*$pager->getPageSize(),
- 'limit' => $pager->pageSize,
+ 'condition' => 'status = 0',
+ 'order' => 'id DESC',
+ 'offset' => $pager->getCurrentPage() * $pager->getPageSize(),
+ 'limit' => $pager->pageSize,
));
foreach($list as $v){
@@ -84,10 +83,9 @@ public function actionEdit($id){
$depart = IMDepartment::model()->findByPk($id);
if(Yii::app()->request->isPostRequest){
-
+ $time = time();
$data = Yii::app()->request->getPost('data');
$depart->attributes = $data;
- $time = time();
$depart->updated = $time;
if($depart->update()){
$this->showAlert('success','修改成功');
diff --git a/TT/protected/controllers/GroupController.php b/TT/protected/controllers/GroupController.php
index e69751a..ed73617 100644
--- a/TT/protected/controllers/GroupController.php
+++ b/TT/protected/controllers/GroupController.php
@@ -17,19 +17,17 @@ public function actionAdd(){
if(Yii::app()->request->isPostRequest){
- $data = Yii::app()->request->getPost('data');
- $file = $this->image();
- //事务处理
- $transaction = Yii::app ()->db->beginTransaction ();
- try{
- $group = new IMGroup();
- $group->attributes = $data;
- if($_FILES['data']['tmp_name']['mod_avatar']){
- $group->avatar = $this->_upload($file);
- // $group->avatar = $this->upload('data[mod_avatar]');
- }else{
- // $group->avatar = '';
- }
+ $data = Yii::app()->request->getPost('data');
+ //事务处理
+ $transaction = Yii::app ()->db->beginTransaction ();
+ try{
+ $group = new IMGroup();
+ $group->attributes = $data;
+ $group->avatar = '';
+ if($_FILES['data']['tmp_name']['mod_avatar']){
+ $file = $this->image();
+ $group->avatar = $this->_upload($file);
+ }
$selUserId = array();
if(!empty($data['selUserId']))
$selUserId = $data['selUserId'];
@@ -127,9 +125,9 @@ public function actionDel($id){
$group->status = 1;
if($group->save()){
- echo '删除成功
';
+ $this->showAlert('success','删除成功');
}else{
- echo '删除失败
';
+ $this->showAlert('fail','删除失败');
}
}
diff --git a/TT/protected/controllers/UserController.php b/TT/protected/controllers/UserController.php
index 5d3ab95..f7a43f5 100644
--- a/TT/protected/controllers/UserController.php
+++ b/TT/protected/controllers/UserController.php
@@ -17,10 +17,9 @@ public function actionAdd(){
$data = Yii::app()->request->getPost('data');
$user->attributes = $data;
$user->pwd = md5($data['pwd']);
+ $user->avatar = '';
if($_FILES['data']['tmp_name']['mod_avatar']){
$user->avatar = $this->upload('data[mod_avatar]');
- }else{
- $user->avatar = '';
}
$time = time();
$user->departId = $data['departId'];