System Command Word

Overview

Basis

Command WordDescription
fresns_cmd_verify_signVerify Sign
fresns_cmd_upload_session_logUpload Session Log
fresns_cmd_send_codeSend Code
fresns_cmd_check_codeCheck Code
fresns_cmd_send_emailSend Email
fresns_cmd_send_smsSend SMS
fresns_cmd_send_iosSend iOS Push
fresns_cmd_send_androidSend Android Push
fresns_cmd_send_wechatSend WeChat Push

User

Command WordDescription
fresns_cmd_user_registerUser Register
fresns_cmd_user_loginUser Login
fresns_cmd_user_detailUser Detail
fresns_cmd_create_session_tokenCreate Session Token
fresns_cmd_verify_session_tokenVerify Session Token
fresns_cmd_wallet_increaseWallet Increase
fresns_cmd_wallet_decreaseWallet Decrease

File

Command WordDescription
fresns_cmd_get_upload_tokenGet Upload Token
fresns_cmd_upload_fileUpload File
fresns_cmd_anti_link_imageImage: Anti Hotlinking URL
fresns_cmd_anti_link_videoVideo: Anti Hotlinking URL
fresns_cmd_anti_link_audioAudio: Anti Hotlinking URL
fresns_cmd_anti_link_docDoc: Anti Hotlinking URL
fresns_cmd_physical_deletion_filePhysical Deletion File

Content

Command WordDescription
fresns_cmd_direct_release_contentDirect Release Content

Error Code and Format

// Success
{
    "code": 0,
    "message": "ok",
    "output": {}
}
// Error
{
    "code": 30000,
    "message": "No service provider configured",
    "output": {}
}
// 30000 No service provider configured
// 30001 The service provider not exist
// 30002 No response from the service provider
// 30003 The service provider not enabled
// 30004 Service provider processing failed
// 30005 Parameter error
// 30006 Abnormal data: failed to be queried or data duplicated.
// 30007 Abnormal execution: file lost or wrong record
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Command Word: Basis

Verify Sign

Command Word: fresns_cmd_verify_sign

Parameters NameTypeRequiredDescription
platformNumberrequired平台编号(配置表 platforms 键名的键值)
versionStringrequired语义化版本号
versionIntNumberrequired整型版本号
appIdStringrequiredApp ID
timestampStringrequired签名生成时间(当前 Unix 时间戳,精确到秒的 10 位数值)
signStringrequired请求签名
uidStringoptional用户参数
midNumberoptional成员参数
tokenStringoptional身份凭证
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_VERIFY_SIGN;
$input = [
    'platform' => $platform,
    'version' => $version,
    'versionInt' => $versionInt,
    'appId' => $appId,
    'timestamp' => $timestamp,
    'sign' => $sign,
    'uid' => $uid,
    'mid' => $mid,
    'token' => $token,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Success
{
    "code": 0,
    "message": "ok",
    "output": {}
}
//失败
{
    "code": 30101,
    "message": "签名错误",
    "output": {}
}
// 30101 签名错误
// 30102 签名已过期
// 30103 输入信息错误
// 30104 平台 ID 不存在
// 30105 App ID 不存在
// 30109 用户错误或者不存在
// 30110 成员错误或者不存在
// 30111 用户 Token 不正确
// 30112 成员 Token 不正确
// 30113 Token 未启用
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Upload Session Log

Command Word: fresns_cmd_upload_session_log

Parameters NameTypeRequiredDescription
platformNumberrequired平台编号(配置表 platforms 键名的键值)
versionStringrequired语义化版本号
versionIntNumberrequired整型版本号
langTagStringoptional语言标签
uidStringoptional用户参数(用户主表 users > uuid 字段)
midNumberoptional成员参数(成员主表 members > uuid 字段)
objectTypeNumberrequired记录类型 session_logs > object_type
objectNameStringrequired目标名称 session_logs > object_name
objectActionStringrequired目标行为 session_logs > object_action
objectResultNumberrequired行为结果 session_logs > object_result
objectOrderIdStringoptional目标 ID session_logs > object_order_id
deviceInfoStringoptional交互设备信息 session_logs > device_info
以字符串传参压缩后的 Object 对象信息
moreJsonStringoptional其他信息 session_logs > more_json
以字符串传参压缩后的 Object 对象信息
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_UPLOAD_SESSION_LOG;
$input = [
    'platform' => $platform,
    'version' => $version,
    'versionInt' => $versionInt,
    'langTag' => $langTag,
    'uid' => $uid,
    'mid' => $mid,
    'objectType' => $objectType,
    'objectName' => $objectName,
    'objectAction' => $objectAction,
    'objectResult' => $objectResult,
    'objectOrderId' => $objectOrderId,
    'deviceInfo' => $deviceInfo,
    'moreJson' => $moreJson,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Send Code

Command Word: fresns_cmd_send_code

Parameters NameTypeRequiredDescription
typeNumberrequired类型:1.邮件验证码 / 2.短信验证码
accountStringrequired账号(邮箱或手机号)
countryCodeNumberoptional国际区号(手机号专用)
templateIdNumberrequired验证码模板 ID
langTagStringrequired语言标签
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_CODE;
$input = [
    'type' => $type,
    'account' => $account,
    'countryCode' => $countryCode,
    'templateId' => $templateId,
    'langTag' => $langTag,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12

Check Code

Command Word: fresns_cmd_check_code

Parameters NameTypeRequiredDescription
typeNumberrequired类型:1.邮件验证码 / 2.短信验证码
accountStringrequired账号(邮箱或手机号)
countryCodeNumberoptional国际区号(手机号专用)
verifyCodeStringrequired验证码
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_CHECK_CODE;
$input = [
    'type' => $type,
    'account' => $account,
    'countryCode' => $countryCode,
    'verifyCode' => $verifyCode
];
$resp =CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
//Success
{
    "code": 0,
    "message": "ok",
    "output": {}
}
//失败
{
    "code": 30008,
    "message": "验证码不正确或验证码已过期",
    "output": {}
}
1
2
3
4
5
6
7
8
9
10
11
12

Send Email

Command Word: fresns_cmd_send_email

Parameters NameTypeRequiredDescription
emailStringrequired邮箱地址
titleStringrequired标题
contentStringrequired内容(支持 HTML 代码)
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_EMAIL;
$input = [
    'email' => $email,
    'title' => $title,
    'content' => $content,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10

Send SMS

Command Word: fresns_cmd_send_sms

Parameters NameTypeRequiredDescription
countryCodeNumberrequired国际区号
phoneNumberNumberrequired手机号
signNameStringoptional短信签名名称
templateCodeStringrequired模板参数
templateParamStringoptional变量参数(以字符串传参压缩后的信息)
查看变量参数 templateParam 格式
// 变量名对应实际值
{
    "nickname": "唐杰",
    "variale1": "有人艾特你"
}

// 压缩后
{"nickname":"唐杰","variale1":"有人艾特你"}
1
2
3
4
5
6
7
8
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_SMS;
$input = [
    'countryCode' => $countryCode,
    'phoneNumber' => $phoneNumber,
    'signName' => $signName,
    'templateCode' => $templateCode,
    'templateParam' => $templateParam,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12

Send iOS Push

Command Word: fresns_cmd_send_ios

Parameters NameTypeRequiredDescription
midNumberrequired成员参数(成员主表 members > uuid 字段)
templateStringoptional模板参数
coverFileUrlStringoptional封面图
titleStringoptional标题
contentStringoptional内容
timeStringoptional时间
linkTypeStringoptional链接类型
linkUrlStringoptional链接地址
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_IOS;
$input = [
    'mid'=> $mid,
    'template'=> $template,
    'coverFileUrl'=> $coverFileUrl,
    'title'=> $title,
    'content'=> $content,
    'time'=> $time,
    'linkType'=> $linkType,
    'linkUrl'=> $linkUrl,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Send Android Push

Command Word: fresns_cmd_send_android

Parameters NameTypeRequiredDescription
midNumberrequired成员参数(成员主表 members > uuid 字段)
templateStringoptional模板参数
coverFileUrlStringoptional封面图
titleStringoptional标题
contentStringoptional内容
timeStringoptional时间
linkTypeStringoptional链接类型
linkUrlStringoptional链接地址
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_ANDROID;
$input = [
    'mid'=> $mid,
    'template'=> $template,
    'coverFileUrl'=> $coverFileUrl,
    'title'=> $title,
    'content'=> $content,
    'time'=> $time,
    'linkType'=> $linkType,
    'linkUrl'=> $linkUrl,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Send WeChat Push

Command Word: fresns_cmd_send_wechat

Parameters NameTypeRequiredDescription
channelNumberrequired渠道 1.公众号 2.小程序
midNumberrequired成员参数(成员主表 members > uuid 字段)
templateStringoptional模板参数
coverFileUrlStringoptional封面图
titleStringoptional标题
contentStringoptional内容
timeStringoptional时间
linkTypeStringoptional链接类型
linkUrlStringoptional链接地址
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_SEND_WECHAT;
$input = [
    'channel' => $channel,
    'mid'=> $mid,
    'template'=> $template,
    'coverFileUrl'=> $coverFileUrl,
    'title'=> $title,
    'content'=> $content,
    'time'=> $time,
    'linkType'=> $linkType,
    'linkUrl'=> $linkUrl,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Command Word: User

User Register

Command Word: fresns_cmd_user_register

Parameters NameTypeRequiredDescription
typeNumberrequired账号类型:1.邮箱 / 2.手机号 / 3.互联平台
accountStringoptional邮箱或手机号专用:邮箱地址 / 手机号码
countryCodeNumberoptional手机号专用:国际区号(type=2 时必填)
connectInfoStringoptional互联平台专用:平台信息(type=3 时必填)
以字符串传参压缩后的 Array 对象信息
passwordStringoptional登录密码
nicknameStringrequired创建成员时使用:昵称
关联字段 members > nickname
avatarFidStringoptional创建成员时使用:头像 fid (uuid),存储时转换成 file id
关联字段 members > avatar_file_id
avatarFileUrlStringoptional创建成员时使用:头像 URL
关联字段 members > avatar_file_url
genderNumberoptional创建成员时使用:性别
关联字段 members > gender
birthdayStringoptional创建成员时使用:生日
关联字段 members > birthday
timezoneStringoptional创建成员时使用:偏好时区
关联字段 members > timezone
languageStringoptional创建成员时使用:偏好语言
关联字段 members > language
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_USER_REGISTER;
$input = [
    'type' => $type,
    'account' => $account,
    'countryCode' => $countryCode,
    'connectInfo' => $connectInfo,
    'password' => $password,
    'nickname' => $nickname,
    'avatarFid' => $avatarFid,
    'avatarFileUrl' => $avatarFileUrl,
    'gender' => $gender,
    'birthday' => $birthday,
    'timezone' => $timezone,
    'language' => $language,
];
$resp = CmdRpcHelper::call(FresnsCmdWords::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    $this->errorCheckInfo($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
    "code": 0,
    "message": "ok",
    "output": {
        "userId": "users > id",
        "userType": "users > user_type",
        "uid": "users > uuid",
    }
}
1
2
3
4
5
6
7
8
9
查看 connectInfo 参数介绍

支持多个,例如微信平台会同时有 UnionID 和 OpenID 两个参数,传参时以字符串传参压缩后的 Array 对象信息。

[
    {
        "connectId": 8, //存储到 user_connects > connect_id
        "connectToken": "unionid", //存储到 user_connects > connect_token
        "connectName": "用户名", //存储到 user_connects > connect_name
        "connectNickname": "昵称", //存储到 user_connects > connect_nickname
        "connectAvatar": "头像 URL", //存储到 user_connects > connect_avatar
    },
    {
        "connectId": 9,
        "connectToken": "openid",
        "connectName": "用户名",
        "connectNickname": "昵称",
        "connectAvatar": "头像 URL",
    }
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
查看注册逻辑
  • 注册时需要生成的数据清单
    • 用户主表 users
    • 用户钱包表 user_wallets
    • 成员主表 members:以“昵称”参数生成一个初始成员,成员名 members > name 随机生成一个 6~8 位字符,需要避免使用禁用名(键名 disable_names 禁用值)。
    • 成员数据统计表 member_stats
    • 成员角色关联表 member_role_rels:初始角色来自配置表 default_role 键值。
    • 其余传参有值时直接录入,无值时留空;头像 fid 需转换为真实 id 存储。
  • 注册完成后,增加数据统计。配置表键值 user_counts +1member_counts +1

User Login

Command Word: fresns_cmd_user_login

Parameters NameTypeRequiredDescription
typeNumberrequired账号类型:1.邮箱 / 2.手机号
accountStringrequired邮箱地址
手机号码
countryCodeNumberoptional手机号专用:国际区号(type=2 时必填)
passwordStringoptional密码登录专用(以 Base64 传参)
verifyCodeStringoptional验证码登录专用(命令字 fresns_cmd_check_code 查验)
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_USER_LOGIN;
$input = [
    'type' => $type,
    'account' => $account,
    'countryCode' => $countryCode,
    'password' => $password,
    'verifyCode' => $verifyCode,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
{
    "code": 0,
    "message": "ok",
    "output": {
        "userId": "users > id",
        "userType": "users > user_type",
        "uid": "users > uuid",
    }
}
1
2
3
4
5
6
7
8
9

User Detail

Command Word: fresns_cmd_user_detail

Parameters NameTypeRequiredDescription
uidStringrequired用户 UUID
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_USER_DETAIL;
$input = [
    'uid' => $uid,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {
        // 参见接口页的描述 /api/fresns/user/detail
        // 所有涉及图片的参数,会判断是否开启了防盗链,如果开启了,会根据配置获取防盗链链接。
    }
}
1
2
3
4
5
6
7
8

Create Session Token

Command Word: fresns_cmd_create_session_token

Parameters NameTypeRequiredDescription
platformNumberrequired平台编号(配置表 platforms 键名的键值)
uidStringrequired用户参数(用户主表 users > uuid 字段)
midNumberoptional成员参数(成员主表 members > uuid 字段)
expiredTimeNumberoptional过期时间,单位:小时(为空代表永久有效)
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_CREATE_SESSION_TOKEN;
$input = [
    'platform' => $platform,
    'uid' => $uid,
    'mid' => $mid,
    'expiredTime' => $expiredTime,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
{
    "code": 0,
    "message": "ok",
    "output": {
        "token": "session_tokens > token",
        "expiredTime": "session_tokens > expired_at 留空代表永久有效,格式为 Y-m-d H:i:s"
    }
}
1
2
3
4
5
6
7
8

Verify Session Token

Command Word: fresns_cmd_verify_session_token

Parameters NameTypeRequiredDescription
platformNumberrequired平台编号(配置表 platforms 键名的键值)
uidStringrequired用户参数(用户主表 users > uuid 字段)
midNumberoptional成员参数(成员主表 members > uuid 字段)
tokenStringrequired身份凭证(凭证表 session_tokens > token 字段)
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_VERIFY_SESSION_TOKEN;
$input = [
    'platform' => $platform,
    'uid' => $uid,
    'mid' => $mid,
    'token' => $token,
];
$resp = CmdRpcHelper::call(FresnsPlugin::class, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
//Success
{
    "code": 0,
    "message": "ok",
    "output": {}
}
//失败
{
    "code": 30109,
    "message": "用户错误或者不存在",
    "output": {}
}
// 30109 用户错误或者不存在
// 30110 成员错误或者不存在
// 30111 用户 Token 不正确
// 30112 成员 Token 不正确
// 30113 Token 未启用
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Wallet Increase

Command Word: fresns_cmd_wallet_increase

Parameters NameTypeRequiredDescription
typeNumberrequired类型(1.充值 2.解冻 3.交易)
关联字段 user_wallet_logs > object_type
uidStringrequired收入方用户,转换后关联字段 user_wallet_logs > user_id
midNumberoptional收入方成员,转换后关联字段 user_wallet_logs > member_id
amountNumberrequired交易总金额 user_wallet_logs > amount
transactionAmountNumberrequired交易金额 user_wallet_logs > transaction_amount
systemFeeNumberrequired交易差额 user_wallet_logs > system_fee
originUidStringoptional来源用户 user_wallet_logs > object_user_id
originMidNumberoptional来源成员 user_wallet_logs > object_member_id
originNameStringrequired交易处理者 user_wallet_logs > object_name
originIdNumberoptional交易记录凭证 user_wallet_logs > object_id
查看收入逻辑
  • 参数 originUid 为空
    • 1、查询 uid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 2、给 uid 用户的钱包 user_wallets > balance transactionAmount 数值,并生成一条交易记录 user_wallet_logs 表
  • 参数 originUid 有值
    • 1、查询 uid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 2、查询 originUid 钱包 user_wallets > balance 字段的数值是否大于或等于 amount 参数值,如果小于,流程中止。
    • 3、查询 originUid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 4、给 originUid 用户的钱包 user_wallets > balance amount 数值,并生成一条交易记录 user_wallet_logs 表
    • 5、给 uid 用户的钱包 user_wallets > balance transactionAmount 数值,并生成一条交易记录 user_wallet_logs 表
  • 备注:查询最后一条 is_enable=1 的交易记录时,如果查询不到交易记录,默认期末余额为 0 值。
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_WALLET_INCREASE;
$input = [
    'type' => $type,
    'uid' => $uid,
    'mid' => $mid,
    'amount' => $amount,
    'transactionAmount' => $transactionAmount,
    'systemFee' => $systemFee,
    'originUid' => $originUid,
    'originMid' => $originMid,
    'originName' => $originName,
    'originId' => $originId,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Wallet Decrease

Command Word: fresns_cmd_wallet_decrease

Parameters NameTypeRequiredDescription
typeNumberrequired类型(4.提现 5.冻结 6.交易)
关联字段 user_wallet_logs > object_type
uidStringrequired支出方用户,转换后关联字段 user_wallet_logs > user_id
midNumberoptional支出方成员,转换后关联字段 user_wallet_logs > member_id
amountNumberrequired交易总金额 user_wallet_logs > amount
transactionAmountNumberrequired交易金额 user_wallet_logs > transaction_amount
systemFeeNumberrequired交易差额 user_wallet_logs > system_fee
originUidStringoptional去向用户 user_wallet_logs > object_user_id
originMidNumberoptional去向成员 user_wallet_logs > object_member_id
originNameStringrequired交易处理者 user_wallet_logs > object_name
originIdNumberoptional交易记录凭证 user_wallet_logs > object_id
查看支出逻辑
  • 参数 originUid 为空
    • 1、查询 uid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 2、给 uid 用户的钱包 user_wallets > balance amount 数值,并生成一条交易记录 user_wallet_logs 表
  • 参数 originUid 有值
    • 1、查询 uid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 2、查询 uid 钱包 user_wallets > balance 字段的数值是否大于或等于 amount 参数值,如果小于,流程中止。
    • 3、查询 originUid 最后一条 is_enable=1 的交易记录,以 closing_balance 字段值对比 user_wallets > balance 字段值,如果不一致,流程中止。
    • 4、给 uid 用户的钱包 user_wallets > balance amount 数值,并生成一条交易记录 user_wallet_logs 表
    • 5、给 originUid 用户的钱包 user_wallets > balance transactionAmount 数值,并生成一条交易记录 user_wallet_logs 表
  • 备注:查询最后一条 is_enable=1 的交易记录时,如果查询不到交易记录,默认期末余额为 0 值。
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_WALLET_DECREASE;
$input = [
    'type' => $type,
    'uid' => $uid,
    'mid' => $mid,
    'amount' => $amount,
    'transactionAmount' => $transactionAmount,
    'systemFee' => $systemFee,
    'originUid' => $originUid,
    'originMid' => $originMid,
    'originName' => $originName,
    'originId' => $originId,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Command Word: File

Get Upload Token

Command Word: fresns_cmd_get_upload_token

Parameters NameTypeRequiredDescription
typeNumberrequired1.图片 / 2.视频 / 3.音频 / 4.文档
sceneNumberrequired参考 files > table_type 来源类型
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_GET_UPLOAD_TOKEN;
$input = [
    'type' => $type,
    'scene' => $scene,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
{
    "code": 0,
    "message": "ok",
    "output": {
        "storageId": "存储服务商编号,见字典键值",
        "token": "跟插件索要的 SDK 上传 token",
        "expireTime": "到期时间"
    }
}
1
2
3
4
5
6
7
8
9

Upload File

Command Word: fresns_cmd_upload_file

Parameters NameTypeRequiredDescription
platformNumberrequired平台编号(配置表 platforms 键名的键值)
typeNumberrequired1.图片 / 2.视频 / 3.音频 / 4.文档
tableTypeNumberrequired来源类型
tableNameStringrequired来源表名
tableFieldStringrequired来源字段名,默认为 id
tableIdStringoptional来源表 UUID,存储时转换成真实 ID
tableKeyStringoptional来源表键名
modeNumberrequired1.Upload File
2.Upload File Info
fileFileoptional1.Upload File(以 request()->file('file') 方式获取文件信息后传值)
fileInfoStringoptional2.Upload File Array Info,以字符串传参压缩后的 Array 数组信息
参见 API 上传文件 /api/fresns/editor/upload
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_UPLOAD_FILE;
$input = [
    'platform' => $platform,
    'type' => $type,
    'tableType' => $tableType,
    'tableName'  =>  $tableName,
    'tableField'  =>  $tableField,
    'tableId' => $tableId,
    'tableKey' => $tableKey,
    'mode' => $mode,
    'file' => $file,
    'fileInfo' => $fileInfo,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "code": 0,
    "message": "ok",
    "output": {
        //输出文件信息 fileInfo,参见 API 上传文件 /api/fresns/editor/upload
    }
}
1
2
3
4
5
6
7
查看转参给插件的参数

主程序将文件存档后,再通过请求存储服务商命令字 fresns_cmd_upload_file 将文件告之插件,请求参数如下:

Parameters NameTypeRequiredDescription
fidStringrequired多个,以字符串传参压缩后的 Array 数组信息
示例:["a1","a2","a3"]
modeNumberrequired1.Upload File
2.Upload File Info

Image: Anti Hotlinking URL

Command Word: fresns_cmd_anti_link_image

Parameters NameTypeRequiredDescription
fidStringrequiredFile UUID
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_ANTI_LINK_IMAGE;
$input = [
    'fid' => $fid,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {
        "imageDefaultUrl": "默认图片,未处理图",
        "imageRatioUrl": "images_bucket_domain + 文件路径 + images_thumb_ratio",
        "imageSquareUrl": "images_bucket_domain + 文件路径 + images_thumb_square",
        "imageBigUrl": "images_bucket_domain + 文件路径 + images_thumb_big",
        "originalUrl": "原始文件(file_appends > file_original_path)"
    }
}
1
2
3
4
5
6
7
8
9
10
11

Video: Anti Hotlinking URL

Command Word: fresns_cmd_anti_link_video

Parameters NameTypeRequiredDescription
fidStringrequiredFile UUID
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_ANTI_LINK_VIDEO;
$input = [
    'fid' => $fid,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {
        "videoCover": "视频服务商生成的视频封面图",
        "videoGif": "视频服务商生成的视频动图",
        "videoUrl": "视频文件",
        "originalUrl": "原始文件(file_appends > file_original_path)"
    }
}
1
2
3
4
5
6
7
8
9
10

Audio: Anti Hotlinking URL

Command Word: fresns_cmd_anti_link_audio

Parameters NameTypeRequiredDescription
fidStringrequiredFile UUID
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_ANTI_LINK_AUDIO;
$input = [
    'fid' => $fid,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {
        "audioUrl": "音频文件",
        "originalUrl": "原始文件(file_appends > file_original_path)"
    }
}
1
2
3
4
5
6
7
8

Doc: Anti Hotlinking URL

Command Word: fresns_cmd_anti_link_doc

Parameters NameTypeRequiredDescription
fidStringrequired文件 uuid
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_ANTI_LINK_DOC;
$input = [
    'fid' => $fid,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {
        "docUrl": "文档文件",
        "originalUrl": "原始文件(file_appends > file_original_path)"
    }
}
1
2
3
4
5
6
7
8

Physical Deletion File

Command Word: fresns_cmd_physical_deletion_file

Parameters NameTypeRequiredDescription
fidStringrequired文件 uuid
View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_PHYSICAL_DELETION_FILE;
$input = [
    'fid' => $fid,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
{
    "code": 0,
    "message": "ok",
    "output": {}
}
1
2
3
4
5

Command Word: Content

Direct Release Content

Command Word: fresns_cmd_direct_release_content

Parameters NameTypeRequiredDescription
typeNumberrequired类型 1.帖子 2.评论
logIdNumberrequired日志表 ID

该功能比较复杂,点击这里可以了解功能逻辑。

View Example
$cmd = FresnsCmdWordsConfig::FRESNS_CMD_DIRECT_RELEASE_CONTENT;
$input = [
    'type' => $type,
    'logId' => $logId,
];
$resp = CmdRpcHelper::call($pluginClass, $cmd, $input);
if (CmdRpcHelper::isErrorCmdResp($resp)) {
    return $this->pluginError($resp);
}
1
2
3
4
5
6
7
8
9