UserInfo.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "bd_user_info".
  6. *
  7. * @property integer $id
  8. * @property integer $uid
  9. * @property string $nickname
  10. * @property string $portrait
  11. * @property string $tel
  12. * @property integer $updated_at
  13. */
  14. class UserInfo extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public static function tableName()
  20. {
  21. return '{{%user_info}}';
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['uid','updated_at'], 'required'],
  30. [['uid', 'updated_at'], 'integer'],
  31. [['nickname', 'tel'], 'string', 'max' => 32],
  32. [['portrait'], 'string', 'max' => 255],
  33. ];
  34. }
  35. /**
  36. * @inheritdoc
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => 'ID',
  42. 'uid' => 'Uid',
  43. 'nickname' => 'Nickname',
  44. 'portrait' => 'Portrait',
  45. 'tel' => 'Tel',
  46. 'updated_at' => 'Updated At',
  47. ];
  48. }
  49. static function imagesUrl($imgurl)
  50. {
  51. $str =substr($imgurl,0,4);
  52. $str2 =substr($imgurl,0,4);
  53. if($str=='http'||$str2=='https')
  54. {
  55. return $imgurl;
  56. }
  57. return Yii::getAlias('@imgdomain').'/'.$imgurl;
  58. }
  59. }