<?php
declare (strict_types = 1);

namespace app\model\api;

use think\Model;

/**
 * @mixin \think\Model
 */
class UserShowTemplate extends Model
{
    /**
     * 用户绑定名片模板
     * @param type $id
     * @param type $uid
     */
    public function userBindTemp($id,$uid){
        $count = $this->where("uid",$uid)->where("show_template_id",$id)->count();
        if($count<=0){
            $r = $this->insert([
                "uid"              => $uid,
                "show_template_id" => $id,
                "start_time"       => time(),
                "end_time"         => time()+100*365*24*60*60,//100年
                "is_default"       => 0,
            ]);
        }
        return true;
    }
    
    
}
