Esempio n. 1
0
 /**
  * 删除字段
  */
 public function fieldAction()
 {
     $id = $this->isG('id', $GLOBALS['_LANG']['COMMON']['DELETE_ID']);
     $field = \Model\Field::findField($id);
     if (empty($field)) {
         $this->error($GLOBALS['_LANG']['MODEL']['NOT_EXIST_FIELD']);
     }
     $removeFieldResult = \Model\Field::removeField($id);
     if (empty($removeFieldResult)) {
         $this->error($GLOBALS['_LANG']['COMMON']['DELETE_ERROR']);
     }
     $model = \Model\Model::findModel($field['model_id']);
     $alertTableFieldResult = \Model\Field::alertTableField($model['model_name'], $field['field_name']);
     if (empty($alertTableFieldResult)) {
         $log = new \Expand\Log();
         $failLog = "Delete Field: " . strtolower($model['model_name']) . "_{$field['field_name']}, Model:{$model['model_name']}  " . date("Y-m-d H:i:s");
         $log->creatLog('fieldError', $failLog);
         $this->error($GLOBALS['_LANG']['MODEL']['ALERT_TABLE_FIELD_ERROR']);
     }
     $this->success($GLOBALS['_LANG']['COMMON']['DELETE_SUCCESS']);
 }
Esempio n. 2
0
 public function action()
 {
     $id = $this->isG('id', '请选择要删除的数据!');
     $field = \Model\Field::findField($id);
     if (empty($field)) {
         $this->error('不存在的字段');
     }
     $removeFieldResult = \Model\Field::removeField($id);
     if (empty($removeFieldResult)) {
         $this->error('删除失败');
     }
     $model = \Model\ModelManage::findModel($field['field_model_id']);
     $alertTableFieldResult = \Model\Field::alertTableField($model['model_name'], $field['field_name']);
     if (empty($alertTableFieldResult)) {
         $log = new \Expand\Log();
         $failLog = "Delete Field: " . strtolower($model['model_name']) . "_{$field['field_name']}, Model:{$model['model_name']}  " . date("Y-m-d H:i:s");
         $log->creatLog('fieldError', $failLog);
         $this->error('移除数据库表字段失败,具体信息请查阅程序日志');
     }
     $this->success('删除成功');
 }