UserExchsoundLog.php 704 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. /**
  5. * 模型
  6. */
  7. class UserExchsoundLog extends Model
  8. {
  9. // 开启自动写入时间戳字段
  10. protected $autoWriteTimestamp = 'int';
  11. // 定义时间戳字段名
  12. protected $createTime = 'createtime';
  13. /**
  14. * 添加钻石兑换记录
  15. */
  16. public function addExchsoundLog($user_id,$sound,$money) {
  17. if(!$user_id || !$sound || !$money) {
  18. return false;
  19. }
  20. $data = [
  21. "user_id" => $user_id,
  22. "sound_coin" => $sound,
  23. "jewel" => $money,
  24. "createtime" => time()
  25. ];
  26. return $this->insertGetId($data);
  27. }
  28. }