소스 검색

判断note不为null

visuddhinanda 2 년 전
부모
커밋
c9f49289f3
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      app/Console/Commands/UpgradeCommunityTerm.php

+ 4 - 3
app/Console/Commands/UpgradeCommunityTerm.php

@@ -84,12 +84,13 @@ class UpgradeCommunityTerm extends Command
                                         ->where('date_int','<=',date_timestamp_get(date_create($term->updated_at))*1000)
                                         ->sum('duration');
                 $iExp = (int)($exp/1000);
-                $noteStrLen = mb_strlen($term->note);
+                $noteStrLen = $term->note? mb_strlen($term->note,'UTF-8'):0;
                 $paliStrLen = 0;
                 $tranStrLen = 0;
                 $noteWithoutPali = "";
-                if(!empty(trim($term->note))){
-                    #查找句子模版
+                if($term->note && !empty(trim($term->note))){
+                    //计算note得分
+                    //查找句子模版
                     $pattern = "/\{\{[0-9].+?\}\}/";
                     //获取去掉句子模版的剩余部分
                     $noteWithoutPali = preg_replace($pattern,"",$term->note);