255], [['seller_comments'], 'string'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => 'User ID', 'mobile' => 'Mobile', 'name' => 'Name', 'status' => '审核状态 0--未审核 1--审核通过 2--审核不通过', 'is_delete' => 'Is Delete', 'addtime' => 'Addtime', 'store_id' => '商城id', 'seller_comments' => '备注', ]; } // public function saveS() // { // if($this->save()){ // return [ // 'code'=>0, // 'msg'=>'成功' // ]; // }else{ // return [ // 'code'=>1, // 'msg'=>'网络异常', // 'data'=>$this->errors, // ]; // } // } public function getFirstChildren() { return $this->hasMany(User::className(), ['parent_id'=>'user_id']) ->alias('f')->andWhere(['f.is_delete'=>0,'f.type' => 1])->select(['f.id','f.nickname','f.parent_id','f.addtime']); } public static function getChildren($index) { $share = Share::findOne(['user_id'=>$index]); if (!$share) { return null; } $children = $share->firstChildren; if (!$children) { return null; } return $children; } // public function getC() // { // return $this->hasMany(User::className(),['parent_id'=>'user_id']); // } public function beforeSave($insert) { $this->name = \yii\helpers\Html::encode($this->name); return parent::beforeSave($insert); } }