|
@@ -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;
|