diff --git a/app/Module/OnlineLicense.php b/app/Module/OnlineLicense.php index b81da239e..9e4eb9fcf 100644 --- a/app/Module/OnlineLicense.php +++ b/app/Module/OnlineLicense.php @@ -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']); } diff --git a/resources/assets/js/pages/manage/setting/license.vue b/resources/assets/js/pages/manage/setting/license.vue index ba331da0c..1c1957cc7 100644 --- a/resources/assets/js/pages/manage/setting/license.vue +++ b/resources/assets/js/pages/manage/setting/license.vue @@ -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: '当前已绑定离线授权,绑定在线后将替换当前授权,是否继续?',