SdkOrderRank.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | saiadmin [ saiadmin快速开发框架 ]
  4. // +----------------------------------------------------------------------
  5. // | Author: your name
  6. // +----------------------------------------------------------------------
  7. namespace app\v1\model\gameLog;
  8. use plugin\saiadmin\basic\BaseNormalModel;
  9. /**
  10. * 充值排行模型
  11. */
  12. class SdkOrderRank extends BaseNormalModel
  13. {
  14. /**
  15. * 数据表主键
  16. * @var string
  17. */
  18. protected $pk = 'orderid';
  19. /**
  20. * 数据库表名称
  21. * @var string
  22. */
  23. protected $table = 'sdk_order_success';
  24. /**
  25. * 数据库连接
  26. * @var string
  27. */
  28. protected $connection = 'db_game_log';
  29. /**
  30. * 游戏名 保存数组转换
  31. */
  32. public function setGameIdAttr($value)
  33. {
  34. return json_encode($value, JSON_UNESCAPED_UNICODE);
  35. }
  36. // /**
  37. // * 游戏名 读取数组转换
  38. // */
  39. // public function getGameIdAttr($value)
  40. // {
  41. // return json_decode($value ?? '', true);
  42. // }
  43. /**
  44. * 注册日期 搜索
  45. */
  46. public function searchRegDateAttr($query, $value)
  47. {
  48. // $query->whereTime('reg_date', 'between', $value);
  49. $sTime = strtotime($value[0] . " 00:00:00");
  50. $eTime = strtotime($value[1] . " 23:59:59");
  51. $query->whereTime('reg_date', 'between', [$sTime, $eTime]);
  52. }
  53. /**
  54. * 充值日期 搜索
  55. */
  56. public function searchPayDateAttr($query, $value)
  57. {
  58. $sTime = strtotime($value[0] . " 00:00:00");
  59. $eTime = strtotime($value[1] . " 23:59:59");
  60. $query->whereTime('pay_date', 'between', [$sTime, $eTime]);
  61. }
  62. }