|
@@ -191,13 +191,18 @@ class Color extends Start_Controller {
|
|
|
}
|
|
|
$this->_Template('color',$this->data);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function _add()
|
|
|
{
|
|
|
$post = $this->input->post(NULL, TRUE);
|
|
|
if(isset($post['title']))
|
|
|
{
|
|
|
$title = $this->input->post('title',true);
|
|
|
+ $num = $this->color->find_count("title = '$title'");
|
|
|
+ if($num > 0){
|
|
|
+ echo json_encode(array('msg'=>'该标题已经存在,请重新输入!','success'=>false));exit;
|
|
|
+ }
|
|
|
+
|
|
|
$img = $this->input->post('img',true);
|
|
|
if($img == '')
|
|
|
{
|
|
@@ -224,6 +229,17 @@ class Color extends Start_Controller {
|
|
|
$post = $this->input->post(NULL, TRUE);
|
|
|
if(isset($post['id']))
|
|
|
{
|
|
|
+
|
|
|
+ $title = $this->input->post('title',true);
|
|
|
+ if(empty($title)){
|
|
|
+ echo json_encode(array('msg'=>'标题不能为空!','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $num = $this->color->find_count("title = '$title' and id != ".$post['id']);
|
|
|
+ if($num > 0){
|
|
|
+ echo json_encode(array('msg'=>'该标题已经存在,请重新输入!','success'=>false));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$id = $this->input->post('id',true);
|
|
|
$post['warehouse'] = $this->input->post('warehouse',true);
|
|
|
$img = $this->input->post('img',true);
|