yuliang1112 2 năm trước cách đây
mục cha
commit
797d492f64

+ 0 - 15
.idea/deployment.xml

@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="PublishConfigData" autoUpload="On explicit save action" serverName="yangji" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true">
-    <serverData>
-      <paths name="yangji">
-        <serverdata>
-          <mappings>
-            <mapping deploy="/root/app" local="$PROJECT_DIR$" web="/" />
-          </mappings>
-        </serverdata>
-      </paths>
-    </serverData>
-    <option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
-  </component>
-</project>

+ 0 - 8
.idea/sshConfigs.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="SshConfigs">
-    <configs>
-      <sshConfig authType="PASSWORD" host="139.9.53.143" id="c2c9746d-0068-4d02-a757-d76c286d3e6e" port="22" nameFormat="DESCRIPTIVE" username="root" />
-    </configs>
-  </component>
-</project>

+ 0 - 14
.idea/webServers.xml

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="WebServers">
-    <option name="servers">
-      <webServer id="3d15d1e3-de40-40ce-92c5-95172fc67d45" name="yangji">
-        <fileTransfer rootFolder="/root" accessType="SFTP" host="139.9.53.143" port="22" sshConfigId="c2c9746d-0068-4d02-a757-d76c286d3e6e" sshConfig="root@139.9.53.143:22 password">
-          <advancedOptions>
-            <advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" />
-          </advancedOptions>
-        </fileTransfer>
-      </webServer>
-    </option>
-  </component>
-</project>

+ 34 - 0
consts/project.go

@@ -202,3 +202,37 @@ func GetRechargeMethod(method int64) string {
 	}
 	return "未知"
 }
+
+var KD100Flags = map[string]string{
+	"圆通":     "yuantong",
+	"韵达":     "yunda",
+	"申通":     "shentong",
+	"中通":     "zhongtong",
+	"顺丰":     "shunfeng",
+	"极兔":     "jtexpress",
+	"邮政":     "youzhengguonei",
+	"EMS":    "ems",
+	"京东":     "jd",
+	"邮政标准快递": "youzhengbk",
+	"丰网速运":   "fengwang",
+	"德邦快递":   "debangkuaidi",
+	"德邦":     "debangwuliu",
+	"丹鸟":     "danniao",
+	"飞豹快递":   "feibaokuaidi",
+	"中通快运":   "zhongtongkuaiyun",
+	"安能快运":   "annengwuliu",
+	"百世快递":   "huitongkuaidi",
+	"安得物流":   "annto",
+	"跨越速运":   "kuayue",
+	"特急送":    "lntjs",
+	"宅急送":    "zhaijisong",
+	"other":  "其它快递",
+}
+
+func GetKD(Kd string) string {
+	toast, contain := KD100Flags[Kd]
+	if contain {
+		return toast
+	}
+	return "未知"
+}

+ 12 - 6
db/data.go

@@ -3,6 +3,8 @@ package db
 import (
 	"context"
 	"fmt"
+	"github.com/caixw/lib.go/conv"
+	"github.com/sirupsen/logrus"
 	"reflect"
 	"strings"
 	"time"
@@ -11,9 +13,6 @@ import (
 	"youngee_m_api/model/http_model"
 	"youngee_m_api/pack"
 	"youngee_m_api/util"
-
-	"github.com/caixw/lib.go/conv"
-	"github.com/sirupsen/logrus"
 )
 
 // GetTaskDataList 查询上传链接的task list
@@ -42,8 +41,17 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 			if tag == "platform_nickname" {
 				platform_nickname = fmt.Sprintf("%v", value.Interface())
 				continue
-			} else if tag == "project_id" || tag == "strategy_id" {
+			} else if tag == "project_id" {
 				db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+			} else if tag == "strategy_ids" {
+				strategyIds := strings.Split(fmt.Sprintf("%v", value.Interface()), ",")
+				var strategyIdList []int
+				for _, strategyId := range strategyIds {
+					strategyIdList = append(strategyIdList, conv.MustInt(strategyId, 0))
+				}
+				db = db.Where("strategy_id in ?", strategyIdList)
+			} else {
+				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -119,8 +127,6 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 			newTaskDatas = append(newTaskDatas, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskDatas = append(newTaskDatas, v)
-		} else if strings.Contains(conv.MustString(v.TaskID, ""), platform_nickname) {
-			newTaskDatas = append(newTaskDatas, v)
 		} else {
 			totalTask--
 		}

+ 33 - 0
db/number_info.go

@@ -2,6 +2,9 @@ package db
 
 import (
 	"context"
+	"fmt"
+	"strconv"
+	"time"
 	"youngee_m_api/model/gorm_model"
 	"youngee_m_api/model/http_model"
 
@@ -210,3 +213,33 @@ func GetFinishNumberInfo(ctx context.Context, projectId int64, strategyIds []int
 	}
 	return &FinishNumberInfoDataList, nil
 }
+
+func GetLogisticsNum() [][]string {
+	var logisticNumsInfos [][]string
+	db := GetReadDB(context.Background())
+	var logisticInfos []*gorm_model.YoungeeTaskLogistics
+	db.Model(gorm_model.YoungeeTaskLogistics{}).Where("things_type = 1 AND status = 0").Find(&logisticInfos)
+	for _, logisticInfo := range logisticInfos {
+		var logisticNumsInfo []string
+		logisticNumsInfo = append(logisticNumsInfo, logisticInfo.CompanyName, logisticInfo.LogisticsNumber, strconv.FormatInt(logisticInfo.LogisticsID, 10))
+		logisticNumsInfos = append(logisticNumsInfos, logisticNumsInfo)
+	}
+	fmt.Println("logisticNumsInfos:", logisticNumsInfos)
+	return logisticNumsInfos
+}
+
+func SignLogistic(logisticId int64) {
+	db := GetReadDB(context.Background())
+	var taskId, projectId, contentType int64
+	db.Model(gorm_model.YoungeeTaskLogistics{}).Select("task_id").Where("logistics_id = ?", logisticId).Find(&taskId)
+	db.Model(gorm_model.YoungeeTaskInfo{}).Select("project_id").Where("task_id = ?", taskId).Find(&projectId)
+	db.Model(gorm_model.ProjectInfo{}).Select("content_type").Where("project_id = ?", projectId).Find(&contentType)
+	db.Model(gorm_model.YoungeeTaskLogistics{}).Where("logistics_id = ?", logisticId).Updates(&gorm_model.YoungeeTaskLogistics{SignedTime: time.Now(), Status: 1})
+	if contentType == 1 {
+		db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskId).Updates(&gorm_model.YoungeeTaskInfo{LogisticsStatus: 3, TaskStage: 9})
+		fmt.Printf("任务 %v 物流状态为已签收,已更新任务状态为 待传初稿\n", taskId)
+	} else {
+		db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskId).Updates(&gorm_model.YoungeeTaskInfo{LogisticsStatus: 3, TaskStage: 7})
+		fmt.Printf("任务 %v 物流状态为已签收,已更新任务状态为 待传脚本\n", taskId)
+	}
+}

+ 4 - 5
db/terminate.go

@@ -3,13 +3,12 @@ package db
 import (
 	"context"
 	"fmt"
+	"gorm.io/gorm"
 	"log"
 	"time"
 	"youngee_m_api/model/gorm_model"
 	"youngee_m_api/util"
 
-	"gorm.io/gorm"
-
 	"github.com/sirupsen/logrus"
 )
 
@@ -35,9 +34,9 @@ func Terminate(ctx context.Context, TaskIDs, projectIds []int) error {
 			logrus.WithContext(ctx).Errorf("[Data db] Count YoungeeTaskInfo error,err:%+v", err)
 			return err1
 		}
-		// var finishedNum int64
-		// db.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage >= 15", projectId).Count(&finishedNum)
-		if unfinishedNum == 0 {
+		var finishedNum int64
+		db.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage >= 15", projectId).Count(&finishedNum)
+		if unfinishedNum == 0 && finishedNum != 0 {
 			// 1. 更新项目状态为结束
 			err2 := db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates("project_status = 10").Error
 			if err2 != nil {

+ 0 - 59
handler/logistics_number_info.go

@@ -1,59 +0,0 @@
-package handler
-
-import (
-	"youngee_m_api/consts"
-	"youngee_m_api/model/http_model"
-	"youngee_m_api/service"
-	"youngee_m_api/util"
-
-	"github.com/gin-gonic/gin"
-	"github.com/sirupsen/logrus"
-	log "github.com/sirupsen/logrus"
-)
-
-func WrapGetLogisticsNumberInfoHandler(ctx *gin.Context) {
-	handler := newGetLogisticsNumberInfoHandler(ctx)
-	BaseRun(handler)
-}
-
-func newGetLogisticsNumberInfoHandler(ctx *gin.Context) *GetLogisticsNumberInfoHandler {
-	return &GetLogisticsNumberInfoHandler{
-		req:  http_model.NewGetLogisticsNumberInfoRequest(),
-		resp: http_model.NewGetLogisticsNumberInfoResponse(),
-		ctx:  ctx,
-	}
-}
-
-type GetLogisticsNumberInfoHandler struct {
-	req  *http_model.GetLogisticsNumberInfoRequest
-	resp *http_model.CommonResponse
-	ctx  *gin.Context
-}
-
-func (h *GetLogisticsNumberInfoHandler) getRequest() interface{} {
-	return h.req
-}
-func (h *GetLogisticsNumberInfoHandler) getContext() *gin.Context {
-	return h.ctx
-}
-func (h *GetLogisticsNumberInfoHandler) getResponse() interface{} {
-	return h.resp
-}
-
-func (h *GetLogisticsNumberInfoHandler) run() {
-	data := http_model.GetLogisticsNumberInfoRequest{}
-	data = *h.req
-	res, err := service.Number.GetLogisticsNumberInfo(h.ctx, data)
-	if err != nil {
-		logrus.Errorf("[GetLogisticsNumberInfoHandler] call GetLogisticsNumberInfo err:%+v\n", err)
-		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
-		log.Info("GetLogisticsNumberInfo fail,req:%+v", h.req)
-		return
-	}
-	h.resp.Message = ""
-	h.resp.Data = res
-}
-
-func (h *GetLogisticsNumberInfoHandler) checkParam() error {
-	return nil
-}

+ 1 - 1
model/common_model/talent_condition.go

@@ -8,7 +8,7 @@ type TalentConditions struct {
 	LinkStatus       int64  `condition:"link_status"`       // 链接状态
 	DataStatus       int64  `condition:"data_status"`       // 数据状态
 	DefaultStatus    int64  `condition:"default_status"`    // 违约状态
-	StrategyId       int64  `condition:"strategy_id"`       // 策略ID
+	StrategyIds      string `condition:"strategy_ids"`      // 策略ID
 	TaskId           string `condition:"task_id"`           // 任务ID
 	PlatformNickname string `condition:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/gorm_model/info_pricing_strategy.go

@@ -13,7 +13,7 @@ type InfoPricingStrategy struct {
 	Platform      int64     `gorm:"column:platform;NOT NULL"`             // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	FansLow       int64     `gorm:"column:fans_low;NOT NULL"`             // 对应粉丝量下限
 	FansUp        int64     `gorm:"column:fans_up;NOT NULL"`              // 对应粉丝量上限
-	ServiceCharge float32   `gorm:"column:service_charge"`                // 服务费,稿费形式为产品置换时填写,可以为空
+	ServiceCharge int64     `gorm:"column:service_charge"`                // 服务费,稿费形式为产品置换时填写,可以为空
 	BaseOffer     float32   `gorm:"column:base_offer"`                    // 基础报价
 	Status        int64     `gorm:"column:status;NOT NULL"`               // 定价策略当前状态,0表示正常,1表示禁用
 	ServiceRate   int64     `gorm:"column:service_rate"`                  // 服务费率*1000,稿费形式为固定稿费和自报价时填写,可以为空

+ 13 - 25
model/gorm_model/recruit_strategy.go

@@ -1,34 +1,22 @@
 // Code generated by sql2gorm. DO NOT EDIT.
 package gorm_model
 
-
 type RecruitStrategy struct {
-	RecruitStrategyID int64    `gorm:"column:recruit_strategy_id;primary_key;AUTO_INCREMENT"` // 招募策略id
-	FeeForm           int64    `gorm:"column:fee_form"`                                       // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
-	StrategyID        int64    `gorm:"column:strategy_id"`                                    // 策略id
-	FollowersLow      int64    `gorm:"column:followers_low"`                                  // 达人粉丝数下限
-	FollowersUp       int64    `gorm:"column:followers_up"`                                   // 达人粉丝数上限
-	RecruitNumber     int64    `gorm:"column:recruit_number"`                                 // 招募数量
-	Offer             float64 `gorm:"column:offer"`                                          // 报价
-	TOffer            float64 `gorm:"column:t_offer"`                                        // 达人所见报价
-	ProjectID         int64    `gorm:"column:project_id"`                                     // 所属项目id
-	ServiceCharge     int64    `gorm:"column:service_charge"`                                 // 平台服务费,稿费形式为产品置换时必填
-	SelectedNumber    int64    `gorm:"column:selected_number;default:0"`                      // 已选数量,被企业选择的达人数量
-	WaitingNumber     int64    `gorm:"column:waiting_number;default:0"`                       // 待发货
-	DeliveredNumber   int64    `gorm:"column:delivered_number;default:0"`                     // 已发货
-	SignedNumber      int64    `gorm:"column:signed_number;default:0"`                        // 已签收
-	MaxOffer          int64    `gorm:"column:max_offer;default:0"`                            // 报价上限
-	MinOffer          int64    `gorm:"column:min_offer;default:0"`                            // 报价下限
-	FanNumber         int64    `gorm:"column:fan_number;default:0"`                           // 总粉丝量
-	PlayNumber        int64    `gorm:"column:play_number;default:0"`                          // 总播放量
-	LikeNumber        int64    `gorm:"column:like_number;default:0"`                          // 总点赞数
-	CollectNumber     int64    `gorm:"column:collect_number;default:0"`                       // 总收藏量
-	CommentNumber     int64    `gorm:"column:comment_number;default:0"`                       // 总评论数
-	FinishNumber      int64    `gorm:"column:finish_number;default:0"`                        // 结案数量
-	TotalOffer        int64    `gorm:"column:total_offer;default:0"`                          // 支付合计
+	RecruitStrategyID int64 `gorm:"column:recruit_strategy_id;primary_key;AUTO_INCREMENT"` // 招募策略id
+	FeeForm           int64 `gorm:"column:fee_form"`                                       // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
+	StrategyID        int64 `gorm:"column:strategy_id"`                                    // 策略id
+	FollowersLow      int64 `gorm:"column:followers_low"`                                  // 达人粉丝数下限
+	FollowersUp       int64 `gorm:"column:followers_up"`                                   // 达人粉丝数上限
+	RecruitNumber     int64 `gorm:"column:recruit_number"`                                 // 招募数量
+	Offer             int64 `gorm:"column:offer"`                                          // 报价
+	ProjectID         int64 `gorm:"column:project_id"`                                     // 所属项目id
+	ServiceCharge     int64 `gorm:"column:service_charge"`                                 // 平台服务费,稿费形式为产品置换时必填
+	SelectedNumber    int64 `gorm:"column:selected_number"`                                // 已选数量,被企业选择的达人数量 应发货
+	WaitingNumber     int64 `gorm:"column:waiting_number"`                                 // 待发货
+	DeliveredNumber   int64 `gorm:"column:delivered_number"`                               // 已发货
+	SignedNumber      int64 `gorm:"column:signed_number"`                                  // 已签收
 }
 
 func (m *RecruitStrategy) TableName() string {
 	return "recruit_strategy"
 }
-

+ 2 - 2
model/gorm_model/task_logistic.go

@@ -20,5 +20,5 @@ type YoungeeTaskLogistics struct {
 	AutoSignAt            time.Time `gorm:"column:auto_sign_at"`                            // 自动签收时间
 	AutoScriptBreakAt     time.Time `gorm:"column:auto_script_break_at"`                    // 脚本违约自动处理时间
 	AutoSketchBreakAt     time.Time `gorm:"column:auto_sketch_break_at"`                    // 初稿违约自动处理时间
-	Status                int64       `gorm:"column:status;default:0"`                        // 签收状态,0为未签收,1为已签收
-}
+	Status                int       `gorm:"column:status;default:0"`                        // 签收状态,0为未签收,1为已签收
+}

+ 2 - 2
model/gorm_model/withdraw_info.go

@@ -9,8 +9,8 @@ import (
 type YounggeeWithdrawRecord struct {
 	WithdrawID     string    `gorm:"column:withdraw_id;primary_key"`  // 提现订单ID
 	TalentID       string    `gorm:"column:talent_id;NOT NULL"`       // 达人id
-	WithdrawAmount int64     `gorm:"column:withdraw_amount;NOT NULL"` // 提现金额
-	AmountPayable  int64     `gorm:"column:amount_payable;NOT NULL"`  // 应付金额
+	WithdrawAmount float64   `gorm:"column:withdraw_amount;NOT NULL"` // 提现金额
+	AmountPayable  float64   `gorm:"column:amount_payable;NOT NULL"`  // 应付金额
 	TaskIDList     string    `gorm:"column:task_id_list;NOT NULL"`    // 该提现订单包含的task_id列表
 	ReceiveInfo    string    `gorm:"column:receive_info;NOT NULL"`    // 收款信息
 	Status         int       `gorm:"column:status;NOT NULL"`          // 提现状态:1为提现待确认,2为已提现

+ 2 - 2
model/http_model/WithDrawalRecordsRequest.go

@@ -14,8 +14,8 @@ type WithdrawalRecordsData struct {
 	WithdrawId     string  `json:"withdraw_id"`
 	TalentId       string  `json:"talent_id"`
 	TalentName     string  `json:"talent_name"`
-	WithdrawAmount float32 `json:"withdraw_amount"`
-	AmountPayable  float32 `json:"amount_payable"`
+	WithdrawAmount float64 `json:"withdraw_amount"`
+	AmountPayable  float64 `json:"amount_payable"`
 	ReceiveInfo    string  `json:"receive_info"`
 	BankType       int     `json:"bank_type"`
 	Phone          string  `json:"phone"`

+ 2 - 2
model/http_model/add_pricing.go

@@ -6,8 +6,8 @@ type AddPricingRequest struct {
 	Platform       string  `json:"platform"`        //社媒平台
 	FansLow        int64   `json:"fans_low"`        //对应创作者 粉丝量
 	FansHigh       int64   `json:"fans_high"`       //对应创作者 粉丝量
-	ServiceCharge  float32 `json:"service_charge"`  //基础报价
-	ServiceRate    int64   `json:"service_rate"`    //平台服务费
+	BaseOffer      float32 `json:"base_offer"`      //基础报价
+	PlatformFee    int64   `json:"platform_fee"`    //平台服务费
 }
 
 type AddPricingResponse struct {

+ 8 - 9
model/http_model/modify_pricing.go

@@ -1,15 +1,14 @@
 package http_model
 
 type ModifyPricingRequest struct {
-	ID            string `json:"id"`
-	StrategyId    string `json:"strategy_id"`
-	ProjectType   string `json:"project_type"`   //项目类型
-	FeeForm       string `json:"fee_form"`       //稿费形式
-	Platform      string `json:"platform"`       //社媒平台
-	FansLow       int64  `json:"fans_low"`       //对应创作者 粉丝量
-	FansHigh      int64  `json:"fans_high"`      //对应创作者 粉丝量
-	ServiceCharge int64  `json:"service_charge"` //平台服务费
-	ServiceRate   int64  `json:"service_rate"`   //平台服务费率
+	StrategyId  string `json:"strategy_id"`
+	ProjectType string `json:"project_type"` //项目类型
+	FeeForm     string `json:"fee_form"`     //稿费形式
+	Platform    string `json:"platform"`     //社媒平台
+	FansLow     int64  `json:"fans_low"`     //对应创作者 粉丝量
+	FansHigh    int64  `json:"fans_high"`    //对应创作者 粉丝量
+	BaseOffer   int64  `json:"base_offer"`   //基础报价
+	PlatformFee int64  `json:"platform_fee"` //平台服务费
 }
 
 type ModifyPricingResponse struct {

+ 6 - 7
model/http_model/project_create.go

@@ -8,13 +8,12 @@ type CreateProjectPhoto struct {
 }
 
 type CreateRecruitStrategy struct {
-	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
-	StrategyID    int64   `json:"strategy_id"`    // 策略id
-	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
-	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
-	RecruitNumber int64   `json:"recruit_number"` // 招募数量
-	Offer         float64 `json:"offer"`          // 报价
-	TOffer        float64 `json:"t_offer"`        // 达人端报价
+	FeeForm       int64 `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
+	StrategyID    int64 `json:"strategy_id"`    // 策略id
+	FollowersLow  int64 `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   int64 `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber int64 `json:"recruit_number"` // 招募数量
+	Offer         int64 `json:"offer"`          // 报价
 }
 
 type CreateProjectRequest struct {

+ 6 - 7
model/http_model/project_update.go

@@ -8,13 +8,12 @@ type UpdateProjectPhoto struct {
 }
 
 type UpdateRecruitStrategy struct {
-	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
-	StrategyID    int64   `json:"strategy_id"`    // 策略id
-	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
-	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
-	RecruitNumber int64   `json:"recruit_number"` // 招募数量
-	Offer         float64 `json:"offer"`          // 报价
-	TOffer        float64 `json:"t_offer"`        // 报价
+	FeeForm       int64 `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
+	StrategyID    int64 `json:"strategy_id"`    // 策略id
+	FollowersLow  int64 `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   int64 `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber int64 `json:"recruit_number"` // 招募数量
+	Offer         int64 `json:"offer"`          // 报价
 }
 
 type UpdateProjectRequest struct {

+ 10 - 11
model/http_model/search_pricing.go

@@ -3,21 +3,20 @@ package http_model
 type SearchPricingRequest struct {
 	PageSize    int32  `json:"page_size"`
 	PageNum     int32  `json:"page_num"`
-	ProjectType string `json:"project_type"` // 项目类型
-	FeeForm     string `json:"fee_form"`     // 稿费形式
-	Platform    string `json:"platform"`     // 社媒平台
+	ProjectType string `json:"project_type"` //项目类型
+	FeeForm     string `json:"fee_form"`     //稿费形式
+	Platform    string `json:"platform"`     //社媒平台
 	UpdateAt    string `json:"update_at"`    // 创建时间
 }
 
 type SearchPricingPreview struct {
-	ID             string `json:"id"`              // 编号
-	StrategyId     string `json:"strategyId"`      // 定价策略编号
-	ProjectType    string `json:"project_type"`    // 项目类型
-	Platform       string `json:"platform"`        // 社媒平台
-	ManuscriptForm string `json:"manuscript_form"` // 稿费形式
-	Fans           string `json:"fans"`            // 对应创作者粉丝量
-	ServiceCharge  string `json:"service_charge"`  // 基础报价
-	ServiceRate    string `json:"service_rate"`    // 平台服务费
+	StrategyId     string `json:"strategyId"`      //定价策略编号
+	ProjectType    string `json:"project_type"`    //项目类型
+	Platform       string `json:"platform"`        //社媒平台
+	ManuscriptForm string `json:"manuscript_form"` //稿费形式
+	Fans           string `json:"fans"`            //对应创作者粉丝量
+	BaseOffer      string `json:"base_offer"`      //基础报价
+	PlatformFee    string `json:"platform_fee"`    //平台服务费
 	UpdateTime     string `json:"update_time"`     // 更新时间
 }
 

+ 1 - 1
model/http_model/task_data.go

@@ -10,7 +10,7 @@ type TaskDataListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DataStatus       string `json:"data_status"`       // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_default_data.go

@@ -10,7 +10,7 @@ type TaskDefaultDataListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DefaultStatus    string `json:"default_status"`    // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_default_review.go

@@ -10,7 +10,7 @@ type TaskDefaultReviewListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DefaultStatus    string `json:"default_status"`    // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_finish.go

@@ -9,7 +9,7 @@ type TaskFinishListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DataStatus       string `json:"data_status"`       // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_link.go

@@ -10,7 +10,7 @@ type TaskLinkListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	LinkStatus       string `json:"link_status"`       // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_script.go

@@ -10,7 +10,7 @@ type TaskScriptListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	ScriptStatus     string `json:"script_status"`     // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_sketch.go

@@ -10,7 +10,7 @@ type TaskSketchListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	SketchStatus     string `json:"sketch_status"`     // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_terminated.go

@@ -10,7 +10,7 @@ type TaskTerminatedListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DefaultStatus    string `json:"default_status"`    // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 1
model/http_model/task_terminating.go

@@ -10,7 +10,7 @@ type TaskTerminatingListRequest struct {
 	PageNum          int64  `json:"page_num"`
 	ProjectId        string `json:"project_id"`        // 项目ID
 	TaskId           string `json:"task_id"`           // 任务ID
-	StrategyId       string `json:"strategy_id"`       // 策略ID
+	StrategyIds      string `json:"strategy_ids"`      // 策略ID
 	DefaultStatus    string `json:"default_status"`    // 稿件状态
 	PlatformNickname string `json:"platform_nickname"` // 账号昵称
 }

+ 1 - 3
route/init.go

@@ -1,12 +1,11 @@
 package route
 
 import (
+	"github.com/gin-gonic/gin"
 	"youngee_m_api/handler"
 	"youngee_m_api/handler/operate"
 	"youngee_m_api/middleware"
 	"youngee_m_api/model/http_model"
-
-	"github.com/gin-gonic/gin"
 )
 
 func InitRoute(r *gin.Engine) {
@@ -48,7 +47,6 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/all", handler.WrapGetAllProjectHandler)
 		m.POST("/project/taskList", handler.WrapProjectTaskListHandler)
 		m.POST("/project/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler)
-		m.POST("/project/getlogisticsnumberinfo", handler.WrapGetLogisticsNumberInfoHandler)
 		m.POST("/project/getlinknumberinfo", handler.WrapGetLinkNumberInfoHandler)
 		m.POST("/project/getdatanumberinfo", handler.WrapGetDataNumberInfoHandler)
 		m.POST("/project/getreviewnumberinfo", handler.WrapGetReviewNumberInfoHandler)

+ 12 - 8
service/auto_task.go

@@ -2,14 +2,14 @@ package service
 
 import (
 	"context"
+	"github.com/caixw/lib.go/conv"
+	"github.com/robfig/cron/v3"
+	"github.com/sirupsen/logrus"
 	"log"
 	"time"
+	"youngee_m_api/consts"
 	"youngee_m_api/db"
 	"youngee_m_api/model/gorm_model"
-
-	"github.com/caixw/lib.go/conv"
-	"github.com/robfig/cron/v3"
-	"github.com/sirupsen/logrus"
 )
 
 func AutoTask() error {
@@ -22,6 +22,7 @@ func AutoTask() error {
 		logisticNums := db.GetLogisticsNum()
 		for i := 0; i < len(logisticNums); i++ {
 			logisticNum := logisticNums[i]
+			log.Println("logisticNum:", logisticNum)
 			status := GetKDStatus(consts.GetKD(logisticNum[0]), logisticNum[1])
 			if status == "1" {
 				db.SignLogistic(conv.MustInt64(logisticNum[2], 0))
@@ -197,11 +198,14 @@ func AutoTask() error {
 		log.Println("GetAutoCaseCloseDefaultTask is running ,Time :", time.Now())
 	}
 	//定时任务
-	// spec := "*/10 * * * * ?" //cron表达式,每10秒一次
-	//spec := "0 */2 * * * ?" //cron表达式,每1分钟一次
-	spec := "0 */30 * * * ?" //cron表达式,每半小时执行一次
-	// spec := "0 0 * * * *" //每小时执行
+	//spec := "*/30 * * * * ?" //cron表达式,每10秒一次
+	//spec := "0 */30 * * * ?" //cron表达式,每一分钟执行一次
+	spec := "0 0 * * * *" //每小时执行
 	// 添加定时任务,
+	_, err := crontab.AddFunc("@midnight", taskKDStatus)
+	if err != nil {
+		return err
+	}
 	_, err1 := crontab.AddFunc(spec, task1)
 	if err1 != nil {
 		return err1

+ 98 - 0
service/kuaiDi100.go

@@ -0,0 +1,98 @@
+package service
+
+import (
+	"crypto/md5"
+	"encoding/hex"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"net/url"
+	"strings"
+)
+
+type KdState struct {
+	Message string `json:"message"`
+	State   string `json:"state"`
+	Status  string `json:"status"`
+	IsCheck string `json:"ischeck"`
+}
+
+var KD100Flags = map[string]string{
+	"ane66":          "安能快递",
+	"debangwuliu":    "德邦物流",
+	"debangkuaidi":   "德邦快递",
+	"ems":            "EMS",
+	"guotongkuaidi":  "国通快递",
+	"huitongkuaidi":  "百世快递",
+	"jd":             "京东物流",
+	"kuayue":         "跨越速运",
+	"pjbest":         "品骏快递",
+	"shentong":       "申通快递",
+	"shunfeng":       "顺丰速运",
+	"suer":           "速尔快递",
+	"xinfengwuliu":   "信丰物流",
+	"youshuwuliu":    "优速物流",
+	"youzhengguonei": "邮政快递包裹",
+	"yuantong":       "圆通速递",
+	"yuantongguoji":  "圆通国际",
+	"yunda":          "韵达快递",
+	"zhaijisong":     "宅急送",
+	"zhongtong":      "中通快递",
+	"ewe":            "EWE全球快递",
+	"quanyikuaidi":   "全一快递",
+	"tiantian":       "天天快递",
+	"sxjdfreight":    "顺心捷达",
+	"dhl":            "DHL-中国件",
+	"tnt":            "TNT",
+	"other":          "其它快递",
+}
+
+// GetKDStatus 获取快递跟踪信息
+func GetKDStatus(com, num string) string {
+	fmt.Printf("查询物流公司为 %v, 快递为编号为 %v 的快递\n", KD100Flags[com], num)
+	key := "jqayXRgj8154"                          //客户授权key
+	customer := "E59437A1C1C69273AEB48F587CEF57B4" //查询公司编号
+
+	postUrl := "https://poll.kuaidi100.com/poll/query.do" //实时查询请求地址
+
+	paramData := make(map[string]string)
+	paramData["com"] = com //快递公司编码
+	paramData["num"] = num //快递单号
+
+	paramDataSlice, _ := json.Marshal(paramData)
+	paramjson := string(paramDataSlice)
+
+	sign := strings.ToUpper(GetMD5Encode(paramjson + key + customer))
+
+	//POST请求需要三个参数,分别为customer(CustomerId)和sign(签名)和param(参数)
+	postRes, postErr := http.PostForm(postUrl, url.Values{"customer": {customer}, "sign": {sign}, "param": {paramjson}})
+	if postErr != nil {
+		fmt.Println("查询失败" + postErr.Error())
+		return "查询失败"
+	}
+	postBody, err := ioutil.ReadAll(postRes.Body)
+	if err != nil {
+		fmt.Println("查询失败,请至快递公司官网自行查询" + err.Error())
+		return "查询失败,请至快递公司官网自行查询"
+	}
+	resp := KdState{}
+	err = json.Unmarshal(postBody, &resp)
+	if err != nil {
+		fmt.Println("json.Unmarshal error", err.Error())
+		return "查询失败"
+	}
+	if resp.IsCheck == "1" {
+		fmt.Println("查询成功,快递已签收")
+	} else {
+		fmt.Println("查询成功,快递尚未签收")
+	}
+	return resp.IsCheck
+}
+
+// GetMD5Encode 返回一个32位md5加密后的字符串
+func GetMD5Encode(data string) string {
+	h := md5.New()
+	h.Write([]byte(data))
+	return hex.EncodeToString(h.Sum(nil))
+}

+ 1 - 17
service/number_info.go

@@ -2,12 +2,11 @@ package service
 
 import (
 	"context"
+	"github.com/caixw/lib.go/conv"
 	"strings"
 	"youngee_m_api/db"
 	"youngee_m_api/model/http_model"
 
-	"github.com/caixw/lib.go/conv"
-
 	"github.com/sirupsen/logrus"
 )
 
@@ -90,18 +89,3 @@ func (*number) GetFinishNumberInfo(ctx context.Context, request http_model.GetFi
 
 	return NumberData, nil
 }
-
-func (*number) GetLogisticsNumberInfo(ctx context.Context, request http_model.GetLogisticsNumberInfoRequest) (*http_model.GetLogisticsNumberInfoData, error) {
-	var StrategyIdList []int64
-	StrategyIds := strings.Split(request.StrategyIds, ",")
-	for _, strategyId := range StrategyIds {
-		StrategyIdList = append(StrategyIdList, conv.MustInt64(strategyId, 0))
-	}
-	NumberData, err := db.GetLogisticsNumberInfo(ctx, request.ProjectId, StrategyIdList)
-	if err != nil {
-		logrus.WithContext(ctx).Errorf("[Data service] call CreateData error,err:%+v", err)
-		return nil, err
-	}
-
-	return NumberData, nil
-}