mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 22:08:48 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
49e0dec799
5 changed files with 30 additions and 9 deletions
|
|
@ -427,4 +427,7 @@ export abstract class Constants {
|
|||
// third
|
||||
"yul", "solidity", "abap",
|
||||
];
|
||||
|
||||
// Google Analytics 事件
|
||||
public static readonly ANALYTICS_EVT_ON_GET_CONFIG: string = "siyuan.onGetConfig";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,9 +160,23 @@ export const onGetConfig = (isStart: boolean) => {
|
|||
mountHelp();
|
||||
}
|
||||
|
||||
window.gtag("event", "config", {
|
||||
let para = {
|
||||
"version": Constants.SIYUAN_VERSION,
|
||||
});
|
||||
"isLoggedIn": "false",
|
||||
"subscriptionStatus": "-1",
|
||||
"subscriptionPlan": "-1",
|
||||
"subscriptionType": "-1",
|
||||
}
|
||||
if (window.siyuan.user) {
|
||||
para.isLoggedIn = "true";
|
||||
if (0 === window.siyuan.user.userSiYuanSubscriptionStatus) {
|
||||
console.log(window.siyuan.user)
|
||||
para.subscriptionStatus = window.siyuan.user.userSiYuanSubscriptionStatus.toString();
|
||||
para.subscriptionPlan = window.siyuan.user.userSiYuanSubscriptionPlan.toString();
|
||||
para.subscriptionType = window.siyuan.user.userSiYuanSubscriptionType.toString();
|
||||
}
|
||||
}
|
||||
window.gtag("event", Constants.ANALYTICS_EVT_ON_GET_CONFIG, para);
|
||||
};
|
||||
|
||||
const initBar = () => {
|
||||
|
|
|
|||
|
|
@ -126,9 +126,11 @@ func removeSnippet(c *gin.Context) {
|
|||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
if err := model.RemoveSnippet(id); nil != err {
|
||||
snippet, err := model.RemoveSnippet(id)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = "remove snippet failed: " + err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
ret.Data = snippet
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ type User struct {
|
|||
UserTrafficTime float64 `json:"userTrafficTime"`
|
||||
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -2:未订阅,-1:试用,0:标准订阅,1:教育订阅
|
||||
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
||||
UserSiYuanSubscriptionType float64 `json:"userSiYuanSubscriptionType"` // 0 年付;1 终生;2 月付
|
||||
}
|
||||
|
||||
type UserTitle struct {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import (
|
|||
|
||||
var snippetsLock = sync.Mutex{}
|
||||
|
||||
func RemoveSnippet(id string) (err error) {
|
||||
func RemoveSnippet(id string) (ret *conf.Snippet, err error) {
|
||||
snippetsLock.Lock()
|
||||
defer snippetsLock.Unlock()
|
||||
|
||||
|
|
@ -40,6 +40,7 @@ func RemoveSnippet(id string) (err error) {
|
|||
|
||||
for i, s := range snippets {
|
||||
if s.ID == id {
|
||||
ret = s
|
||||
snippets = append(snippets[:i], snippets[i+1:]...)
|
||||
break
|
||||
}
|
||||
|
|
@ -48,7 +49,7 @@ func RemoveSnippet(id string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func SetSnippet(id, name, typ, content string, enabled bool) (snippet *conf.Snippet, err error) {
|
||||
func SetSnippet(id, name, typ, content string, enabled bool) (ret *conf.Snippet, err error) {
|
||||
snippetsLock.Lock()
|
||||
defer snippetsLock.Unlock()
|
||||
|
||||
|
|
@ -64,15 +65,15 @@ func SetSnippet(id, name, typ, content string, enabled bool) (snippet *conf.Snip
|
|||
s.Type = typ
|
||||
s.Content = content
|
||||
s.Enabled = enabled
|
||||
snippet = s
|
||||
ret = s
|
||||
isUpdate = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !isUpdate {
|
||||
snippet = &conf.Snippet{ID: id, Name: name, Type: typ, Content: content, Enabled: enabled}
|
||||
snippets = append(snippets, snippet)
|
||||
ret = &conf.Snippet{ID: id, Name: name, Type: typ, Content: content, Enabled: enabled}
|
||||
snippets = append(snippets, ret)
|
||||
}
|
||||
err = writeSnippetsConf(snippets)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue