SdkOrderRank.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. $sTime = strtotime($value[0] . " 00:00:00");
  49. $eTime = strtotime($value[1] . " 23:59:59");
  50. $query->whereTime('reg_date', 'between', [$sTime, $eTime]);
  51. }
  52. /**
  53. * 充值日期 搜索
  54. */
  55. public function searchPayDateAttr($query, $value)
  56. {
  57. $sTime = strtotime($value[0] . " 00:00:00");
  58. $eTime = strtotime($value[1] . " 23:59:59");
  59. $query->whereTime('pay_date', 'between', [$sTime, $eTime]);
  60. }
  61. }