UC interface documentation

UC interface documentation

First, the functional description

Provide synchronous login, logoff, registration and other related interface enables a user account, the login a full stop traffic.

Second, the test environment UC address

http://s1.p5w.net/uc/

Third, the relevant interfaces

UC_API=http://s1.p5w.net/uc/

UC_IP =

UC_KEY = 123456

UC_APPID = 15

UC_CONNECT =

1. registered

integer uc_user_register(string username , string password , string email)

 

Parameter Description

username

username

password

password

email

Email address

 

return value

Value  integer

Is greater than 0: Returns the user ID, the user indicates successful registration
-1: user name is not legitimate
-2: contains the words not allowed to register
-3: user name already exists
-4: In Email Malformed
-5: In Email not allowed to register
-6 : the Email is already registered

2. User login

array uc_user_login(string username , string password [, bool isuid])

 

Parameter Description

username

username

 

password

password

 

isuid

Whether to use the user login ID

1: Use User ID Login
0 :( default value) using a user name to log on

 

return value

Value String

Is greater than 0: Returns the user ID, indicates the user is logged
-1: user does not exist, or deleted
-2: wrong password

3. Obtain user data

array uc_get_user(string username [, bool isuid])

 

Parameter Description

username

username

 

isuid

Whether to use the user login ID

1: Use User ID Login
0 :( default value) using a user name to log on

 

return value

值 array integer [0] string [1] string [2]

integer [0]

User ID

string [1]

username

string [2]

Email

 

4. Update user information

integer uc_user_edit(string username , string oldpw , string newpw , string email [, boolignoreoldpw])

 

Parameter Description

username

username

 

oldpw

old password

 

newpw

new password

 

email

email address

 

ignoreoldpw

Whether or not ignore the old password

1: Ignore, change the information does not require authentication password
0 :( default) does not ignore, changes in the information required to verify the password

 

return value

Integer value

1: updated successfully
0: did not make any changes
-1: the old password is incorrect
-4: Email format is incorrect
-5: Email does not allow registration
-6: The Email is already registered
-7: do not make any changes to
-8: The users do not have permission to change the protected

5. delete users

integer uc_user_delete(string/array username)

 

Parameter Description

username

username

 

return value

Integer value

1: Success

0: Failed

6.同步登录

string uc_user_synlogin(integer uid)

 

参数说明

uid

用户ID

 

返回值

值 string

同步登录的 HTML 代码

7.同步退出

string uc_user_synlogout()

 

参数说明

uid

用户ID

 

返回值

值 string

同步退出的 HTML 代码

8.检查 Email 地址

integer uc_user_checkemail(string email)

 

参数说明

email

用户ID

 

返回值

值 integer

1:成功
-4:Email 格式有误
-5:Email 不允许注册
-6:该 Email 已经被注册

9.检查用户名

integer uc_user_checkname(string username)

 

参数说明

username

用户名

 

返回值

值 integer

1:成功
-1:用户名不合法
-2:包含要允许注册的词语
-3:用户名已经存在

 

四、接收消息通知

接收通知的请求URL  /api/uc.php

例:

http://s2.p5w.net/api/uc.php?time=1566975513&code=504ca0TEJqqu%2Bh%2BkdPBM0ryA9NP9bqKiUsR5V%2FK2k0LsFybIPXQAvjtWlevmxOmRm8dORwC2PdI%2F1QjtkL9YjoUZxGZwj0Euch6PyTnVbM9FOAsz2CIOHchQReL7yc%2F2XIX%2BRwPaUvvW8j88bA%2BVcCWJHyDdgVdP3s7PML9JK9cyYmenZg&_=1566975497211

1、test

此接口供仅测试连接。当 UCenter 发起 test 的接口请求时,如果成功获取到接口返回的 API_RETURN_SUCCEED 值,表示 UCenter 和应用通讯正常。

2、deleteuser

当 UCenter 删除一个用户时,会发起 deleteuser 的接口请求,通知所有应用程序删除相应的用户。

输入的参数放在 $get['ids'] 中,值为用逗号分隔的用户 ID。如果删除成功则输出 API_RETURN_SUCCEED

3、renameuser

当 UCenter 更改一个用户的用户名时,会发起 renameuser 的接口请求,通知所有应用程序改名。

输入的参数 $get['uid'] 表示用户 ID$get['oldusername'] 表示旧用户名,$get['newusername'] 表示新用户名。如果修改成功则输出 API_RETURN_SUCCEED

4、updatepw

当用户更改用户密码时,此接口负责接受 UCenter 发来的新密码。

输入的参数 $get['username'] 表示用户名,$get['password'] 表示新密码。如果修改成功则输出 API_RETURN_SUCCEED

5、gettag

如果应用程序存在标签功能,可以通过此接口把应用程序的标签数据传递给 UCenter

输入的参数放在 $get['id'] 中,值为标签名称。输出的数组需经过 uc_serialize 处理。

integer [0] 标签名称

array [1] 标签数据 mixed ['xxx'] 自定义

自定义多个数组项,索引名任意,一同返回给 UCenter。为了保证应用间数据的共享,您需要在“应用管理管理”的“标签单条显示模板”和“标签模板标记说明”设置模板和说明。模板中 “{xxx}”表示标签数据的索引,代表相应的数据。如扩展数据模板中的“{image}”将显示“['image']”数组项的内容。

6、synlogin

如果应用程序需要和其他应用程序进行同步登录,此部分代码负责标记指定用户的登录状态。

输入的参数放在 $get['uid'] 中,值为用户 ID。此接口为通知接口,无输出内容。同步登录需使用 P3P 标准。

7、synlogout

如果应用程序需要和其他应用程序进行同步退出登录,此部分代码负责撤销用户的登录的状态。

此接口为通知接口,无输入参数和输出内容。同步退出需使用 P3P 标准。

8、updatebadwords

当 UCenter 的词语过滤设置变更时,此接口负责通知所有应用程序更新后的词语过滤设置内容。

设置内容用 POST 方式提交到接口。接口运行完毕输出 API_RETURN_SUCCEED

9、updatehosts

当 UCenter 的域名解析设置变更时,此接口负责通知所有应用程序更新后的域名解析设置内容。

设置内容用 POST 方式提交到接口。接口运行完毕输出 API_RETURN_SUCCEED

10、updateapps

当 UCenter 的应用程序列表变更时,此接口负责通知所有应用程序更新后的应用程序列表。

设置内容用 POST 方式提交到接口。接口运行完毕输出 API_RETURN_SUCCEED

11、updateclient

当 UCenter 的基本设置信息变更时,此接口负责通知所有应用程序更新后的基本设置内容。

设置内容用 POST 方式提交到接口。接口运行完毕输出 API_RETURN_SUCCEED

 

12、updatecredit

当某应用执行了积分兑换请求的接口函数 uc_credit_exchange_request() 后,此接口负责通知被兑换的目的应用程序所需修改的用户积分值。

输入的参数 $get['credit'] 表示积分编号,$get['amount'] 表示积分的增减值,$get['uid'] 表示用户 ID

13、getcreditsettings

此接口负责把应用程序的积分设置传递给 UCenter,以供 UCenter 在积分兑换设置中使用。

此接口无输入参数。输出的数组需经过 uc_serialize 处理。

输出的数组单条结构: 1 KEY 2 KEY

array [n] 积分编号 string [0] 积分名称

string [1] 积分单位

如:

array(

        '1' => array('威望', ''),

        '2' => array('金钱', ''),

)

14、updatecreditsettings

此接口负责接收 UCenter 积分兑换设置的参数。

输入的参数放在 $get['credit'] 中,值为设置的参数数组。接口运行完毕输出 API_RETURN_SUCCEED

输入的数组单条结构: 1 KEY 2 KEY

array [appid] 应用程序 ID integer ['appiddesc'] 积分兑换的目标应用程序 ID

integer ['creditdesc'] 积分兑换的目标积分编号

integer ['creditsrc'] 积分兑换的源积分编号

string ['title'] 积分名称

string ['unit'] 积分单位

integer ['ratio'] 积分兑换比率

如:

array(

        '1' => array(

                'appiddesc' => 2,

                'creditdesc' => 1,

                'creditsrc' => 1,

                'title' => '金钱',

                'unit' => '',

                'ratio' => 2,

        ),

)

15、getcredit

此接口用于把应用程序中指定用户的积分传递给 UCenter

输入的参数 $get['uid'] 为用户 ID$get['credit'] 为积分编号。接口运行完毕输出积分值。

Guess you like

Origin www.cnblogs.com/yipianchuyun/p/12286912.html