Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

104 linhas
2.8 KiB

  1. <?php
  2. /**
  3. * 数据库表类 fx_user
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm LoginController.php
  13. * Create By 2017/10/17 15:08 $
  14. */
  15. namespace common\models;
  16. use yii\db\ActiveRecord;
  17. /**
  18. * 数据库表类 fx_user.
  19. * @property integer $uid
  20. * @property string $user_name
  21. * @property string $openid
  22. * @property string $phone
  23. * @property string $nickname
  24. * @property string $headimgurl
  25. * @property integer $sex
  26. * @property string $country
  27. * @property string $province
  28. * @property string $city
  29. * @property integer $status
  30. * @property string $reg_time
  31. * @property integer $delete_flag
  32. * @property string $wx_openid
  33. * @property integer $main_user_id
  34. */
  35. class FxUser extends ActiveRecord
  36. {
  37. /**
  38. * @inheritdoc
  39. */
  40. public static function tableName()
  41. {
  42. return 'fx_user';
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function rules()
  48. {
  49. return [
  50. [['openid'], 'required'],
  51. [['sex', 'status', 'delete_flag', 'main_user_id'], 'integer'],
  52. [['reg_time'], 'safe'],
  53. [['user_name'], 'string', 'max' => 100],
  54. [['openid', 'wx_openid'], 'string', 'max' => 120],
  55. [['phone'], 'string', 'max' => 11],
  56. [['nickname'], 'string', 'max' => 21],
  57. [['headimgurl', 'country', 'province', 'city'], 'string', 'max' => 255],
  58. [['openid'], 'unique'],
  59. ];
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function attributeLabels()
  65. {
  66. return [
  67. 'uid' => 'Uid',
  68. 'user_name' => 'User Name',
  69. 'openid' => 'Openid',
  70. 'phone' => 'Phone',
  71. 'nickname' => 'Nickname',
  72. 'headimgurl' => 'Headimgurl',
  73. 'sex' => 'Sex',
  74. 'country' => 'Country',
  75. 'province' => 'Province',
  76. 'city' => 'City',
  77. 'status' => 'Status',
  78. 'reg_time' => 'Reg Time',
  79. 'delete_flag' => 'Delete Flag',
  80. 'wx_openid' => 'Wx Openid',
  81. 'main_user_id' => 'Main User ID',
  82. ];
  83. }
  84. /**
  85. * Des:修改用户数据
  86. * Name: updateById
  87. * @param $value
  88. * @param $id
  89. * @return int
  90. * @author 倪宗锋
  91. */
  92. public function updateById($value, $id)
  93. {
  94. $count = self::updateAll($value, ['in', 'uid', $id]);
  95. return $count;
  96. }
  97. }