FansStat.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace addons\Wechat\common\models;
  3. use Yii;
  4. use yii\behaviors\BlameableBehavior;
  5. use yii\behaviors\TimestampBehavior;
  6. use yii\db\ActiveRecord;
  7. /**
  8. * This is the model class for table "{{%addon_wechat_fans_stat}}".
  9. *
  10. * @property string $id
  11. * @property int $new_attention 今日新关注
  12. * @property int $cancel_attention 今日取消关注
  13. * @property int $cumulate_attention 累计关注
  14. * @property string $date
  15. * @property int $status 状态[-1:删除;0:禁用;1启用]
  16. * @property string $created_at 添加时间
  17. * @property string $updated_at 修改时间
  18. */
  19. class FansStat extends \common\models\base\BaseModel
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return '{{%addon_wechat_fans_stat}}';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['merchant_id', 'new_attention', 'cancel_attention', 'cumulate_attention', 'status', 'created_at', 'updated_at'], 'integer'],
  35. [['date'], 'required'],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'new_attention' => '今日新关注',
  46. 'cancel_attention' => '今日取消关注',
  47. 'cumulate_attention' => '累计关注',
  48. 'date' => '日期',
  49. 'status' => 'Status',
  50. 'created_at' => '创建时间',
  51. 'updated_at' => '更新时间',
  52. ];
  53. }
  54. /**
  55. * 行为
  56. * @return array
  57. */
  58. public function behaviors()
  59. {
  60. return [
  61. [
  62. 'class' => TimestampBehavior::class,
  63. 'attributes' => [
  64. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at'],
  65. ],
  66. ],
  67. [
  68. 'class' => BlameableBehavior::class,
  69. 'attributes' => [
  70. ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'],
  71. ],
  72. 'value' => Yii::$app->services->merchant->getId(),
  73. ]
  74. ];
  75. }
  76. }
粤ICP备19079148号