Przeglądaj źródła

feat: b站提交链接直接存储bvid

yankun 1 tydzień temu
rodzic
commit
a5cf8dc9ba

+ 2 - 1
app/model/youngee_talent_model/task_link.go

@@ -4,5 +4,6 @@ type AddTaskLinkRequest struct {
 	TaskId  string `orm:"task_id"           json:"task_id"`   // 任务id
 	LinkUrl string `orm:"link_url"           json:"link_url"` // 链接url
 	//PhotoUrl string `orm:"photo_url"           json:"photo_url"` // 截图url(弃用)
-	TaskType int `orm:"task_type"           json:"task_type"`
+	TaskType   int `orm:"task_type"           json:"task_type"`
+	PlatformId int `orm:"platform_id"           json:"platform_id"` // 平台id
 }

+ 1 - 2
app/service/youngee_talent_service/talent_account.go

@@ -99,7 +99,6 @@ func OnAddTalentAccount(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
 	//获取 基本信息,头像昵称、粉丝数、作品数目、点赞数
-
 	//小红书
 	if account.PlatformId == 1 {
 		//获取用户唯一标识
@@ -107,7 +106,7 @@ func OnAddTalentAccount(r *ghttp.Request) *TalentHttpResult {
 		//调用MoreAPI
 		userDetail := getXHSUserDetail(shareText)
 		if userDetail == nil {
-			return &TalentHttpResult{Code: -1, Msg: "MoreApi调用出错"}
+			return &TalentHttpResult{Code: -1, Msg: "小红书cookie已过期,请重新登录获取cookie"}
 		}
 		//是否被其他人绑定
 		BindCode := CheckAccountBind(account.PlatformId, userDetail.RedID)

+ 11 - 0
app/service/youngee_task_service/task_link.go

@@ -60,6 +60,7 @@ func AddTaskLink(r *ghttp.Request) *TalentHttpResult {
 	//最新link数据
 	linkInfo := model.YounggeeLinkInfo{
 		TaskId:      LinkInfoReq.TaskId,
+		PlatformId:  LinkInfoReq.PlatformId,
 		LinkUrl:     LinkInfoReq.LinkUrl,
 		CreateAt:    gtime.Now(),
 		IsReview:    0,
@@ -72,6 +73,16 @@ func AddTaskLink(r *ghttp.Request) *TalentHttpResult {
 	if !strings.HasPrefix(LinkInfoReq.LinkUrl, "http://") && !strings.HasPrefix(LinkInfoReq.LinkUrl, "https://") {
 		linkInfo.LinkUrl = "https://" + LinkInfoReq.LinkUrl
 	}
+	//如果是platform_id=5。提取出bvid。【视频火了就发给导师看-哔哩哔哩】 https://b23.tv/lmBqJRH(最后一个斜杠后面的就是bvid)
+	if LinkInfoReq.PlatformId == 5 {
+		splitUrl := strings.Split(LinkInfoReq.LinkUrl, "/")
+		if len(splitUrl) > 0 {
+			bvid := splitUrl[len(splitUrl)-1]
+			linkInfo.LinkUrl = bvid
+		} else {
+			return &TalentHttpResult{Code: -2, Msg: "Invalid BVID format"}
+		}
+	}
 
 	//上传过但是被拒了
 	var condition1 bool = len(taskLinkInfo) != 0 && taskLinkInfo[0].IsReview == 1 && taskLinkInfo[0].IsOk == 0

BIN
bin/main


BIN
bin/v4.1.9/linux_amd64/youngmini_server


+ 2 - 4
config/config.toml

@@ -69,8 +69,6 @@ cookieName  = "gfsessionid"   # cookie的名字
 # xhs cookie pool
 [xhsCookiePool]
 cookiesList = [
-    "abRequestId=023e90e1-a95a-58db-830a-d66c0cc67f60; a1=19566f0f66eglh42hy8peqvpak3xqglp49289p8xb50000109075; webId=d189df044ca380c74b5b97bc300db5a1; gid=yj2KKiyyyY4Yyj2KKi8iKjUYKdk1x4JxvYUdJCDAhU0TqY28CAk1Uj888y8j8W288q4Jif4i; xsecappid=xhs-pc-web; webBuild=4.62.3; loadts=1745844315922; acw_tc=0a4ad62517458443171336139e75772e8309d4caf46a5bbe75d13ed1f39023; websectiga=2a3d3ea002e7d92b5c9743590ebd24010cf3710ff3af8029153751e41a6af4a3; sec_poison_id=618e82ac-335a-4cc7-a4da-61f4d2b9740d; web_session=0400698c340cec15e62b1a303a3a4b527fb28b; unread={%22ub%22:%2267f51cef000000001c0051d9%22%2C%22ue%22:%2268085423000000001b027fce%22%2C%22uc%22:26}",
-    "abRequestId=049c2b9f-ea02-5169-b7f9-225d43b6d656; a1=194e4756d31aw1znk9hskj7ljyjv5lxewjiy2aqj130000315258; webId=9512b53376b911dc1b63a4f0c767cfe8; gid=yj4d4W2WjYEjyj4d4W2KfV0Aqy0EyuITjxMT3VyVW1VvVvq8h21CdJ888qy2J2Y8YJf0WfqW; web_session=040069b7d36add244a1df74f92354bf79f6df4; xsecappid=xhs-pc-web; webBuild=4.62.3; acw_tc=0ad597da17458427276414556ec5a39ba2b9d29b33d353888e4c606fb151d4; loadts=1745843013640; unread={%22ub%22:%226806195b000000001c006397%22%2C%22ue%22:%22680ef5400000000009038ac4%22%2C%22uc%22:29}; websectiga=a9bdcaed0af874f3a1431e94fbea410e8f738542fbb02df1e8e30c29ef3d91ac; sec_poison_id=d179a6cc-e9be-4fef-be9a-f2ae8c492479",
-    "a1=193de37a35888r97avcdrb0iu9a41u8aq65lnvty400000261790; webId=507dc263893bbab4ff8a7242f998a970; gid=yjqfdqW02YADyjqfdqW0qKh92YYYFjW0hSfF2v4D837j01884y7Y0I888JKyWj88dD8K0Kfy; abRequestId=507dc263893bbab4ff8a7242f998a970; xsecappid=xhs-pc-web; webBuild=4.62.3; acw_tc=0a0bb0cb17458442305007719ea1eb6801d7c3ba2842965a9052839814f377; websectiga=8886be45f388a1ee7bf611a69f3e174cae48f1ea02c0f8ec3256031b8be9c7ee; sec_poison_id=1599be33-41ad-4e69-84c2-fea0165d4cba; loadts=1745844567039; web_session=040069b29a05c56f42780d313a3a4b9ed5f3f4; unread={%22ub%22:%22680ee49b000000002001c82b%22%2C%22ue%22:%22680c6af6000000001c031779%22%2C%22uc%22:33}"
-]
+    "abRequestId=049c2b9f-ea02-5169-b7f9-225d43b6d656; a1=194e4756d31aw1znk9hskj7ljyjv5lxewjiy2aqj130000315258; webId=9512b53376b911dc1b63a4f0c767cfe8; gid=yj4d4W2WjYEjyj4d4W2KfV0Aqy0EyuITjxMT3VyVW1VvVvq8h21CdJ888qy2J2Y8YJf0WfqW; xsecappid=xhs-pc-web; web_session=040069b41c29aed16ac4feef0d3a4b5798c3bb; webBuild=4.70.2; unread={%22ub%22:%22686275070000000020018de3%22%2C%22ue%22:%22685e479f000000000d01a6e0%22%2C%22uc%22:26}; websectiga=f47eda31ec99545da40c2f731f0630efd2b0959e1dd10d5fedac3dce0bd1e04d; sec_poison_id=f6fdaf78-4672-4a03-8d53-e774e6570640; loadts=1751719009535"
+   ]