VipLogModel.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace App\Models\Log;
  3. use App\Models\Model;
  4. /**
  5. * *
  6. * * Class VipLogModel
  7. * * @package App\Models\Log
  8. * * @method renewalSupvip(int $uid, int $day)
  9. * * @method openSupvip(int $uid, int $day)
  10. * * @method openVip(int $uid)
  11. * * @method closeVip(int $uid)
  12. *
  13. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Log\VipLogModel newModelQuery()
  14. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Log\VipLogModel newQuery()
  15. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Log\VipLogModel query()
  16. * @mixin \Eloquent
  17. */
  18. class VipLogModel extends Model
  19. {
  20. protected $connection = "mysql_datalog";
  21. protected $table = "kdgx_vip_logs";
  22. public $timestamps = false;
  23. protected $fillable = ['id', 'created_at', 'uid', 'log', 'day'];
  24. /**
  25. * @param string $method
  26. * @param array $params
  27. * @return mixed
  28. */
  29. public static function __callStatic($method, $params)
  30. {
  31. return call_user_func_array([new VipLogModel(), "p{$method}"], $params);
  32. }
  33. /**
  34. * 记录激活普通会籍
  35. * @param int $uid
  36. */
  37. private function popenVip(int $uid)
  38. {
  39. $this->fill([
  40. 'created_at' => time(),
  41. 'uid' => $uid,
  42. 'log' => "激活会籍"
  43. ])->save();
  44. }
  45. /**
  46. * 记录取消普通会籍
  47. * @param int $uid
  48. */
  49. private function pcloseVip(int $uid)
  50. {
  51. $this->fill([
  52. 'created_at' => time(),
  53. 'uid' => $uid,
  54. 'log' => "取消会籍"
  55. ])->save();
  56. }
  57. /**
  58. * 记录开通超级会员
  59. * @param int $uid
  60. * @param int $day
  61. */
  62. private function popenSupvip(int $uid, int $day)
  63. {
  64. $this->fill([
  65. 'created_at' => time(),
  66. 'uid' => $uid,
  67. 'log' => "开通超级会员",
  68. 'day' => $day
  69. ])->save();
  70. }
  71. /**
  72. * 记录续费超级会员
  73. * @param int $uid
  74. * @param int $day
  75. */
  76. private function prenewalSupvip(int $uid, int $day)
  77. {
  78. $this->fill([
  79. 'created_at' => time(),
  80. 'uid' => $uid,
  81. 'log' => "续费超级会员",
  82. 'day' => $day
  83. ])->save();
  84. }
  85. }