0], ['be_user_id', 'required'], ['be_user_id', 'exist', 'targetClass' => '\common\models\User', 'targetAttribute' => 'id'], ['be_user_id', 'number', 'integerOnly' => true], ['type', 'default', 'value' => EnumUtil::USER_SYSTEM_LOG_DEAL_COMPLETE], ['type', 'in', 'range' => EnumUtil::USER_SYSTEM_LOG_LIST], ['message', 'default', 'value' => ''], ['message', 'string', 'max' => 500], ['del', 'default', 'value' => EnumUtil::DELETE_NOT], ['del', 'in', 'range' => EnumUtil::DELETE_LIST], ['created_at', 'default', 'value' => 0], ['updated_at', 'default', 'value' => 0], ]; } public static function findByID($id) { return self::findOne(['id' => $id, 'del' => EnumUtil::DELETE_NOT]); } /** * @param $userID * @param $offset * @param $count * @param $totalCount * @return array|UserLog[] */ public static function findAllByUserID($userID, $offset, $count, &$totalCount) { $find = UserSystemLog::find()->where(['be_user_id' => $userID, 'del' => EnumUtil::DELETE_NOT])->orderBy(['updated_at' => SORT_DESC]); $totalCount = $find->count(); return $find->offset($offset)->limit($count)->all(); } public static function findByUserID($userID,$type) { $find = UserSystemLog::find()->where(['user_id' => $userID, 'del' => EnumUtil::DELETE_NOT])->orderBy(['updated_at' => SORT_DESC]); $totalCount = $find->count(); return $find->all(); } public function __get($name) { return parent::__get($name); } public function attributeLabels() { $data = parent::attributeLabels(); return $data; } public function genClientData() { return [ 'id' => $this->id, 'be_user_id' => $this->be_user_id, 'type' => $this->type, 'message' => $this->message, 'created_at' => $this->created_at, ]; } }