Skip to content
On this page

User Command Word

createUser

php
\FresnsCmdWord::plugin('Fresns')->createUser($wordBody);
Parameter NameTypeRequiredDescription
aidStringrequiredRelated field accounts->aid
aidTokenStringoptionalIf not passed, the account identity will not be verified, and users will be added directly to the account
platformIdNumberoptionalPlatform ID, required when passing aidToken
versionStringoptionalSemantic version number, required when passing aidToken
appIdStringoptionalApp ID, required when passing aidToken
usernameStringoptionalUsername, related field users->username
If not passed, a random 6-8 character string will be generated, avoiding the use of banned names (key name ban_names banned values)
nicknameStringoptionalNickname, related field users->nickname
If not passed, a random 8 character string
passwordStringoptionalLogin password, related field users->password
avatarFidStringoptionalAvatar file fid, converted to files->id when stored
Related field users->avatar_file_id
avatarUrlStringoptionalAvatar file URL, related field users->avatar_file_url
bannerFidStringoptionalBanner file fid, converted to files->id when stored
Related field users->banner_file_id
bannerUrlStringoptionalBanner file URL, related field users->banner_file_url
genderNumberoptionalGender, related field users->gender
birthdayStringoptionalBirthday, related field users->birthday, format is Y-m-d H:i:s
timezoneStringoptionalPreferred timezone, related field users->timezone
languageStringoptionalPreferred language, related field users->language
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": {
        "aid": "accounts->aid",
        "aidToken": "aidToken",
        "uid": "users->uid",
        "username": "users->username",
        "nickname": "users->nickname"
    }
}
View the add logic
  • Data list to be generated during registration
    • Main user table users
    • User data statistics table user_stats
    • User role association table user_roles: The initial role comes from the default_role key in the configuration table.
    • For other parameters, if there's a value, record it directly; if not, leave it blank.

verifyUser

php
\FresnsCmdWord::plugin('Fresns')->verifyUser($wordBody);
Parameter NameTypeRequiredDescription
platformIdNumberrequiredPlatform ID (key value of the key name in the configuration table platforms)
versionStringrequiredSemantic version number
appIdStringrequiredApp ID
aidStringrequiredAccount AID accounts->aid
aidTokenStringrequiredAccount Token
uidNumberrequiredUser UID users->uid
passwordStringoptionalPassword users->password
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": {
        "aid": "accounts->aid",
        "aidToken": "aidToken",
        "uid": "users->uid",
    }
}

createUserToken

php
\FresnsCmdWord::plugin('Fresns')->createUserToken($wordBody);
Parameter NameTypeRequiredDescription
platformIdNumberrequiredPlatform ID (key value of the key name in the configuration table platforms)
versionStringrequiredSemantic version number
appIdStringrequiredApp ID
aidStringrequiredAccount parameter session_tokens->account_id
Stored as accounts->id when converted from aid
aidTokenStringrequiredAccount identity credential (credential table session_tokens->token field)
uidNumberrequiredUser parameter session_tokens->user_id
Stored as users->id when converted from uid
expiredTimeNumberoptionalExpiration time, unit: hours (empty means valid forever)
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": {
        "aid": "aid",
        "aidToken": "aidToken",
        "uid": "users->uid",
        "uidToken": "session_tokens->token",
        "uidTokenId": "session_tokens->id",
        "expiredHours": "Expiration hours", // If not available, output null
        "expiredDays": "Expiration days", // If not available, output null
        "expiredDateTime": "session_tokens->expired_at, leave empty for permanent validity, format: Y-m-d H:i:s", // If not available, output null
    }
}

verifyUserToken

php
\FresnsCmdWord::plugin('Fresns')->verifyUserToken($wordBody);
Parameter NameTypeRequiredDescription
platformIdNumberrequiredPlatform ID (key value of the key name in the configuration table platforms)
aidStringrequiredAccount parameter session_tokens->account_id
Checked by converting aid to accounts->id
aidTokenStringrequiredAccount identity credential (credential table session_tokens->token field)
uidNumberrequiredUser parameter session_tokens->user_id
Checked by converting uid to users->id
uidTokenStringrequiredUser identity credential (credential table session_tokens->token field)

logicalDeletionUser

php
\FresnsCmdWord::plugin('Fresns')->logicalDeletionUser($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid

setUserExtcredits

php
\FresnsCmdWord::plugin('Fresns')->setUserExtcredits($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid
extcreditsIdNumberrequiredextcredits id 1-5
fskeyStringrequiredplugin fskey
operationStringrequiredOperation Type incrementdecrement
amountNumberoptionalLeave blank to default to 1
remarkStringoptionalRemark

setUserExpiryDatetime

php
\FresnsCmdWord::plugin('Fresns')->setUserExpiryDatetime($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid
datetimeStringoptionalY-m-d H:i:s Date and time value, timezone is the database timezone
clearDatetimeBooleanoptionalWhether to clear the user's validity period
  • Choose one between datetime and clearDatetime to pass as a parameter.
  • This feature is only effective for site private mode.
  • This feature is only effective for group private mode.
  • If the user has not joined the group, they will automatically join the group and set the validity period.

setUserGroupExpiryDatetime

php
\FresnsCmdWord::plugin('Fresns')->setUserGroupExpiryDatetime($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid
gidStringrequiredGroup GID groups->gid
datetimeStringoptionalY-m-d H:i:s Date and time value, timezone is the database timezone
clearDatetimeBooleanoptionalWhether to clear the user's validity period
  • Choose one between datetime and clearDatetime to pass as a parameter.
  • This feature is only effective for group private mode.
  • If the user has not joined the group, they will automatically join the group and set the validity period.

Released under the Apache-2.0 License