yingzi 3 년 전
부모
커밋
c88b72ca41
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      app/model/api/UserShowTemplate.php

+ 2 - 1
app/model/api/UserShowTemplate.php

@@ -18,12 +18,13 @@ class UserShowTemplate extends Model
     public function userBindTemp($id,$uid){
         $count = $this->where("uid",$uid)->where("show_template_id",$id)->count();
         if($count<=0){
+            $ocount =  $this->where("uid",$uid)->count();
             $r = $this->insert([
                 "uid"              => $uid,
                 "show_template_id" => $id,
                 "start_time"       => time(),
                 "end_time"         => time()+100*365*24*60*60,//100年
-                "is_default"       => 0,
+                "is_default"       => $ocount>0 ? 0 : 1,
             ]);
         }
         return true;