yankun 5 meses atrás
pai
commit
f84b6edca8
29 arquivos alterados com 1719 adições e 497 exclusões
  1. BIN
      .DS_Store
  2. 10 0
      .idea/inspectionProfiles/Project_Default.xml
  3. 28 11
      app/api/youngee_talent_api/talent_auth_get_api.go
  4. 9 1
      app/api/youngee_talent_api/talent_auth_post_api.go
  5. 9 11
      app/api/youngee_talent_api/talent_get_api.go
  6. 1 0
      app/model/model.go
  7. 174 0
      app/model/youngee_talent_model/local_info.go
  8. 1 1
      app/model/youngee_talent_model/message.go
  9. 46 25
      app/model/youngee_talent_model/project_detail.go
  10. 40 13
      app/model/youngee_talent_model/talent_income.go
  11. 48 32
      app/model/youngee_talent_model/task_income.go
  12. 78 7
      app/model/youngee_talent_model/task_info.go
  13. 7 7
      app/model/youngee_talent_model/task_link.go
  14. 1 1
      app/service/youngee_talent_service/log_message.go
  15. 218 132
      app/service/youngee_talent_service/talent_income.go
  16. 337 0
      app/service/youngee_task_service/local_life_info.go
  17. 24 7
      app/service/youngee_task_service/project_info.go
  18. 13 0
      app/service/youngee_task_service/task_book.go
  19. 239 199
      app/service/youngee_task_service/task_income.go
  20. 395 17
      app/service/youngee_task_service/task_info.go
  21. 3 3
      app/service/youngee_task_service/task_link.go
  22. 20 18
      app/service/youngee_task_service/task_sketch.go
  23. 1 0
      app/system/assignment/assignment_model.go
  24. 12 7
      app/system/assignment/assignment_service.go
  25. BIN
      bin/main
  26. BIN
      bin/v3.7.6/.DS_Store
  27. BIN
      bin/v3.7.6/linux_amd64/youngmini_server
  28. BIN
      bin/v3.7.6/windows_amd64/youngmini_server.exe
  29. 5 5
      config/config.toml

BIN
.DS_Store


+ 10 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,10 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="GoDfaErrorMayBeNotNil" enabled="true" level="WARNING" enabled_by_default="true">
+      <methods>
+        <method importPath="github.com/gogf/gf/database/gredis" receiver="*Redis" name="DoVar" />
+      </methods>
+    </inspection_tool>
+  </profile>
+</component>

+ 28 - 11
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -25,17 +25,6 @@ func (*talentAuthGetApi) GetProjectDetail(r *ghttp.Request) {
 	}
 }
 
-// todo: 获取本地生活详情页
-//func (*talentGetApi) GetLocalLifeDetail(r *ghttp.Request) {
-//	res := youngee_task_service.GetLocalLifeDetail(r)
-//	fmt.Println("我进入了talent_get_api中的GetProjectList(展示所有种草)")
-//
-//	err := r.Response.WriteJson(res)
-//	if err != nil {
-//		panic("write response error")
-//	}
-//}
-
 // GetTalentInfo 获取达人信息
 // youngee_talent_info
 func (*talentAuthGetApi) GetTalentInfo(r *ghttp.Request) {
@@ -688,3 +677,31 @@ func (*talentAuthGetApi) GetProjRecruitList(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+// 提现记录列表
+func (*talentAuthGetApi) GetWithdrawList(r *ghttp.Request) {
+	res := youngee_task_service.GetWithdrawList(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+// 提现记录详情 todo
+func (*talentAuthGetApi) GetWithdrawDetail(r *ghttp.Request) {
+	res := youngee_task_service.GetWithdrawDetail(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+// todo: 获取本地生活详情页
+func (*talentGetApi) GetLocalLifeDetail(r *ghttp.Request) {
+	res := youngee_task_service.GetLocalLifeDetail(r)
+
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}

+ 9 - 1
app/api/youngee_talent_api/talent_auth_post_api.go

@@ -186,7 +186,7 @@ func (*talentAuthPostApi) GetTalentIncomeInfo(r *ghttp.Request) {
 
 // Withdraw 提现
 func (*talentAuthPostApi) Withdraw(r *ghttp.Request) {
-	res := youngee_talent_service.Withdraw(r)
+	res := youngee_task_service.Withdraw(r)
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")
@@ -245,3 +245,11 @@ func (*talentAuthPostApi) SignUpTaskWithKsAccount(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+func (*talentAuthPostApi) SignUpLocalWithKsAccount(r *ghttp.Request) {
+	res := youngee_task_service.SignUpLocalWithKsAccount(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}

+ 9 - 11
app/api/youngee_talent_api/talent_get_api.go

@@ -35,17 +35,6 @@ func (*talentGetApi) GetProjectList(r *ghttp.Request) {
 	}
 }
 
-// todo :获取种草列表
-//func (*talentGetApi) GetLocalLifeList(r *ghttp.Request) {
-//	res := youngee_task_service.GetLocalLifeList(r)
-//	fmt.Println("我进入了talent_get_api中的GetProjectList(展示所有种草)")
-//
-//	err := r.Response.WriteJson(res)
-//	if err != nil {
-//		panic("write response error")
-//	}
-//}
-
 // 获取选品任务广场展示列表
 // 前端可能传过来筛选和搜索的参数
 // 筛选参数参数形如&secform[]=2&secform[]=3&secform[]=9
@@ -57,3 +46,12 @@ func (*talentGetApi) GetSelectionList(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+// 本地生活列表
+func (*talentGetApi) GetLocalLifeList(r *ghttp.Request) {
+	res := youngee_task_service.GetLocalLifeList(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}

+ 1 - 0
app/model/model.go

@@ -1468,4 +1468,5 @@ type YounggeeWithdrawRecord struct {
 	BankType       int         `orm:"bank_type"           json:"bank_type"`       // 到账方式,1为支付宝,2为银行卡
 	SubmitAt       *gtime.Time `orm:"submit_at"           json:"submit_at"`       // 申请提交时间
 	WithdrawAt     *gtime.Time `orm:"withdraw_at"         json:"withdraw_at"`     // 提现时间
+	TaxAmount      float64     `orm:"tax_amount"          json:"tax_amount"`
 }

+ 174 - 0
app/model/youngee_talent_model/local_info.go

@@ -0,0 +1,174 @@
+package youngee_talent_model
+
+import (
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gmeta"
+)
+
+type YounggeeLocalLifeInfo struct {
+	gmeta.Meta          `orm:"table:younggee_local_life_info"`
+	Id                  int                `json:"id"`                     // 本地生活表主键ID
+	LocalId             string             `json:"local_id"`               // 项目id
+	LocalType           int                `json:"local_type"`             // 项目类型,1代表全流程项目,2代表专项项目
+	LocalPlatform       int                `json:"local_platform"`         // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ServiceChargeRate   float64            `json:"service_charge_rate"`    // 公开服务费率
+	StoreId             int                `json:"store_id"`               // 关联门店id
+	StoreRelatedAt      *gtime.Time        `json:"store_related_at"`       // 关联门店时间
+	TeamBuyingId        int                `json:"team_buying_id"`         // 关联团购id
+	TeamBuyingRelatedAt *gtime.Time        `json:"team_buying_related_at"` // 关联团购时间
+	PromoteBody         int                `json:"promote_body"`           // 推广主体(1门店 2团购)
+	Donate              int                `json:"donate"`                 // 赠送达人套餐(1有赠送 2无赠送)
+	LocalName           string             `json:"local_name"`             // 任务标题
+	TalentType          string             `json:"talent_type"`            // 达人类型(,分隔)
+	RecruitDdl          *gtime.Time        `json:"recruit_ddl"`            // 招募截止时间
+	TaskForm            int                `json:"task_form"`              // 任务形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
+	ContentType         int                `json:"content_type"`           // 内容形式,1代表图文,2代表视频
+	TaskDetail          string             `json:"task_detail"`            // 任务详情
+	TaskStatus          int                `json:"task_status"`            // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	EnterpriseId        string             `json:"enterprise_id"`          // 所属企业id
+	SubAccountId        int                `json:"sub_account_id"`         // 子账号id
+	OperatorType        int                `json:"operator_type"`          // 创建者类型,1商家主账号,2商家子账号
+	ApplyNum            int                `json:"apply_num"`              // 报名人数
+	RecruitNum          int                `json:"recruit_num"`            // 已招募人数
+	CreatedAt           *gtime.Time        `json:"created_at"`             // 创建时间
+	UpdatedAt           *gtime.Time        `json:"updated_at"`             // 修改时间
+	AutoFailAt          *gtime.Time        `json:"auto_fail_at"`           // 失效自动处理时间
+	AutoTaskId          int                `json:"auto_task_id"`           // 定时任务id
+	AutoDefaultId       int                `json:"auto_default_id"`        // 违约状态id
+	PaymentAmount       float32            `json:"payment_amount"`         // 支付金额
+	PayAt               *gtime.Time        `json:"pay_at"`                 // 支付时间
+	SubmitAt            *gtime.Time        `json:"submit_at"`              // 提交审核时间
+	PassAt              *gtime.Time        `json:"pass_at"`                // 审核通过时间
+	FinishAt            *gtime.Time        `json:"finish_at"`              // 结案时间
+	EstimatedCost       float64            `json:"estimated_cost"`         // 预估成本
+	SettlementAmount    float64            `json:"settlement_amount"`      // 结算金额
+	TotalRecruitNum     int                `json:"total_recruit_num"`      // 此任务各策略招募人数总和
+	Tools               string             `json:"tools"`                  // 工具选择,1邀约招募 2样品物流 3审稿工具 4作品审查 5数据巡检 6结算账单(,分隔)
+	InvoiceStatus       int                `json:"invoice_status"`         // 开票状态(1开票中 2已开票)
+	YounggeeStore       *YounggeeStore     `json:"younggee_store"`         //关联门店
+	RecruitStrategys    []*RecruitStrategy `orm:"with:project_id=project_id"`
+	Enterprise          *Enterprise        `orm:"with:enterprise_id=enterprise_id"`
+	WatchNum            int                `json:"watch_num"`
+}
+
+// 服务商接手的项目信息
+type LocalInfoSupplier struct {
+	gmeta.Meta          `orm:"table:younggee_s_local_info"`
+	SProjectID          int     `orm:"s_project_id" json:"s_project_id"`                   // 服务商种草任务ID
+	ProjectID           string  `orm:"project_id" json:"project_id"`                       // 被服务商加入商单的原种草任务ID
+	ProjectStatus       int8    `orm:"project_status" json:"project_status"`               // 项目状态
+	ProjectType         int8    `orm:"project_type" json:"project_type"`                   // 种草任务类型
+	ProjectName         string  `orm:"project_name" json:"project_name"`                   // 种草任务名称
+	ProjectPlatform     int8    `orm:"project_platform" json:"project_platform"`           // 种草任务平台
+	ProjectForm         int8    `orm:"project_form" json:"project_form"`                   // 任务形式
+	ContentType         int8    `orm:"content_type" json:"content_type"`                   // 内容形式
+	ShareCode           string  `orm:"share_code" json:"share_code"`                       // 分享码URL
+	SupplierID          int     `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
+	EnterpriseID        string  `orm:"enterprise_id" json:"enterprise_id"`                 // 所属企业ID
+	ApplyNum            int     `orm:"apply_num" json:"apply_num"`                         // 报名人数
+	RecruitNum          int     `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
+	SettleNum           int     `orm:"settle_num" json:"settle_num"`                       // 已结算人数
+	SubAccountID        int     `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
+	ServiceCharge       float64 `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
+	ServiceChargeActual float64 `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
+	OperatorType        int     `orm:"operator_type" json:"operator_type"`
+}
+
+type LocalInfoDetail struct {
+	Id                  int                `json:"id"`                              // 本地生活表主键ID
+	LocalId             string             `json:"local_id"`                        // 项目id
+	LocalType           int                `json:"local_type"`                      // 项目类型,1代表全流程项目,2代表专项项目
+	LocalPlatform       int                `json:"local_platform"`                  // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ServiceChargeRate   float64            `json:"service_charge_rate"`             // 公开服务费率
+	StoreId             int                `json:"store_id"`                        // 关联门店id
+	StoreRelatedAt      *gtime.Time        `json:"store_related_at"`                // 关联门店时间
+	TeamBuyingId        int                `json:"team_buying_id"`                  // 关联团购id
+	TeamBuyingRelatedAt *gtime.Time        `json:"team_buying_related_at"`          // 关联团购时间
+	PromoteBody         int                `json:"promote_body"`                    // 推广主体(1门店 2团购)
+	Donate              int                `json:"donate"`                          // 赠送达人套餐(1有赠送 2无赠送)
+	LocalName           string             `json:"local_name"`                      // 任务标题
+	TalentType          string             `json:"talent_type"`                     // 达人类型(,分隔)
+	RecruitDdl          *gtime.Time        `json:"recruit_ddl"`                     // 招募截止时间
+	TaskForm            int                `json:"task_form"`                       // '任务形式,1-2分别代表线下探店,素材分发',
+	ContentType         int                `json:"content_type"`                    // 内容形式,1代表图文,2代表视频
+	TaskDetail          string             `json:"task_detail"`                     // 任务详情
+	TaskStatus          int                `json:"task_status"`                     // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	EnterpriseId        string             `json:"enterprise_id"`                   // 所属企业id
+	SubAccountId        int                `json:"sub_account_id"`                  // 子账号id
+	OperatorType        int                `json:"operator_type"`                   // 创建者类型,1商家主账号,2商家子账号
+	ApplyNum            int                `json:"apply_num"`                       // 报名人数
+	RecruitNum          int                `json:"recruit_num"`                     // 已招募人数
+	CreatedAt           *gtime.Time        `json:"created_at"`                      // 创建时间
+	UpdatedAt           *gtime.Time        `json:"updated_at"`                      // 修改时间
+	AutoFailAt          *gtime.Time        `json:"auto_fail_at"`                    // 失效自动处理时间
+	AutoTaskId          int                `json:"auto_task_id"`                    // 定时任务id
+	AutoDefaultId       int                `json:"auto_default_id"`                 // 违约状态id
+	PaymentAmount       float32            `json:"payment_amount"`                  // 支付金额
+	PayAt               *gtime.Time        `json:"pay_at"`                          // 支付时间
+	SubmitAt            *gtime.Time        `json:"submit_at"`                       // 提交审核时间
+	PassAt              *gtime.Time        `json:"pass_at"`                         // 审核通过时间
+	FinishAt            *gtime.Time        `json:"finish_at"`                       // 结案时间
+	EstimatedCost       float64            `json:"estimated_cost"`                  // 预估成本
+	SettlementAmount    float64            `json:"settlement_amount"`               // 结算金额
+	TotalRecruitNum     int                `json:"total_recruit_num"`               // 此任务各策略招募人数总和
+	Tools               string             `json:"tools"`                           // 工具选择,1邀约招募 2样品物流 3审稿工具 4作品审查 5数据巡检 6结算账单(,分隔)
+	InvoiceStatus       int                `json:"invoice_status"`                  // 开票状态(1开票中 2已开票)
+	WatchedNum          int                `json:"watched_num"`                     // 浏览量
+	YounggeeStore       *YounggeeStore     `orm:"with:store_id=store_id"`           //关联门店
+	RecruitStrategys    []*RecruitStrategy `orm:"with:project_id=store_id"`         //门店的策略
+	Enterprise          *Enterprise        `orm:"with:enterprise_id=enterprise_id"` //商家信息
+	YounggeeSupplier    *YounggeeSupplier  `json:"younggee_supplier"`               //服务商信息
+	PlatformInfo        *PlatformInfo      `orm:"with:platform_id=local_platform"`  //平台信息
+	LocalInfoSupplier   *LocalInfoSupplier //服务商提供的LocalInfo
+	ProjectBrief        []*ProjectBrief    `orm:"with:project_brief_id=id"` // 项目brief图
+	ProjectMaterial     []*ProjectMaterial `orm:"with:project_material=id"` // 项目brief图
+	//违约说明
+	DraftDefault *DraftDefault `json:"draft_default"` //初稿违约说明
+	LinkDefault  *LinkDefault  `json:"link_breach"`   //链接违约说明
+	DataDefault  *DataDefault  `json:"data_default"`  //数据违约说明
+
+}
+
+type YounggeeStore struct {
+	gmeta.Meta           `orm:"table:younggee_store"`
+	StoreId              int                     `json:"store_id"`               // 门店id
+	StoreName            string                  `json:"store_name"`             // 门店名称
+	StoreCategory        string                  `json:"store_category"`         // 门店类目(/分隔)
+	StoreType            int                     `json:"store_type"`             // 门店类型,1单门店,2连锁门店
+	StoreLocation        string                  `json:"store_location"`         // 门店地址
+	StoreDetail          string                  `json:"store_detail"`           // 门店特点
+	StoreLink            string                  `json:"store_link"`             // 分销链接
+	TeamNum              int                     `json:"team_num"`               // 包含团购套餐数
+	BelongEnterpriseId   string                  `json:"belong_enterprise_id"`   // 门店所属商家ID
+	CreatedAt            *gtime.Time             `json:"created_at"`             // 创建时间
+	IsDeleted            int                     `json:"is_deleted"`             // 已删除(0否 1是)
+	OperateType          int                     `json:"operate_type"`           // 操作人类型(1商家 2后台)
+	EnterpriseId         string                  `json:"enterprise_id"`          // 商家id
+	SubAccountId         int                     `json:"sub_account_id"`         // 商家子账号id
+	YounggeeTeamBuying   []*YounggeeTeamBuying   `json:"younggee_team_buying"`   //关联团购
+	YounggeeProductPhoto []*YounggeeProductPhoto `json:"younggee_product_photo"` //门店照片
+
+}
+
+type YounggeeTeamBuying struct {
+	gmeta.Meta         `orm:"table:younggee_team_buying"`
+	TeamBuyingId       int         `json:"team_buying_id"`       // 团购id
+	StoreId            int         `json:"store_id"`             // 所属门店ID
+	TeamBuyingCategory string      `json:"team_buying_category"` // 团购类目(/分隔)
+	TeamBuyingName     string      `json:"team_buying_name"`     // 团购标题
+	TeamBuyingPrice    float64     `json:"team_buying_price"`    // 团购售价
+	PublicCommission   int         `json:"public_commission"`    // 公开佣金%
+	TeamBuyingDetail   string      `json:"team_buying_detail"`   // 团购详情
+	TeamBuyingLink     string      `json:"team_buying_link"`     // 分销链接
+	CreatedAt          *gtime.Time `json:"created_at"`           // 创建时间
+	IsDeleted          int         `json:"is_deleted"`           // 删除(0否 1是)
+	OperateType        int         `json:"operate_type"`         // 操作人类型(1商家 2后台)
+	EnterpriseId       string      `json:"enterprise_id"`        // 商家id
+	SubAccountId       int         `json:"sub_account_id"`       // 商家子账号id
+}
+
+type LocalInfoList struct {
+	MaxPage    int `json:"max_page"`
+	LocalInfos []*YounggeeLocalLifeInfo
+	//ProjectDetail []*ProjectDetail
+}

+ 1 - 1
app/model/youngee_talent_model/message.go

@@ -91,7 +91,7 @@ type YounggeeMutilMessInfo struct {
 	gmeta.Meta     `orm:"table:message_multi_info"`
 	Id             int         `orm:"id,primary"   json:"id"`                 // id,递增
 	MessageContent string      `orm:"message_content" json:"message_content"` //具体消息信息
-	MessType       int         `orm:"mess_type"     json:"mess_type"`         //消息类型
+	MessType       int         `orm:"mess_type"     json:"mess_type"`         //消息类型 1-6
 	TalentId       string      `orm:"talent_id"     json:"talent_id"`
 	CreatedAt      *gtime.Time `orm:"created_at"   json:"created_at"` // 消息创建时间
 	IsReaded       int         `orm:"is_readed"    json:"is_readed"`  // 是否已读,1表示未读,2表示已读

+ 46 - 25
app/model/youngee_talent_model/project_detail.go

@@ -40,11 +40,12 @@ type RecruitStrategy struct {
 	StrategyId        int     `json:"strategy_id"`         // 策略id
 	FollowersLow      int     `json:"followers_low"`       // 达人粉丝数下限
 	FollowersUp       int     `json:"followers_up"`        // 达人粉丝数上限
-	RecruitNumber     int     `json:"recruit_number"`      // 招募数量
-	Offer             int     `json:"offer"`               // 报价
-	TOffer            int     `json:"t_offer"`             // 达人报价报价
+	RecruitNumber     int     `json:"recruit_number"`      // 招募数量 每个策略招募的人数可以不一样
+	Offer             int     `json:"offer"`               // 商家or服务商的报价
+	TOffer            int     `json:"t_offer"`             // 达人真实所见的稿费,
 	ProjectId         string  `json:"project_id"`          // 所属项目id
 	ServiceCharge     float64 `json:"service_charge"`      // 平台服务费,稿费形式为产品置换时必填
+	ServiceRate       float64 `json:"service_rate"`        //服务费率
 	IsFit             int     `json:"is_fit"`              //此策略是否匹配成功
 }
 
@@ -126,31 +127,51 @@ type ProjectInfoSupplier struct {
 }
 
 type ProjectDetail struct {
-	gmeta.Meta          `orm:"table:project_info"`
-	ProjectId           string               `json:"project_id"`                                    // 项目id
-	ProjectName         string               `json:"project_name"`                                  // 项目名称
-	ProjectType         int                  `json:"project_type"`                                  // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectStatus       int                  `json:"project_status"`                                // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectPlatform     int                  `json:"project_platform"`                              // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
-	ProjectForm         int                  `json:"project_form"`                                  // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
-	TalentType          string               `json:"talent_type"`                                   // 达人类型
-	RecruitDdl          *gtime.Time          `json:"recruit_ddl"`                                   // 招募截止时间
-	ContentType         int                  `json:"content_type"`                                  // 内容形式,1代表图文,2代表视频
-	ProjectDetail       string               `json:"project_detail"`                                // 项目详情
-	ApplyNum            int                  `json:"apply_num"`                                     // 报名人数
-	ProductId           int                  `json:"product_id"`                                    // 关联商品id
-	EnterpriseId        string               `json:"enterprise_id"`                                 // 所属企业id
-	SupplierId          string               `json:"supplier_id"`                                   //所属服务商id
-	WatchedNum          int                  `json:"watched_num"`                                   // 浏览量
-	ProjectBrief        []*ProjectBrief      `orm:"with:project_id=project_id"`                     // 项目brief图
-	ProjectMaterial     []*ProjectMaterial   `orm:"with:project_id=project_id"`                     // 项目brief图
-	RecruitStrategy     []*RecruitStrategy   `orm:"with:project_id=project_id"`                     // 招募策略
-	Enterprise          *Enterprise          `orm:"with:enterprise_id=enterprise_id"`               // 商家信息
-	ProjectInfoSupplier *ProjectInfoSupplier `orm:"with:project_id=project_id"`                     //服务商项目特有信息
-	YounggeeSupplier    *YounggeeSupplier    `orm:"with:supplier_id=supplier_id"`                   // 服务商信息
+	gmeta.Meta      `orm:"table:project_info"`
+	ProjectId       string      `json:"project_id"`       // 项目id
+	ProjectName     string      `json:"project_name"`     // 项目名称
+	ProjectType     int         `json:"project_type"`     // 项目类型,1代表全流程项目,2代表专项项目
+	ProjectStatus   int         `json:"project_status"`   // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectPlatform int         `json:"project_platform"` // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectForm     int         `json:"project_form"`     // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+	TalentType      string      `json:"talent_type"`      // 达人类型
+	RecruitDdl      *gtime.Time `json:"recruit_ddl"`      // 招募截止时间
+	ContentType     int         `json:"content_type"`     // 内容形式,1代表图文,2代表视频
+	ProjectDetail   string      `json:"project_detail"`   // 项目详情
+	ApplyNum        int         `json:"apply_num"`        // 报名人数
+	ProductId       int         `json:"product_id"`       // 关联商品id
+	EnterpriseId    string      `json:"enterprise_id"`    // 所属企业id
+	//SupplierId          string               `json:"supplier_id"`                                   //所属服务商id
+	WatchedNum          int                  `json:"watched_num"`               // 浏览量
+	ProjectBrief        []*ProjectBrief      `orm:"with:project_id=project_id"` // 项目brief图
+	ProjectMaterial     []*ProjectMaterial   `orm:"with:project_id=project_id"` // 项目brief图
+	RecruitStrategy     []*RecruitStrategy   `orm:"with:project_id=project_id"` // 招募策略
+	Enterprise          *Enterprise          //商家信息
+	ProjectInfoSupplier *ProjectInfoSupplier //服务商单的project
+	YounggeeSupplier    *YounggeeSupplier    //服务商信息
 	PlatformInfo        *PlatformInfo        `orm:"with:platform_id=project_platform"`              //平台信息,目前为快手
 	ProductSnap         string               `orm:"product_snap"         json:"product_snap"`       // 商品信息快照
 	ProductPhotoSnap    string               `orm:"product_photo_snap"   json:"product_photo_snap"` // 商品图片快照
 	ServiceChargeRate   float64              `orm:"service_charge_rate" json:"service_charge_rate"` //服务费率
 	ViewNum             int                  `orm:"view_num" json:"view_num"`                       //浏览量
+	//违约说明
+	AutoTaskId   int           `orm:"auto_task_id" json:"auto_task_id"`
+	AutoDefaltId int           `orm:"auto_defalt_id" json:"auto_defalt_id"`
+	DraftDefault *DraftDefault `json:"draft_default"` //初稿违约说明
+	LinkDefault  *LinkDefault  `json:"link_breach"`   //链接违约说明
+	DataDefault  *DataDefault  `json:"data_default"`  //数据违约说明
+}
+
+type DraftDefault struct {
+	BreakTime   int `json:"break_time"`
+	BreakPecent int `json:"break_pecent"`
+}
+
+type LinkDefault struct {
+	BreakTime   int `json:"break_time"`
+	BreakPecent int `json:"break_pecent"`
+}
+type DataDefault struct {
+	BreakTime   int `json:"break_time"`
+	BreakPecent int `json:"break_pecent"`
 }

+ 40 - 13
app/model/youngee_talent_model/talent_income.go

@@ -1,6 +1,7 @@
 package youngee_talent_model
 
 import (
+	"github.com/gogf/gf/util/gmeta"
 	"youngmini_server/app/model"
 
 	"github.com/gogf/gf/os/gtime"
@@ -11,20 +12,29 @@ type GetTalentIncomeReq struct {
 	SearchInput string `json:"search_input"` // 模糊搜索内容
 }
 
+type TalentIncomeInfoAll struct {
+	TalentIncomeInfos []*TalentIncomeInfo `json:"talentIncomeInfos"`
+	TalentInfo        *TalentInfo         `json:"talentInfo"`
+}
+
 type TalentIncomeInfo struct {
-	Id              int         `json:"id"`              // 收益记录id
-	ProjectId       string      `json:"project_id"`      // 项目id
-	TaskId          string      `json:"task_id"`         // 任务id
-	BrandName       string      `json:"brand_name"`      // 品牌名称
-	TaskName        string      `json:"task_name"`       // 任务名称
-	Type            int         `json:"type"`            //种草、带货、本地生活
-	PhotoUrl        string      `json:"photo_url"`       //
-	TeamId          string      `json:"team_id"`         // young之团id
-	Income          float64     `json:"income"`          // 收益金额
-	IncomeType      int         `json:"income_type"`     // 收益类型,1-4分别表示任务收益、开团收益、样品返现、悬赏收益
-	WithdrawStatus  int         `json:"withdraw_status"` // 提现状态,1-3分别表示可提现、提现中、已提现
-	IncomeAt        *gtime.Time `json:"income_at"`       // 收益产生时间
-	WithdrawAt      *gtime.Time `json:"withdraw_at"`     // 提现时间
+	gmeta.Meta      `orm:"table:younggee_talent_income"`
+	Id              int         `orm:"id,primary"      json:"id"`              // 递增id
+	TalentId        string      `orm:"talent_id"       json:"talent_id"`       // 达人id,对应youngee_talent_info中id字段
+	ProjectId       string      `orm:"project_id"      json:"project_id"`      // 项目id
+	SelectionId     string      `orm:"selection_id"    json:"selection_id"`    // 选品id
+	TaskId          string      `orm:"task_id"         json:"task_id"`         // 任务id
+	SectaskId       string      `orm:"sectask_id"      json:"sectask_id"`      // 选品任务id
+	BrandName       string      `orm:"brand_name"      json:"brand_name"`      // 品牌名称
+	TaskName        string      `orm:"task_name"       json:"task_name"`       // 任务名称
+	TeamId          string      `orm:"team_id"         json:"team_id"`         // young之团id
+	Income          float64     `orm:"income"          json:"income"`          // 收益金额
+	IncomeType      int         `orm:"income_type"     json:"income_type"`     // 收益类型,1-4分别表示任务收益、开团收益、样品返现、悬赏收益
+	WithdrawStatus  int         `orm:"withdraw_status" json:"withdraw_status"` // 提现状态,1-3分别表示可提现、提现中、已提现
+	IncomeAt        *gtime.Time `orm:"income_at"       json:"income_at"`       // 收益产生时间
+	WithdrawAt      *gtime.Time `orm:"withdraw_at"     json:"withdraw_at"`     // 提现时间
+	PhotoUrl        string      `orm:"photo_url"       json:"photo_url"`       // 商品主图
+	Type            int         `orm:"type"            json:"type"`            // 选品or项目,1:项目,2:选品
 	PlatformIconUrl string      `json:"platform_icon_url"`
 }
 
@@ -32,3 +42,20 @@ type TalentPointInfo struct {
 	Point             int                                `json:"point"`               // 现有积分
 	TalentPointRecord []*model.YounggeeTalentPointRecord `json:"talent_point_record"` // 达人积分收益记录
 }
+
+type WithdrawDetail struct {
+	WithdrawId       string              `json:"withdraw_id"`     // 提现订单ID
+	TalentId         string              `json:"talent_id"`       // 达人id
+	WithdrawAmount   string              `json:"withdraw_amount"` // 提现金额
+	AmountPayable    string              `json:"amount_payable"`  // 应付金额
+	PayPoint         int                 `json:"pay_point"`       // 抵扣积分
+	IncomeIdList     string              `json:"income_id_list"`  // 该提现订单包含的income_id列表
+	ReceiveInfo      string              `json:"receive_info"`    // 收款信息 (JSON格式)
+	Status           int                 `json:"status"`          // 提现状态:1为提现中,2为已提现, 3为提现失败
+	BankType         int                 `json:"bank_type"`       // 到账方式,1为支付宝,2为银行卡
+	SubmitAt         string              `json:"submit_at"`       // 申请提交时间 (字符串格式,方便前端处理)
+	WithdrawAt       string              `json:"withdraw_at"`     // 提现时间 (字符串格式)
+	TaxAmount        float32             `json:"tax_amount"`      // 扣税
+	RejectReason     string              `json:"reject_reason"`   // 拒绝理由
+	TalentIncomeInfo []*TalentIncomeInfo `json:"talent_income_info"`
+}

+ 48 - 32
app/model/youngee_talent_model/task_income.go

@@ -1,32 +1,48 @@
-package youngee_talent_model
-
-import (
-	"github.com/gogf/gf/os/gtime"
-)
-
-type WithdrawTaskInfo struct {
-	TaskId          string      `json:"task_id"`
-	ProjectName     string      `json:"project_name"`
-	PlatformIconUrl string      `json:"platform_icon_url"`
-	PlatformName    string      `json:"platform_name"`
-	ProductPhoto    string      `json:"product_photo"`
-	TaskReward      float64     `json:"task_reward"`
-	SettleAmount    float64     `json:"settle_amount"`
-	CompleteDate    *gtime.Time `json:"complete_date"`
-	WithdrawDate    *gtime.Time `json:"withdraw_date"`
-	Checked         bool        `json:"checked"`
-}
-
-type WithdrawTaskInfoList struct {
-	CanWithdrawTaskInfoList []*WithdrawTaskInfo `json:"can_withdraw_task_info_list"`
-	WithdrawingTaskInfoList []*WithdrawTaskInfo `json:"withdrawing_task_info_list"`
-	WithdrawedTaskInfoList  []*WithdrawTaskInfo `json:"withdrawed_task_info_list"`
-}
-
-type WithdrawInfo struct {
-	IncomeIdList string  `json:"income_id_list"` // 收益记录id列表
-	Point        int     `json:"point"`          // 抵扣积分
-	TotalAmount  float64 `json:"total_amount"`   // 提现金额
-	RealAmount   float64 `json:"real_amount"`    // 实际金额
-	BankType     int     `json:"bank_type"`      // 到账方式
-}
+package youngee_talent_model
+
+import (
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gmeta"
+	"time"
+)
+
+type WithdrawTaskInfo struct {
+	TaskId          string      `json:"task_id"`
+	ProjectName     string      `json:"project_name"`
+	PlatformIconUrl string      `json:"platform_icon_url"`
+	PlatformName    string      `json:"platform_name"`
+	ProductPhoto    string      `json:"product_photo"`
+	TaskReward      float64     `json:"task_reward"`
+	SettleAmount    float64     `json:"settle_amount"`
+	CompleteDate    *gtime.Time `json:"complete_date"`
+	WithdrawDate    *gtime.Time `json:"withdraw_date"`
+	Checked         bool        `json:"checked"`
+}
+
+type WithdrawTaskInfoList struct {
+	CanWithdrawTaskInfoList []*WithdrawTaskInfo `json:"can_withdraw_task_info_list"`
+	WithdrawingTaskInfoList []*WithdrawTaskInfo `json:"withdrawing_task_info_list"`
+	WithdrawedTaskInfoList  []*WithdrawTaskInfo `json:"withdrawed_task_info_list"`
+}
+
+type WithdrawInfo struct {
+	IncomeIdList string  `json:"income_id_list"` // 收益记录id列表
+	TotalAmount  float64 `json:"total_amount"`   // 提现金额
+}
+
+type WithdrawRecord struct {
+	gmeta.Meta     `orm:"table:younggee_withdraw_record"`
+	WithdrawID     string    `orm:"withdraw_id" json:"withdraw_id"`
+	TalentID       string    `orm:"talent_id" json:"talent_id"`
+	WithdrawAmount float64   `orm:"withdraw_amount" json:"withdraw_amount"`
+	AmountPayable  float64   `orm:"amount_payable" json:"amount_payable"`
+	PayPoint       int       `orm:"pay_point" json:"pay_point"`
+	IncomeIDList   string    `orm:"income_id_list" json:"income_id_list"`
+	ReceiveInfo    string    `orm:"receive_info" json:"receive_info"`
+	Status         int       `orm:"status" json:"status"`
+	BankType       int       `orm:"bank_type" json:"bank_type"`
+	SubmitAt       time.Time `orm:"submit_at" json:"submit_at"`
+	WithdrawAt     time.Time `orm:"withdraw_at" json:"withdraw_at"`
+	TaxAmount      float32   `orm:"tax_amount" json:"tax_amount"`
+	RejectReason   string    `orm:"reject_reason" json:"reject_reason"`
+}

+ 78 - 7
app/model/youngee_talent_model/task_info.go

@@ -44,7 +44,7 @@ type YoungeeTaskInfo struct {
 	TalentPersonalInfoSnap string         `json:"talent_personal_info_snap"` // 达人个人信息快照
 	TalentPostAddrSnap     string         `json:"talent_post_addr_snap"`     // 收货地址快照
 	TaskReward             float64        `json:"task_reward"`               // 达人报酬
-	SettleAmount           int            `json:"settle_amount"`             // 达人实际所得(扣除违约扣款)
+	SettleAmount           float64        `json:"settle_amount"`             // 达人实际所得(扣除违约扣款)
 	AllPayment             float64        `json:"all_payment"`               // 企业支付总额
 	RealPayment            float64        `json:"real_payment"`              // 企业实际支付(扣除违约扣款)
 	ServiceRate            float64        `json:"service_rate"`              // 服务费率(千分比)
@@ -79,7 +79,69 @@ type YoungeeTaskInfo struct {
 	CurBreakAt             *gtime.Time    `json:"cur_break_at"`              // 当前阶段截止时间
 	SupplierId             int            `json:"supplier_id"`               // 服务商ID
 	SupplierStatus         int            `json:"supplier_status"`           // 服务商任务状态
-	DraftFee               int            `json:"draft_fee"`                 // 达人稿费
+	DraftFee               float64        `json:"draft_fee"`                 // 达人稿费
+	SupportFee             float64        `json:"support_fee"`               //提报价格
+	SignedTime             *gtime.Time    `json:"signed_time"`               // 签收时间
+	FansNum                int            `json:"fans_num"`                  // 粉丝数
+	VoteAvg                int            `json:"vote_avg"`                  // 平均点赞数
+	CommitAvg              int            `json:"commit_avg"`                // 平均评论数
+	BOperator              string         `json:"b_operator"`                // 商家确定达人操作人ID
+	BOperatorType          int            `json:"b_operator_type"`           // 商家操作人类型
+	SOperator              int            `json:"s_operator"`                // 服务商提报达人操作人ID
+	SOperatorType          int            `json:"s_operator_type"`           // 服务商操作人类型
+	SProjectId             int            `json:"s_project_id"`              // 服务商种草任务ID
+	ProjectDetail          *ProjectDetail `json:"project_detail"`            //项目详情
+}
+
+type YoungeeLocalTaskInfo struct {
+	gmeta.Meta             `orm:"table:youngee_local_task_info"`
+	TaskId                 string         `json:"task_id"`                   // 任务ID
+	LocalId                string         `json:"local_id"`                  // 项目ID
+	TalentId               string         `json:"talent_id"`                 // 达人ID
+	AccountId              int            `json:"account_id"`                // 账号ID
+	OpenId                 string         `json:"open_id"`                   // 快手唯一标识
+	StrategyId             int            `json:"strategy_id"`               // 报名选择的招募策略ID
+	TalentPlatformInfoSnap string         `json:"talent_platform_info_snap"` // 达人平台信息快照
+	TalentPersonalInfoSnap string         `json:"talent_personal_info_snap"` // 达人个人信息快照
+	TalentPostAddrSnap     string         `json:"talent_post_addr_snap"`     // 收货地址快照
+	TaskReward             float64        `json:"task_reward"`               // 达人报酬
+	SettleAmount           float64        `json:"settle_amount"`             // 达人实际所得(扣除违约扣款)
+	AllPayment             float64        `json:"all_payment"`               // 企业支付总额
+	RealPayment            float64        `json:"real_payment"`              // 企业实际支付(扣除违约扣款)
+	ServiceRate            float64        `json:"service_rate"`              // 服务费率(千分比)
+	ServiceCharge          float64        `json:"service_charge"`            // 服务费
+	FeeForm                int            `json:"fee_form"`                  // 稿费形式 1: 产品置换 2: 固定稿费 3: 自报价
+	ErrBreakRate           int            `json:"err_break_rate"`            // 未上传类型违约扣款比例(百分比)
+	ScriptBreakRate        int            `json:"script_break_rate"`         // 脚本超时违约扣款比例(百分比)
+	SketchBreakRate        int            `json:"sketch_break_rate"`         // 初稿超时违约扣款比例(百分比)
+	LinkBreakRate          int            `json:"link_break_rate"`           // 链接超时违约扣款比例(百分比)
+	DataBreakRate          int            `json:"data_break_rate"`           // 数据超时违约扣款比例(百分比)
+	TaskStage              int            `json:"task_stage"`                // 任务阶段
+	TaskStatus             int            `json:"task_status"`               // 商家任务状态 1: 待选 2: 已选 3: 落选
+	LogisticsStatus        int            `json:"logistics_status"`          // 发货状态 1: 待发货 2: 已发货 3: 已签收
+	BookStatus             int            `json:"book_status"`               // 脚本上传状态 1-5 表示各阶段
+	SketchStatus           int            `json:"sketch_status"`             // 初稿上传状态 1-5 表示各阶段
+	LinkStatus             int            `json:"link_status"`               // 链接上传状态 1-5 表示各阶段
+	DataStatus             int            `json:"data_status"`               // 数据上传状态 1-5 表示各阶段
+	CompleteStatus         int            `json:"complete_status"`           // 结束方式 1: 未结束 2: 正常结束 3: 反选失败 4: 被解约
+	UpdateAt               *gtime.Time    `json:"update_at"`                 // 更新时间
+	CreateDate             *gtime.Time    `json:"create_date"`               // 创建时间
+	SelectDate             *gtime.Time    `json:"select_date"`               // 反选时间
+	DeliveryDate           *gtime.Time    `json:"delivery_date"`             // 发货时间
+	CompleteDate           *gtime.Time    `json:"complete_date"`             // 结束时间
+	WithdrawDate           *gtime.Time    `json:"withdraw_date"`             // 提现时间
+	CurDefaultType         int            `json:"cur_default_type"`          // 当前处于的违约类型
+	WithdrawStatus         int            `json:"withdraw_status"`           // 提现状态 1-4 表示不同状态
+	LeadTeamId             string         `json:"lead_team_id"`              // 团长young之团ID
+	TeamId                 string         `json:"team_id"`                   // 团员young之团ID
+	SettleStatus           int            `json:"settle_status"`             // 结算状态 1: 待结算 2: 已结算
+	TeamIncome             float64        `json:"team_income"`               // 团长现金收益
+	TeamPoint              int            `json:"team_point"`                // 团长积分收益
+	CurBreakAt             *gtime.Time    `json:"cur_break_at"`              // 当前阶段截止时间
+	SupplierId             int            `json:"supplier_id"`               // 服务商ID
+	SupplierStatus         int            `json:"supplier_status"`           // 服务商任务状态
+	DraftFee               float64        `json:"draft_fee"`                 // 达人稿费
+	SupportFee             float64        `json:"support_fee"`               //提报价格
 	SignedTime             *gtime.Time    `json:"signed_time"`               // 签收时间
 	FansNum                int            `json:"fans_num"`                  // 粉丝数
 	VoteAvg                int            `json:"vote_avg"`                  // 平均点赞数
@@ -93,11 +155,20 @@ type YoungeeTaskInfo struct {
 }
 
 type SignTaskInfo struct {
-	ProjectId  string `json:"project_id"`
-	OpenID     string `json:"open_id"` //选中快手账号唯一标识
-	AddressId  uint64 `json:"address_id"`
-	StrategyId int    `json:"strategy_id"`
-	Offer      int    `json:"offer"`
+	ProjectId  string  `json:"project_id"`
+	SProjectId int     `json:"s_project_id"` //服务商加入商单
+	OpenID     string  `json:"open_id"`      //选中快手账号唯一标识
+	AddressId  uint64  `json:"address_id"`
+	StrategyId int     `json:"strategy_id"`
+	Offer      float64 `json:"offer"` //最终提交时的稿费
+}
+
+type SignLocalTaskInfo struct {
+	LocalId    string  `json:"local_id"`
+	SLocalId   int     `json:"s_local_id"` //服务商加入商单
+	OpenID     string  `json:"open_id"`    //选中快手账号唯一标识
+	StrategyId int     `json:"strategy_id"`
+	Offer      float64 `json:"offer"` //最终提交时的稿费
 }
 
 type TaskInfoBrief struct {

+ 7 - 7
app/model/youngee_talent_model/task_link.go

@@ -1,7 +1,7 @@
-package youngee_talent_model
-
-type AddTaskLinkRequest struct {
-	TaskId   string `orm:"task_id"           json:"task_id"`   // 任务id
-	LinkUrl  string `orm:"title"           json:"link_url"`    // 链接url
-	PhotoUrl string `orm:"content"           json:"photo_url"` // 截图url
-}
+package youngee_talent_model
+
+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(弃用)
+}

+ 1 - 1
app/service/youngee_talent_service/log_message.go

@@ -52,7 +52,7 @@ func GetMessageList(r *ghttp.Request) *TalentHttpResult {
 
 	// 定义不同类型的消息列表
 	var MessList []youngee_talent_model.YounggeeMutilMessInfo
-	err = g.Model("message_system").Where("talent_id = ? and is_deleted = 0", tid).Order("created_at desc").Scan(&MessList)
+	err = g.Model("message_multi_info").Where("talent_id = ? and is_deleted = 0", tid).Order("created_at desc").Scan(&MessList)
 
 	if err != nil {
 		log.Println("GetMessage error:", err)

+ 218 - 132
app/service/youngee_talent_service/talent_income.go

@@ -1,22 +1,14 @@
 package youngee_talent_service
 
 import (
-	"context"
-	"encoding/json"
-	"fmt"
-	"math/rand"
 	"strconv"
-	"strings"
-	"time"
 	"youngmini_server/app/dao"
 	"youngmini_server/app/model"
 	"youngmini_server/app/model/youngee_talent_model"
 	"youngmini_server/app/utils"
 
-	"github.com/gogf/gf/database/gdb"
 	"github.com/gogf/gf/frame/g"
 	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
 )
 
 func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
@@ -24,19 +16,16 @@ func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
-
 	var getTalentIncomeReq *youngee_talent_model.GetTalentIncomeReq
 	err = r.ParseForm(&getTalentIncomeReq)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: "params error"}
 	}
+	var TalentIncomeInfoRes youngee_talent_model.TalentIncomeInfoAll
+	g.DB().Model("youngee_talent_info").Where("id=?", tid).Scan(&TalentIncomeInfoRes.TalentInfo)
 
-	var talentIncomerep []youngee_talent_model.TalentIncomeInfo
-	var talentIncomeList []*model.YounggeeTalentIncome
-	err = g.DB().Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = ?", tid, getTalentIncomeReq.Type).Scan(&talentIncomeList)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: err.Error()}
-	}
+	var talentIncomeList []*youngee_talent_model.TalentIncomeInfo
+	err = g.DB().Model("younggee_talent_income").Where("talent_id = ? and withdraw_status = ?", tid, getTalentIncomeReq.Type).Scan(&talentIncomeList)
 
 	platformMap := make(map[string]model.InfoThirdPlatform)
 	platformInfo := []*model.InfoThirdPlatform{}
@@ -51,10 +40,10 @@ func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
 		}
 	}
 
-	for _, v := range talentIncomeList { //遍历收入表中的所有信息
+	for _, v := range talentIncomeList {
 		var platform model.InfoThirdPlatform
 		switch v.Type {
-		case 1: //种草收入
+		case 1:
 			projectPlatform, err := g.Model(dao.ProjectInfo.Table).Fields("project_platform").Where("project_id = ?", v.ProjectId).Value()
 			if err != nil {
 				return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
@@ -78,9 +67,9 @@ func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
 				PlatformIconUrl: platform.PlatformIcon,
 			}
 
-			talentIncomerep = append(talentIncomerep, talentIncomeInfo)
+			TalentIncomeInfoRes.TalentIncomeInfos = append(TalentIncomeInfoRes.TalentIncomeInfos, &talentIncomeInfo)
 			break
-		case 2: //带货收入
+		case 2:
 			platformId, err := g.Model(dao.YounggeeSelectionInfo.Table).Fields("platform").Where("selection_id = ?", v.SelectionId).Value()
 			if err != nil {
 				return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
@@ -104,128 +93,225 @@ func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
 				PlatformIconUrl: platform.PlatformIcon,
 			}
 
-			talentIncomerep = append(talentIncomerep, talentIncomeInfo)
+			TalentIncomeInfoRes.TalentIncomeInfos = append(TalentIncomeInfoRes.TalentIncomeInfos, &talentIncomeInfo)
 			break
 		default:
 		}
 
 	}
 
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: talentIncomerep}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: TalentIncomeInfoRes}
 }
 
-// 提现
-func Withdraw(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: err.Error()}
-	}
-
-	var DataInfoReq *youngee_talent_model.WithdrawInfo
-	err = r.ParseForm(&DataInfoReq)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-	incomeIdStrList := strings.Split(DataInfoReq.IncomeIdList, ",")
-	incomeIdList := utils.TypeTran.String2Int(incomeIdStrList)
-
-	// 检验是否均处于可提现状态,且达人id是否对应
-	var incomeList []model.YounggeeTalentIncome
-	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("id IN (?)", incomeIdList).Scan(&incomeList)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: err.Error()}
-	}
-	if len(incomeIdList) != len(incomeList) {
-		return &TalentHttpResult{Code: -3, Msg: "Req IncomeIdList Error"}
-	}
-
-	// 检查达人积分是否足够
-	totalPoint, err := g.Model(dao.YoungeeTalentInfo.Table).Fields("point").Where("id = ?", tid).Value()
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: err.Error()}
-	}
-	if totalPoint.Int() < DataInfoReq.Point {
-		return &TalentHttpResult{Code: -3, Msg: "Req Point Error"}
-	}
-
-	// 查询达人提现到账账户信息
-	var talentBank model.YounggeeTalentBank
-	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: err.Error()}
-	}
-	bankJsons, errs := json.Marshal(talentBank) //转换成JSON返回的是byte[]
-	if errs != nil {
-		return &TalentHttpResult{Code: -7, Msg: err.Error()}
-	}
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		s1 := tid[7:]
-		s2 := fmt.Sprintf("%d", gtime.Now().YearDay())
-		s3 := fmt.Sprintf("%02v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(100))
-		s := "6" + s1 + s2 + s3
-		// 插入提现记录
-		_, err1 := tx.Ctx(ctx).Model(dao.YounggeeWithdrawRecord.Table).Data(model.YounggeeWithdrawRecord{
-			WithdrawId:     s,
-			TalentId:       tid,
-			WithdrawAmount: float64(DataInfoReq.TotalAmount),
-			AmountPayable:  float64(DataInfoReq.RealAmount),
-			IncomeIdList:   DataInfoReq.IncomeIdList,
-			PayPoint:       DataInfoReq.Point,
-			ReceiveInfo:    string(bankJsons),
-			BankType:       2,
-			Status:         1,
-			SubmitAt:       gtime.Now(),
-		}).InsertAndGetId()
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// 更新income表中提现状态
-		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// 更新talent表中提现金额
-		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Increment("withdrawing", float64(DataInfoReq.TotalAmount))
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Decrement("canwithdraw", float64(DataInfoReq.TotalAmount))
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// 达人消息
-		for _, incomeInfo := range incomeList {
-			messageTypeId := [4]int{25, 26, 27, 28}
-			messageInfo := model.YounggeeMessageInfo{
-				MessageId:   messageTypeId[incomeInfo.IncomeType-1],
-				MessageType: 2,
-				CreatedAt:   gtime.Now(),
-				ProjectName: incomeInfo.TaskName,
-				IsReaded:    0,
-				IsDeleted:   0,
-			}
-			_, err = tx.Ctx(ctx).Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
-			if err != nil {
-				fmt.Printf("[Withdraw Transaction] Error:%+v\n", err)
-				return err
-			}
-		}
-		return nil
-	})
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "Add Withdraw Record failed: " + err.Error()}
-	}
+//func GetTalentIncomeInfo(r *ghttp.Request) *TalentHttpResult {
+//	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+//	}
+//
+//	var getTalentIncomeReq *youngee_talent_model.GetTalentIncomeReq
+//	err = r.ParseForm(&getTalentIncomeReq)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -2, Msg: "params error"}
+//	}
+//
+//	var talentIncomerep []youngee_talent_model.TalentIncomeInfo
+//	var talentIncomeList []*model.YounggeeTalentIncome
+//	fmt.Println("222", getTalentIncomeReq.Type)
+//	err = g.DB().Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = ?", tid, 2).Scan(&talentIncomeList)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//	}
+//
+//	platformMap := make(map[string]model.InfoThirdPlatform)
+//	platformInfo := []*model.InfoThirdPlatform{}
+//	if len(talentIncomeList) != 0 {
+//		err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
+//		}
+//
+//		for i, _ := range platformInfo {
+//			platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
+//		}
+//	}
+//
+//	for _, v := range talentIncomeList {
+//		var platform model.InfoThirdPlatform
+//		switch v.Type {
+//		case 1:
+//			projectPlatform, err := g.Model(dao.ProjectInfo.Table).Fields("project_platform").Where("project_id = ?", v.ProjectId).Value()
+//			if err != nil {
+//				return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
+//			}
+//			platform = platformMap[projectPlatform.String()]
+//
+//			talentIncomeInfo := youngee_talent_model.TalentIncomeInfo{
+//				Id:              v.Id,
+//				ProjectId:       v.ProjectId,
+//				TaskId:          v.TaskId,
+//				Type:            v.Type,
+//				BrandName:       v.BrandName,
+//				TaskName:        v.TaskName,
+//				PhotoUrl:        v.PhotoUrl,
+//				TeamId:          v.TeamId,
+//				Income:          v.Income,
+//				IncomeType:      v.IncomeType,
+//				WithdrawStatus:  v.WithdrawStatus,
+//				IncomeAt:        v.IncomeAt,
+//				WithdrawAt:      v.WithdrawAt,
+//				PlatformIconUrl: platform.PlatformIcon,
+//			}
+//
+//			talentIncomerep = append(talentIncomerep, talentIncomeInfo)
+//			break
+//		case 2:
+//			platformId, err := g.Model(dao.YounggeeSelectionInfo.Table).Fields("platform").Where("selection_id = ?", v.SelectionId).Value()
+//			if err != nil {
+//				return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
+//			}
+//			platform = platformMap[platformId.String()]
+//
+//			talentIncomeInfo := youngee_talent_model.TalentIncomeInfo{
+//				Id:              v.Id,
+//				ProjectId:       v.SelectionId,
+//				TaskId:          v.SectaskId,
+//				Type:            v.Type,
+//				BrandName:       v.BrandName,
+//				TaskName:        v.TaskName,
+//				PhotoUrl:        v.PhotoUrl,
+//				TeamId:          v.TeamId,
+//				Income:          v.Income,
+//				IncomeType:      v.IncomeType,
+//				WithdrawStatus:  v.WithdrawStatus,
+//				IncomeAt:        v.IncomeAt,
+//				WithdrawAt:      v.WithdrawAt,
+//				PlatformIconUrl: platform.PlatformIcon,
+//			}
+//
+//			talentIncomerep = append(talentIncomerep, talentIncomeInfo)
+//			break
+//		default:
+//		}
+//
+//	}
+//
+//	return &TalentHttpResult{Code: 0, Msg: "success", Data: talentIncomerep}
+//}
 
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
+// 提现
+//func Withdraw(r *ghttp.Request) *TalentHttpResult {
+//	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+//	}
+//
+//	var DataInfoReq *youngee_talent_model.WithdrawInfo
+//	err = r.ParseForm(&DataInfoReq)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+//	}
+//	incomeIdStrList := strings.Split(DataInfoReq.IncomeIdList, ",")
+//	incomeIdList := utils.TypeTran.String2Int(incomeIdStrList)
+//
+//	// 检验是否均处于可提现状态,且达人id是否对应
+//	var incomeList []model.YounggeeTalentIncome
+//	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("id IN (?)", incomeIdList).Scan(&incomeList)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -4, Msg: err.Error()}
+//	}
+//	if len(incomeIdList) != len(incomeList) {
+//		return &TalentHttpResult{Code: -3, Msg: "Req IncomeIdList Error"}
+//	}
+//
+//	//// 检查达人积分是否足够
+//	//totalPoint, err := g.Model(dao.YoungeeTalentInfo.Table).Fields("point").Where("id = ?", tid).Value()
+//	//if err != nil {
+//	//	return &TalentHttpResult{Code: -5, Msg: err.Error()}
+//	//}
+//	//if totalPoint.Int() < DataInfoReq.Point {
+//	//	return &TalentHttpResult{Code: -3, Msg: "Req Point Error"}
+//	//}
+//
+//	// 查询达人提现到账账户信息
+//	var talentBank model.YounggeeTalentBank
+//	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -6, Msg: err.Error()}
+//	}
+//	bankJsons, errs := json.Marshal(talentBank) //转换成JSON返回的是byte[]
+//	if errs != nil {
+//		return &TalentHttpResult{Code: -7, Msg: err.Error()}
+//	}
+//
+//	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
+//		s1 := tid[7:]
+//		s2 := fmt.Sprintf("%d", gtime.Now().YearDay())
+//		s3 := fmt.Sprintf("%02v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(100))
+//		s := "6" + s1 + s2 + s3
+//		// 插入提现记录
+//		_, err1 := tx.Ctx(ctx).Model(dao.YounggeeWithdrawRecord.Table).Data(model.YounggeeWithdrawRecord{
+//			WithdrawId:     s,
+//			TalentId:       tid,
+//			WithdrawAmount: float64(DataInfoReq.TotalAmount),
+//			AmountPayable:  float64(DataInfoReq.RealAmount),
+//
+//			IncomeIdList: DataInfoReq.IncomeIdList,
+//			//PayPoint:       DataInfoReq.Point,
+//			ReceiveInfo: string(bankJsons),
+//			BankType:    2,
+//			Status:      1,
+//			SubmitAt:    gtime.Now(),
+//		}).InsertAndGetId()
+//		if err1 != nil {
+//			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+//			return err1
+//		}
+//
+//		// 更新income表中提现状态
+//		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
+//		if err1 != nil {
+//			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+//			return err1
+//		}
+//
+//		// 更新talent表中提现金额
+//		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Increment("withdrawing", float64(DataInfoReq.TotalAmount))
+//		if err1 != nil {
+//			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+//			return err1
+//		}
+//		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Decrement("canwithdraw", float64(DataInfoReq.TotalAmount))
+//		if err1 != nil {
+//			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+//			return err1
+//		}
+//
+//		// 达人消息
+//		for _, incomeInfo := range incomeList {
+//			messageTypeId := [4]int{25, 26, 27, 28}
+//			messageInfo := model.YounggeeMessageInfo{
+//				MessageId:   messageTypeId[incomeInfo.IncomeType-1],
+//				MessageType: 2,
+//				CreatedAt:   gtime.Now(),
+//				ProjectName: incomeInfo.TaskName,
+//				IsReaded:    0,
+//				IsDeleted:   0,
+//			}
+//			_, err = tx.Ctx(ctx).Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
+//			if err != nil {
+//				fmt.Printf("[Withdraw Transaction] Error:%+v\n", err)
+//				return err
+//			}
+//		}
+//		return nil
+//	})
+//	if err != nil {
+//		return &TalentHttpResult{Code: -8, Msg: "Add Withdraw Record failed: " + err.Error()}
+//	}
+//
+//	return &TalentHttpResult{Code: 0, Msg: "success"}
+//}
 
 // 查询积分明细
 func GetTalentPointInfo(r *ghttp.Request) *TalentHttpResult {

+ 337 - 0
app/service/youngee_task_service/local_life_info.go

@@ -0,0 +1,337 @@
+package youngee_task_service
+
+import (
+	"fmt"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/glog"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gconv"
+	"reflect"
+	"sort"
+	"strconv"
+	"youngmini_server/app/dao"
+	"youngmini_server/app/model/youngee_talent_model"
+	"youngmini_server/app/utils"
+)
+
+func GetLocalLifeList(r *ghttp.Request) *TalentHttpResult {
+	pageIndex := r.GetQueryInt("idx", -1)
+	cntPerPage := r.GetQueryInt("cnt", -1)
+	//组合筛选
+	platform := r.Get("platform", "")       //抖音、快手、红Book、B站、微博
+	taskForm := r.Get("task_form", "")      //任务形式,1-2分别代表线下探店,素材分发
+	contentType := r.Get("contenttype", "") //图文形式、视频形式
+	createTime := r.Get("createTime", "")   //任务上线时间
+	//categoryForm := r.Get("categoryform", "") ////商品类目 智能家居、食品饮料等20种
+	//todo 城市参数?
+	//Location := r.GetQueryString("city", "")  //门店store所属城市,
+
+	//排根据浏览量排序
+	viewOrder := r.GetQueryInt("pageViewOrder", -1) //根据哪个字段排序
+
+	//仅稿费”+“稿费+赠品"。这个在recruit表中,得到列表之后进行排序
+	feeForm := r.GetInt("feeform", 0)
+
+	searchValue := r.Get("searchvalue")
+	if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
+		return &TalentHttpResult{Code: -1, Msg: "参数错误"}
+	}
+	// 如果有任务形式的过滤条件,则将过滤条件保存于taskModeList
+	var taskFormList []interface{}
+	if taskForm != nil {
+		if reflect.TypeOf(taskForm).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
+		}
+
+		taskFormList = make([]interface{}, 0)
+		taskFormList = taskForm.([]interface{})
+	} else {
+		taskFormList = make([]interface{}, 0)
+	}
+
+	// 如果有平台的过滤条件,则将平台列表保存于platformList
+	var platformList []interface{}
+	if platform != nil {
+		if reflect.TypeOf(platform).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
+		}
+
+		platformList = make([]interface{}, 0)
+		platformList = platform.([]interface{})
+	}
+
+	// 如果有内容形式的过滤条件,则将过滤条件保存于taskModeList
+	var contentTypeList []interface{}
+	if contentType != nil {
+		if reflect.TypeOf(contentType).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
+		}
+
+		contentTypeList = make([]interface{}, 0)
+		contentTypeList = contentType.([]interface{})
+	}
+
+	// 上线时间
+	var createTimeList []interface{}
+	if createTime != nil {
+		if reflect.TypeOf(createTime).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
+		}
+		createTimeList = make([]interface{}, 0)
+		createTimeList = createTime.([]interface{})
+	}
+
+	// 如果有商品类目的过滤条件,则将过滤条件保存于categoryFormList
+	//var categoryFormList []interface{}
+	//if categoryForm != nil {
+	//	if reflect.TypeOf(categoryForm).Kind() != reflect.Slice {
+	//		return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
+	//	}
+	//
+	//	categoryFormList = make([]interface{}, 0)
+	//	categoryFormList = categoryForm.([]interface{})
+	//}
+	//if len(categoryFormList) > 0 {
+	//	// 使用 categoryFormList 进行某些操作
+	//	fmt.Println("Filtered categoryFormList:", categoryFormList)
+	//}
+
+	// 构造查询的条件
+	startId := pageIndex * cntPerPage
+	// whereStr := fmt.Sprintf("(project_status >= %d and project_status <> %d and project_type = 1)", projectStatusRecruiting, projectStatusInvalid)
+	whereStr := fmt.Sprintf("(task_status >= %d and  local_type = 1)", projectStatusRecruiting)
+	if platformList != nil {
+		whereStr = whereStr + " and local_platform in ("
+		for _, v := range platformList {
+			whereStr += v.(string) + ", "
+		}
+
+		whereStr = whereStr[0 : len(whereStr)-2]
+		whereStr += ")"
+	}
+
+	if contentTypeList != nil {
+		whereStr = whereStr + " and content_type in ("
+		for _, v := range contentTypeList {
+			whereStr += v.(string) + ", "
+		}
+
+		whereStr = whereStr[0 : len(whereStr)-2]
+		whereStr += ")"
+	}
+
+	// 处理 selectionFormList (创建时间的过滤条件)
+	if createTimeList != nil {
+		whereStr += " AND created_at >= (NOW() - INTERVAL "
+		for _, v := range createTimeList {
+			switch v.(string) {
+			case "1": // 近7天
+				whereStr += "7 DAY"
+			case "2": // 近30天
+				whereStr += "30 DAY"
+			case "3": // 近90天
+				whereStr += "90 DAY"
+			default:
+				continue // 无效的过滤条件,跳过
+			}
+		}
+		whereStr += ")"
+	}
+
+	if taskFormList != nil {
+		whereStr += " and task_form in ("
+		for _, v := range taskFormList {
+			whereStr += v.(string) + ", "
+		}
+
+		whereStr = whereStr[0 : len(whereStr)-2]
+		whereStr += ")"
+	}
+
+	if searchValue != nil {
+		whereStr += " and local_name like '%" + searchValue.(string) + "%'"
+	}
+
+	fmt.Println("whereStr:-----》 ", whereStr)
+
+	// 查询所有project
+	var localList = []youngee_talent_model.YounggeeLocalLifeInfo{}
+	err := g.Model(dao.ProjectInfo.Table).Where(whereStr).Scan(&localList)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "查询数据库失败"}
+	}
+
+	// 判断请求页面是否超过最大页面
+	c, err := g.DB().Model("younggee_local_life_info").Fields("local_id").Where(whereStr).Count()
+
+	if c <= 0 {
+		return &TalentHttpResult{Code: -4, Msg: "has no fullproject", Data: nil}
+	}
+
+	maxPage := c / cntPerPage
+	if c%cntPerPage > 0 {
+		maxPage += 1
+	}
+
+	if pageIndex+1 > maxPage {
+		return &TalentHttpResult{Code: -5, Msg: "over max page"}
+	}
+
+	var localInfoList = youngee_talent_model.LocalInfoList{}
+	err = g.DB().Model("younggee_local_life_info").WithAll().Where(whereStr).
+		Order("task_status ASC,recruit_ddl DESC").Limit(startId, cntPerPage).Scan(&localInfoList.LocalInfos)
+
+	if err != nil {
+		return &TalentHttpResult{Code: -6, Msg: "查询数据库失败"}
+	}
+
+	// 遍历projectList
+	for i, local := range localInfoList.LocalInfos {
+		//处理浏览量
+		localViewKey := "local:view:" + gconv.String(local.LocalId)
+		//redis中取浏览量 返回的是gvar.Var类型。 不存咋则为nil。经过viewCount.Int变成0
+		viewCount, err := g.Redis().DoVar("GET", localViewKey)
+		if err != nil {
+			glog.Error(err)
+			return &TalentHttpResult{Code: 0, Msg: "Redis error"}
+		}
+		localInfoList.LocalInfos[i].WatchNum = viewCount.Int()
+		// 根据 WatchedNum 从高到低排序
+		if viewOrder != -1 {
+			sort.Slice(localInfoList.LocalInfos, func(i, j int) bool {
+				return localInfoList.LocalInfos[i].WatchNum > localInfoList.LocalInfos[j].WatchNum
+			})
+		}
+	}
+	localInfoList.MaxPage = maxPage
+	var filteredLocalInfo []*youngee_talent_model.YounggeeLocalLifeInfo
+	//筛选出“仅稿费”+“稿费+赠品”任务,
+	//只要策略中有 无费置换 之外的fee_form就是有稿费,donate=1就是有赠品
+	if feeForm != 0 {
+		for _, local := range localInfoList.LocalInfos {
+			if local.Donate == 1 {
+				filteredLocalInfo = append(filteredLocalInfo, local)
+				continue // 如果满足条件1,直接跳过后续条件判断
+			}
+
+			// 条件2:RecruitStrategy 中存在 fee_form 不等于 1 的数据
+			for _, strategy := range local.RecruitStrategys {
+				if strategy.FeeForm != 1 {
+					filteredLocalInfo = append(filteredLocalInfo, local)
+					break // 找到符合条件的策略,跳出当前循环,避免重复添加
+				}
+			}
+		}
+		localInfoList.LocalInfos = filteredLocalInfo
+
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: localInfoList}
+
+}
+
+func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
+	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	local_id := r.GetQueryInt("id", 0)
+	//通过首页进入的详情页,获取服务商id,younggee_supplier表
+	enterprise_id := r.GetQueryString("enterprise_id", "")
+	//通过扫服务商码进入的详情页,获取服务商id,younggee_supplier表
+	//supplier_id := r.GetQueryString("supplier_id", "")
+	s_local_id := r.GetQueryString("s_local_id", "")
+	localInfoSupplier := youngee_talent_model.LocalInfoSupplier{}
+	if s_local_id != "" {
+		// 来自服务商
+		err := g.DB().Model("younggee_s_local__info").Where("s_local_id=?", s_local_id).Scan(&localInfoSupplier)
+		if err != nil {
+			fmt.Println("projectInfoSupplier err:", err.Error())
+		}
+	}
+	// Redis key
+	loalViewKey := "local:view:" + strconv.Itoa(local_id)
+	userViewedKey := "user:viewed:" + tid + ":" + strconv.Itoa(local_id)
+	if local_id == 0 {
+		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
+	}
+	//在redis中增加浏览量
+	// Check if the user has already viewed the product
+	//DoVar方便进行类型转化
+	viewed, err := g.Redis().DoVar("GET", userViewedKey)
+	if err != nil {
+		glog.Error(err)
+		return &TalentHttpResult{Code: 0, Msg: "Redis error"}
+	}
+	var LocalDetail *youngee_talent_model.LocalInfoDetail
+	err = g.DB().Model("younggee_local_life_info").WithAll().Where("id", local_id).Scan(&LocalDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+	}
+
+	//违约
+	one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", LocalDetail.AutoDefaultId).One()
+	one2, err := g.DB().Model("info_auto_task").Where("auto_task_id=?", LocalDetail.AutoTaskId).One()
+	LocalDetail.DraftDefault.BreakPecent = one["sketch_replace_not_upload"].Int()
+	LocalDetail.LinkDefault.BreakPecent = one["link_replace_not_upload"].Int()
+	LocalDetail.DataDefault.BreakPecent = one["data_replace_not_upload"].Int()
+	LocalDetail.DraftDefault.BreakTime = one2["draft_default"].Int()
+	LocalDetail.DraftDefault.BreakTime = one2["link_breach"].Int()
+	LocalDetail.DraftDefault.BreakTime = one2["case_close_default"].Int()
+
+	if viewed.IsNil() {
+		// User hasn't viewed this product yet, increase the view count
+		_, err = g.Redis().Do("INCR", loalViewKey)
+
+		if err != nil {
+			glog.Error(err)
+			return &TalentHttpResult{Code: 0, Msg: "Redis error"}
+		}
+		// Mark the product as viewed by this user
+		_, err = g.Redis().Do("SET", userViewedKey, true)
+		if err != nil {
+			glog.Error(err)
+			return &TalentHttpResult{Code: 0, Msg: "Redis error"}
+		}
+	}
+	viewNum, err := g.Redis().DoVar("GET", loalViewKey)
+	if err != nil {
+		fmt.Println("获取浏览量失败")
+	}
+	LocalDetail.WatchedNum = viewNum.Int()
+
+	//浏览历史
+	currentDate := gtime.Now().Format("Ymd")
+	// 设计 Redis Key
+	redisBrowseKey := fmt.Sprintf("browseLocal:%s:%s", currentDate, tid)
+	fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
+	// 将 project_id 添加到 Redis 中的 SET
+	_, err = g.Redis().Do("SADD", redisBrowseKey, local_id)
+	if err != nil {
+		return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}
+	}
+	// 设置 Key 的过期时间为 7 天
+	_, err = g.Redis().Do("EXPIRE", redisBrowseKey, 7*24*60*60) // 7 天的秒数
+	if err != nil {
+		return &TalentHttpResult{Code: 0, Msg: "Redis 设置过期时间失败"}
+	}
+
+	if enterprise_id != "" { //project来自商家
+		var enterprise *youngee_talent_model.Enterprise
+		err = g.DB().Model("enterprise").WithAll().Where("enterprise_id", enterprise_id).Scan(&enterprise)
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+		}
+		LocalDetail.Enterprise = enterprise
+	}
+	if s_local_id != "" {
+		// 来自服务商
+		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
+		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", localInfoSupplier.SupplierID).Scan(&younggeeSupplier)
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+		}
+		LocalDetail.YounggeeSupplier = younggeeSupplier
+		LocalDetail.LocalInfoSupplier = &localInfoSupplier
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: LocalDetail}
+}

+ 24 - 7
app/service/youngee_task_service/project_info.go

@@ -49,7 +49,7 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 	viewOrder := r.GetQueryInt("pageViewOrder", -1) //根据哪个字段排序
 
 	//仅稿费”+“稿费+赠品"。这个在recruit表中,得到列表之后进行排序
-	feeForm := r.Get("feeform", nil)
+	feeForm := r.GetInt("feeform", 0)
 
 	searchValue := r.Get("searchvalue")
 	if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
@@ -246,7 +246,7 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 	var filteredProjects []*youngee_talent_model.ProjectInfo
 	//筛选出“仅稿费”+“稿费+赠品”任务,
 	//只要策略中有 无费置换 之外的fee_form就是有稿费,projectform是 商品寄拍 和 虚拟产品测评 ,就是有赠品
-	if feeForm != nil {
+	if feeForm != 0 {
 
 		for _, project := range projectInfoList.ProjectInfos {
 			// 条件1:筛选出所有 project_form 为 1 或 3 的项目
@@ -277,9 +277,16 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	//通过首页进入的详情页,获取服务商id,younggee_supplier表
 	enterprise_id := r.GetQueryString("enterprise_id", "")
 	//通过扫服务商码进入的详情页,获取服务商id,younggee_supplier表
-	supplier_id := r.GetQueryString("supplier_id", "")
-	fmt.Println("enterprise_id----:", enterprise_id)
-	fmt.Println("supplier_id----:", supplier_id)
+	//supplier_id := r.GetQueryString("supplier_id", "")
+	s_project_id := r.GetQueryString("s_project_id", "")
+	projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
+	if s_project_id != "" {
+		// 来自服务商
+		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
+		if err != nil {
+			fmt.Println("projectInfoSupplier err:", err.Error())
+		}
+	}
 	// Redis key
 	projectViewKey := "project:view:" + strconv.Itoa(pid)
 	userViewedKey := "user:viewed:" + tid + ":" + strconv.Itoa(pid)
@@ -299,6 +306,15 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -3, Msg: err.Error()}
 	}
+	//违约
+	one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", ProjectDetail.AutoDefaltId).One()
+	one2, err := g.DB().Model("info_auto_task").Where("auto_task_id=?", ProjectDetail.AutoTaskId).One()
+	ProjectDetail.DraftDefault.BreakPecent = one["sketch_replace_not_upload"].Int()
+	ProjectDetail.LinkDefault.BreakPecent = one["link_replace_not_upload"].Int()
+	ProjectDetail.DataDefault.BreakPecent = one["data_replace_not_upload"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["draft_default"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["link_breach"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["case_close_default"].Int()
 
 	if viewed.IsNil() {
 		// User hasn't viewed this product yet, increase the view count
@@ -345,14 +361,15 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 		}
 		ProjectDetail.Enterprise = enterprise
 	}
-	if supplier_id != "" {
+	if s_project_id != "" {
 		// 来自服务商
 		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
-		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", supplier_id).Scan(&younggeeSupplier)
+		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
 		if err != nil {
 			return &TalentHttpResult{Code: -3, Msg: err.Error()}
 		}
 		ProjectDetail.YounggeeSupplier = younggeeSupplier
+		ProjectDetail.ProjectInfoSupplier = &projectInfoSupplier
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}

+ 13 - 0
app/service/youngee_task_service/task_book.go

@@ -0,0 +1,13 @@
+package youngee_task_service
+
+import "github.com/gogf/gf/net/ghttp"
+
+// 提交探店申请
+func AddTaskBook(r *ghttp.Request) *TalentHttpResult {
+
+}
+
+// 预约探店审核历史
+func GetTaskBook(r *ghttp.Request) *TalentHttpResult {
+
+}

+ 239 - 199
app/service/youngee_task_service/task_income.go

@@ -1,199 +1,239 @@
-package youngee_task_service
-
-import (
-	"context"
-	"encoding/json"
-	"fmt"
-	"math/rand"
-	"strconv"
-	"strings"
-	"time"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/youngee_talent_model"
-	"youngmini_server/app/utils"
-
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-)
-
-func GetWithdrawTaskInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	withdrawTaskInfoList := youngee_talent_model.WithdrawTaskInfoList{}
-	// 获取可提现任务列表
-	var taskList []*model.YoungeeTaskInfo
-	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("withdraw_status IN(?)", g.Slice{2, 3, 4}).Scan(&taskList)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
-	}
-
-	platformMap := make(map[string]model.InfoThirdPlatform)
-	platformInfo := []*model.InfoThirdPlatform{}
-	if len(taskList) != 0 {
-		err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
-		if err != nil {
-			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
-		}
-
-		for i, _ := range platformInfo {
-			platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
-		}
-	}
-
-	for _, v := range taskList {
-		projectInfo, err := g.Model(dao.ProjectInfo.Table).Where("project_id = ?", v.ProjectId).One()
-		if err != nil {
-			return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
-		}
-		// product, err := g.Model(dao.YounggeeProduct.Table).One("product_id = ?", projectInfo[dao.ProjectInfo.Columns.ProductId])
-		// if err != nil {
-		// 	return &TalentHttpResult{Code: -1, Msg: "Get product mainphoto failed"}
-		// }
-		// strategy := model.RecruitStrategy{}
-		// err = g.Model(dao.RecruitStrategy.Table).Where("project_id = ? and strategy_id = ?", v.ProjectId, v.StrategyId).Scan(&strategy)
-		// if err != nil {
-		// 	return &TalentHttpResult{Code: -1, Msg: "Get RecruitStrategy failed"}
-		// }
-
-		taskInfoBrief := &youngee_talent_model.WithdrawTaskInfo{
-			TaskId:          v.TaskId,
-			ProjectName:     projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
-			ProductPhoto:    projectInfo[dao.ProjectInfo.Columns.ProductPhotoSnap].String(),
-			PlatformIconUrl: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformIcon,
-			PlatformName:    platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
-			TaskReward:      v.TaskReward,
-			SettleAmount:    v.SettleAmount,
-			CompleteDate:    v.CompleteDate,
-			WithdrawDate:    v.WithdrawDate,
-			Checked:         false,
-		}
-		if v.WithdrawStatus == 2 {
-			withdrawTaskInfoList.CanWithdrawTaskInfoList = append(withdrawTaskInfoList.CanWithdrawTaskInfoList, taskInfoBrief)
-		} else if v.WithdrawStatus == 3 {
-			withdrawTaskInfoList.WithdrawingTaskInfoList = append(withdrawTaskInfoList.WithdrawingTaskInfoList, taskInfoBrief)
-		} else if v.WithdrawStatus == 4 {
-			withdrawTaskInfoList.WithdrawedTaskInfoList = append(withdrawTaskInfoList.WithdrawedTaskInfoList, taskInfoBrief)
-		}
-	}
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: withdrawTaskInfoList}
-}
-
-func Withdraw(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var DataInfoReq *youngee_talent_model.WithdrawInfo
-	err = r.ParseForm(&DataInfoReq)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-	incomeIdList := strings.Split(DataInfoReq.IncomeIdList, ",")
-	// taskIdListInt := utils.TypeTran.String2Int(taskIdListStr)
-
-	// 检验是否taskIdList中所有task均处于可提现状态,且talent_id是否正确
-	var incomeList []model.YounggeeTalentIncome
-	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("task_id IN (?)", incomeIdList).Scan(&incomeList)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "Get task list failed"}
-	}
-	if len(incomeIdList) != len(incomeList) {
-		return &TalentHttpResult{Code: -4, Msg: "Task TalentID Error"}
-	}
-
-	var talentBank model.YounggeeTalentBank
-	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "Get Bank Info failed"}
-	}
-
-	bankJsons, errs := json.Marshal(talentBank) //转换成JSON返回的是byte[]
-	if errs != nil {
-		return &TalentHttpResult{Code: -6, Msg: " Json transformed failed"}
-	}
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		s1 := tid[7:]
-		s2 := fmt.Sprintf("%d", gtime.Now().YearDay())
-		s3 := fmt.Sprintf("%02v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(100))
-		s := "6" + s1 + s2 + s3
-		// 插入提现记录
-		_, err1 := tx.Ctx(ctx).Model(dao.YounggeeWithdrawRecord.Table).Data(model.YounggeeWithdrawRecord{
-			WithdrawId:     s,
-			TalentId:       tid,
-			WithdrawAmount: float64(DataInfoReq.TotalAmount),
-			AmountPayable:  float64(DataInfoReq.RealAmount),
-			IncomeIdList:   DataInfoReq.IncomeIdList,
-			ReceiveInfo:    string(bankJsons),
-			BankType:       2,
-			Status:         1,
-			SubmitAt:       gtime.Now(),
-		}).InsertAndGetId()
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// 更新income表中提现状态
-		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("task_id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// 更新talent表中提现金额
-		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Increment("withdrawing", float64(DataInfoReq.TotalAmount))
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Decrement("canwithdraw", float64(DataInfoReq.TotalAmount))
-		if err1 != nil {
-			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-			return err1
-		}
-
-		// // 达人消息
-		// for _, taskId := range taskIdListStr {
-		// 	taskInfo := model.YoungeeTaskInfo{}
-		// 	err1 = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", taskId).Scan(&taskInfo)
-		// 	if err1 != nil {
-		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-		// 		return err1
-		// 	}
-		// 	projectInfo := model.ProjectInfo{}
-		// 	err1 = tx.Ctx(ctx).Model(model.ProjectInfo{}).Where("project_id = ?", taskInfo.ProjectId).Scan(&projectInfo)
-		// 	if err1 != nil {
-		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
-		// 		return err1
-		// 	}
-		// 	messageInfo := model.YounggeeMessageInfo{
-		// 		MessageId:   12,
-		// 		MessageType: 2,
-		// 		CreatedAt:   gtime.Now(),
-		// 		TalentId:    taskId,
-		// 		ProjectName: projectInfo.ProjectName,
-		// 		IsReaded:    0,
-		// 		IsDeleted:   0,
-		// 	}
-		// 	_, err = tx.Ctx(ctx).Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
-		// 	if err != nil {
-		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err)
-		// 		return err
-		// 	}
-		// }
-		return nil
-	})
-	if err != nil {
-		return &TalentHttpResult{Code: -7, Msg: "Add Withdraw Record failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
+package youngee_task_service
+
+import (
+	"context"
+	"encoding/json"
+	"fmt"
+	"math"
+	"math/rand"
+	"strconv"
+	"strings"
+	"time"
+	"youngmini_server/app/dao"
+	"youngmini_server/app/model"
+	"youngmini_server/app/model/youngee_talent_model"
+	"youngmini_server/app/utils"
+
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/gtime"
+)
+
+func GetWithdrawTaskInfo(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	withdrawTaskInfoList := youngee_talent_model.WithdrawTaskInfoList{}
+	// 获取可提现任务列表
+	var taskList []*model.YoungeeTaskInfo
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("withdraw_status IN(?)", g.Slice{2, 3, 4}).Scan(&taskList)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
+	}
+
+	platformMap := make(map[string]model.InfoThirdPlatform)
+	platformInfo := []*model.InfoThirdPlatform{}
+	if len(taskList) != 0 {
+		err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
+		}
+
+		for i, _ := range platformInfo {
+			platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
+		}
+	}
+
+	for _, v := range taskList {
+		projectInfo, err := g.Model(dao.ProjectInfo.Table).Where("project_id = ?", v.ProjectId).One()
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
+		}
+		// product, err := g.Model(dao.YounggeeProduct.Table).One("product_id = ?", projectInfo[dao.ProjectInfo.Columns.ProductId])
+		// if err != nil {
+		// 	return &TalentHttpResult{Code: -1, Msg: "Get product mainphoto failed"}
+		// }
+		// strategy := model.RecruitStrategy{}
+		// err = g.Model(dao.RecruitStrategy.Table).Where("project_id = ? and strategy_id = ?", v.ProjectId, v.StrategyId).Scan(&strategy)
+		// if err != nil {
+		// 	return &TalentHttpResult{Code: -1, Msg: "Get RecruitStrategy failed"}
+		// }
+
+		taskInfoBrief := &youngee_talent_model.WithdrawTaskInfo{
+			TaskId:          v.TaskId,
+			ProjectName:     projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
+			ProductPhoto:    projectInfo[dao.ProjectInfo.Columns.ProductPhotoSnap].String(),
+			PlatformIconUrl: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformIcon,
+			PlatformName:    platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
+			TaskReward:      v.TaskReward,
+			SettleAmount:    v.SettleAmount,
+			CompleteDate:    v.CompleteDate,
+			WithdrawDate:    v.WithdrawDate,
+			Checked:         false,
+		}
+		if v.WithdrawStatus == 2 {
+			withdrawTaskInfoList.CanWithdrawTaskInfoList = append(withdrawTaskInfoList.CanWithdrawTaskInfoList, taskInfoBrief)
+		} else if v.WithdrawStatus == 3 {
+			withdrawTaskInfoList.WithdrawingTaskInfoList = append(withdrawTaskInfoList.WithdrawingTaskInfoList, taskInfoBrief)
+		} else if v.WithdrawStatus == 4 {
+			withdrawTaskInfoList.WithdrawedTaskInfoList = append(withdrawTaskInfoList.WithdrawedTaskInfoList, taskInfoBrief)
+		}
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: withdrawTaskInfoList}
+}
+
+func Withdraw(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	var DataInfoReq *youngee_talent_model.WithdrawInfo
+	err = r.ParseForm(&DataInfoReq)
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	}
+	incomeIdList := strings.Split(DataInfoReq.IncomeIdList, ",")
+	// taskIdListInt := utils.TypeTran.String2Int(taskIdListStr)
+
+	// 检验是否taskIdList中所有task均处于可提现状态,且talent_id是否正确
+	var incomeList []model.YounggeeTalentIncome
+	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("task_id IN (?)", incomeIdList).Scan(&incomeList)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "Get task list failed"}
+	}
+	if len(incomeIdList) != len(incomeList) {
+		return &TalentHttpResult{Code: -4, Msg: "Task TalentID Error"}
+	}
+
+	var talentBank model.YounggeeTalentBank
+	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: "Get Bank Info failed"}
+	}
+
+	bankJsons, errs := json.Marshal(talentBank) //转换成JSON返回的是byte[]
+	if errs != nil {
+		return &TalentHttpResult{Code: -6, Msg: " Json transformed failed"}
+	}
+
+	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
+		s1 := tid[7:]
+		s2 := fmt.Sprintf("%d", gtime.Now().YearDay())
+		s3 := fmt.Sprintf("%02v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(100))
+		s := "6" + s1 + s2 + s3
+		RealAmount := math.Floor(float64(DataInfoReq.TotalAmount) * (1 - 0.05))
+		taxAmount := math.Floor(float64(DataInfoReq.TotalAmount) * 0.05)
+		// 插入提现记录
+		_, err1 := tx.Ctx(ctx).Model(dao.YounggeeWithdrawRecord.Table).Data(model.YounggeeWithdrawRecord{
+			WithdrawId:     s,
+			TalentId:       tid,
+			WithdrawAmount: float64(DataInfoReq.TotalAmount), //全部金额
+			AmountPayable:  RealAmount,                       //实际到账
+			IncomeIdList:   DataInfoReq.IncomeIdList,
+			ReceiveInfo:    string(bankJsons),
+			BankType:       2,
+			Status:         1,
+			SubmitAt:       gtime.Now(),
+			TaxAmount:      taxAmount, //税
+		}).InsertAndGetId()
+		if err1 != nil {
+			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+			return err1
+		}
+
+		// 更新income表中提现状态
+		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("task_id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
+		if err1 != nil {
+			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+			return err1
+		}
+
+		// 更新talent表中提现金额
+		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Increment("withdrawing", float64(DataInfoReq.TotalAmount))
+		if err1 != nil {
+			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+			return err1
+		}
+		_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Where("id = ?", tid).Decrement("canwithdraw", float64(DataInfoReq.TotalAmount))
+		if err1 != nil {
+			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+			return err1
+		}
+		//todo 达人提现插入消息
+		// // 达人消息
+		// for _, taskId := range taskIdListStr {
+		// 	taskInfo := model.YoungeeTaskInfo{}
+		// 	err1 = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", taskId).Scan(&taskInfo)
+		// 	if err1 != nil {
+		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+		// 		return err1
+		// 	}
+		// 	projectInfo := model.ProjectInfo{}
+		// 	err1 = tx.Ctx(ctx).Model(model.ProjectInfo{}).Where("project_id = ?", taskInfo.ProjectId).Scan(&projectInfo)
+		// 	if err1 != nil {
+		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
+		// 		return err1
+		// 	}
+		// 	messageInfo := model.YounggeeMessageInfo{
+		// 		MessageId:   12,
+		// 		MessageType: 2,
+		// 		CreatedAt:   gtime.Now(),
+		// 		TalentId:    taskId,
+		// 		ProjectName: projectInfo.ProjectName,
+		// 		IsReaded:    0,
+		// 		IsDeleted:   0,
+		// 	}
+		// 	_, err = tx.Ctx(ctx).Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
+		// 	if err != nil {
+		// 		fmt.Printf("[Withdraw Transaction] Error:%+v\n", err)
+		// 		return err
+		// 	}
+		// }
+		return nil
+	})
+	if err != nil {
+		return &TalentHttpResult{Code: -7, Msg: "Add Withdraw Record failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success"}
+}
+
+func GetWithdrawList(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	queryInt := r.GetQueryInt("status", -1)
+	var Records []*youngee_talent_model.WithdrawRecord
+	if queryInt == 0 {
+		g.DB().Model("younggee_withdraw_record").Where("talent_id = ? ", tid).Scan(&Records)
+	} else {
+		g.DB().Model("younggee_withdraw_record").Where("talent_id = ? and status = ?", tid, queryInt).Scan(&Records)
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: Records}
+}
+
+func GetWithdrawDetail(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	withdrawId := r.GetQueryString("withdraw_id", "")
+	var WithdrawDetail *youngee_talent_model.WithdrawDetail
+	err = g.DB().Model("younggee_withdraw_record").Where("talent_id = ? and withdraw_id = ?", tid, withdrawId).Scan(&WithdrawDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	// 将 IncomeIdList 分割成 ID 列表
+	incomeIDs := strings.Split(WithdrawDetail.IncomeIdList, ",")
+	err = g.DB().Model("younggee_talent_income").Where("id IN ?", incomeIDs).Scan(WithdrawDetail.TalentIncomeInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: WithdrawDetail}
+}

+ 395 - 17
app/service/youngee_task_service/task_info.go

@@ -530,10 +530,16 @@ func GetTaskDetail(r *ghttp.Request) *TalentHttpResult {
 func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
 	fanNum := r.GetQueryInt("fan_num", -1)
 	projectId := r.GetQueryString("project_id", -1)
+	SProjectId := r.GetQueryInt("project_id", 0)
 	var recruitStrategies []*youngee_talent_model.RecruitStrategy
-	err := g.DB().Model("recruit_strategy").Where("project_id = ?", projectId).Scan(&recruitStrategies)
-	if err != nil {
-		fmt.Println(err.Error())
+	//不经过服务商
+	if SProjectId == 0 {
+		err := g.DB().Model("recruit_strategy").Where("project_id = ? and strategy_type=?", projectId, 1).Scan(&recruitStrategies)
+		if err != nil {
+			fmt.Println(err.Error())
+		}
+	} else { //经过服务商
+		_ = g.DB().Model("recruit_strategy").Where("s_project_id = ?", SProjectId).Scan(&recruitStrategies)
 	}
 	for _, strategy := range recruitStrategies {
 		// 判断粉丝数是否满足当前策略的要求
@@ -545,6 +551,7 @@ func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
 			strategy.IsFit = 0
 		}
 	}
+
 	//根据projectId获取招募策略表多条策略,
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: recruitStrategies}
 }
@@ -621,13 +628,133 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
 	}
 	taskInfo := youngee_talent_model.YoungeeTaskInfo{}
+	// 公开任务
 	if projectDetail.ProjectType == 1 {
-		// 全流程任务/公开任务
-		var strategy *youngee_talent_model.RecruitStrategy
-		err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
-		if err != nil {
-			return &TalentHttpResult{Code: -10, Msg: err.Error()}
+		//经过服务商
+		if signTaskInfo.SProjectId != 0 {
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
+			var ServiceChargePrice = 0.0      //服务费
+			var SupporPricer = 0.0            //提报价
+			if signTaskInfo.StrategyId == 3 { //自报价
+				ServiceChargePrice = signTaskInfo.Offer * strategy.ServiceRate * 0.01
+				SupporPricer = signTaskInfo.Offer * (1 + strategy.ServiceRate*0.01)
+
+			} else if signTaskInfo.StrategyId == 2 { //一口价
+				ServiceChargePrice = strategy.ServiceCharge
+				SupporPricer = signTaskInfo.Offer
+			} else { //无费置换
+				ServiceChargePrice = 0.0
+				SupporPricer = 0.0
+			}
+			if err != nil {
+				return &TalentHttpResult{Code: -10, Msg: err.Error()}
+			}
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.ProjectId,
+				SProjectId:             signTaskInfo.SProjectId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				TalentPostAddrSnap:     string(addrSnap),
+				StrategyId:             signTaskInfo.StrategyId,
+				TaskStage:              1,
+				FeeForm:                strategy.FeeForm,
+				ServiceCharge:          ServiceChargePrice,              //服务费(自报价要计算,一口价直接从strategy中取得,无非置换为0)
+				ServiceRate:            projectDetail.ServiceChargeRate, //公开服务费率,projectinfo和recruit 表中是一样的
+				SupportFee:             SupporPricer,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				SettleStatus:           1,
+				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:           signTaskInfo.Offer,
+				SupplierStatus:         1,
+			}
+
+		} else {
+			//不经过服务商
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
+			if err != nil {
+				return &TalentHttpResult{Code: -10, Msg: err.Error()}
+			}
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.ProjectId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				TalentPostAddrSnap:     string(addrSnap),
+				StrategyId:             signTaskInfo.StrategyId,
+				TaskStage:              1,
+				FeeForm:                strategy.FeeForm,
+				ServiceCharge:          0,                               //不经过服务商则为0
+				ServiceRate:            projectDetail.ServiceChargeRate, //公开服务费率
+				SupportFee:             signTaskInfo.Offer,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				SettleStatus:           1,
+				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:           signTaskInfo.Offer,
+			}
+
+		}
+	} else if projectDetail.ProjectType == 2 { //定向任务
+		//经过服务商
+		if signTaskInfo.SProjectId != 0 {
+			//查找服务商定义的策略
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SProjectId).Scan(&strategy)
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.ProjectId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				TalentPostAddrSnap:     string(addrSnap),
+				TaskStage:              1,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				ServiceCharge:          0,                  //不经过服务商,无服务费
+				ServiceRate:            0,                  //服务费率
+				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+			}
+
+		} else {
+			//不经过服务商
+
 		}
+
+		//定向任务,服务费在哪设置
 		taskInfo = youngee_talent_model.YoungeeTaskInfo{
 			TaskId:                 newTaskId,
 			ProjectId:              signTaskInfo.ProjectId,
@@ -636,11 +763,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			TalentPlatformInfoSnap: string(accountSnap),
 			TalentPersonalInfoSnap: string(talentSnap),
 			TalentPostAddrSnap:     string(addrSnap),
-			StrategyId:             signTaskInfo.StrategyId,
 			TaskStage:              1,
-			FeeForm:                strategy.FeeForm,
-			ServiceCharge:          strategy.ServiceCharge,          //  服务费
-			ServiceRate:            projectDetail.ServiceChargeRate, //公开服务费率
 			CreateDate:             gtime.Now(),
 			TaskStatus:             1,
 			LogisticsStatus:        1,
@@ -651,10 +774,10 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			CompleteStatus:         1,
 			CurDefaultType:         0,
 			WithdrawStatus:         1,
-			SettleStatus:           1,
-			DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的,
-			SettleAmount:           signTaskInfo.Offer,
+			SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+			DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
 		}
+
 	}
 	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
 		// 在task_info表中插入任务
@@ -669,8 +792,263 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			return err
 		}
 		//如果经过服务商,服务younggee_s_project_info中报名人数加一
-		if projectDetail.ProjectInfoSupplier != nil {
-			_, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("project_id = ? ", projectDetail.ProjectId).Increment("apply_num", 1)
+		if signTaskInfo.SProjectId != 0 {
+			_, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("s_project_id = ? ", signTaskInfo.SProjectId).Increment("apply_num", 1)
+			if err != nil {
+				return err
+			}
+		}
+
+		return nil
+	})
+	if err != nil {
+		return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: newTaskId}
+}
+
+// 本地生活报名
+func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	//POST请求体信息
+	var signTaskInfo *youngee_talent_model.SignLocalTaskInfo
+	err = r.ParseForm(&signTaskInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: "data query failed"}
+	}
+
+	var projectDetail *youngee_talent_model.LocalInfoDetail
+	err = g.DB().Model(youngee_talent_model.LocalInfoDetail{}).WithAll().Where("local_id", signTaskInfo.LocalId).Scan(&projectDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+	}
+
+	//达人用户信息
+	var talentInfo *youngee_talent_model.TalentInfo
+	err = g.DB().Model("youngee_talent_info").WithAll().Where("id", tid).Scan(&talentInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -4, Msg: "Get talent info failed"}
+	}
+
+	//达人快手信息
+	var accountInfo *youngee_talent_model.KuaishouUserInfo
+	err = g.DB().Model("platform_kuaishou_user_info").WithAll().Where("talent_id = ? AND open_id = ? AND platform_id = ? ", tid, signTaskInfo.OpenID, projectDetail.LocalPlatform).Scan(&accountInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: err.Error()}
+	}
+
+	var newTaskId string
+	// 首先生成任务id
+	newTaskId = utils.GetUuid.GetTaskId(projectDetail.LocalId, projectDetail.EnterpriseId, tid)
+	//// 生成达人平台账号信息快照
+	accountSnap, err := gjson.Encode(accountInfo)
+	//if err != nil {
+	//	return &TalentHttpResult{Code: -7, Msg: "encode platform snap failed"}
+	//}
+
+	// 生成达人信息快照
+	talentSnap, err := gjson.Encode(talentInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -8, Msg: "encode talent info snap failed"}
+	}
+
+	if err != nil {
+		return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
+	}
+	taskInfo := youngee_talent_model.YoungeeTaskInfo{}
+	// 公开任务
+	if projectDetail.LocalType == 1 {
+		//经过服务商
+		if signTaskInfo.SLocalId != 0 {
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.LocalId).Scan(&strategy)
+			var ServiceChargePrice = 0.0      //服务费
+			var SupporPricer = 0.0            //提报价
+			if signTaskInfo.StrategyId == 3 { //自报价
+				ServiceChargePrice = signTaskInfo.Offer * strategy.ServiceRate * 0.01
+				SupporPricer = signTaskInfo.Offer * (1 + strategy.ServiceRate*0.01)
+
+			} else if signTaskInfo.StrategyId == 2 { //一口价
+				ServiceChargePrice = strategy.ServiceCharge
+				SupporPricer = signTaskInfo.Offer
+			} else { //无费置换
+				ServiceChargePrice = 0.0
+				SupporPricer = 0.0
+			}
+			if err != nil {
+				return &TalentHttpResult{Code: -10, Msg: err.Error()}
+			}
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.LocalId,
+				SProjectId:             signTaskInfo.SLocalId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				StrategyId:             signTaskInfo.StrategyId,
+				TaskStage:              1,
+				FeeForm:                strategy.FeeForm,
+				ServiceCharge:          ServiceChargePrice,              //服务费(自报价要计算,一口价直接从strategy中取得,无非置换为0)
+				ServiceRate:            projectDetail.ServiceChargeRate, //公开服务费率,projectinfo和recruit 表中是一样的
+				SupportFee:             SupporPricer,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				SettleStatus:           1,
+				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:           signTaskInfo.Offer,
+				SupplierStatus:         1,
+			}
+
+		} else {
+			//不经过服务商
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.LocalId).Scan(&strategy)
+			if err != nil {
+				return &TalentHttpResult{Code: -10, Msg: err.Error()}
+			}
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.LocalId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				StrategyId:             signTaskInfo.StrategyId,
+				TaskStage:              1,
+				FeeForm:                strategy.FeeForm,
+				ServiceCharge:          0,                               //不经过服务商则为0
+				ServiceRate:            projectDetail.ServiceChargeRate, //公开服务费率
+				SupportFee:             signTaskInfo.Offer,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				SettleStatus:           1,
+				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:           signTaskInfo.Offer,
+			}
+
+		}
+	} else if projectDetail.LocalType == 2 { //定向任务
+		//经过服务商
+		if signTaskInfo.SLocalId != 0 {
+			//查找服务商定义的策略
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.LocalId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				TaskStage:              1,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				ServiceCharge:          0,                  //不经过服务商,无服务费
+				ServiceRate:            0,                  //服务费率
+				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+			}
+
+		} else {
+			//不经过服务商
+			//查找服务商定义的策略
+			var strategy *youngee_talent_model.RecruitStrategy
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
+			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+				TaskId:                 newTaskId,
+				ProjectId:              signTaskInfo.LocalId,
+				TalentId:               tid,
+				OpenId:                 signTaskInfo.OpenID,
+				TalentPlatformInfoSnap: string(accountSnap),
+				TalentPersonalInfoSnap: string(talentSnap),
+				TaskStage:              1,
+				CreateDate:             gtime.Now(),
+				TaskStatus:             1,
+				LogisticsStatus:        1,
+				LinkStatus:             1,
+				DataStatus:             1,
+				ScriptStatus:           1,
+				SketchStatus:           1,
+				CompleteStatus:         1,
+				CurDefaultType:         0,
+				WithdrawStatus:         1,
+				ServiceCharge:          0,                  //不经过服务商,无服务费
+				ServiceRate:            0,                  //服务费率
+				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+			}
+
+		}
+
+		//定向任务,服务费在哪设置
+		taskInfo = youngee_talent_model.YoungeeTaskInfo{
+			TaskId:                 newTaskId,
+			ProjectId:              signTaskInfo.LocalId,
+			TalentId:               tid,
+			OpenId:                 signTaskInfo.OpenID,
+			TalentPlatformInfoSnap: string(accountSnap),
+			TalentPersonalInfoSnap: string(talentSnap),
+			TaskStage:              1,
+			CreateDate:             gtime.Now(),
+			TaskStatus:             1,
+			LogisticsStatus:        1,
+			LinkStatus:             1,
+			DataStatus:             1,
+			ScriptStatus:           1,
+			SketchStatus:           1,
+			CompleteStatus:         1,
+			CurDefaultType:         0,
+			WithdrawStatus:         1,
+			SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+			DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+		}
+
+	}
+	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
+		// 在task_info表中插入任务
+		_, err = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(&taskInfo).Insert()
+		if err != nil {
+			return err
+		}
+
+		// 对应项目的报名人数自增
+		_, err = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.LocalId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
+		if err != nil {
+			return err
+		}
+		//如果经过服务商,服务younggee_s_project_info中报名人数加一
+		if signTaskInfo.SLocalId != 0 {
+			_, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("s_project_id = ? ", signTaskInfo.SLocalId).Increment("apply_num", 1)
 			if err != nil {
 				return err
 			}

+ 3 - 3
app/service/youngee_task_service/task_link.go

@@ -26,9 +26,9 @@ func AddTaskLink(r *ghttp.Request) *TalentHttpResult {
 	var condition2 bool = len(taskLinkInfo) == 0
 	//最新sketch数据
 	linkInfo := model.YounggeeLinkInfo{
-		TaskId:   LinkInfoReq.TaskId,
-		LinkUrl:  LinkInfoReq.LinkUrl,
-		PhotoUrl: LinkInfoReq.PhotoUrl,
+		TaskId:  LinkInfoReq.TaskId,
+		LinkUrl: LinkInfoReq.LinkUrl,
+		//PhotoUrl: LinkInfoReq.PhotoUrl,
 		CreateAt: gtime.Now(),
 		IsReview: 0,
 		IsSubmit: 0, //忽略

+ 20 - 18
app/service/youngee_task_service/task_sketch.go

@@ -103,6 +103,7 @@ func AddTaskSketch(r *ghttp.Request) *TalentHttpResult {
 	}
 	taskInfo := youngee_talent_model.YoungeeTaskInfo{}
 	//task设置为初稿待审核
+	fmt.Println("&&&&****")
 	_, err = g.DB().Model(model.YoungeeTaskInfo{}).Data(g.Map{"task_stage": "10"}).Where("task_id = ?", sketchInfoReq.TaskId).Update()
 	// 若处于违约状态则解除
 	if taskInfo.CurDefaultType == 3 || taskInfo.CurDefaultType == 9 {
@@ -129,25 +130,26 @@ func AddTaskSketch(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -5, Msg: "YounggeeTaskLog insert failed"}
 	}
+	//todo 添加初稿报错 ProjectInfo find failed
 	//插入一条消息
-	projectInfo := model.ProjectInfo{}
-	err1 := g.DB().Model(model.ProjectInfo{}).Where("project_id = ?", taskInfo.ProjectId).Scan(&projectInfo)
-	if err1 != nil {
-		return &TalentHttpResult{Code: -8, Msg: "ProjectInfo find failed"}
-	}
-	messageInfo := model.YounggeeMessageInfo{
-		MessageId:   11,
-		MessageType: 2,
-		CreatedAt:   gtime.Now(),
-		TalentId:    taskInfo.TalentId,
-		ProjectName: projectInfo.ProjectName,
-		IsReaded:    0,
-		IsDeleted:   0,
-	}
-	_, err = g.DB().Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
-	if err != nil {
-		return &TalentHttpResult{Code: -9, Msg: "YounggeeMessageInfo insert failed"}
-	}
+	//projectInfo := model.ProjectInfo{}
+	//err1 := g.DB().Model(model.ProjectInfo{}).Where("project_id = ?", taskInfo.ProjectId).Scan(&projectInfo)
+	//if err1 != nil {
+	//	return &TalentHttpResult{Code: -8, Msg: "ProjectInfo find failed"}
+	//}
+	//messageInfo := model.YounggeeMessageInfo{
+	//	MessageId:   11,
+	//	MessageType: 2,
+	//	CreatedAt:   gtime.Now(),
+	//	TalentId:    taskInfo.TalentId,
+	//	ProjectName: projectInfo.ProjectName,
+	//	IsReaded:    0,
+	//	IsDeleted:   0,
+	//}
+	//_, err = g.DB().Model(dao.YounggeeMessageInfo.Table).Data(&messageInfo).Insert()
+	//if err != nil {
+	//	return &TalentHttpResult{Code: -9, Msg: "YounggeeMessageInfo insert failed"}
+	//}
 
 	return &TalentHttpResult{Code: 0, Msg: "success"}
 }

+ 1 - 0
app/system/assignment/assignment_model.go

@@ -9,6 +9,7 @@ type AddAssignmentReq struct {
 	PayMoney      int         `json:"pay_money"`       // 悬赏结算金额
 	LinkUrl       string      `json:"link_url"`        // 作业连接
 	PhotoUrl      string      `json:"photo_url"`       // 作业截图
+	ProductPhoto  string      `json:"product_photo"`   //商品主图
 	ReviseOpinion string      `json:"revise_opinion"`  // 审核意见
 	IsSubmit      int         `json:"is_submit" d:"1"` // 是否提交
 	IsReview      int         `json:"is_review" d:"0"` // 是否审核

+ 12 - 7
app/system/assignment/assignment_service.go

@@ -60,8 +60,8 @@ func (s *assignmentService) Add(r *ghttp.Request, req *AddAssignmentReq) (res sq
 	if err != nil {
 		return nil, err
 	}
-	//4. 插入消息
-	// 查询选品项目信息
+	//4. 插入消息 todo new message
+	// 查询带货项目信息
 	selectionInfo, err := selection.GetDetailByTaskId(r.Context(), req.TaskId)
 	if err != nil {
 		return nil, err
@@ -106,12 +106,17 @@ func (s *assignmentService) Add(r *ghttp.Request, req *AddAssignmentReq) (res sq
 		"reward_stage":   2, //已结算
 	}).Where("task_id=?", req.TaskId).Update()
 	//4.插入一条达人收入数据
+	//todo: 种草稿费结算也要插入一条数据
 	_, err = g.DB().Model("younggee_talent_income").Data(g.Map{
-		"selection_id": req.SelectionId,
-		"talent_id":    tid,
-		"sectask_id":   req.TaskId,
-		"income":       req.PayMoney,
-		"income_at":    gtime.Now(),
+		"selection_id":    req.SelectionId,
+		"talent_id":       tid,
+		"sectask_id":      req.TaskId,
+		"income":          req.PayMoney,
+		"income_at":       gtime.Now(),
+		"photo_url":       req.ProductPhoto,
+		"type":            2,
+		"withdraw_status": 1,
+		"task_name":       selectionInfo.SelectionName,
 	}).Save()
 	if err != nil {
 		return nil, err

BIN
bin/main


BIN
bin/v3.7.6/.DS_Store


BIN
bin/v3.7.6/linux_amd64/youngmini_server


BIN
bin/v3.7.6/windows_amd64/youngmini_server.exe


+ 5 - 5
config/config.toml

@@ -2,7 +2,7 @@ SessionStorage = "redis"
 
 # HTTP Server
 [server]
-Address = ":8201"
+Address = ":8202"
 ServerAgent = "gf-app"
 ServerRoot = "public"
 
@@ -19,10 +19,10 @@ name = "youngmini_server"
 output = "./bin"
 pack = ""
 system = "linux,windows"
-version = "v3.7.4"
+version = "v3.7.6"
 [gfcli.gen.dao]
 jsonCase = "Snake"
-link = "mysql:talent:talentDB_123@tcp(139.9.53.143:3306)/youngmini"
+link = "mysql:root:Younggee_root_DB_123@tcp(1.92.142.62:3306)/youngmini"
 
 # Logger.
 [logger]
@@ -41,7 +41,7 @@ Path = "template"
 [database]
 #link  = "mysql:liming:123456@tcp(192.168.0.105:3306)/youngmini"
 debug = true
-link = "mysql:talent:talentDB_123@tcp(139.9.53.143:3306)/youngmini"
+link = "mysql:root:Younggee_root_DB_123@tcp(1.92.142.62:3306)/youngmini"
 # Database logger.
 [database.logger]
 Level = "all"
@@ -50,7 +50,7 @@ Stdout = true
 
 # redis
 [redis]
-default = "139.9.53.143:6379,younggeeRedis_123?idleTimeout=600&db=10"
+default = "1.92.142.62:6379,younggeeRedis_123?idleTimeout=600&db=10"
 
 # mini program info
 [miniapp]