GameSixlotteryLog.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Models;
  3. class GameSixlotteryLog extends BaseModel {
  4. protected $table = "game_sixlottery_log";
  5. public $timestamps = false;
  6. //添加六合彩开奖日志
  7. function addLog($data) {
  8. $this->info_no = $data['info_no'];
  9. $this->codes = $data['codes'];
  10. $this->open_time = $data['open_time'];
  11. $this->time = $data['time'];
  12. $this->status = $data['status'];
  13. $res = $this->save();
  14. if (!$res) {
  15. return -5050000102; //添加开奖失败
  16. }
  17. return 1;
  18. }
  19. //获取往期开奖记录
  20. function getLog($list=20,$fild='id',$order='desc',$where=''){
  21. $data=$this->orderBy($fild,$order);
  22. if(!empty($where)&&is_array($where)){
  23. $data = $data->where($where);
  24. }
  25. $data = $data->paginate($list);
  26. if(!$data){
  27. return -5050000202;//没有开奖数据
  28. }
  29. return $data->toArray();
  30. }
  31. //获取一个游戏开奖数据
  32. function getOne($identity){
  33. $data=$this->where('id',$identity)->first();
  34. if(!$data){
  35. return -5050000302;//没有开奖数据
  36. }
  37. return $data->toArray();
  38. }
  39. //删除一个游戏开奖数据
  40. function deleteOpendata($identity){
  41. $data=$this->where('status','未开奖')->where('id',$identity)->delete();
  42. if(!$data){
  43. return -5050000402;//删除失败
  44. }
  45. return 1;
  46. }
  47. //修改开奖信息
  48. function updateOpendata($data,$identity){
  49. $data=$this->where('status','未开奖')->where('id',$identity)->update($data);
  50. if(!$data){
  51. return -5050000502;//更新失败
  52. }
  53. return 1;
  54. }
  55. //修改开奖结果
  56. function updateData($data,$identity){
  57. $data=$this->where('id',$identity)->update($data);
  58. if(!$data){
  59. return -5050000502;//更新失败
  60. }
  61. return 1;
  62. }
  63. //按期号获取游戏开奖号码
  64. function getPrizeCodes($no){
  65. $data=$this->where('info_no',$no)->first();
  66. if(!$data){
  67. return -5040100122;//没有该期信息
  68. }
  69. return $data->toArray();
  70. }
  71. }