Example #1
0
 /**
  * 检测哪些分类是跟目前的分类信息不对应的
  *
  * @Author   tianyunzi
  * @DateTime 2016-02-18T09:38:48+0800
  * @return   [type]                   [description]
  */
 public function checkCateInfoAction()
 {
     $count = 0;
     $fp = fopen("/tmp/b", "r");
     while (!feof($fp)) {
         $line = trim(fgets($fp));
         if (empty($line)) {
             continue;
         }
         $count++;
         $propertyArr = explode("\t", $line);
         $propertyArr[1] = json_decode($propertyArr[1], true);
         $cateid = $propertyArr[0];
         $cateRs = Fbcateinfo::findFirst(array("conditions" => "cateid = ?1", "bind" => array(1 => $cateid), "limit" => 1));
         if (empty($cateRs)) {
             echo "分类 " . $cateid . "不存在\n";
             continue;
         }
         if ($cateRs->is_leaf != 1) {
             echo "分类 " . $cateid . "不是末级分类\n";
             continue;
         }
         /** 检测下该分类下属性是不是已经入库 */
         $count = Fbcateproperty::count("cateid='" . $cateid . "'");
         if ($count == 0) {
             echo "分类 " . $cateid . "没能入属性表成功!\n";
             continue;
         }
     }
     echo "总共" . $count . "条\n";
 }
Example #2
0
 public function checkCatezh($cateid)
 {
     $cateMysql = Fbcateinfo::findFirst(array("conditions" => "cateid = ?1", "bind" => array(1 => $cateid), "limit" => 1));
     if (empty($cateMysql)) {
         return false;
     }
     if ($cateMysql->catezh) {
         return true;
     }
     $catezh = $this->getCatezh($cateMysql->catename);
     echo $cateMysql->catename . "\t" . $catezh . "\n";
     $cateMysql->catezh = $catezh;
     $cateMysql->save();
 }
Example #3
0
 /**
  * 分析下所有的新增的分类是否和属性对应,因为新增分类id是自增的,所以可能id对应的不正确
  *
  * @Author   tianyunzi
  * @DateTime 2016-02-18T10:28:38+0800
  * @return   [type]                   [description]
  */
 public function cateaddAction()
 {
     $id = 0;
     while (1) {
         $cateMysql = Fbcateinfo::find(array("conditions" => "cateid > ?1 and is_copyadd = 1", "bind" => array(1 => $id), "limit" => 100));
         $cateRs = $cateMysql->toArray();
         if (empty($cateRs)) {
             break;
         }
         foreach ($cateRs as $value) {
             $id = $value["cateid"];
             $propertyRs = Fbcateproperty::find(array("conditions" => "cateid = ?1", "bind" => array(1 => $id), "limit" => 100));
             $propertyRs = $propertyRs->toArray();
             if (empty($propertyRs)) {
                 continue;
             }
             echo $value["catename"] . "\n";
             foreach ($propertyRs as $value1) {
                 echo "====  " . $value1["ppname"] . "  ======\n";
             }
         }
     }
 }