Browse Source

auto_task_times

Xingyu Xian 1 week ago
parent
commit
45310d2c80
3 changed files with 45 additions and 9 deletions
  1. 31 4
      .idea/workspace.xml
  2. 6 1
      db/talent.go
  3. 8 4
      service/auto_task.go

+ 31 - 4
.idea/workspace.xml

@@ -4,9 +4,9 @@
     <option name="autoReloadType" value="ALL" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="82c9532a-4868-4653-982c-0f0ec6f4cfe9" name="Changes" comment="">
-      <change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
+    <list default="true" id="82c9532a-4868-4653-982c-0f0ec6f4cfe9" name="Changes" comment="logistic_signed_auto_task">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/db/talent.go" beforeDir="false" afterPath="$PROJECT_DIR$/db/talent.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/service/auto_task.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/auto_task.go" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -29,6 +29,7 @@
   </component>
   <component name="PropertiesComponent">{
   &quot;keyToString&quot;: {
+    &quot;Go Build.go build youngee_m_api.executor&quot;: &quot;Run&quot;,
     &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
     &quot;RunOnceActivity.GoLinterPluginOnboarding&quot;: &quot;true&quot;,
     &quot;RunOnceActivity.GoLinterPluginStorageMigration&quot;: &quot;true&quot;,
@@ -47,11 +48,22 @@
     &quot;settings.editor.selected.configurable&quot;: &quot;go.vgo&quot;
   }
 }</component>
+  <component name="RunManager">
+    <configuration name="go build youngee_m_api" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
+      <module name="younggee_m_api" />
+      <working_directory value="$PROJECT_DIR$" />
+      <kind value="PACKAGE" />
+      <package value="youngee_m_api" />
+      <directory value="$PROJECT_DIR$" />
+      <filePath value="$PROJECT_DIR$" />
+      <method v="2" />
+    </configuration>
+  </component>
   <component name="SharedIndexes">
     <attachedChunks>
       <set>
-        <option value="bundled-gosdk-3b128438d3f6-34ac7aa8f6ab-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-251.23774.430" />
-        <option value="bundled-js-predefined-d6986cc7102b-f27c65a3e318-JavaScript-GO-251.23774.430" />
+        <option value="bundled-gosdk-3b128438d3f6-07d2d2d66b1e-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-251.26927.50" />
+        <option value="bundled-js-predefined-d6986cc7102b-09060db00ec0-JavaScript-GO-251.26927.50" />
       </set>
     </attachedChunks>
   </component>
@@ -68,6 +80,21 @@
   <component name="TypeScriptGeneratedFilesManager">
     <option name="version" value="3" />
   </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+  <component name="VcsManagerConfiguration">
+    <MESSAGE value="logistic_signed_auto_task" />
+    <option name="LAST_COMMIT_MESSAGE" value="logistic_signed_auto_task" />
+  </component>
   <component name="VgoProject">
     <environment>
       <map>

+ 6 - 1
db/talent.go

@@ -214,7 +214,12 @@ func UpdateKuaishouUserInfoByTalentID(ctx context.Context, talentInfo gorm_model
 func UpdateKuaishouUserInfoById(ctx context.Context, talentInfo gorm_model.PlatformKuaishouUserInfo) error {
 	db6 := GetReadDB(ctx)
 	whereCondition := gorm_model.PlatformKuaishouUserInfo{Id: talentInfo.Id}
-	err := db6.Model(gorm_model.PlatformKuaishouUserInfo{}).Where(whereCondition).Updates(talentInfo).Error
+	updateData := gorm_model.PlatformKuaishouUserInfo{
+		Id:           talentInfo.Id,
+		RefreshToken: talentInfo.RefreshToken,
+		AccessToken:  talentInfo.AccessToken,
+	}
+	err := db6.Model(gorm_model.PlatformKuaishouUserInfo{}).Where(whereCondition).Updates(updateData).Error
 	if err != nil {
 		return err
 	}

+ 8 - 4
service/auto_task.go

@@ -275,7 +275,6 @@ func AutoTask() error {
 		for i, _ := range talentList {
 			var refreshkey string = talentList[i].RefreshToken
 			re, err := kuaishou.RefreshAccessToken(refreshkey, AppKey, SignSecret)
-			fmt.Println(err)
 			newKuaishouUserInfo := gorm_model.PlatformKuaishouUserInfo{
 				//TalentId:     talentList[i].TalentId,
 				Id:           talentList[i].Id,
@@ -283,7 +282,12 @@ func AutoTask() error {
 				AccessToken:  re.AccessToken,
 			}
 			err1 := db.UpdateKuaishouUserInfoById(ctx, newKuaishouUserInfo)
-			fmt.Println(err1)
+			if talentList[i].OpenId == "f1b0d3a11c24fcde14bf5724d0d1cdfc" {
+				fmt.Println("UpdateErr:", err1)
+				fmt.Println("authErr:", err)
+				fmt.Println("PlatformId:", talentList[i].PlatformId)
+			}
+			// fmt.Println(err1)
 		}
 
 		println("完成自动刷新AccessToken")
@@ -326,9 +330,9 @@ func AutoTask() error {
 	*/
 
 	//定时任务
-	spec := "*/30 * * * * ?" //cron表达式,每30秒一次
+	//spec := "*/30 * * * * ?" //cron表达式,每30秒一次
 	//spec := "0 */1 * * * ?" //cron表达式,每一分钟执行一次
-	//spec := "0 0 * * * *" //每小时执行
+	spec := "0 0 * * * *" //每小时执行
 	// "0 0 12 * * ?" 每天中午12点执行
 	// 添加定时任务,
 	_, err := crontab.AddFunc("0 0 * * * *", taskKDStatus) //每小时执行一次快递是否签收的查询