123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- namespace common\modules\user\models;
- use common\models\Voice;
- use common\modules\attachment\behaviors\UploadBehavior;
- use common\modules\attachment\models\Attachment;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%user_profile}}".
- *
- * @property integer $id
- * @property integer $money
- * @property integer $integral
- * @property integer $created_at
- * @property integer $updated_at
- * @property string $signature
- * @property string $avatar
- * @property integer $gender
- * @property string $country
- * @property string $province
- * @property string $city
- * @property string $address
- * @property string $contact
- * @property array $genderList
- *
- */
- class Profile extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%user_profile}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['gender'], 'integer'],
- [['money', 'integral'], 'integer'], // 充值场景
- [['signature'], 'string', 'max' => 100],
- [['province', 'city', 'country'], 'string', 'max' => 50],
- ['locale', 'default', 'value' => Yii::$app->language],
- // ['locale', 'in', 'range' => array_keys(self::getLocaleList())],
- [['picture', 'avatar', 'rank_pic'], 'safe']
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'money' => Yii::t('common', '余额'),
- 'integral' => Yii::t('common', '积分'),
- 'created_at' => Yii::t('common', 'Created At'),
- 'updated_at' => Yii::t('common', 'Updated At'),
- 'signature' => Yii::t('common', 'Signature'),
- 'avatar' => Yii::t('common', 'Avatar'),
- 'gender' => Yii::t('common', 'Gender'),
- 'locale' => '语言',
- 'province' => '省份',
- 'city' => '市县',
- 'address' => '地址',
- 'contact' => '联系人',
- 'country' => '国家',
- ];
- }
- public function behaviors()
- {
- return [
- TimestampBehavior::className(),
- // [
- // 'class' => UploadBehavior::className(),
- // 'attribute' => 'avatar',
- // 'entity' => __CLASS__
- // ],
- ];
- }
- public static function getGenderList()
- {
- return [Yii::t('common', 'Male'), Yii::t('common', 'Famale')];
- }
- public static function getLocaleList()
- {
- return [
- 'zh-CN' => '简体中文'
- ];
- }
- /**
- * @return string
- */
- public function getFullArea()
- {
- return $this->country . ' ' . $this->province . ' ' . $this->city;
- }
- public function afterFind()
- {
- parent::afterFind(); // TODO: Change the autogenerated stub
- }
- }
|