/**
  * 初始化和收获,已经refill都要调用这个方法来验证
  * @param $item 数据库里的具体对象
  */
 function checkMultiProducts($item)
 {
     if (!$item) {
         return;
     }
     if (isset($item->start_time) && $item->start_time > 0) {
         // 这样才可以产出物品,如果没有这个值说明现在没有正在产出东西
         $prodcuts = $this->num_complete_raw_materials(unserialize($item->raw_materials), $item->id);
         $dbProducts = unserialize($item->products) ? unserialize($item->products) : array();
         $storeModel = new StoreModel($this->lang);
         $storeItem = $storeModel->getStoreById($item->id);
         // storeItem里的信息
         $collect_in = $storeItem->collect_in;
         // 收获的时间
         $num = min(self::MAX_PRODUCTS - count($dbProducts), min($prodcuts, floor((time() - $item->start_time) / $collect_in)));
         $decreaseMaterials = null;
         $this->debugMsg("this can product {$num}");
         if ($num <= 0) {
             // 能生产出来的最大的数量
             $num = 0;
         } else {
             $decreaseMaterials = $this->decreaseMaterials($item, $num);
         }
         $item->start_time += $num * $collect_in;
         $nowProducts = $this->num_complete_raw_materials($item->raw_materials, $item->id);
         if (count($dbProducts) == self::MAX_PRODUCTS) {
             //$nowProducts == 0 ||
             $item->start_time = 0;
             // 不能再生产了,如果当前已经是产到最大了,那么就不能再生产了,
             //当收获之后去验证这个,这样就可以生产了
             $this->debugMsg('不能再继续生产了');
         }
         $this->debugMsg("执行中..{$item->start_time}");
         $change = array('start_time' => $item->start_time);
         if ($decreaseMaterials) {
             $updata = array_merge($decreaseMaterials, $change);
             $map = new MapModel();
             $map->updateMapItem($this->uid, $item->x, $item->y, $updata);
             // 这个不知道是不是更新到数据库里了
             return $updata;
         }
     }
     return;
 }