UserShowTemplate.php 737 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\model\api;
  4. use think\Model;
  5. /**
  6. * @mixin \think\Model
  7. */
  8. class UserShowTemplate extends Model
  9. {
  10. /**
  11. * 用户绑定名片模板
  12. * @param type $id
  13. * @param type $uid
  14. */
  15. public function userBindTemp($id,$uid){
  16. $count = $this->where("uid",$uid)->where("show_template_id",$id)->count();
  17. if($count<=0){
  18. $r = $this->insert([
  19. "uid" => $uid,
  20. "show_template_id" => $id,
  21. "start_time" => time(),
  22. "end_time" => time()+100*365*24*60*60,//100年
  23. "is_default" => 0,
  24. ]);
  25. }
  26. return true;
  27. }
  28. }