ShareRedpackRecordLog.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace addons\ShareRedpack\common\models;
  3. use common\models\user\User;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_share_redpack_record_log".
  7. *
  8. * @property int $id
  9. * @property int $mall_id
  10. * @property int $record_id share_redpack_record.id
  11. * @property int $user_id 发红包者的id
  12. * @property int $get_user_id 获取红包者的id
  13. * @property float $change_num 变动金额
  14. * @property string $change_type add 增 sub 减
  15. * @property string $source_table 来源表
  16. * @property int $source_table_id 操作来源业务id
  17. * @property int|null $status 状态,-1:失效,1:正常,2:冻结
  18. * @property string|null $desc 变动说明
  19. * @property int|null $created_at
  20. * @property int|null $updated_at
  21. */
  22. class ShareRedpackRecordLog extends \common\models\base\BaseActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return 'qimall_addons_share_redpack_record_log';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['mall_id', 'record_id', 'user_id', 'get_user_id', 'change_num', 'change_type'], 'required'],
  38. [['mall_id', 'record_id', 'user_id', 'get_user_id', 'source_table_id', 'status', 'created_at', 'updated_at'], 'integer'],
  39. [['change_num'], 'number'],
  40. [['change_type'], 'string', 'max' => 10],
  41. [['source_table', 'desc'], 'string', 'max' => 255],
  42. ];
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'id' => 'ID',
  51. 'mall_id' => 'Mall ID',
  52. 'record_id' => 'Record ID',
  53. 'user_id' => 'User ID',
  54. 'get_user_id' => 'Get User ID',
  55. 'change_num' => 'Change Num',
  56. 'change_type' => 'Change Type',
  57. 'source_table' => 'Source Table',
  58. 'source_table_id' => 'Source Table ID',
  59. 'status' => 'Status',
  60. 'desc' => 'Desc',
  61. 'created_at' => 'Created At',
  62. 'updated_at' => 'Updated At',
  63. ];
  64. }
  65. /**
  66. * 关联用户表
  67. */
  68. public function getUser()
  69. {
  70. return $this->hasOne(User::class,['id'=>'user_id'])->select('nickname,avatar_url,mobile,username,id,created_at');
  71. }
  72. }