Skip to content

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
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
deviceTokenStringoptionalInteraction device Token
For example, iOS Device Token or Android Device Token
Can be used for push notifications
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)

getUserDeviceToken

php
\FresnsCmdWord::plugin('Fresns')->getUserDeviceToken($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequired
platformIdNumberoptionalPlatform ID (Key value of the platforms key name in the configuration table)
No value then output all
  • The result is an array sorted in reverse chronological order by creation time, with the most recent creation on top.
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": [
        {
            "platformId": 5,
            "deviceToken": "",
            "datetime": ""
        }
    ]
}

logicalDeletionUser

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

physicalDeletionUser

php
\FresnsCmdWord::plugin('Fresns')->physicalDeletionUser($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid
  • Physical deletion involves a lot of content, so the deletion function is performed using a queue, so configure the Fresns queues.

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.

setUserBadge

php
\FresnsCmdWord::plugin('Fresns')->setUserBadge($wordBody);
Parameter NameTypeRequiredDescription
uidNumberrequiredUser UID users->uid
fskeyStringrequiredplugin fskey
typeNumberrequired1. Red dot / 2. Number / 3. Text
badgeNumberNumberoptionalRequired for type=2, the displayed number. If an old number exists, it will be accumulated
badgeTextStringoptionalRequired for type=3, the displayed text content. Supports up to 8 characters

clearUserBadge

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

clearUserAllBadges

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

Released under the Apache-2.0 License