فهرست منبع

修改typeclass的消息体香

lvhao 2 روز پیش
والد
کامیت
455cc35ab4
1فایلهای تغییر یافته به همراه29 افزوده شده و 18 حذف شده
  1. 29 18
      core/CoreApp/controllers/Typeclass.php

+ 29 - 18
core/CoreApp/controllers/Typeclass.php

@@ -174,18 +174,18 @@ class Typeclass extends Start_Controller {
 		{
 			$post['title'] = $this->input->post('title',true);
 			$post['spare'] = $this->input->post('spare',true);
-			$cf = $this->typeclass->find_all("spare = '".$post['spare']."' or title = '".$post['title']."'");
+			$cf = $this->typeclass->find_all("spare = '".$post['spare']."' or title = '".$post['title']."' or jm = '".$post['jm']."'");
 			if($cf)
 			{
-				echo json_encode(array('msg'=>'SKU/产品名称有重复!','success'=>false));exit;
-			}
-			$jm = $this->input->post('jm',true);
-			if(!empty($jm)){
-				$jm_num =  $this->typeclass->find_all("jm = '$jm'");
-				if(!empty($jm_num)){
-					echo json_encode(array('msg'=>'该用友料号已存在!','success'=>false));exit;
-				}
+				echo json_encode(array('msg'=>'商品名称|店铺SKU|产品名称有重复!','success'=>false));exit;
 			}
+			// $jm = $this->input->post('jm',true);
+			// if(!empty($jm)){
+			// 	$jm_num =  $this->typeclass->find_all("jm = '$jm'");
+			// 	if(!empty($jm_num)){
+			// 		echo json_encode(array('msg'=>'该用友料号已存在!','success'=>false));exit;
+			// 	}
+			// }
 			
 			$post['class'] = $this->input->post('class',true);
 			$post['classid'] = $this->input->post('classid',true);
@@ -244,21 +244,32 @@ class Typeclass extends Start_Controller {
 			$id = $this->input->post('id',true);
 			$post['title'] = $this->input->post('title',true);
 			$post['spare'] = $this->input->post('spare',true);
-			$cf = $this->typeclass->find_all("spare = '".$post['spare']."' or (title = '".$post['title']."' and classid != 999)");
+			// $cf = $this->typeclass->find_all("spare = '".$post['spare']."' or (title = '".$post['title']."' and classid != 999)");
+			// if($cf)
+			// {
+			// 	if($cf[0]['id'] != $id)
+			// 	{
+			// 	    echo json_encode(array('msg'=>'SKU/产品名称有重复!','cs'=>'查询ID '.$cf[0]['id'].' - 修改ID '.$id,'success'=>false));exit;
+			// 	}
+			// }
+			// $jm = $this->input->post('jm',true);
+			// if(!empty($jm)){
+			// 	$jm_num =  $this->typeclass->find_all("jm = '$jm' and id != '$id'");
+			// 	if(!empty($jm_num)){
+			// 		echo json_encode(array('msg'=>'该用友料号已存在!','success'=>false));exit;
+			// 	}
+			// }
+
+			$cf = $this->typeclass->find_all("(  (spare = '".$post['spare']."') or ( jm = '".$post['jm']."' ) or (title = '".$post['title']."' and classid != 999)  )     and id != ".$id);
 			if($cf)
 			{
 				if($cf[0]['id'] != $id)
 				{
-				    echo json_encode(array('msg'=>'SKU/产品名称有重复!','cs'=>'查询ID '.$cf[0]['id'].' - 修改ID '.$id,'success'=>false));exit;
-				}
-			}
-			$jm = $this->input->post('jm',true);
-			if(!empty($jm)){
-				$jm_num =  $this->typeclass->find_all("jm = '$jm' and id != '$id'");
-				if(!empty($jm_num)){
-					echo json_encode(array('msg'=>'该用友料号已存在!','success'=>false));exit;
+				    echo json_encode(array('msg'=>'商品名称|店铺SKU|产品名称有重复!','cs'=>'查询ID '.$cf[0]['id'].' - 修改ID '.$id,'success'=>false));exit;
 				}
 			}
+
+
 			$post['classid'] = $this->input->post('classid',true);
 			$classtitle = $this->classid->read($post['classid']);
 			if($post['classid'] != '999')