|  | @@ -178,15 +178,31 @@ class Article extends Base
 | 
											
												
													
														|  |              'status','sort','hits','content_type','userid','username'])->save($data);
 |  |              'status','sort','hits','content_type','userid','username'])->save($data);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          FileManager::saveInfoid($article->id, $data['cjid']);
 |  |          FileManager::saveInfoid($article->id, $data['cjid']);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $keys = explode(',', $data['keywords']);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        Tag::saveTags($keys, $article->id);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      public static function updateOne($data)
 |  |      public static function updateOne($data)
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |          $article = self::find($data['id']);
 |  |          $article = self::find($data['id']);
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +        $oldkeys = explode(',', $article->keywords);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          $article->allowField(['cid','title','writer','source','titlepic','keywords','summary','content',
 |  |          $article->allowField(['cid','title','writer','source','titlepic','keywords','summary','content',
 | 
											
												
													
														|  |              'status','sort','hits','content_type','userid','username'])->save($data);
 |  |              'status','sort','hits','content_type','userid','username'])->save($data);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          FileManager::saveInfoid($article->id, $data['cjid']);
 |  |          FileManager::saveInfoid($article->id, $data['cjid']);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $newkeys = explode(',', $data['keywords']);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $keys = array_diff($newkeys, $oldkeys);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $dec  = array_diff($oldkeys, $newkeys);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        Tag::saveTags($keys, $article->id);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        Tag::decNums($dec, $article->id);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 |