UserTaskFinish.php 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Created by CRMEB.
  4. * Copyright (c) 2017~2019 http://www.crmeb.com All rights reserved.
  5. * Author: liaofei <136327134@qq.com>
  6. * Date: 2019/3/27 21:42
  7. */
  8. namespace app\models\user;
  9. use crmeb\traits\ModelTrait;
  10. use crmeb\basic\BaseModel;
  11. /**
  12. * TODO 用户等级完成任务记录 model
  13. * Class UserTaskFinish
  14. * @package app\models\user
  15. */
  16. class UserTaskFinish extends BaseModel
  17. {
  18. /**
  19. * 数据表主键
  20. * @var string
  21. */
  22. protected $pk = 'id';
  23. /**
  24. * 模型名称
  25. * @var string
  26. */
  27. protected $name = 'user_task_finish';
  28. use ModelTrait;
  29. /**
  30. * 设置任务完成情况
  31. * @param $uid 用户uid
  32. * @param $task_id 任务id
  33. * @return UserTaskFinish|bool|\think\Model
  34. */
  35. public static function setFinish($uid,$task_id)
  36. {
  37. $add_time=time();
  38. if(self::be(['uid'=>$uid,'task_id'=>$task_id])) return true;
  39. return self::create(compact('uid','task_id','add_time'));
  40. }
  41. }