yingzi 2 years ago
parent
commit
c88b72ca41
1 changed files with 2 additions and 1 deletions
  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){
     public function userBindTemp($id,$uid){
         $count = $this->where("uid",$uid)->where("show_template_id",$id)->count();
         $count = $this->where("uid",$uid)->where("show_template_id",$id)->count();
         if($count<=0){
         if($count<=0){
+            $ocount =  $this->where("uid",$uid)->count();
             $r = $this->insert([
             $r = $this->insert([
                 "uid"              => $uid,
                 "uid"              => $uid,
                 "show_template_id" => $id,
                 "show_template_id" => $id,
                 "start_time"       => time(),
                 "start_time"       => time(),
                 "end_time"         => time()+100*365*24*60*60,//100年
                 "end_time"         => time()+100*365*24*60*60,//100年
-                "is_default"       => 0,
+                "is_default"       => $ocount>0 ? 0 : 1,
             ]);
             ]);
         }
         }
         return true;
         return true;