天心软件授权系统

天心软件授权系统


C++

<p>[TOC]</p> <h2>一、结构体</h2> <ul> <li> <p>返回数据结构</p> <pre><code class="language-cpp">struct ReturnStruct { bool success; string msg; };</code></pre> </li> <li> <p>软件数据结构</p> <pre><code class="language-cpp">struct SoftwareStruct { string software_name;//软件名称 string software_announcement;//软件公告 string software_loginAnnouncement;//软件登录公告(登录成功后才能获取) string software_data;//软件数据(登录成功后才能获取) string software_fileName;//软件文件名(上传版本后可获取) string software_updateTime;//软件更新时间 string software_version;//软件版本号 int software_status;//软件状态(0=正常 1=免费 &gt;=2维护中[维护开始的时间戳]) bool software_isOpen;//软件允许多开 bool test_open;//试用是否开启 int test_resetDays;//试用刷新天数 int test_time;//试用每次时长(单位分钟) int test_count;//允许试用次数 int user_count;//用户总数 int user_onlineCount;//在线用户数 };</code></pre> </li> <li>用户数据结构 <pre><code class="language-cpp">struct UserStruct { string qq;// 用户qq string endTime;//到期时间 int testCount;//已申请试用次数 int testResetTime;//试用次数刷新剩余天数(单位天) string lastLoginTime; // 上次登录的时间 string lastLoginIp;// 上次登录的地点 string loginTime; // 本次登录的时间 string loginIp;// 本次登录的地点 string data;//私有数据 };</code></pre></li> </ul> <h2>二、初始化</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct init(int _pin, void* _successFunction, void* _heartFunction);</code></p> <p><strong>函数说明</strong></p> <p>用于软件的初始化,必须最先调用</p> <p><strong>参数说明</strong></p> <ul> <li>pin:你软件的PIN,从服务端首页查询</li> <li>successFunction:登录成功后执行的函数</li> <li>heartFunction:登录成功之后的心跳验证失败后执行的函数(有一个参数char*用于接收心跳失败原因)</li> </ul> <h2>三、获取登录码</h2> <p><strong>函数原型</strong></p> <p><code>int getCode();</code></p> <p><strong>函数说明</strong></p> <p>用于软件的初始化,必须最先调用</p> <p><strong>参数说明</strong></p> <ul> <li>无</li> </ul> <h2>四、监听登录</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct monitorLogin(bool remember);</code></p> <p><strong>函数说明</strong></p> <p>调用一次则监听一次,如需循环监听请使用“loopMonitorLogin函数”,如果登录成功系统会自动调用“初始化中的successFunction指向的函数”</p> <p><strong>参数说明</strong></p> <ul> <li>remember:是否记住登录状态(用于下次开启软件调用token登录完成)</li> </ul> <h2>五、循环监听登录</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct loopMonitorLogin(bool remember);</code></p> <p><strong>函数说明</strong></p> <p>循环监听登录,如果登录成功系统会自动调用“初始化中的successFunction指向的函数”</p> <p><strong>参数说明</strong></p> <ul> <li>remember:是否记住登录状态(用于下次开启软件调用token登录完成)</li> </ul> <h2>六、token登录</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct tokenLogin();</code></p> <p><strong>函数说明</strong></p> <p>记住登录状态的情况下可使用,如果登录成功系统会自动调用“初始化中的successFunction指向的函数”</p> <p><strong>参数说明</strong></p> <ul> <li>无</li> </ul> <h2>七、是否存在登录状态</h2> <p><strong>函数原型</strong></p> <p><code>bool hasToken();</code></p> <p><strong>函数说明</strong></p> <p>返回本机是否存在登录状态</p> <p><strong>参数说明</strong></p> <ul> <li>无</li> </ul> <h2>八、清除登录状态</h2> <p><strong>函数原型</strong></p> <p><code>void removeToken();</code></p> <p><strong>函数说明</strong></p> <p>清除本机记住登录的状态</p> <p><strong>参数说明</strong></p> <ul> <li>无</li> </ul> <h2>九、查询软件数据</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct getSoftware(SoftwareStruct* _SoftwareStruct);</code></p> <p><strong>函数说明</strong></p> <p>查询当前软件的数据</p> <p><strong>参数说明</strong></p> <ul> <li>_SoftwareStruct:软件数据结构,执行成功后可从里面拿到很多关于软件的信息</li> </ul> <h2>十、查询用户数据</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct getUser(UserStruct* _UserStruct);</code></p> <p><strong>函数说明</strong></p> <p>查询当前登录用户的数据(只有登录成功后才能调用)</p> <p><strong>参数说明</strong></p> <ul> <li>_UserStruct:用户数据结构,执行成功后可从里面拿到很多关于用户的信息</li> </ul> <h2>十一、设置私有数据</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct setData(string content);</code></p> <p><strong>函数说明</strong></p> <p>设置当前登录用户的私有数据(只有登录成功后才能调用)</p> <p><strong>参数说明</strong></p> <ul> <li>content:数据内容</li> </ul> <h2>十二、追加私有数据</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct appendData(string content);</code></p> <p><strong>函数说明</strong></p> <p>在当前登录用户的私有数据后追加新的数据(只有登录成功后才能调用)</p> <p><strong>参数说明</strong></p> <ul> <li>content:数据内容</li> </ul> <h2>十三、下载软件</h2> <p><strong>函数原型</strong></p> <p><code>ReturnStruct downloadSoftware(char*&amp; content, void* callback = NULL);</code></p> <p><strong> 函数说明</strong></p> <p>在当前登录用户的私有数据后追加新的数据(只有登录成功后才能调用)</p> <p><strong>参数说明</strong></p> <ul> <li>content:文件数据,用于接收版本文件的字节</li> <li>callback:回调函数,用于监听更新进度(必须有3个int参数,用于接收总大小、下载大小、耗时【单位毫秒】)</li> </ul>

页面列表

ITEM_HTML