mirror of
https://github.com/kuaifan/dootask.git
synced 2026-07-23 22:48:24 +00:00
feat(license): 在线授权前端与上报优化
- 替换离线授权二次确认:仅当离线为真实付费(people>3)且 sn/mac 匹配本机时才提示 - 上报 url 改用真实外网地址(RequestContext::replaceBaseUrl)、version 改用应用版本(Base::getVersion) - trialSend 携带实例指纹,便于 appstore 发码前做试用资格校验 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4ca7fc10d1
commit
389cb6d709
@ -3,6 +3,7 @@
|
||||
namespace App\Module;
|
||||
|
||||
use App\Exceptions\ApiException;
|
||||
use App\Services\RequestContext;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
@ -83,8 +84,10 @@ class OnlineLicense
|
||||
return [
|
||||
'sn' => Doo::dooSN(),
|
||||
'macs' => implode(',', Doo::macs()),
|
||||
'url' => (string)config('app.url'),
|
||||
'version' => Doo::dooVersion(),
|
||||
// 优先真实外网地址:config('app.url') 若为 localhost 由 replaceBaseUrl 替换为缓存的访问地址
|
||||
'url' => RequestContext::replaceBaseUrl((string)config('app.url')),
|
||||
// DooTask 应用版本(非 doo.so 库版本)
|
||||
'version' => Base::getVersion(),
|
||||
];
|
||||
}
|
||||
|
||||
@ -171,7 +174,8 @@ class OnlineLicense
|
||||
*/
|
||||
public static function trialSend(string $account, string $password): string
|
||||
{
|
||||
$r = self::call('trial/send', ['account' => $account, 'password' => $password]);
|
||||
// 带上实例指纹(sn/macs),让 appstore 在发送验证码前即可做试用资格校验
|
||||
$r = self::call('trial/send', array_merge(['account' => $account, 'password' => $password], self::fingerprint()));
|
||||
if (!$r['ok']) {
|
||||
throw new ApiException($r['message']);
|
||||
}
|
||||
|
||||
@ -248,6 +248,21 @@ export default {
|
||||
offlineBound() {
|
||||
return !this.onlineActive && !!String(this.formData.license || '').trim();
|
||||
},
|
||||
|
||||
// 绑定在线前是否需要二次确认替换离线授权:
|
||||
// 仅当当前离线 license 是「真实有效且绑定本机的付费授权」时才提示。
|
||||
// 默认/试用 3 人版(people 1~3)或 sn/mac 不匹配 → 该授权在本机本就无意义,替换无需提示。
|
||||
offlineReplaceNeedConfirm() {
|
||||
if (!this.offlineBound) {
|
||||
return false;
|
||||
}
|
||||
const info = this.formData.info || {};
|
||||
const people = parseInt(info.people) || 0;
|
||||
const isTrialThree = people >= 1 && people <= 3;
|
||||
const snOk = this.existIntersection(this.formData.doo_sn, info.sn);
|
||||
const macOk = this.existIntersection(this.formData.macs, info.mac);
|
||||
return !isTrialThree && snOk && macOk;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
@ -390,9 +405,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 已绑定离线时,绑定在线前二次确认
|
||||
// 已绑定离线时,绑定在线前二次确认(仅当离线授权为真实有效绑定本机的付费授权)
|
||||
confirmReplaceOffline(onOk) {
|
||||
if (this.offlineBound) {
|
||||
if (this.offlineReplaceNeedConfirm) {
|
||||
$A.modalConfirm({
|
||||
title: '绑定在线授权',
|
||||
content: '当前已绑定离线授权,绑定在线后将替换当前授权,是否继续?',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user