GameDiceone.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Models;
  3. class GameDiceone extends BaseModel {
  4. protected $table = "game_diceone";
  5. public $timestamps = false;
  6. //获取往期开奖记录
  7. function getLog($list=20,$fild,$order,$where=''){
  8. $data=$this->orderBy($fild,$order);
  9. if(!empty($where)&&is_array($where)){
  10. $data = $data->where($where);
  11. }
  12. $data = $data->paginate($list);
  13. if(!$data){
  14. return -5040000622;//没有开奖数据
  15. }
  16. return $data->toArray();
  17. }
  18. //获取一个游戏开奖数据
  19. function getOne() {
  20. $data = $this->where('status', 2)->orderBy('open_time', 'desc')->first();
  21. if (!$data) {
  22. return -5040000622; //没有开奖数据
  23. }
  24. return $data->toArray();
  25. }
  26. //按期号获取游戏开奖号码
  27. function getPrizeCodes($no){
  28. $data=$this->where('info_no',$no)->first();
  29. if(!$data){
  30. return -5040100122;//没有该期信息
  31. }
  32. return $data->toArray();
  33. }
  34. //根据id获取订单信息
  35. function getInfoByID($id) {
  36. $data = $this->where('id', $id)->first();
  37. if (!$data) {
  38. return -5030001022; //没有订单数据
  39. }
  40. return $data->toArray();
  41. }
  42. //根据订单号获取订单信息
  43. function getInfoByOrderID($order_id) {
  44. $data = $this->where('order_id', $order_id)->first();
  45. if (!$data) {
  46. return -5030001022; //没有订单数据
  47. }
  48. return $data->toArray();
  49. }
  50. //管理员作废更新
  51. function updateStatus($order_id){
  52. $res=$this->where('order_id',$order_id)->update(['betstatus'=>2,'winmoney'=>0]);
  53. if(!$res){
  54. return -7021021122;
  55. }
  56. return 1;
  57. }
  58. }