ChannelGamePoint.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\model;
  3. /**
  4. * 渠道游戏点位表
  5. * @author Administrator
  6. */
  7. class ChannelGamePoint extends \think\Model
  8. {
  9. protected $pk = 'id';
  10. protected $table = 'cy_channel_game_point';
  11. protected $autoWriteTimestamp = true;
  12. protected $createTime = 'create_time';
  13. protected $updateTime = 'update_time';
  14. public function getPoint($game_id, $channel_id)
  15. {
  16. return $this->where(['game_id'=>$game_id, 'channel_id'=>$channel_id])->value('point');
  17. }
  18. public function updateData($data, $where)
  19. {
  20. $info = $this->where($where)->find();
  21. if (!$info) {
  22. $data = array_merge($data, $where);
  23. $data['create_time'] = NOW_TIMESTAMP;
  24. return $this->allowField(true)->insert($data, $where);
  25. } else {
  26. return $this->update($data, $where);
  27. }
  28. }
  29. public function getAllPoint($game_id, $channel_id)
  30. {
  31. return $this->where(['game_id'=>$game_id, 'channel_id'=>$channel_id])->field('point,first_point')->find();
  32. }
  33. }