Browse Source

init feature_yf

unknown 2 years ago
parent
commit
c332710aeb
69 changed files with 1794 additions and 2922 deletions
  1. 68 0
      app/api/youngee_talent_api/talent_auth_get_api.go
  2. 18 0
      app/api/youngee_talent_api/talent_auth_post_api.go
  3. 24 0
      app/dao/enterprise_pay_record.go
  4. 24 0
      app/dao/info_pricing_strategy.go
  5. 24 0
      app/dao/info_product_type.go
  6. 24 0
      app/dao/info_task_stage.go
  7. 71 0
      app/dao/internal/enterprise_pay_record.go
  8. 75 0
      app/dao/internal/info_pricing_strategy.go
  9. 59 0
      app/dao/internal/info_product_type.go
  10. 59 0
      app/dao/internal/info_task_stage.go
  11. 2 0
      app/dao/internal/project_info.go
  12. 10 0
      app/dao/internal/recruit_strategy.go
  13. 0 2
      app/dao/internal/youngee_talent_delivery_address.go
  14. 4 4
      app/dao/internal/youngee_talent_info.go
  15. 25 3
      app/dao/internal/youngee_task_info.go
  16. 77 0
      app/dao/internal/youngee_task_logistics.go
  17. 77 0
      app/dao/internal/youngee_task_pay.go
  18. 71 0
      app/dao/internal/younggee_script_info.go
  19. 24 0
      app/dao/youngee_task_logistics.go
  20. 24 0
      app/dao/youngee_task_pay.go
  21. 24 0
      app/dao/younggee_script_info.go
  22. 88 7
      app/model/model.go
  23. 5 4
      app/model/youngee_talent_model/info_tables.go
  24. 1 0
      app/model/youngee_talent_model/project_detail.go
  25. 0 2
      app/model/youngee_talent_model/talent_address.go
  26. 0 4
      app/model/youngee_talent_model/talent_info.go
  27. 61 6
      app/model/youngee_talent_model/task_info.go
  28. 6 0
      app/model/youngee_talent_model/task_script.go
  29. 0 271
      app/service/talent_service/bobo_coin.go
  30. 0 184
      app/service/talent_service/delivery_addr.go
  31. 0 42
      app/service/talent_service/info_table.go
  32. 0 10
      app/service/talent_service/islogined.go
  33. 0 388
      app/service/talent_service/order.go
  34. 0 228
      app/service/talent_service/platform_info.go
  35. 0 34
      app/service/talent_service/region_info.go
  36. 0 37
      app/service/talent_service/search.go
  37. 0 132
      app/service/talent_service/share.go
  38. 0 19
      app/service/talent_service/talent_http_result.go
  39. 0 104
      app/service/talent_service/talent_info.go
  40. 0 241
      app/service/talent_service/task_info.go
  41. 0 770
      app/service/talent_service/uploads.go
  42. 0 113
      app/service/talent_service/wxlogin.go
  43. 0 289
      app/service/talent_service/wxpay_handler.go
  44. 6 1
      app/service/youngee_talent_service/info_tables.go
  45. 58 24
      app/service/youngee_talent_service/project_info.go
  46. 6 0
      app/service/youngee_talent_service/talent_account.go
  47. 26 0
      app/service/youngee_talent_service/talent_address.go
  48. 377 0
      app/service/youngee_talent_service/task_info.go
  49. 50 0
      app/service/youngee_talent_service/task_script.go
  50. BIN
      bin/v2.0.1/linux_amd64/youngmini_server
  51. BIN
      bin/v2.0.1/windows_amd64/youngmini_server.exe
  52. BIN
      bin/v2.0.2/linux_amd64/youngmini_server
  53. BIN
      bin/v2.0.2/windows_amd64/youngmini_server.exe
  54. BIN
      bin/v2.0.3/linux_amd64/youngmini_server
  55. BIN
      bin/v2.0.3/windows_amd64/youngmini_server.exe
  56. BIN
      bin/v2.0.4/linux_amd64/youngmini_server
  57. BIN
      bin/v2.0.4/windows_amd64/youngmini_server.exe
  58. BIN
      bin/v2.0.5/linux_amd64/youngmini_server
  59. BIN
      bin/v2.0.5/windows_amd64/youngmini_server.exe
  60. 2 2
      config/config.toml
  61. 1 0
      go.mod
  62. 2 0
      go.sum
  63. 1 1
      middleware/middleware_wx_auth.go
  64. 6 0
      router/router.go
  65. 21 0
      vendor/github.com/wxnacy/wgo/LICENSE
  66. 82 0
      vendor/github.com/wxnacy/wgo/arrays/arrays.go
  67. 95 0
      vendor/github.com/wxnacy/wgo/arrays/contains.go
  68. 113 0
      vendor/github.com/wxnacy/wgo/arrays/set.go
  69. 3 0
      vendor/modules.txt

+ 68 - 0
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -40,6 +40,16 @@ func (*talentAuthGetApi) GetTalentAddress(r *ghttp.Request) {
 	}
 }
 
+// GetTalentDefaultAddress 获取单个达人收货地址详情
+// youngee_talent_delivery_address
+func (*talentAuthGetApi) GetTalentDefaultAddress(r *ghttp.Request) {
+	res := youngee_talent_service.GetTalentDefaultAddress(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 // GetTalentAddress 获取单个达人收货地址详情
 // youngee_talent_delivery_address
 func (*talentAuthGetApi) GetSingleAddress(r *ghttp.Request) {
@@ -67,3 +77,61 @@ func (*talentAuthGetApi) IsLogin(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+func (*talentAuthGetApi) IsSignUpTask(r *ghttp.Request) {
+	res := youngee_talent_service.IsSignUpTask(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthGetApi) GetTaskBriefList(r *ghttp.Request) {
+	res := youngee_talent_service.GetTaskBriefList(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthGetApi) GetTaskExeList(r *ghttp.Request) {
+	res := youngee_talent_service.GetExeTaskBriefList(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthGetApi) GetTaskNum(r *ghttp.Request) {
+	res := youngee_talent_service.GetTaskNum(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthGetApi) GetTaskDetail(r *ghttp.Request) {
+	res := youngee_talent_service.GetTaskDetail(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthGetApi) GetTaskLogisticsInfo(r *ghttp.Request) {
+	res := youngee_talent_service.GetTaskLogisticsInfo(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+// GetTaskScript 获取任务脚本
+// younggee_script_info
+func (*talentAuthGetApi) GetTaskScript(r *ghttp.Request) {
+	res := youngee_talent_service.GetTaskScript(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}

+ 18 - 0
app/api/youngee_talent_api/talent_auth_post_api.go

@@ -78,3 +78,21 @@ func (*talentAuthPostApi) UpdateTalentAccount(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+func (*talentAuthPostApi) SignUpTask(r *ghttp.Request) {
+	res := youngee_talent_service.SignUpTask(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+// AddTaskScript 上传脚本
+// younggee_script_info
+func (*talentAuthPostApi) AddTaskScript(r *ghttp.Request) {
+	res := youngee_talent_service.AddTaskScript(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}

+ 24 - 0
app/dao/enterprise_pay_record.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// enterprisePayRecordDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type enterprisePayRecordDao struct {
+	*internal.EnterprisePayRecordDao
+}
+
+var (
+	// EnterprisePayRecord is globally public accessible object for table enterprise_pay_record operations.
+	EnterprisePayRecord = enterprisePayRecordDao{
+		internal.NewEnterprisePayRecordDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
app/dao/info_pricing_strategy.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// infoPricingStrategyDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type infoPricingStrategyDao struct {
+	*internal.InfoPricingStrategyDao
+}
+
+var (
+	// InfoPricingStrategy is globally public accessible object for table info_pricing_strategy operations.
+	InfoPricingStrategy = infoPricingStrategyDao{
+		internal.NewInfoPricingStrategyDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
app/dao/info_product_type.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// infoProductTypeDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type infoProductTypeDao struct {
+	*internal.InfoProductTypeDao
+}
+
+var (
+	// InfoProductType is globally public accessible object for table info_product_type operations.
+	InfoProductType = infoProductTypeDao{
+		internal.NewInfoProductTypeDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
app/dao/info_task_stage.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// infoTaskStageDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type infoTaskStageDao struct {
+	*internal.InfoTaskStageDao
+}
+
+var (
+	// InfoTaskStage is globally public accessible object for table info_task_stage operations.
+	InfoTaskStage = infoTaskStageDao{
+		internal.NewInfoTaskStageDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 71 - 0
app/dao/internal/enterprise_pay_record.go

@@ -0,0 +1,71 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// EnterprisePayRecordDao is the manager for logic model data accessing and custom defined data operations functions management.
+type EnterprisePayRecordDao struct {
+	Table   string                     // Table is the underlying table name of the DAO.
+	Group   string                     // Group is the database configuration group name of current DAO.
+	Columns EnterprisePayRecordColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// EnterprisePayRecordColumns defines and stores column names for table enterprise_pay_record.
+type EnterprisePayRecordColumns struct {
+	Id           string // id
+	Payment      string // 交易金额
+	Balance      string // 交易后账户可用余额
+	PayType      string // 交易类型,1表示充值,2表示支付
+	RechargeType string // 充值方式,1表示在线交易,2表示对公转账
+	EnterpriseId string // 企业id
+	PayAt        string // 交易时间
+	ProjectId    string // 支付的项目id
+}
+
+//  enterprisePayRecordColumns holds the columns for table enterprise_pay_record.
+var enterprisePayRecordColumns = EnterprisePayRecordColumns{
+	Id:           "id",
+	Payment:      "payment",
+	Balance:      "balance",
+	PayType:      "pay_type",
+	RechargeType: "recharge_type",
+	EnterpriseId: "enterprise_id",
+	PayAt:        "pay_at",
+	ProjectId:    "project_id",
+}
+
+// NewEnterprisePayRecordDao creates and returns a new DAO object for table data access.
+func NewEnterprisePayRecordDao() *EnterprisePayRecordDao {
+	return &EnterprisePayRecordDao{
+		Group:   "default",
+		Table:   "enterprise_pay_record",
+		Columns: enterprisePayRecordColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *EnterprisePayRecordDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *EnterprisePayRecordDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *EnterprisePayRecordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 75 - 0
app/dao/internal/info_pricing_strategy.go

@@ -0,0 +1,75 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// InfoPricingStrategyDao is the manager for logic model data accessing and custom defined data operations functions management.
+type InfoPricingStrategyDao struct {
+	Table   string                     // Table is the underlying table name of the DAO.
+	Group   string                     // Group is the database configuration group name of current DAO.
+	Columns InfoPricingStrategyColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// InfoPricingStrategyColumns defines and stores column names for table info_pricing_strategy.
+type InfoPricingStrategyColumns struct {
+	Id            string // id
+	FeeForm       string // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	Platform      string // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	FansLow       string // 对应粉丝量下限
+	FansUp        string // 对应粉丝量上限
+	ServiceCharge string // 服务费,稿费形式为产品置换时填写,可以为空
+	ServiceRate   string // 服务费率*1000,稿费形式为固定稿费和自报价时填写,可以为空
+	UpdateId      string // 修改管理人员id,对应user表中主键
+	UpdateAt      string // 修改时间
+	CreateAt      string // 创建时间
+}
+
+//  infoPricingStrategyColumns holds the columns for table info_pricing_strategy.
+var infoPricingStrategyColumns = InfoPricingStrategyColumns{
+	Id:            "id",
+	FeeForm:       "fee_form",
+	Platform:      "platform",
+	FansLow:       "fans_low",
+	FansUp:        "fans_up",
+	ServiceCharge: "service_charge",
+	ServiceRate:   "service_rate",
+	UpdateId:      "update_id",
+	UpdateAt:      "update_at",
+	CreateAt:      "create_at",
+}
+
+// NewInfoPricingStrategyDao creates and returns a new DAO object for table data access.
+func NewInfoPricingStrategyDao() *InfoPricingStrategyDao {
+	return &InfoPricingStrategyDao{
+		Group:   "default",
+		Table:   "info_pricing_strategy",
+		Columns: infoPricingStrategyColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *InfoPricingStrategyDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *InfoPricingStrategyDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *InfoPricingStrategyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 59 - 0
app/dao/internal/info_product_type.go

@@ -0,0 +1,59 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// InfoProductTypeDao is the manager for logic model data accessing and custom defined data operations functions management.
+type InfoProductTypeDao struct {
+	Table   string                 // Table is the underlying table name of the DAO.
+	Group   string                 // Group is the database configuration group name of current DAO.
+	Columns InfoProductTypeColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// InfoProductTypeColumns defines and stores column names for table info_product_type.
+type InfoProductTypeColumns struct {
+	ProductTypeId string // 商品类型id
+	ProductType   string // 商品类型
+}
+
+//  infoProductTypeColumns holds the columns for table info_product_type.
+var infoProductTypeColumns = InfoProductTypeColumns{
+	ProductTypeId: "product_type_id",
+	ProductType:   "product_type",
+}
+
+// NewInfoProductTypeDao creates and returns a new DAO object for table data access.
+func NewInfoProductTypeDao() *InfoProductTypeDao {
+	return &InfoProductTypeDao{
+		Group:   "default",
+		Table:   "info_product_type",
+		Columns: infoProductTypeColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *InfoProductTypeDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *InfoProductTypeDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *InfoProductTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 59 - 0
app/dao/internal/info_task_stage.go

@@ -0,0 +1,59 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// InfoTaskStageDao is the manager for logic model data accessing and custom defined data operations functions management.
+type InfoTaskStageDao struct {
+	Table   string               // Table is the underlying table name of the DAO.
+	Group   string               // Group is the database configuration group name of current DAO.
+	Columns InfoTaskStageColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// InfoTaskStageColumns defines and stores column names for table info_task_stage.
+type InfoTaskStageColumns struct {
+	TaskStageId string // 任务阶段id
+	TaskStage   string // 任务阶段
+}
+
+//  infoTaskStageColumns holds the columns for table info_task_stage.
+var infoTaskStageColumns = InfoTaskStageColumns{
+	TaskStageId: "task_stage_id",
+	TaskStage:   "task_stage",
+}
+
+// NewInfoTaskStageDao creates and returns a new DAO object for table data access.
+func NewInfoTaskStageDao() *InfoTaskStageDao {
+	return &InfoTaskStageDao{
+		Group:   "default",
+		Table:   "info_task_stage",
+		Columns: infoTaskStageColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *InfoTaskStageDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *InfoTaskStageDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *InfoTaskStageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 2 - 0
app/dao/internal/project_info.go

@@ -35,6 +35,7 @@ type ProjectInfoColumns struct {
 	ProductId       string // 关联商品id
 	CreatedAt       string // 创建时间
 	UpdatedAt       string // 修改时间
+	FeeForm         string // 稿费形式列表
 }
 
 //  projectInfoColumns holds the columns for table project_info.
@@ -55,6 +56,7 @@ var projectInfoColumns = ProjectInfoColumns{
 	ProductId:       "product_id",
 	CreatedAt:       "created_at",
 	UpdatedAt:       "updated_at",
+	FeeForm:         "fee_form",
 }
 
 // NewProjectInfoDao creates and returns a new DAO object for table data access.

+ 10 - 0
app/dao/internal/recruit_strategy.go

@@ -27,6 +27,11 @@ type RecruitStrategyColumns struct {
 	RecruitNumber     string // 招募数量
 	Offer             string // 报价
 	ProjectId         string // 所属项目id
+	ServiceCharge     string // 平台服务费,稿费形式为产品置换时必填
+	SelectedNumber    string // 已选数量,被企业选择的达人数量
+	WaitingNumber     string // 待发货
+	DeliveredNumber   string // 已发货
+	SignedNumber      string // 已签收
 }
 
 //  recruitStrategyColumns holds the columns for table recruit_strategy.
@@ -39,6 +44,11 @@ var recruitStrategyColumns = RecruitStrategyColumns{
 	RecruitNumber:     "recruit_number",
 	Offer:             "offer",
 	ProjectId:         "project_id",
+	ServiceCharge:     "service_charge",
+	SelectedNumber:    "selected_number",
+	WaitingNumber:     "waiting_number",
+	DeliveredNumber:   "delivered_number",
+	SignedNumber:      "signed_number",
 }
 
 // NewRecruitStrategyDao creates and returns a new DAO object for table data access.

+ 0 - 2
app/dao/internal/youngee_talent_delivery_address.go

@@ -26,7 +26,6 @@ type YoungeeTalentDeliveryAddressColumns struct {
 	PhoneNumber  string // 联系电话
 	ReceiverName string // 收货人名字
 	DefaultTag   string // 是否默认收货地址
-	MailCode     string // 邮政编码
 }
 
 //  youngeeTalentDeliveryAddressColumns holds the columns for table youngee_talent_delivery_address.
@@ -38,7 +37,6 @@ var youngeeTalentDeliveryAddressColumns = YoungeeTalentDeliveryAddressColumns{
 	PhoneNumber:  "phone_number",
 	ReceiverName: "receiver_name",
 	DefaultTag:   "default_tag",
-	MailCode:     "mail_code",
 }
 
 // NewYoungeeTalentDeliveryAddressDao creates and returns a new DAO object for table data access.

+ 4 - 4
app/dao/internal/youngee_talent_info.go

@@ -22,17 +22,16 @@ type YoungeeTalentInfoColumns struct {
 	Id                string // 达人id
 	TalentWxOpenid    string // 达人的微信openid
 	TalentWxNickname  string // 达人的微信昵称
-	TalentWxNumber    string // 达人微信号
 	Income            string // 收益总数
 	Withdrawing       string // 提现中金额
 	Canwithdraw       string // 可提现金额
 	Withdrawed        string // 已提现金额
-	TalentGender      string // 性别,0未知 1男 2女
 	TalentPhoneNumber string // 电话号码
 	TalentAgeBracket  string // 年龄段,取tallent_age_bracket表id
 	TalentNationality string // 国籍,取tallent_nationality表id
 	VisitStoreRegion  string // 探店区域,取region_info表中的self_code
 	IsBindInfo        string // 是否填写个人资料
+	IsBindAccount     string // 是否绑定账号,1是0否
 	IsBindLocation    string // 是否绑定收货地址
 	IsBindBank        string // 是否绑定银行账户信息
 	InBlacklist       string // 是否加入黑名单 0否 1是
@@ -42,6 +41,7 @@ type YoungeeTalentInfoColumns struct {
 	TaskEnd           string // 结束任务数量
 	CreateDate        string // 创建时间
 	LastLoginDate     string // 最后登录时间
+	ApplyNum          string // 剩余申请次数(每天更新)
 }
 
 //  youngeeTalentInfoColumns holds the columns for table youngee_talent_info.
@@ -49,17 +49,16 @@ var youngeeTalentInfoColumns = YoungeeTalentInfoColumns{
 	Id:                "id",
 	TalentWxOpenid:    "talent_wx_openid",
 	TalentWxNickname:  "talent_wx_nickname",
-	TalentWxNumber:    "talent_wx_number",
 	Income:            "income",
 	Withdrawing:       "withdrawing",
 	Canwithdraw:       "canwithdraw",
 	Withdrawed:        "withdrawed",
-	TalentGender:      "talent_gender",
 	TalentPhoneNumber: "talent_phone_number",
 	TalentAgeBracket:  "talent_age_bracket",
 	TalentNationality: "talent_nationality",
 	VisitStoreRegion:  "visit_store_region",
 	IsBindInfo:        "is_bind_info",
+	IsBindAccount:     "is_bind_account",
 	IsBindLocation:    "is_bind_location",
 	IsBindBank:        "is_bind_bank",
 	InBlacklist:       "in_blacklist",
@@ -69,6 +68,7 @@ var youngeeTalentInfoColumns = YoungeeTalentInfoColumns{
 	TaskEnd:           "task_end",
 	CreateDate:        "create_date",
 	LastLoginDate:     "last_login_date",
+	ApplyNum:          "apply_num",
 }
 
 // NewYoungeeTalentInfoDao creates and returns a new DAO object for table data access.

+ 25 - 3
app/dao/internal/youngee_task_info.go

@@ -22,17 +22,28 @@ type YoungeeTaskInfoColumns struct {
 	TaskId                 string // 任务id
 	ProjectId              string // 项目id
 	TalentId               string // 达人id
+	AccountId              string // 账号id
 	TalentPlatformInfoSnap string // 达人平台信息快照
 	TalentPersonalInfoSnap string // 达人个人信息快照
 	TalentPostAddrSnap     string // 收货地址快照
 	StrategyId             string // 报名选择的招募策略id
-	TaskReward             string // 任务奖励金额
-	SettleAmount           string // 待结算金额(任务奖励扣除违规扣款)
-	TaskStatus             string // 任务状态
+	TaskReward             string // 达人报酬
+	SettleAmount           string // 达人实际所得(扣除违约扣款)
+	AllPayment             string // 企业支付
+	RealPayment            string // 企业实际支付(扣除违约扣款)
+	Penalty                string // 违约扣款比例,百分之
+	FeeForm                string // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ServiceCharge          string // 服务费
+	ServiceRate            string // 服务费率,千分之
+	TaskStatus             string // 任务状态 1待选 2已选 3落选
+	TaskStage              string // 任务阶段,详情见info_task_stage表
 	CreateDate             string // 创建时间
 	SelectDate             string // 反选时间
+	DeliveryDate           string // 发货时间
 	CompleteStatus         string // 结束方式 1未结束 2正常结束 3反选失败 4被解约
 	CompleteDate           string // 结束时间
+	LogisticsStatus        string // 发货状态 1 待发货 2已发货 3 已签收
+	ScriptStatus           string // 脚本上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
 }
 
 //  youngeeTaskInfoColumns holds the columns for table youngee_task_info.
@@ -40,17 +51,28 @@ var youngeeTaskInfoColumns = YoungeeTaskInfoColumns{
 	TaskId:                 "task_id",
 	ProjectId:              "project_id",
 	TalentId:               "talent_id",
+	AccountId:              "account_id",
 	TalentPlatformInfoSnap: "talent_platform_info_snap",
 	TalentPersonalInfoSnap: "talent_personal_info_snap",
 	TalentPostAddrSnap:     "talent_post_addr_snap",
 	StrategyId:             "strategy_id",
 	TaskReward:             "task_reward",
 	SettleAmount:           "settle_amount",
+	AllPayment:             "all_payment",
+	RealPayment:            "real_payment",
+	Penalty:                "penalty",
+	FeeForm:                "fee_form",
+	ServiceCharge:          "service_charge",
+	ServiceRate:            "service_rate",
 	TaskStatus:             "task_status",
+	TaskStage:              "task_stage",
 	CreateDate:             "create_date",
 	SelectDate:             "select_date",
+	DeliveryDate:           "delivery_date",
 	CompleteStatus:         "complete_status",
 	CompleteDate:           "complete_date",
+	LogisticsStatus:        "logistics_status",
+	ScriptStatus:           "script_status",
 }
 
 // NewYoungeeTaskInfoDao creates and returns a new DAO object for table data access.

+ 77 - 0
app/dao/internal/youngee_task_logistics.go

@@ -0,0 +1,77 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// YoungeeTaskLogisticsDao is the manager for logic model data accessing and custom defined data operations functions management.
+type YoungeeTaskLogisticsDao struct {
+	Table   string                      // Table is the underlying table name of the DAO.
+	Group   string                      // Group is the database configuration group name of current DAO.
+	Columns YoungeeTaskLogisticsColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// YoungeeTaskLogisticsColumns defines and stores column names for table youngee_task_logistics.
+type YoungeeTaskLogisticsColumns struct {
+	LogisticsId           string // 货物-id
+	CompanyName           string // 实物商品-物流公司名称
+	LogisticsNumber       string // 实物商品-物流单号
+	ExplorestoreStarttime string // 线下探店-探店开始时间
+	ExplorestoreEndtime   string // 线下探店-探店结束时间
+	ExplorestorePeriod    string // 线下探店-探店持续时间
+	CouponCodeInformation string // 虚拟产品-券码信息
+	TaskId                string // 任务id
+	DeliveryTime          string // 发货时间
+	ThingsType            string // 任务类型:1 实物,2:线下探店,3:虚拟产品
+	SignedTime            string // 实物商品-签收时间
+}
+
+//  youngeeTaskLogisticsColumns holds the columns for table youngee_task_logistics.
+var youngeeTaskLogisticsColumns = YoungeeTaskLogisticsColumns{
+	LogisticsId:           "logistics_id",
+	CompanyName:           "company_name",
+	LogisticsNumber:       "logistics_number",
+	ExplorestoreStarttime: "explorestore_starttime",
+	ExplorestoreEndtime:   "explorestore_endtime",
+	ExplorestorePeriod:    "explorestore_period",
+	CouponCodeInformation: "coupon_code_information",
+	TaskId:                "task_id",
+	DeliveryTime:          "delivery_time",
+	ThingsType:            "things_type",
+	SignedTime:            "signed_time",
+}
+
+// NewYoungeeTaskLogisticsDao creates and returns a new DAO object for table data access.
+func NewYoungeeTaskLogisticsDao() *YoungeeTaskLogisticsDao {
+	return &YoungeeTaskLogisticsDao{
+		Group:   "default",
+		Table:   "youngee_task_logistics",
+		Columns: youngeeTaskLogisticsColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *YoungeeTaskLogisticsDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *YoungeeTaskLogisticsDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *YoungeeTaskLogisticsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 77 - 0
app/dao/internal/youngee_task_pay.go

@@ -0,0 +1,77 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// YoungeeTaskPayDao is the manager for logic model data accessing and custom defined data operations functions management.
+type YoungeeTaskPayDao struct {
+	Table   string                // Table is the underlying table name of the DAO.
+	Group   string                // Group is the database configuration group name of current DAO.
+	Columns YoungeeTaskPayColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// YoungeeTaskPayColumns defines and stores column names for table youngee_task_pay.
+type YoungeeTaskPayColumns struct {
+	Id            string // id
+	TaskId        string // 任务id
+	AllReward     string // 达人报酬
+	RealReward    string // 达人实际所得(扣除违约扣款)
+	AllPayment    string // 企业支付
+	RealPayment   string // 企业实际支付(扣除违约扣款)
+	Penalty       string // 违约扣款比例,百分之
+	FeeForm       string // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ServiceCharge string // 服务费
+	ServiceRate   string // 服务费率
+	UpdateAt      string // 更新时间
+}
+
+//  youngeeTaskPayColumns holds the columns for table youngee_task_pay.
+var youngeeTaskPayColumns = YoungeeTaskPayColumns{
+	Id:            "id",
+	TaskId:        "task_id",
+	AllReward:     "all_reward",
+	RealReward:    "real_reward",
+	AllPayment:    "all_payment",
+	RealPayment:   "real_payment",
+	Penalty:       "penalty",
+	FeeForm:       "fee_form",
+	ServiceCharge: "service_charge",
+	ServiceRate:   "service_rate",
+	UpdateAt:      "update_at",
+}
+
+// NewYoungeeTaskPayDao creates and returns a new DAO object for table data access.
+func NewYoungeeTaskPayDao() *YoungeeTaskPayDao {
+	return &YoungeeTaskPayDao{
+		Group:   "default",
+		Table:   "youngee_task_pay",
+		Columns: youngeeTaskPayColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *YoungeeTaskPayDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *YoungeeTaskPayDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *YoungeeTaskPayDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 71 - 0
app/dao/internal/younggee_script_info.go

@@ -0,0 +1,71 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+)
+
+// YounggeeScriptInfoDao is the manager for logic model data accessing and custom defined data operations functions management.
+type YounggeeScriptInfoDao struct {
+	Table   string                    // Table is the underlying table name of the DAO.
+	Group   string                    // Group is the database configuration group name of current DAO.
+	Columns YounggeeScriptInfoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
+}
+
+// YounggeeScriptInfoColumns defines and stores column names for table younggee_script_info.
+type YounggeeScriptInfoColumns struct {
+	ScriptId      string // 脚本id
+	TaskId        string //
+	Content       string // 任务阶段
+	ReviseOpinion string //
+	CreateAt      string //
+	AgreeAt       string //
+	RejectAt      string //
+	IsReview      string //
+}
+
+//  younggeeScriptInfoColumns holds the columns for table younggee_script_info.
+var younggeeScriptInfoColumns = YounggeeScriptInfoColumns{
+	ScriptId:      "script_id",
+	TaskId:        "task_id",
+	Content:       "content",
+	ReviseOpinion: "revise_opinion",
+	CreateAt:      "create_at",
+	AgreeAt:       "agree_at",
+	RejectAt:      "reject_at",
+	IsReview:      "is_review",
+}
+
+// NewYounggeeScriptInfoDao creates and returns a new DAO object for table data access.
+func NewYounggeeScriptInfoDao() *YounggeeScriptInfoDao {
+	return &YounggeeScriptInfoDao{
+		Group:   "default",
+		Table:   "younggee_script_info",
+		Columns: younggeeScriptInfoColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *YounggeeScriptInfoDao) DB() gdb.DB {
+	return g.DB(dao.Group)
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *YounggeeScriptInfoDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *YounggeeScriptInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 24 - 0
app/dao/youngee_task_logistics.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// youngeeTaskLogisticsDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type youngeeTaskLogisticsDao struct {
+	*internal.YoungeeTaskLogisticsDao
+}
+
+var (
+	// YoungeeTaskLogistics is globally public accessible object for table youngee_task_logistics operations.
+	YoungeeTaskLogistics = youngeeTaskLogisticsDao{
+		internal.NewYoungeeTaskLogisticsDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
app/dao/youngee_task_pay.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// youngeeTaskPayDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type youngeeTaskPayDao struct {
+	*internal.YoungeeTaskPayDao
+}
+
+var (
+	// YoungeeTaskPay is globally public accessible object for table youngee_task_pay operations.
+	YoungeeTaskPay = youngeeTaskPayDao{
+		internal.NewYoungeeTaskPayDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
app/dao/younggee_script_info.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"youngmini_server/app/dao/internal"
+)
+
+// younggeeScriptInfoDao is the manager for logic model data accessing and custom defined data operations functions management.
+// You can define custom methods on it to extend its functionality as you wish.
+type younggeeScriptInfoDao struct {
+	*internal.YounggeeScriptInfoDao
+}
+
+var (
+	// YounggeeScriptInfo is globally public accessible object for table younggee_script_info operations.
+	YounggeeScriptInfo = younggeeScriptInfoDao{
+		internal.NewYounggeeScriptInfoDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 88 - 7
app/model/model.go

@@ -74,12 +74,44 @@ type Enterprise struct {
 	UpdatedAt        *gtime.Time `orm:"updated_at"            json:"updated_at"`        // 更新时间
 }
 
+// EnterprisePayRecord is the golang structure for table enterprise_pay_record.
+type EnterprisePayRecord struct {
+	Id           int         `orm:"id,primary"    json:"id"`            // id
+	Payment      int         `orm:"payment"       json:"payment"`       // 交易金额
+	Balance      int         `orm:"balance"       json:"balance"`       // 交易后账户可用余额
+	PayType      int         `orm:"pay_type"      json:"pay_type"`      // 交易类型,1表示充值,2表示支付
+	RechargeType int         `orm:"recharge_type" json:"recharge_type"` // 充值方式,1表示在线交易,2表示对公转账
+	EnterpriseId int         `orm:"enterprise_id" json:"enterprise_id"` // 企业id
+	PayAt        *gtime.Time `orm:"pay_at"        json:"pay_at"`        // 交易时间
+	ProjectId    int         `orm:"project_id"    json:"project_id"`    // 支付的项目id
+}
+
+// InfoPricingStrategy is the golang structure for table info_pricing_strategy.
+type InfoPricingStrategy struct {
+	Id            int         `orm:"id,primary"     json:"id"`             // id
+	FeeForm       int         `orm:"fee_form"       json:"fee_form"`       // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	Platform      int         `orm:"platform"       json:"platform"`       // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	FansLow       int         `orm:"fans_low"       json:"fans_low"`       // 对应粉丝量下限
+	FansUp        int         `orm:"fans_up"        json:"fans_up"`        // 对应粉丝量上限
+	ServiceCharge int         `orm:"service_charge" json:"service_charge"` // 服务费,稿费形式为产品置换时填写,可以为空
+	ServiceRate   int         `orm:"service_rate"   json:"service_rate"`   // 服务费率*1000,稿费形式为固定稿费和自报价时填写,可以为空
+	UpdateId      int         `orm:"update_id"      json:"update_id"`      // 修改管理人员id,对应user表中主键
+	UpdateAt      *gtime.Time `orm:"update_at"      json:"update_at"`      // 修改时间
+	CreateAt      *gtime.Time `orm:"create_at"      json:"create_at"`      // 创建时间
+}
+
 // InfoProductClassify is the golang structure for table info_product_classify.
 type InfoProductClassify struct {
 	ClassifyId int    `orm:"classify_id,primary" json:"classify_id"` // 分类id
 	Classify   string `orm:"classify"            json:"classify"`    // 分类名
 }
 
+// InfoProductType is the golang structure for table info_product_type.
+type InfoProductType struct {
+	ProductTypeId int    `orm:"product_type_id,primary" json:"product_type_id"` // 商品类型id
+	ProductType   string `orm:"product_type"            json:"product_type"`    // 商品类型
+}
+
 // InfoRegion is the golang structure for table info_region.
 type InfoRegion struct {
 	RegionId    uint   `orm:"region_id,primary" json:"region_id"`    //
@@ -107,6 +139,12 @@ type InfoTalentSkinType struct {
 	SkinTypeDescribe string `orm:"skin_type_describe" json:"skin_type_describe"` //
 }
 
+// InfoTaskStage is the golang structure for table info_task_stage.
+type InfoTaskStage struct {
+	TaskStageId int    `orm:"task_stage_id,primary" json:"task_stage_id"` // 任务阶段id
+	TaskStage   string `orm:"task_stage"            json:"task_stage"`    // 任务阶段
+}
+
 // InfoThirdPlatform is the golang structure for table info_third_platform.
 type InfoThirdPlatform struct {
 	PlatformId        uint   `orm:"platform_id,primary" json:"platform_id"`         // 平台id,主键
@@ -454,6 +492,7 @@ type ProjectInfo struct {
 	ProductId       int         `orm:"product_id"         json:"product_id"`       // 关联商品id
 	CreatedAt       *gtime.Time `orm:"created_at"         json:"created_at"`       // 创建时间
 	UpdatedAt       *gtime.Time `orm:"updated_at"         json:"updated_at"`       // 修改时间
+	FeeForm         string      `orm:"fee_form"           json:"fee_form"`         // 稿费形式列表
 }
 
 // ProjectPhoto is the golang structure for table project_photo.
@@ -502,6 +541,11 @@ type RecruitStrategy struct {
 	RecruitNumber     int `orm:"recruit_number"              json:"recruit_number"`      // 招募数量
 	Offer             int `orm:"offer"                       json:"offer"`               // 报价
 	ProjectId         int `orm:"project_id"                  json:"project_id"`          // 所属项目id
+	ServiceCharge     int `orm:"service_charge"              json:"service_charge"`      // 平台服务费,稿费形式为产品置换时必填
+	SelectedNumber    int `orm:"selected_number"             json:"selected_number"`     // 已选数量,被企业选择的达人数量
+	WaitingNumber     int `orm:"waiting_number"              json:"waiting_number"`      // 待发货
+	DeliveredNumber   int `orm:"delivered_number"            json:"delivered_number"`    // 已发货
+	SignedNumber      int `orm:"signed_number"               json:"signed_number"`       // 已签收
 }
 
 // TalentDeliveryAddress is the golang structure for table talent_delivery_address.
@@ -786,7 +830,6 @@ type YoungeeTalentDeliveryAddress struct {
 	PhoneNumber  string `orm:"phone_number"       json:"phone_number"`  // 联系电话
 	ReceiverName string `orm:"receiver_name"      json:"receiver_name"` // 收货人名字
 	DefaultTag   int    `orm:"default_tag"        json:"default_tag"`   // 是否默认收货地址
-	MailCode     string `orm:"mail_code"          json:"mail_code"`     // 邮政编码
 }
 
 // YoungeeTalentInfo is the golang structure for table youngee_talent_info.
@@ -794,17 +837,16 @@ type YoungeeTalentInfo struct {
 	Id                string      `orm:"id,primary"          json:"id"`                  // 达人id
 	TalentWxOpenid    string      `orm:"talent_wx_openid"    json:"talent_wx_openid"`    // 达人的微信openid
 	TalentWxNickname  string      `orm:"talent_wx_nickname"  json:"talent_wx_nickname"`  // 达人的微信昵称
-	TalentWxNumber    string      `orm:"talent_wx_number"    json:"talent_wx_number"`    // 达人微信号
 	Income            int64       `orm:"income"              json:"income"`              // 收益总数
 	Withdrawing       int64       `orm:"withdrawing"         json:"withdrawing"`         // 提现中金额
 	Canwithdraw       int64       `orm:"canwithdraw"         json:"canwithdraw"`         // 可提现金额
 	Withdrawed        int64       `orm:"withdrawed"          json:"withdrawed"`          // 已提现金额
-	TalentGender      int         `orm:"talent_gender"       json:"talent_gender"`       // 性别,0未知 1男 2女
 	TalentPhoneNumber string      `orm:"talent_phone_number" json:"talent_phone_number"` // 电话号码
 	TalentAgeBracket  int         `orm:"talent_age_bracket"  json:"talent_age_bracket"`  // 年龄段,取tallent_age_bracket表id
 	TalentNationality int         `orm:"talent_nationality"  json:"talent_nationality"`  // 国籍,取tallent_nationality表id
 	VisitStoreRegion  int         `orm:"visit_store_region"  json:"visit_store_region"`  // 探店区域,取region_info表中的self_code
 	IsBindInfo        uint        `orm:"is_bind_info"        json:"is_bind_info"`        // 是否填写个人资料
+	IsBindAccount     int         `orm:"is_bind_account"     json:"is_bind_account"`     // 是否绑定账号,1是0否
 	IsBindLocation    uint        `orm:"is_bind_location"    json:"is_bind_location"`    // 是否绑定收货地址
 	IsBindBank        uint        `orm:"is_bind_bank"        json:"is_bind_bank"`        // 是否绑定银行账户信息
 	InBlacklist       uint        `orm:"in_blacklist"        json:"in_blacklist"`        // 是否加入黑名单 0否 1是
@@ -814,24 +856,51 @@ type YoungeeTalentInfo struct {
 	TaskEnd           int         `orm:"task_end"            json:"task_end"`            // 结束任务数量
 	CreateDate        *gtime.Time `orm:"create_date"         json:"create_date"`         // 创建时间
 	LastLoginDate     *gtime.Time `orm:"last_login_date"     json:"last_login_date"`     // 最后登录时间
+	ApplyNum          int         `orm:"apply_num"           json:"apply_num"`           // 剩余申请次数(每天更新)
 }
 
 // YoungeeTaskInfo is the golang structure for table youngee_task_info.
 type YoungeeTaskInfo struct {
-	TaskId                 uint64      `orm:"task_id,primary"           json:"task_id"`                   // 任务id
+	TaskId                 int         `orm:"task_id,primary"           json:"task_id"`                   // 任务id
 	ProjectId              int         `orm:"project_id"                json:"project_id"`                // 项目id
 	TalentId               string      `orm:"talent_id"                 json:"talent_id"`                 // 达人id
+	AccountId              int         `orm:"account_id"                json:"account_id"`                // 账号id
 	TalentPlatformInfoSnap string      `orm:"talent_platform_info_snap" json:"talent_platform_info_snap"` // 达人平台信息快照
 	TalentPersonalInfoSnap string      `orm:"talent_personal_info_snap" json:"talent_personal_info_snap"` // 达人个人信息快照
 	TalentPostAddrSnap     string      `orm:"talent_post_addr_snap"     json:"talent_post_addr_snap"`     // 收货地址快照
 	StrategyId             int         `orm:"strategy_id"               json:"strategy_id"`               // 报名选择的招募策略id
-	TaskReward             int64       `orm:"task_reward"               json:"task_reward"`               // 任务奖励金额
-	SettleAmount           int64       `orm:"settle_amount"             json:"settle_amount"`             // 待结算金额(任务奖励扣除违规扣款)
-	TaskStatus             int         `orm:"task_status"               json:"task_status"`               // 任务状态
+	TaskReward             float64     `orm:"task_reward"               json:"task_reward"`               // 达人报酬
+	SettleAmount           float64     `orm:"settle_amount"             json:"settle_amount"`             // 达人实际所得(扣除违约扣款)
+	AllPayment             float64     `orm:"all_payment"               json:"all_payment"`               // 企业支付
+	RealPayment            float64     `orm:"real_payment"              json:"real_payment"`              // 企业实际支付(扣除违约扣款)
+	Penalty                int         `orm:"penalty"                   json:"penalty"`                   // 违约扣款比例,百分之
+	FeeForm                int         `orm:"fee_form"                  json:"fee_form"`                  // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ServiceCharge          float64     `orm:"service_charge"            json:"service_charge"`            // 服务费
+	ServiceRate            int         `orm:"service_rate"              json:"service_rate"`              // 服务费率,千分之
+	TaskStatus             int         `orm:"task_status"               json:"task_status"`               // 任务状态 1待选 2已选 3落选
+	TaskStage              int         `orm:"task_stage"                json:"task_stage"`                // 任务阶段,详情见info_task_stage表
 	CreateDate             *gtime.Time `orm:"create_date"               json:"create_date"`               // 创建时间
 	SelectDate             *gtime.Time `orm:"select_date"               json:"select_date"`               // 反选时间
+	DeliveryDate           *gtime.Time `orm:"delivery_date"             json:"delivery_date"`             // 发货时间
 	CompleteStatus         int         `orm:"complete_status"           json:"complete_status"`           // 结束方式 1未结束 2正常结束 3反选失败 4被解约
 	CompleteDate           *gtime.Time `orm:"complete_date"             json:"complete_date"`             // 结束时间
+	LogisticsStatus        int         `orm:"logistics_status"          json:"logistics_status"`          // 发货状态 1 待发货 2已发货 3 已签收
+	ScriptStatus           int         `orm:"script_status"             json:"script_status"`             // 脚本上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+}
+
+// YoungeeTaskLogistics is the golang structure for table youngee_task_logistics.
+type YoungeeTaskLogistics struct {
+	LogisticsId           int         `orm:"logistics_id,primary"    json:"logistics_id"`            // 货物-id
+	CompanyName           string      `orm:"company_name"            json:"company_name"`            // 实物商品-物流公司名称
+	LogisticsNumber       string      `orm:"logistics_number"        json:"logistics_number"`        // 实物商品-物流单号
+	ExplorestoreStarttime *gtime.Time `orm:"explorestore_starttime"  json:"explorestore_starttime"`  // 线下探店-探店开始时间
+	ExplorestoreEndtime   *gtime.Time `orm:"explorestore_endtime"    json:"explorestore_endtime"`    // 线下探店-探店结束时间
+	ExplorestorePeriod    string      `orm:"explorestore_period"     json:"explorestore_period"`     // 线下探店-探店持续时间
+	CouponCodeInformation string      `orm:"coupon_code_information" json:"coupon_code_information"` // 虚拟产品-券码信息
+	TaskId                int         `orm:"task_id,unique"          json:"task_id"`                 // 任务id
+	DeliveryTime          *gtime.Time `orm:"delivery_time"           json:"delivery_time"`           // 发货时间
+	ThingsType            int         `orm:"things_type"             json:"things_type"`             // 任务类型:1 实物,2:线下探店,3:虚拟产品
+	SignedTime            *gtime.Time `orm:"signed_time"             json:"signed_time"`             // 实物商品-签收时间
 }
 
 // YounggeeProduct is the golang structure for table younggee_product.
@@ -859,6 +928,18 @@ type YounggeeProductPhoto struct {
 	CreatedAt      *gtime.Time `orm:"created_at"               json:"created_at"`       // 创建时间
 }
 
+// YounggeeScriptInfo is the golang structure for table younggee_script_info.
+type YounggeeScriptInfo struct {
+	ScriptId      int         `orm:"script_id,primary" json:"script_id"`      // 脚本id
+	TaskId        int         `orm:"task_id"           json:"task_id"`        //
+	Content       string      `orm:"content"           json:"content"`        // 任务阶段
+	ReviseOpinion string      `orm:"revise_opinion"    json:"revise_opinion"` //
+	CreateAt      *gtime.Time `orm:"create_at"         json:"create_at"`      //
+	AgreeAt       *gtime.Time `orm:"agree_at"          json:"agree_at"`       //
+	RejectAt      *gtime.Time `orm:"reject_at"         json:"reject_at"`      //
+	IsReview      int         `orm:"is_review"         json:"is_review"`      //
+}
+
 // YounggeeUser is the golang structure for table younggee_user.
 type YounggeeUser struct {
 	Id            int         `orm:"id,primary"      json:"id"`              // 用户表id

+ 5 - 4
app/model/youngee_talent_model/info_tables.go

@@ -3,10 +3,11 @@ package youngee_talent_model
 import "youngmini_server/app/model"
 
 type InfoTables struct {
-	ProductClassify []model.InfoProductClassify
-	AgeBracket      []model.InfoTalentAgeBracket
-	SkilledArea     []model.InfoTalentSkilledArea
-	ThirdPlatform   []ThirdPlatformInfo
+	ProductType   []model.InfoProductType
+	AgeBracket    []model.InfoTalentAgeBracket
+	SkilledArea   []model.InfoTalentSkilledArea
+	ThirdPlatform []ThirdPlatformInfo
+	TaskStage     []model.InfoTaskStage
 }
 
 type ThirdPlatformInfo struct {

+ 1 - 0
app/model/youngee_talent_model/project_detail.go

@@ -44,6 +44,7 @@ type RecruitStrategy struct {
 	RecruitNumber     int `json:"recruit_number"`      // 招募数量
 	Offer             int `json:"offer"`               // 报价
 	ProjectId         int `json:"project_id"`          // 所属项目id
+	ServiceCharge     int `json:"service_charge"`      // 平台服务费,稿费形式为产品置换时必填
 }
 
 type ProjectPhoto struct {

+ 0 - 2
app/model/youngee_talent_model/talent_address.go

@@ -9,7 +9,6 @@ type TalentDeliveryAddress struct {
 	PhoneNumber  string `json:"phone_number"`  // 联系电话
 	ReceiverName string `json:"receiver_name"` // 收货人名字
 	DefaultTag   int    `json:"default_tag"`   // 是否默认收货地址
-	MailCode     string `json:"mail_code"`     // 邮政编码
 	TalentId     string `json:"talent_id"`     // 达人id(youngee_talent_info表中的id)
 }
 
@@ -26,5 +25,4 @@ type DeliveryAddressModifyReq struct {
 	DetailAddr   string `json:"detail_addr"`   // 详细地址
 	PhoneNumber  string `json:"phone_number"`  // 联系电话
 	ReceiverName string `json:"receiver_name"` // 收货人名字
-	MailCode     string `json:"mail_code"`     // 邮政编码
 }

+ 0 - 4
app/model/youngee_talent_model/talent_info.go

@@ -6,8 +6,6 @@ import (
 
 // TalentSelfInputInfo 达人端用户输入的属性
 type TalentSelfInputInfo struct {
-	TalentWxNumber    string `json:"talent_wx_number"`    // 达人微信号
-	TalentGender      int    `json:"talent_gender"`       // 性别,0未知 1男 2女
 	TalentPhoneNumber string `json:"talent_phone_number"` // 电话号码
 	TalentAgeBracket  int    `json:"talent_age_bracket"`  // 年龄段,取tallent_age_bracket表id
 	TalentNationality int    `json:"talent_nationality"`  // 国籍,取tallent_nationality表id
@@ -20,12 +18,10 @@ type TalentInfo struct {
 	Id                string `json:"id"`                  // 达人id
 	TalentWxOpenid    string `json:"talent_wx_openid"`    // 达人的微信openid
 	TalentWxNickname  string `json:"talent_wx_nickname"`  // 达人的微信昵称
-	TalentWxNumber    string `json:"talent_wx_number"`    // 达人微信号
 	Income            int64  `json:"income"`              // 收益总数
 	Withdrawing       int64  `json:"withdrawing"`         // 提现中金额
 	Canwithdraw       int64  `json:"canwithdraw"`         // 可提现金额
 	Withdrawed        int64  `json:"withdrawed"`          // 已提现金额
-	TalentGender      int    `json:"talent_gender"`       // 性别,0未知 1男 2女
 	TalentPhoneNumber string `json:"talent_phone_number"` // 电话号码
 	TalentAgeBracket  int    `json:"talent_age_bracket"`  // 年龄段,取tallent_age_bracket表id
 	TalentNationality int    `json:"talent_nationality"`  // 国籍,取tallent_nationality表id

+ 61 - 6
app/model/youngee_talent_model/task_info.go

@@ -1,6 +1,8 @@
 package youngee_talent_model
 
 import (
+	"youngmini_server/app/model"
+
 	"github.com/gogf/gf/util/gmeta"
 
 	"github.com/gogf/gf/os/gtime"
@@ -8,18 +10,71 @@ import (
 
 type YoungeeTaskInfo struct {
 	gmeta.Meta             `orm:"table:youngee_task_info"`
-	TaskId                 uint64      `json:"task_id"`                   //
-	ProjectId              int         `json:"project_id"`                // 任务id
-	TalentId               string      `json:"talent_id"`                 // 达人id(youngee_talent_info表中的id)
+	TaskId                 int         `json:"task_id"`                   // 任务id
+	ProjectId              int         `json:"project_id"`                // 项目id
+	TalentId               string      `json:"talent_id"`                 // 达人id
+	AccountId              int         `json:"account_id"`                // 账号id
 	TalentPlatformInfoSnap string      `json:"talent_platform_info_snap"` // 达人平台信息快照
 	TalentPersonalInfoSnap string      `json:"talent_personal_info_snap"` // 达人个人信息快照
 	TalentPostAddrSnap     string      `json:"talent_post_addr_snap"`     // 收货地址快照
 	StrategyId             int         `json:"strategy_id"`               // 报名选择的招募策略id
-	TaskReward             int64       `json:"task_reward"`               // 任务奖励金额
-	SettleAmount           int64       `json:"settle_amount"`             // 待结算金额(任务奖励扣除违规扣款)
-	TaskStatus             int         `json:"task_status"`               // 任务状态
+	TaskReward             float64     `json:"task_reward"`               // 达人报酬
+	SettleAmount           float64     `json:"settle_amount"`             // 达人实际所得(扣除违约扣款)
+	AllPayment             float64     `json:"all_payment"`               // 企业支付
+	RealPayment            float64     `json:"real_payment"`              // 企业实际支付(扣除违约扣款)
+	Penalty                int         `json:"penalty"`                   // 违约扣款比例,百分之
+	FeeForm                int         `json:"fee_form"`                  // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ServiceCharge          float64     `json:"service_charge"`            // 服务费
+	ServiceRate            int         `json:"service_rate"`              // 服务费率,千分之
+	TaskStatus             int         `json:"task_status"`               // 任务状态 1待选 2已选 3落选
+	TaskStage              int         `json:"task_stage"`                // 任务阶段
 	CreateDate             *gtime.Time `json:"create_date"`               // 创建时间
 	SelectDate             *gtime.Time `json:"select_date"`               // 反选时间
 	CompleteStatus         int         `json:"complete_status"`           // 结束方式 1未结束 2正常结束 3反选失败 4被解约
 	CompleteDate           *gtime.Time `json:"complete_date"`             // 结束时间
 }
+
+type SignTaskInfo struct {
+	ProjectId  uint64 `json:"project_id"`
+	AddressId  uint64 `json:"address_id"`
+	StrategyId int    `json:"strategy_id"`
+	Offer      int    `json:"offer"`
+}
+
+type TaskInfoBrief struct {
+	TaskId           uint64 `json:"task_id"`
+	PlatformIconUrl  string `json:"platform_icon_url"`
+	PlatformName     string `json:"platform_name"`
+	PlatformNickName string `json:"platform_nick_name"`
+	ProjectName      string `json:"project_name"`
+	ProductImgUrl    string `json:"product_img_url"`
+	TaskStatus       int    `json:"task_status"`
+	TaskStage        int    `json:"task_stage"`
+}
+
+type TaskInfoBriefList struct {
+	AllTaskInfoList       []*TaskInfoBrief `json:"all_Task_info_list"`
+	SignUpTaskInfoList    []*TaskInfoBrief `json:"sgin_up_Task_info_list"`
+	GoingOnTaskInfoList   []*TaskInfoBrief `json:"going_on_Task_info_list"`
+	CompletedTaskInfoList []*TaskInfoBrief `json:"completed_Task_info_list"`
+}
+type EXETaskInfoBriefList struct {
+	List1 []*TaskInfoBrief `json:"list1"`
+	List2 []*TaskInfoBrief `json:"list2"`
+	List3 []*TaskInfoBrief `json:"list3"`
+	List4 []*TaskInfoBrief `json:"list4"`
+}
+
+type TaskNum struct {
+	AllNum       int `json:"all_num"`
+	SignUpNum    int `json:"sign_up_num"`
+	GoingOnNum   int `json:"going_on_num"`
+	CompletedNum int `json:"completed_num"`
+}
+
+type TaskDetail struct {
+	TaskInfo      *model.YoungeeTaskInfo      `json:"task_info"`
+	ProjectDetail *ProjectDetail              `json:"project_detail"`
+	ProductPhoto  *model.YounggeeProductPhoto `json:"product_photo"`
+	Strategy      *model.RecruitStrategy      `json:"strategy"`
+}

+ 6 - 0
app/model/youngee_talent_model/task_script.go

@@ -0,0 +1,6 @@
+package youngee_talent_model
+
+type AddTaskScriptRequest struct {
+	TaskId  int    `orm:"task_id"           json:"task_id"` // 任务id
+	Content string `orm:"content"           json:"content"` // 脚本内容
+}

+ 0 - 271
app/service/talent_service/bobo_coin.go

@@ -1,271 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-// GetBoBoCoinList 获取卜卜币收入支出记录列表
-func GetBoBoCoinList(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	//res, err := g.DB().Model(dao.BobocoinIncomeRecord.Table, "coin").Where("coin.talent_id", tid).OrderDesc("complete_date").
-	//	LeftJoin(dao.OrderInfo.Table, "order", "order.order_id=coin.order_id").
-	//	LeftJoin(dao.TaskBaseInfo.Table, "task", "task.task_id=order.task_id").
-	//	Fields("task.task_name", "coin.*").All()
-	//var res []*talent_model.BoBoCoinIncomeInfo
-	//err = g.DB().Model(dao.BobocoinIncomeRecord.Table).WithAll().Where("talent_id", tid).Scan(&res)
-	//if err != nil {
-	//	return &TalentHttpResult{Code: -2, Msg: "query income info failed"}
-	//}
-	//
-	//res1, err := g.DB().Model(dao.BobocoinWithdrawalRecord.Table).Where("talent_id = ?", tid).OrderDesc("complete_date").All()
-	//if err != nil {
-	//	return &TalentHttpResult{Code: -3, Msg: "query draw info failed"}
-	//}
-	//
-	//if res == nil {
-	//	res = make([]*talent_model.BoBoCoinIncomeInfo, 0)
-	//}
-	//
-	//if res1 == nil {
-	//	res1 = make([]gdb.Record, 0)
-	//}
-	//
-	//allInfo := talent_model.BoBoCoinDetailAccount{IncomeList: res, DrawMoneyList: res1}
-	//
-	//return &TalentHttpResult{Code: 0, Msg: "success", Data: allInfo}
-
-
-
-	// 计算待结算卜卜币
-	var waitSettleValue, settleUpValue int64
-	var talentAllOrder []*model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).Scan(&talentAllOrder, dao.OrderInfo.Columns.TalentId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query talent order info failed"}
-	}
-
-	for _, v := range talentAllOrder {
-		if v.CompleteStatus < int(utils.OrderCompleteTypeNormal) {
-			if v.OrderStatus > 1 {
-				// 执行中的订单,稿费计入待结算
-				waitSettleValue += v.SettleAmount
-			}
-		}
-
-		if v.CompleteStatus == int(utils.OrderCompleteTypeNormal) {
-			// 执行完成订单,稿费计入已结算
-			settleUpValue += v.SettleAmount
-		}
-	}
-
-	// 查询总收入
-	var incomeRes []*model.BobocoinIncomeRecord
-	err = g.DB().Model(dao.BobocoinIncomeRecord.Table).Scan(&incomeRes, dao.BobocoinIncomeRecord.Columns.TalentId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "query income info failed"}
-	}
-
-	incomeRecMap := make(map[uint64]*model.BobocoinIncomeRecord)
-
-	var incomeValue int64
-	// 校验总收入和上面统计的已结算是否相等
-	for _, v := range incomeRes {
-		incomeValue += v.BobocoinValue
-
-		incomeRecMap[uint64(v.OrderId)] = v
-	}
-
-	if incomeValue != settleUpValue {
-		return &TalentHttpResult{Code: -4, Msg: "income value not equ settle up value"}
-	}
-
-	// 查询扣款记录
-	var deductRes []*model.BobocoinDeductRecord
-	err = g.DB().Model(dao.BobocoinDeductRecord.Table).Scan(&deductRes, dao.BobocoinDeductRecord.Columns.TalentId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "query income info failed"}
-	}
-
-	// 查询提现记录
-	var withdrawRes []*model.BobocoinWithdrawalRecord
-	err = g.DB().Model(dao.BobocoinWithdrawalRecord.Table).Scan(&withdrawRes, dao.BobocoinWithdrawalRecord.Columns.TalentId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "query income info failed"}
-	}
-
-	// 计算已提现和待打款
-	var waitPay, hasPaied int64
-	for _, v := range withdrawRes {
-		if v.PayState == 2 {
-			hasPaied += v.DrawAmount
-		} else {
-			waitPay += v.DrawAmount
-		}
-	}
-
-	allInfo := talent_model.BoBoCoinDetailAccount{
-		WaitSettle:    waitSettleValue,
-		SettleUp:      settleUpValue,
-		CanWithdraw:   settleUpValue - hasPaied - waitPay,  // 可提现金额为: 已结算金额 - 已打款金额 - 待打款金额
-		HasWithDraw:   hasPaied,
-		WaitPay:       waitPay,
-		IncomeList:    incomeRes,
-		DrawMoneyList: withdrawRes,
-		DeductList:    deductRes,
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: allInfo}
-}
-
-// GetBoBoCoinOrderSettleInfo 获取订单结算卜卜币的信息
-func GetBoBoCoinOrderSettleInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	// 获取结束状态小于3(1进行中 2已结算)的订单
-	var orderSettleInfo []*talent_model.BoBoCoinOrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).Scan(&orderSettleInfo, "talent_id = ? and complete_status < 3 and order_status > 1", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query order info failed"}
-	}
-
-	orderListMap := make(map[uint64]*talent_model.BoBoCoinOrderInfo)
-
-	// 分别存储已结算和未结算订单
-	allOrderList := talent_model.BoBoCoinOrderSettleStateResult{}
-	for _, v := range orderSettleInfo {
-		if v.CompleteStatus == 1 {
-			allOrderList.UnsettledOrders = append(allOrderList.UnsettledOrders, v)
-		}
-
-		if v.CompleteStatus == 2 {
-			allOrderList.SettleUpOrders = append(allOrderList.SettleUpOrders, v)
-			orderListMap[v.OrderId] = v
-		}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: allOrderList}
-}
-
-// GetBoBoCoinWithdrawalInfo 获取已有提现信息,目前只是支付宝账号
-func GetBoBoCoinWithdrawalInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	rec, err := g.DB().Model(dao.TalentInfo.Table).Fields(dao.TalentInfo.Columns.AliName, dao.TalentInfo.Columns.AliAccount).One("id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query info failed"}
-	}
-
-	boboCoin, err := g.DB().Model(dao.BobocoinIncomeRecord.Table).Where("talent_id", tid).Sum(dao.BobocoinIncomeRecord.Columns.BobocoinValue)
-	if err != nil {
-		boboCoin = 0
-	}
-
-	drawMoney, err := g.DB().Model(dao.BobocoinWithdrawalRecord.Table).
-		Where("talent_id = ? and (pay_state = 1 or pay_state = 2)", tid).
-		Sum(dao.BobocoinWithdrawalRecord.Columns.DrawAmount)
-	if err != nil {
-		drawMoney = 0
-	}
-
-	data := talent_model.BoBoCoinWithdrawInfo{
-		BoBoCoinValue: int64(boboCoin - drawMoney),
-		AliName: rec["ali_name"].String(),
-		AliAccount: rec["ali_account"].String(),
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: data}
-}
-
-// BindWithdrawalAccount 绑定提现账户信息
-func BindWithdrawalAccount(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var info *talent_model.BoBoCoinAliAccountInfo
-	err = r.ParseForm(&info)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-
-	_, err = g.DB().Model(dao.TalentInfo.Table).Update(info, "id", tid)
-	if err != nil {
-		panic(err.Error())
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// BoBoCoinWithdrawalReq 卜卜币提现申请
-func BoBoCoinWithdrawalReq(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	// 查看提现账户信息是否完善
-	accountRec, err := g.DB().Model(dao.TalentInfo.Table).
-		Fields(dao.TalentInfo.Columns.AliName, dao.TalentInfo.Columns.AliAccount).
-		One("id", tid)
-	if err != nil || accountRec[dao.TalentInfo.Columns.AliName] == nil || accountRec[dao.TalentInfo.Columns.AliAccount] == nil {
-		return &TalentHttpResult{Code: -2, Msg: "please complete withdrawal account info"}
-	}
-
-	var info *talent_model.BoBoCoinWithdrawalReq
-	err = r.ParseForm(&info)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: err.Error()}
-	}
-
-	// 获取可提现金额
-	inSum, err := g.DB().Model(dao.BobocoinIncomeRecord.Table).Where("talent_id", tid).Sum(dao.BobocoinIncomeRecord.Columns.BobocoinValue)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "query database failed"}
-	}
-	outSum, err := g.DB().Model(dao.BobocoinWithdrawalRecord.Table).
-		Where("talent_id = ? and (pay_state = 1 or pay_state = 2)", tid).
-		Sum(dao.BobocoinWithdrawalRecord.Columns.DrawAmount)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "query database failed"}
-	}
-
-	// 可提现金额小于申请提现金额,失败,返回
-	withdrawAble := int64(inSum - outSum)
-	if withdrawAble < info.WithdrawalAmount {
-		return &TalentHttpResult{Code: -6, Msg: "bobocoin not enough"}
-	}
-
-	// 将请求写入数据库
-	_, err = g.DB().Model(dao.BobocoinWithdrawalRecord.Table).Insert(model.BobocoinWithdrawalRecord{
-		TalentId:     tid,
-		DrawAmount:   info.WithdrawalAmount,
-		PayAccount:   accountRec[dao.TalentInfo.Columns.AliAccount].String(),
-		AccountName:  accountRec[dao.TalentInfo.Columns.AliName].String(),
-		PayPlatform:  1,
-		PayState:     1,
-		SubmitDate:   gtime.Now(),
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -7, Msg: "write to database failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}

+ 0 - 184
app/service/talent_service/delivery_addr.go

@@ -1,184 +0,0 @@
-package talent_service
-
-import (
-	"context"
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-// OnGetDeliveryAddr 获取达人收货地址列表
-func OnGetDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	res, err := g.DB().Model(dao.TalentDeliveryAddress.Table).All("talent_id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2,Msg: err.Error()}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
-}
-
-// OnGetDeliveryAddrDetail 获取单个收货地址详情
-func OnGetDeliveryAddrDetail(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	addrId := r.GetRequestInt("address_id", 0)
-	if addrId == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "address id error"}
-	}
-
-	rec, err := g.DB().Model(dao.TalentDeliveryAddress.Table).One("address_id = ? and talent_id = ?", addrId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "Delivery address not found"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnAddDeliveryAddr 接受达人端上传的收货地址
-func OnAddDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var tAddr *talent_model.DeliveryAddress
-	err = r.ParseForm(&tAddr)
-	if err != nil {
-		return &TalentHttpResult{Code:-2, Msg: err.Error()}
-	}
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		var tErr error
-		// 如果设置的是地址是默认地址,则把当前默认地址设为非默认
-		if tAddr.DefaultTag > 0{
-			_, tErr = tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).
-				Update("default_tag=0", "talent_id=? and default_tag = 1", tid)
-			if tErr != nil {
-				return tErr
-			}
-		}
-
-		// 将达人id存入结构体
-		tAddr.TalentId = tid
-
-		// 插入新的收货地址记录
-		_, tErr = tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).Insert(tAddr)
-		if tErr != nil {
-			return tErr
-		}
-
-		return nil
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// OnDeleteDeliveryAddress 删除收货地址
-func OnDeleteDeliveryAddress(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var deleteReq *talent_model.DeleteDeliveryAddress
-	err = r.ParseForm(&deleteReq)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "params error"}
-	}
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		_, err1 := tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).Limit(1).Update("default_tag = 1", "talent_id = ? and address_id <> ?", tid, deleteReq.AddressId)
-		if err1 != nil {
-			return err1
-		}
-
-		// 删除收货地址记录
-		_, err1 = tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).Delete("address_id", deleteReq.AddressId)
-		return err1
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// ModifyDeliveryAddr 修改收货地址信息
-func ModifyDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var modifyReq *talent_model.DeliveryAddressModifyReq
-	err = r.ParseForm(&modifyReq)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "params error"}
-	}
-
-	_, err = g.DB().Model(dao.TalentDeliveryAddress.Table).Update(modifyReq, "address_id = ? and talent_id = ?", modifyReq.AddressId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "update failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// SetDefaultDeliveryAddr 设置默认收货地址
-func SetDefaultDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	aid := r.GetRequestInt32("address_id", 0)
-	if aid == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "address id error"}
-	}
-
-	rec, err := g.DB().Model(dao.TalentDeliveryAddress.Table).One("talent_id = ? and default_tag = 1", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "found default delivery address error"}
-	}
-
-
-	if rec == nil {
-		_, err = g.DB().Model(dao.TalentDeliveryAddress.Table).Update("default_tag = 1", "aid", aid)
-	} else {
-		err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-			_, err1 := tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).Update("default_tag = 0", "address_id", rec["address_id"])
-			if err1 != nil {
-				return err1
-			}
-
-			_, err1 = tx.Ctx(ctx).Model(dao.TalentDeliveryAddress.Table).Update("default_tag = 1", "address_id", aid)
-			if err1 != nil {
-				return err1
-			}
-
-			return nil
-		})
-	}
-
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "database error"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}

+ 0 - 42
app/service/talent_service/info_table.go

@@ -1,42 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/frame/g"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-)
-
-func GetInfoTables() *TalentHttpResult {
-	allInfos := talent_model.InfoTables{}
-	err := g.DB().Model(model.InfoTalentAgeBracket{}).Scan(&allInfos.AgeBracket)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "query age bracket failed"}
-	}
-
-	err = g.DB().Model(model.InfoTalentSkinType{}).Scan(&allInfos.SkinType)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query skin type failed"}
-	}
-
-	err = g.DB().Model(model.InfoTalentSkilledArea{}).Scan(&allInfos.SkilledArea)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "query skilled area failed"}
-	}
-
-	err = g.DB().Model(model.InfoProductClassify{}).Scan(&allInfos.ProductClassify)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "query product classify failed"}
-	}
-
-	err = g.DB().Model(dao.InfoThirdPlatform.Table).Fields(
-		dao.InfoThirdPlatform.Columns.PlatformId,
-		dao.InfoThirdPlatform.Columns.PlatformIcon,
-		dao.InfoThirdPlatform.Columns.PlatformName).Scan(&allInfos.ThirdPlatform)
-
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "query third platform info failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: allInfos}
-}

+ 0 - 10
app/service/talent_service/islogined.go

@@ -1,10 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/net/ghttp"
-)
-
-func IsLogin(r *ghttp.Request) *TalentHttpResult {
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}

+ 0 - 388
app/service/talent_service/order.go

@@ -1,388 +0,0 @@
-package talent_service
-
-import (
-	"context"
-	"fmt"
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/encoding/gjson"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-type platformExamineState int
-const (
-	waitForExamine platformExamineState = iota + 1
-	examineSuccess
-	examineFailed
-)
-
-const buySamplesTypeYounggee = 1
-
-// GetOrderList 获取达人已接订单列表,如果有search_name参数则根据此信息对已接订单进行搜索,否则获取所有已接订单
-func GetOrderList(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	taskOrBrandName := r.GetQueryString("search_name", "nil")
-
-
-	whereStr := fmt.Sprintf("talent_id = %d", tid)
-	if taskOrBrandName != "nil" {
-		taskOrBrandName = "%" + taskOrBrandName + "%"
-		whereStr += " and (task_name like '" + taskOrBrandName + "' or task_brand_name like '" + taskOrBrandName + "')"
-	}
-
-	var orderList []*model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).Where(whereStr).
-		Order(dao.OrderInfo.Columns.CompleteStatus).Scan(&orderList)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "get order info failed"}
-	}
-
-	classifiedOrderList := talent_model.ClassifiedOrderInfoBriefList{}
-	for _, v := range orderList {
-		// 获取任务招募等级信息
-		levelRec, err1 := g.DB().Model(dao.TaskRecruitTalentLevel.Table).Where("trt_id", v.TaskLevelId).One()
-		if err1 != nil || levelRec == nil {
-			return &TalentHttpResult{Code: -4, Msg: "query task level failed"}
-		}
-
-		// 获取任务信息
-		taskRec, err1 := g.DB().Model(dao.TaskBaseInfo.Table).Where("task_id", v.TaskId).One()
-		if err1 != nil || taskRec == nil {
-			return &TalentHttpResult{Code: -5, Msg: "query task info failed"}
-		}
-
-		// 获取任务关联的商品的主图
-		productPhoto, err1 := g.DB().Model(dao.ProductPhoto.Table).One("product_id = ? and symbol = 1", taskRec[dao.TaskBaseInfo.Columns.ProductId])
-		if err1 != nil {
-			return &TalentHttpResult{Code: -6, Msg: "query product photo info failed"}
-		}
-
-		// 获取平台信息
-		platRec, err1 := g.DB().Model(dao.InfoThirdPlatform.Table).One("platform_id", taskRec[dao.TaskBaseInfo.Columns.TaskPlatform].Int())
-		if err1 != nil || platRec == nil {
-			return &TalentHttpResult{Code: -7, Msg: "query platform info failed"}
-		}
-
-		// 获取平台昵称
-		nickNameRet, err1 := g.DB().Model(platRec[dao.InfoThirdPlatform.Columns.PlatformTableName].String()).
-			Fields("platform_nickname").
-			Where("talent_id", v.TalentId).One()
-		if err1 != nil || nickNameRet == nil {
-			return &TalentHttpResult{Code: -8, Msg: "query platform nickname failed"}
-		}
-
-		// 获取订单执行进度
-		procedureRec, err1 := g.DB().Model(dao.WorkflowNodeContainer.Table).
-			One("order_id = ? and sort_id = ?", v.OrderId, v.OrderStatus)
-		if err1 != nil || procedureRec == nil {
-			return &TalentHttpResult{Code: -9, Msg: "query order procedure info failed"}
-		}
-
-		var procedureName string
-		if procedureRec[dao.WorkflowNodeContainer.Columns.CurExecutionTimes].Int() < 2 {
-			procedureName = procedureRec[dao.WorkflowNodeContainer.Columns.NodeNameFirst].String()
-		} else {
-			procedureName = procedureRec[dao.WorkflowNodeContainer.Columns.NodeNameAfterSecond].String()
-		}
-
-		orderInfoBrief := &talent_model.OrderInfoBrief{
-			OrderId: v.OrderId,
-			PlatformIconUrl: platRec[dao.InfoThirdPlatform.Columns.PlatformIcon].String(),
-			PlatformName: platRec[dao.InfoThirdPlatform.Columns.PlatformName].String(),
-			PlatformNickName: nickNameRet["platform_nickname"].String(),
-			OrderProcedure: procedureName,
-			TaskName: taskRec[dao.TaskBaseInfo.Columns.TaskName].String(),
-			RecruitLevel: levelRec,
-			ProcedureNote: procedureRec[dao.WorkflowNodeContainer.Columns.Tip].String(),
-			ProductImgUrl: productPhoto[dao.ProductPhoto.Columns.PhotoUrl].String(),
-			OrderCompleteStatus: v.CompleteStatus,
-			OrderCompleteDate: v.CompleteDate,
-		}
-
-		classifiedOrderList.AllOrderInfoList = append(classifiedOrderList.AllOrderInfoList, orderInfoBrief)
-
-		if v.CompleteStatus < 2 {
-			if v.OrderStatus == 1 {
-				classifiedOrderList.SelectOrderInfoList = append(classifiedOrderList.SelectOrderInfoList, orderInfoBrief)
-			}
-
-			if v.OrderStatus > 1 {
-				classifiedOrderList.GoingOnOrderInfoList = append(classifiedOrderList.GoingOnOrderInfoList, orderInfoBrief)
-			}
-		} else {
-			classifiedOrderList.CompletedOrderInfoList = append(classifiedOrderList.CompletedOrderInfoList, orderInfoBrief)
-		}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: classifiedOrderList}
-}
-
-// GetOrderDetail 获取订单详情
-func GetOrderDetail(r *ghttp.Request) *TalentHttpResult {
-	orderId := r.GetQueryInt("oid", 0)
-	if orderId == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "未找到订单号信息"}
-	}
-
-	var orderDetail *talent_model.OrderDetailInfo
-	err := g.DB().Model(dao.OrderInfo.Table).WithAll().Scan(&orderDetail, dao.OrderInfo.Columns.OrderId, orderId)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "查询数据失败"}
-	}
-
-	//if orderDetail.TaskInfo.Conditions.BuySamplesType == buySamplesTypeYounggee {
-	//	// 拍单方式为样叽拍单,获取拍单详细信息
-	//	rec, err1 := g.DB().Model(dao.TaskProcedureBuySamplesInfo.Table).One(dao.TaskProcedureBuySamplesInfo.Columns.TaskBaseId, orderDetail.TaskId)
-	//	if err1 != nil {
-	//		return &TalentHttpResult{Code: -3, Msg: "查询拍单信息失败"}
-	//	}
-	//
-	//	orderDetail.BuySamplesInfo = rec
-	//} else {
-	//	orderDetail.BuySamplesInfo = nil
-	//}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: orderDetail}
-}
-
-// SignupTask 达人报名任务(产生订单)
-func SignupTask(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	// 获取达人信息
-	talentRec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || talentRec == nil {
-		return &TalentHttpResult{Code: -13, Msg: "query talent info failed"}
-	}
-
-	// 如果达人在黑名单则不允许报名
-	if talentRec[dao.TalentInfo.Columns.InBlacklist].Int() >= 1 {
-		return &TalentHttpResult{Code: -2, Msg: "talent in blacklist"}
-	}
-
-	var signupInfo *talent_model.SignupInfo
-	err = r.ParseForm(&signupInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: err.Error()}
-	}
-
-	taskId := signupInfo.TaskId
-
-	var taskDetail *talent_model.TaskDetail
-	err = g.DB().Model(talent_model.TaskDetail{}).WithAll().Where("task_id", taskId).Scan(&taskDetail)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "data query failed"}
-	}
-
-	// 校验任务是否已过报名截止时间
-	if taskDetail.DeadlineTime.Before(gtime.Now()) {
-		return &TalentHttpResult{Code: -5, Msg: "task has close sign up"}
-	}
-
-	// 校验达人是否已经报名过该任务
-	rec, err := g.DB().Model(dao.OrderInfo.Table).One("task_id = ? and talent_id = ?", taskId, tid)
-	if err != nil || rec != nil {
-		return &TalentHttpResult{Code: -6, Msg: "talent have signed up task"}
-	}
-
-	// 校验达人是否拥有任务要求的平台账号
-	rec, err = g.DB().Model(dao.RTalentPlatformTable.Table).One("tid = ? and p_id = ?", tid, taskDetail.TaskPlatform)
-	if err != nil {
-		return &TalentHttpResult{Code: -7, Msg: "query talent platform info failed"}
-	}
-
-	// 达人没有任务要求的平台账号,返回
-	if rec == nil {
-		return &TalentHttpResult{Code: -8, Msg: "talent have no platform account"}
-	}
-
-	// 达人平台账号审核未通过,返回
-	if rec[dao.RTalentPlatformTable.Columns.ExamineState].Int() != int(examineSuccess) {
-		return &TalentHttpResult{Code: -9, Msg: "talent platform account examine failed"}
-	}
-
-
-	// 获取任务要求的平台对应的平台信息
-	rec, err = g.DB().Model(dao.InfoThirdPlatform.Table).One(dao.InfoThirdPlatform.Columns.PlatformId, taskDetail.TaskPlatform)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -10, Msg: "query platform table name failed"}
-	}
-
-	// 获取达人的平台账号信息
-	platformRec, err := g.DB().Model(rec[dao.InfoThirdPlatform.Columns.PlatformTableName].String()).One("talent_id", tid)
-	if err != nil || platformRec == nil {
-		return &TalentHttpResult{Code: -11, Msg: "query talent platform info failed"}
-	}
-
-	var remuneration int64
-	found := false
-	for _, v := range taskDetail.NeedTalentCount {
-		if v.TrtId == signupInfo.TaskRecruitLevelId {
-			if platformRec["fans_count"].Int() < v.FansCountMin {
-				return &TalentHttpResult{Code: -12, Msg: "fans count not match recruit level"}
-			}
-
-			remuneration = v.RewardRoyalties
-			found = true
-			break
-		}
-	}
-
-	if !found {
-		return &TalentHttpResult{Code: -13, Msg: "recruit level info error"}
-	}
-	//// 校验达人粉丝数量是否符合要求
-	//if platformRec["fans_count"].Int() < taskDetail.NeedTalentCount[signupInfo.TaskRecruitLevelId].FansCountMin {
-	//	return &TalentHttpResult{Code: -10, Msg: "fans count not match recruit level"}
-	//}
-
-
-	// 获取收货地址信息
-	var addrInfo *model.TalentDeliveryAddress
-	err = g.DB().Model(dao.TalentDeliveryAddress.Table).
-		Where(dao.TalentDeliveryAddress.Columns.AddressId, signupInfo.DeliveryAddrId).Scan(&addrInfo)
-	if err != nil || addrInfo == nil {
-		return &TalentHttpResult{Code: -14, Msg: "query delivery address failed"}
-	}
-
-	// 生成达人平台账号信息和达人信息的快照
-	platformSnap, err := gjson.Encode(platformRec)
-	if err != nil {
-		return &TalentHttpResult{Code: -15, Msg: "encode platform snap failed"}
-	}
-
-	// 生成达人信息快照
-	talentSnap, err := gjson.Encode(talentRec)
-	if err != nil {
-		return &TalentHttpResult{Code: -16, Msg: "encode talent info snap failed"}
-	}
-
-	// 生成收货地址快照
-	addrSnap, err := gjson.Encode(addrInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -17, Msg: "encode delivery address snap failed"}
-	}
-
-	var productMainImg string
-	for _, v := range taskDetail.ProductInfo.ProductImages {
-		if productMainImg == "" {
-			productMainImg = v.PhotoUrl
-		}
-
-		if v.Symbol == 1 {
-			productMainImg = v.PhotoUrl
-			break
-		}
-	}
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		// 报名信息存入报名信息(订单)表
-		orderId, err1 := tx.Ctx(ctx).Model(dao.OrderInfo.Table).Data(model.OrderInfo{
-			TaskId:                 taskId,
-			TaskName:               taskDetail.TaskName,
-			TaskBrandName:          taskDetail.TaskBrandInfo.BrandName,
-			ProductName:            taskDetail.ProductInfo.ProductName,
-			ProductMainImg:         productMainImg,
-			TalentId:               tid,
-			TalentPlatformInfoSnap: string(platformSnap),
-			TalentPersonalInfoSnap: string(talentSnap),
-			TalentPostAddrSnap:     string(addrSnap),
-			TaskLevelId:            signupInfo.TaskRecruitLevelId,
-			SettleAmount: 			remuneration,
-			ProdSpecificationId:    signupInfo.ProductSpecificationIndex,
-			ProdNote:               signupInfo.ProductNote,
-			OrderStatus:            1,
-			CompleteStatus:         1,
-			CreateDate:             gtime.Now(),
-		}).InsertAndGetId()
-		if err1 != nil {
-			return err1
-		}
-
-		// 产生订单流程
-		err1 = utils.OrderProcedureManager.GenOrderWorkflowList(taskId, int(orderId), ctx, tx)
-		if err1 != nil {
-			return err1
-		}
-
-		// 将达人收货信息写入order_delivery_info表,供后台查看和操作
-		_, err1 = tx.Ctx(ctx).Model(dao.OrderDeliveryInfo.Table).Insert(model.OrderDeliveryInfo{
-			OrderId:          orderId,
-			OrderAddressee:   addrInfo.ReceiverName,
-			OrderPhone:       addrInfo.PhoneNumber,
-			RegionCode:       addrInfo.RegionCode,
-			OrderAddress:     addrInfo.DetailAddr,
-			LogisticsCompany: "",
-			TrackingNum:      "",
-			CreatedAt:        gtime.Now(),
-			ConfirmTime:      nil,
-			DeliveryTime:     nil,
-			DeliveryStatus:   1,
-		})
-		if err1 != nil {
-			return err1
-		}
-
-		// 将订单状态插入订单状态表
-		_, err1 = tx.Ctx(ctx).Model(dao.OrderStatusRecord.Table).Insert(model.OrderStatusRecord{
-			OrderId:       int(orderId),
-			AlterBefore:   0,
-			AlterAfter:    1,
-			RoleTag:       2,
-			RecordId:      tid,
-			RecordName:    talentRec[dao.TalentInfo.Columns.TalentWxNickname].String(),
-			CreatedAt:     gtime.Now(),
-		})
-
-		return err1
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -18, Msg: "add order data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// GetOrderSignUpPlatformInfo 获取报名信息里的平台信息快照
-func GetOrderSignUpPlatformInfo(r *ghttp.Request) *TalentHttpResult {
-	orderId := r.GetQueryInt("order_id", 0)
-	if orderId == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "need order id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentPlatformInfoSnap).One(dao.OrderInfo.Columns.OrderId, orderId)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -2, Msg: "query order info failed"}
-	}
-
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec[dao.OrderInfo.Columns.TalentPlatformInfoSnap]}
-}
-
-// GetOrderBriefInfo 获取订单帮助信息里的brief列表
-func GetOrderBriefInfo(r *ghttp.Request) *TalentHttpResult {
-	orderId := r.GetQueryInt("order_id", 0)
-	if orderId == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "must input order id"}
-	}
-
-	var briefList *talent_model.OrderBriefInfo
-	err := g.DB().Model(dao.OrderInfo.Table).WithAll().Scan(&briefList, dao.OrderInfo.Columns.OrderId, orderId)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: briefList}
-}

+ 0 - 228
app/service/talent_service/platform_info.go

@@ -1,228 +0,0 @@
-package talent_service
-
-import (
-	"context"
-	"encoding/json"
-	"errors"
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"reflect"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-type platformId int
-
-const (
-	PlatformIdLittleRedBook platformId = iota + 1
-	PlatformIdTiktok
-	PlatformIdWeibo
-	PlatformIdKuaishou
-	PlatformIdBilibili
-	PlatformIdDianping
-	PlatformIdZhihu
-)
-
-var PlatformDataMap = map[platformId]interface{} {
-	PlatformIdLittleRedBook: talent_model.PlatformLittleRedBook{},
-	PlatformIdTiktok: talent_model.PlatformTiktok{},
-	PlatformIdWeibo: talent_model.PlatformWeibo{},
-	PlatformIdKuaishou: talent_model.PlatformKuaishou{},
-	PlatformIdBilibili: talent_model.PlatformBilibili{},
-	PlatformIdDianping: talent_model.PlatformDianping{},
-	PlatformIdZhihu: talent_model.PlatformZhihu{},
-}
-
-// GetTalentAllPlatformBriefInfo 获取达人所有平台的简略信息
-func GetTalentAllPlatformBriefInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	res, err := g.DB().Model("r_talent_platform_table").All("tid", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query database error"}
-	}
-
-	if res == nil {
-		return &TalentHttpResult{Code: -3, Msg: "未绑定任何平台"}
-	}
-
-	var platformBriefInfo talent_model.TalentPlatformBriefInfo
-	err = g.DB().Model("talent_info").WithAll().Where("id", tid).Scan(&platformBriefInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "query data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: platformBriefInfo}
-
-}
-
-// OnGetTalentPlatformDetail 获取达人社媒平台的详细信息
-func OnGetTalentPlatformDetail(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	pid := r.GetQueryInt("pid", 0)
-	if tid == 0 || pid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "request param error"}
-	}
-
-	// 通过达人与平台关联表(平台账号审核表)查找达人已有平台
-	rtpRec, err := g.DB().Model("r_talent_platform_table").One("tid=? and p_id=?", tid, pid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "query database failed"}
-	}
-
-	// 达人还没有提交过此平台信息
-	if rtpRec == nil {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no info of platform"}
-	}
-
-	// 根据平台id查找平台信息表名
-	pRec, err := g.DB().Model(dao.InfoThirdPlatform.Table).Fields(dao.InfoThirdPlatform.Columns.PlatformTableName).
-		One("platform_id", rtpRec[dao.RTalentPlatformTable.Columns.PId])
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "query database failed"}
-	}
-
-	if pRec == nil {
-		return &TalentHttpResult{Code: -6, Msg: "platform info not found"}
-	}
-
-	// 用得到的信息表名查找平台信息
-	infoRec, err := g.DB().Model(pRec[dao.InfoThirdPlatform.Columns.PlatformTableName].String()).One("talent_id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -7, Msg: "query talent platform info failed"}
-	}
-
-	if infoRec == nil {
-		return &TalentHttpResult{Code: -8, Msg: "not found talent platform info"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: infoRec}
-}
-
-func getPlatformById(pid int32) (interface{}, error) {
-	switch pid {
-	case 1:
-		return &talent_model.PlatformLittleRedBook{}, nil
-	case 2:
-		return &talent_model.PlatformTiktok{}, nil
-	case 3:
-		return &talent_model.PlatformWeibo{}, nil
-	case 4:
-		return &talent_model.PlatformKuaishou{}, nil
-	case 5:
-		return &talent_model.PlatformBilibili{}, nil
-	case 6:
-		return &talent_model.PlatformDianping{}, nil
-	case 7:
-		return &talent_model.PlatformZhihu{}, nil
-	}
-
-	return nil, errors.New("id error")
-}
-
-// 将三个擅长领域转换为json
-func combineSkillsOnToJson(skillsOn1 int32, skillsOn2 int32, skillsOn3 int32) string {
-	r := []int32{skillsOn1, skillsOn2, skillsOn3}
-
-	bytes, err := json.Marshal(r)
-	if err != nil {
-		return "[]"
-	}
-
-	return string(bytes)
-}
-
-// OnPostPlatformDetailInfo 上传平台信息
-func OnPostPlatformDetailInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	pid := r.GetRequestInt32("platformId", 0)
-	if tid == 0 || pid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "param tid and pid must be provided"}
-	}
-
-	platformData, err := getPlatformById(pid)
-	if err = r.ParseForm(platformData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-
-	// 根据平台id获取平台信息
-	platformInfoRec, err := g.DB().Model(dao.InfoThirdPlatform.Table).
-		Fields(dao.InfoThirdPlatform.Columns.PlatformTableName, dao.InfoThirdPlatform.Columns.PlatformIcon).One("platform_id", pid)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "get platform table name failed"}
-	}
-
-	//_, exist1 := reflect.TypeOf(platformData).Elem().FieldByName("SkilledAt1")
-	//_, exist2 := reflect.TypeOf(platformData).Elem().FieldByName("SkilledAt2")
-	//_, exist3 := reflect.TypeOf(platformData).Elem().FieldByName("SkilledAt3")
-	//_, exist := reflect.TypeOf(platformData).Elem().FieldByName("SkilledAt")
-	//
-	//if exist1 && exist2 && exist3 &&exist {
-	//	// 如果上传的信息中包括SkilledAt1 SkilledAt2 SkilledAt3字段,则将三个字段转换为json,并存入SkilledAt字段
-	//	skilledAt1 := reflect.ValueOf(platformData).Elem().FieldByName("SkilledAt1").Int()
-	//	skilledAt2 := reflect.ValueOf(platformData).Elem().FieldByName("SkilledAt2").Int()
-	//	skilledAt3 := reflect.ValueOf(platformData).Elem().FieldByName("SkilledAt3").Int()
-	//
-	//	reflect.ValueOf(platformData).Elem().FieldByName("SkilledAt").SetString(
-	//		combineSkillsOnToJson(int32(skilledAt1), int32(skilledAt2), int32(skilledAt3)))
-	//}
-
-	reflect.ValueOf(platformData).Elem().FieldByName("SkilledAt").SetString("[]")
-
-	// 将达人id存入结构体
-	reflect.ValueOf(platformData).Elem().FieldByName("TalentId").SetInt(int64(tid))
-	// 平台名称写入结构体
-	reflect.ValueOf(platformData).Elem().FieldByName("PlatformName").SetString(platformInfoRec[dao.InfoThirdPlatform.Columns.PlatformName].String())
-	// 平台图标url写入结构体
-	reflect.ValueOf(platformData).Elem().FieldByName("PlatformIconUrl").SetString(platformInfoRec[dao.InfoThirdPlatform.Columns.PlatformIcon].String())
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		// 将平台账号信息存入对应的平台表
-		_, err1 := tx.Ctx(ctx).Model(platformInfoRec["platform_table_name"].String()).Save(platformData)
-		if err1 != nil {
-			return err1
-		}
-
-		// 将账号审核信息写入r_talent_platform_table表, 无论是新建还是更新都把状态回复为原始状态
-		_, err1 = tx.Ctx(ctx).Model(dao.RTalentPlatformTable.Table).
-			Save(model.RTalentPlatformTable{
-				Tid:            tid,
-				PId:            int(pid),
-				PName:          platformInfoRec[dao.InfoThirdPlatform.Columns.PlatformName].String(),
-				PNickname:      reflect.ValueOf(platformData).Elem().FieldByName("PlatformNickname").String(),
-				PAccountId:     reflect.ValueOf(platformData).Elem().FieldByName("PlatformAccountId").String(),
-				FansCount:      reflect.ValueOf(platformData).Elem().FieldByName("FansCount").Int(),
-				HomePageUrl:    reflect.ValueOf(platformData).Elem().FieldByName("HomePageUrl").String(),
-				ExamineState:   1,
-				FailReason:     "",
-				ExamineAdminId: 0,
-				CreateDate:     gtime.Now(),
-				ExamineDate:    nil,
-				DisableDate:    nil,
-				Deleted: 0,
-			})
-
-		return err1
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "save platformData failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}

+ 0 - 34
app/service/talent_service/region_info.go

@@ -1,34 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-)
-
-func GetRegionInfo(r *ghttp.Request) *TalentHttpResult {
-	sPid := r.GetQueryInt("pid", 0)
-
-	var res gdb.Result
-	var err error
-
-	if sPid == 0 {
-		res, err = g.DB().Model(model.InfoRegion{}).Fields(dao.InfoRegion.Columns.SelfCode,
-			dao.InfoRegion.Columns.RegionName).All("parent_code is null")
-	} else {
-		res, err = g.DB().Model(model.InfoRegion{}).Fields(dao.InfoRegion.Columns.SelfCode,
-			dao.InfoRegion.Columns.RegionName).All("parent_code", sPid)
-	}
-
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query data failed"}
-	}
-
-	if res == nil {
-		return &TalentHttpResult{Code: -3, Msg: "param error"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
-}

+ 0 - 37
app/service/talent_service/search.go

@@ -1,37 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model/talent_model"
-)
-
-func SearchByTaskName(r *ghttp.Request) *TalentHttpResult {
-	taskOrBrandName := r.GetRequestString("task_name", "nil")
-	if taskOrBrandName == "nil" {
-		return &TalentHttpResult{Code: -1, Msg: "input task_name param"}
-	}
-
-	taskOrBrandName = "%" + taskOrBrandName + "%"
-	var searchResult talent_model.SearchByNameResult
-	err := g.DB().Model(dao.TaskBaseInfo.Table).WithAll().
-		Where(dao.TaskBaseInfo.Columns.TaskStatus, taskStatusInProgress).
-		Where("(task_name like ? or brand_name like ?)", taskOrBrandName, taskOrBrandName).
-		Scan(&searchResult.SearchResult)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "query task info failed"}
-	}
-
-	// 如果搜索结果位空则推荐任务
-	if len(searchResult.SearchResult) <= 0 {
-		err = g.DB().Model("task_base_info").WithAll().
-			Where(dao.TaskBaseInfo.Columns.TaskStatus, taskStatusInProgress).
-			Order("task_id").Limit(6).Scan(&searchResult.RecommendResult)
-		if err != nil {
-			return &TalentHttpResult{Code: -3, Msg: "query commend task info failed"}
-		}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: searchResult}
-}

+ 0 - 132
app/service/talent_service/share.go

@@ -1,132 +0,0 @@
-package talent_service
-
-import (
-	"bytes"
-	"encoding/json"
-	"errors"
-	"fmt"
-	"github.com/gogf/gf/encoding/gjson"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"io/ioutil"
-	"net/http"
-	"strings"
-	"youngmini_server/app/model/talent_model"
-)
-
-const (
-	accessTokenUrlFormat = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"
-	qrCodeUrlFormat = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s"
-	wxAccesssTokenKey = "wx_access_token"
-)
-
-// getAndCacheWxAccessToken 获取并缓存微信的access token
-func getAndCacheWxAccessToken() (string, error) {
-	appId := g.Config().GetString("miniapp.appid")
-	secret := g.Config().GetString("miniapp.appsecret")
-	url := fmt.Sprintf(accessTokenUrlFormat, appId, secret)
-
-	resp, err := http.Get(url)
-	if err != nil {
-		return "", errors.New("request access token failed")
-	}
-	defer resp.Body.Close()
-
-	// 解析微信服务端返回的信息
-	var accessTokenRes talent_model.WxAccessTokenResponse
-	decoder := json.NewDecoder(resp.Body)
-	if err = decoder.Decode(&accessTokenRes); err != nil {
-		return "", errors.New("decode wx response failed")
-	}
-
-	if accessTokenRes.Errcode != 0 {
-		return "", errors.New("request access token failed")
-	}
-
-	// 缓存获取的access token,比微信返回的有效时间短5分钟失效
-	_, err = g.Redis().Do("SETEX", wxAccesssTokenKey, accessTokenRes.ExpiresIn - 300, accessTokenRes.AccessToken)
-
-
-	return accessTokenRes.AccessToken, nil
-}
-
-func RequestShareInfo(r *ghttp.Request) *TalentHttpResult {
-
-	var requestArg *talent_model.ShareRequest
-	if err := r.ParseForm(&requestArg); err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "param error"}
-	}
-
-	// 获取access_token
-	var accessToken string
-	accessTokenVar, err := g.Redis().DoVar("GET", "wx_access_token")
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "get access token from cache err"}
-	}
-
-	if accessTokenVar.IsEmpty() {
-		// 如果没有缓存的access token 则获取并缓存
-		accessToken, err = getAndCacheWxAccessToken()
-	} else {
-		// 取缓存的access token
-		accessToken = accessTokenVar.String()
-	}
-
-	qrRequest := talent_model.WxQrCodeRequest{
-		Scene:      requestArg.Scene,
-		Page:       requestArg.Page,
-		Width:      430,
-		CheckPath:  false,
-		EnvVersion: "release",
-	}
-	jsonBody, err := gjson.Encode(qrRequest)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: ""}
-	}
-	
-	qrCodeUrl := fmt.Sprintf(qrCodeUrlFormat, accessToken)
-	resp, err := http.Post(qrCodeUrl, "application/json; charset=utf8", bytes.NewReader(jsonBody))
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "request from wx server failed"}
-	}
-	defer resp.Body.Close()
-
-	var qrcodeBytes []byte
-
-	switch header := resp.Header.Get("content-Type"); {
-	case strings.HasPrefix(header, "application/json"):
-		// 如果返回的是json结构,说明发生错误
-		var qrResponse *talent_model.WxQrCodeResponse
-		decoder := json.NewDecoder(resp.Body)
-		if err = decoder.Decode(&qrResponse); err != nil {
-			return &TalentHttpResult{Code: -5, Msg: "request qrcode failed"}
-		}
-
-		return &TalentHttpResult{Code: -6, Msg: "wx request error", Data: qrResponse}
-	case strings.HasPrefix(header, "image"):
-		qrcodeBytes, err = ioutil.ReadAll(resp.Body)
-		if err != nil {
-			return &TalentHttpResult{Code: -6, Msg: "read resp body error"}
-		}
-
-		// { 用返回的字节数组生成本地图片,测试图片用
-		//imgUUID := uuid.New()
-		//imgContent, err := os.Create("./" + imgUUID + ".jpg")
-		//if err != nil {
-		//	return &TalentHttpResult{Code: -7, Msg: "create image file failed"}
-		//}
-		//
-		//_, err = io.WriteString(imgContent, string(qrcodeBytes))
-		//if err != nil {
-		//	return &TalentHttpResult{Code: -8, Msg: "write file failed"}
-		//}
-		//
-		//err = imgContent.Close()
-		//if err != nil {
-		//	return &TalentHttpResult{Code: -9, Msg: "close file failed"}
-		//}
-		// } 用返回的字节数组生成本地图片,测试图片用
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: qrcodeBytes}
-}

+ 0 - 19
app/service/talent_service/talent_http_result.go

@@ -1,19 +0,0 @@
-package talent_service
-
-import "github.com/gogf/gf/os/glog"
-
-type TalentHttpResult struct {
-	Code int `json:"code"`
-	Msg string `json:"msg"`
-	Data interface{} `json:"data"`
-}
-
-func New(code int, msg string, data *interface{}) *TalentHttpResult {
-	t := &TalentHttpResult{code, msg, data}
-	if code != 0 {
-		glog.DefaultLogger().Error()
-	} else {
-
-	}
-	return t
-}

+ 0 - 104
app/service/talent_service/talent_info.go

@@ -1,104 +0,0 @@
-package talent_service
-
-import (
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-func OnGetTalentBriefInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	isComplete := false
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	test := rec[dao.TalentInfo.Columns.TalentWxNumber].Val()
-	if err != nil || rec == nil || test == nil {
-		isComplete = false
-	} else {
-		isComplete = true
-	}
-
-	platCnt, err := g.DB().Model(dao.RTalentPlatformTable.Table).
-		Where("tid = ? and (examine_state = 1 or examine_state = 2)", tid).Count()
-	if err != nil {
-		platCnt = 0
-	}
-
-	boboCoin, err := g.DB().Model(dao.BobocoinIncomeRecord.Table).
-		Where("talent_id", tid).
-		Sum(dao.BobocoinIncomeRecord.Columns.BobocoinValue)
-	if err != nil {
-		boboCoin = 0
-	}
-
-	drawMoney, err := g.DB().Model(dao.BobocoinWithdrawalRecord.Table).
-		Where("talent_id = ? and (pay_state = 1 or pay_state = 2)", tid).
-		Sum(dao.BobocoinWithdrawalRecord.Columns.DrawAmount)
-	if err != nil {
-		drawMoney = 0
-	}
-
-	hasAddr := false
-	addrCnt, err := g.DB().Model(dao.TalentDeliveryAddress.Table).
-		Where(dao.TalentDeliveryAddress.Columns.TalentId, tid).Count(dao.TalentDeliveryAddress.Columns.AddressId)
-	if err != nil {
-		hasAddr = false
-	} else {
-		hasAddr = addrCnt > 0
-	}
-
-	briefInfo := talent_model.TalentBriefInfo{
-		IsInfoComplete: isComplete,
-		PlatformCount: platCnt,
-		BoBoCoinValue: int64(boboCoin - drawMoney),
-		HasDeliveryAddr: hasAddr,
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: briefInfo}
-}
-
-// OnGetTalentDetailInfo 获取达人详细信息
-func OnGetTalentDetailInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	rec, err := g.DB().Model(dao.TalentInfo.Table).Fields(dao.TalentInfo.Columns.TalentAgeBracket,
-		dao.TalentInfo.Columns.TalentSkinType, dao.TalentInfo.Columns.TalentWxNumber,
-		dao.TalentInfo.Columns.TalentNationality, dao.TalentInfo.Columns.VisitStoreRegion,
-		dao.TalentInfo.Columns.TalentGender, dao.TalentInfo.Columns.TalentPhoneNumber).One("id", tid)
-
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "can not found talent info"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnPostTalentDetailInfo 修改达人详细信息
-func OnPostTalentDetailInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var infos *talent_model.TalentSelfInputInfo
-	err = r.ParseForm(&infos)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-
-	_, err = g.DB().Model(dao.TalentInfo.Table).Update(infos, "id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "update failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-

+ 0 - 241
app/service/talent_service/task_info.go

@@ -1,241 +0,0 @@
-package talent_service
-
-import (
-	"fmt"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"reflect"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-type accountExamineState int
-const (
-	accountExamineWait accountExamineState = iota + 1
-	accountExamineSuc
-	accountExamineFail
-)
-
-type taskStatus int
-const (
-	 taskStatusNotStart = iota + 1
-	 taskStatusInProgress
-	 taskStatusComplete
-	 taskStatusDelete
-)
-
-const taskDetailCacheNamePrefix = "task_cache_"
-
-func GetTaskInfoList(r *ghttp.Request) *TalentHttpResult {
-
-	pageIndex := r.GetQueryInt("idx", -1)
-	cntPerPage := r.GetQueryInt("cnt", -1)
-	platform := r.Get("platform")
-	taskMode := r.Get("mode")
-	if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "参数错误"}
-	}
-
-	// 如果有平台的过滤条件,则将平台列表保存于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 taskModeList []interface{}
-	if taskMode != nil {
-		if reflect.TypeOf(taskMode).Kind() != reflect.Slice {
-			return &TalentHttpResult{Code: -3, Msg: "搜索条件任务模式错误"}
-		}
-
-		taskModeList = make([]interface{}, 0)
-		taskModeList = taskMode.([]interface{})
-	}
-
-	// 构造查询的条件
-	startId := pageIndex * cntPerPage
-	whereStr := fmt.Sprintf("task_status = %d", taskStatusInProgress)
-	if platformList != nil {
-		whereStr = whereStr + " and task_platform in ("
-		for _, v := range platformList {
-			whereStr += v.(string) + ", "
-		}
-
-		whereStr = whereStr[0:len(whereStr) - 2]
-		whereStr += ")"
-	}
-
-	if taskModeList != nil {
-		whereStr += " and task_mode in ("
-		for _, v := range taskModeList {
-			whereStr += v.(string) + ", "
-		}
-
-		whereStr = whereStr[0:len(whereStr) - 2]
-		whereStr += ")"
-	}
-
-	// 判断请求页面是否超过最大页面
-	c, err := g.DB().Model(dao.TaskBaseInfo.Table).Fields("task_id").
-		Count(whereStr)
-
-	if c <= 0 {
-		return &TalentHttpResult{Code: -4, Msg: "has no task", Data: nil}
-	}
-
-	maxPage := c / cntPerPage
-	if c % cntPerPage > 0 {
-		maxPage += 1
-	}
-
-	if pageIndex + 1 > maxPage {
-		return &TalentHttpResult{Code: -5, Msg: "over max page"}
-	}
-
-	var taskSimple = talent_model.SimpleTaskResult{}
-	err = g.DB().Model("task_base_info").WithAll().
-		Where(whereStr).
-		Order("deadline_time DESC, task_id").Limit(startId, cntPerPage).Scan(&taskSimple.TaskInfos)
-
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "查询数据库失败"}
-	}
-
-	taskSimple.MaxPage = maxPage
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskSimple}
-}
-
-// GetTaskDetailInfo 获取任务详情
-func GetTaskDetailInfo(r *ghttp.Request) *TalentHttpResult {
-	tid := r.GetQueryInt("taskid", 0)
-	if tid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
-	}
-
-	var taskDetail *talent_model.TaskDetail
-	err := g.DB().Model(talent_model.TaskDetail{}).WithAll().
-		Where("task_id", tid).Scan(&taskDetail)
-
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
-	}
-
-	// 计算各招募等级的已报名人数
-	for _, v := range taskDetail.NeedTalentCount {
-		cnt, err1 := g.DB().Model(dao.OrderInfo.Table).Count("task_level_id = ? and order_status > 1", v.TrtId)
-		if err1 == nil {
-			v.SignupCount = int64(cnt)
-		} else {
-			v.SignupCount = 0
-		}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskDetail}
-}
-
-func GetPlatformFansCount(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	pid := r.GetQueryInt("pid", 0)
-	if pid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "input pid param"}
-	}
-
-
-	// 如果账号为通过审核则返回空
-	rec, err := g.DB().Model(dao.RTalentPlatformTable.Table).
-		One("p_id = ? and tid = ?", pid, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "query platform examine info failed"}
-	}
-
-	if rec == nil {
-		return &TalentHttpResult{Code: -4, Msg: "have no platform account"}
-	}
-
-	if rec[dao.RTalentPlatformTable.Columns.ExamineState].Int() == int(accountExamineWait) {
-		return &TalentHttpResult{Code: -5, Msg: "platform account waiting examine"}
-	}
-
-	if rec[dao.RTalentPlatformTable.Columns.ExamineState].Int() == int(accountExamineFail) {
-		return &TalentHttpResult{Code: -6, Msg: "platform account examine failed"}
-	}
-
-	rec, err = g.DB().Model(dao.InfoThirdPlatform.Table).
-		Fields(dao.InfoThirdPlatform.Columns.PlatformTableName).
-		One("platform_id", pid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -7, Msg: "get platform table name failed"}
-	}
-
-	fansRec, err := g.DB().Model(rec[dao.InfoThirdPlatform.Columns.PlatformTableName].String()).
-		Fields("fans_count").One("talent_id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "query fans count failed"}
-	}
-
-	taskId := r.GetQueryInt("task_id", 0)
-	if taskId == 0 {
-		return &TalentHttpResult{Code: -9, Msg: "input task id"}
-	}
-
-	rec, err = g.DB().Model(dao.OrderInfo.Table).One("task_id = ? and talent_id = ?", taskId, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -10, Msg: "query talent signup task info failed"}
-	}
-
-	fansCountAndTaskSignupInfo := talent_model.FansCountAndTaskSignupInfo{
-		FansCountInfo: fansRec,
-		IsSignupTask: 0,
-	}
-
-	if rec != nil {
-		fansCountAndTaskSignupInfo.IsSignupTask = 1
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: fansCountAndTaskSignupInfo}
-}
-
-func GetSignupPageTaskDetail(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	taskId := r.GetQueryInt("task_id", 0)
-	if taskId == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入任务id"}
-	}
-
-	addrRec, err := g.DB().Model(dao.TalentDeliveryAddress.Table).One("talent_id = ? and default_tag = 1", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "设置收货地址才可以接任务"}
-	}
-
-	var taskDetail *talent_model.SignupPageTaskDetail
-	err = g.DB().Model(talent_model.TaskDetail{}).WithAll().Where("task_id", taskId).Scan(&taskDetail)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
-	}
-
-	platRec, err := g.DB().Model(taskDetail.PlatformInfo.PlatformTableName).One("talent_id", tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "查询平台信息出错"}
-	}
-
-	taskDetail.PlatformDetail = &platRec
-	taskDetail.DeliveryAddress = &addrRec
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskDetail}
-}

+ 0 - 770
app/service/talent_service/uploads.go

@@ -1,770 +0,0 @@
-package talent_service
-
-import (
-	"context"
-	"github.com/gogf/gf/database/gdb"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-type orderStage int
-
-const (
-	orderStageWaitForSelect orderStage = iota + 1
-	orderStageSendSamples
-	orderStageDraft
-	orderStageArticle
-	orderStageLinkExamine
-	orderStageDataExamine
-	orderStageSamplesReturn
-	orderStageComplete
-)
-
-func OnGetExpressInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	rec, err = g.DB().Model(dao.OrderDeliveryInfo.Table).Fields(
-		dao.OrderDeliveryInfo.Columns.OrderAddressee,   // 收货人
-		dao.OrderDeliveryInfo.Columns.OrderPhone,       // 联系电话
-		dao.OrderDeliveryInfo.Columns.OrderAddress,     // 详细地址
-		dao.OrderDeliveryInfo.Columns.RegionCode,       // 区域码
-		dao.OrderDeliveryInfo.Columns.DeliveryTime,     // 发货时间
-		dao.OrderDeliveryInfo.Columns.LogisticsCompany, // 快递公司
-		dao.OrderDeliveryInfo.Columns.TrackingNum,      // 订单号
-		dao.OrderDeliveryInfo.Columns.DeliveryStatus).One(dao.OrderDeliveryInfo.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "获取运单信息失败"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnConfirmReceiveExpress 达人确认收到样品
-func OnConfirmReceiveExpress(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var receiveSamplesData talent_model.ConfirmReceiveSampleData
-	if err = r.ParseForm(&receiveSamplesData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "upload data error"}
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", receiveSamplesData.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	// 获取达人昵称
-	var talentNickname string
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || rec == nil {
-		talentNickname = ""
-	} else {
-		talentNickname = rec[dao.TalentInfo.Columns.TalentWxNickname].String()
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于等待上传初稿状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageSendSamples) ||
-		procedureInfo.StepInStage != 2 {
-		return &TalentHttpResult{Code: -7, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	// 记录初稿信息,并将订单执行步骤记录为初稿上传后的步骤
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		_, err1 := tx.Ctx(ctx).Model(dao.OrderDeliveryInfo.Table).Update(g.Map{
-			"confirm_time":      gtime.Now(),
-			"delivery_status":   3,
-		}, "order_id", receiveSamplesData.OrderId)
-		if err1 != nil {
-			return err
-		}
-
-		return utils.OrderProcedureManager.OnOperateOrder(receiveSamplesData.OrderId, true, tid, talentNickname)
-	})
-
-
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "update data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-func OnGetDraftInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	rec, err = g.DB().Model(dao.OrderDraftReview.Table).Fields(
-		dao.OrderDraftReview.Columns.OnlineLink,
-		dao.OrderDraftReview.Columns.AuditStatus,
-		dao.OrderDraftReview.Columns.AuditOpinion,
-		dao.OrderDraftReview.Columns.ConfirmTime).One(dao.OrderDraftReview.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "获取初稿信息失败"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnUploadDraft 上传初稿
-func OnUploadDraft(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var draftData talent_model.UploadDraftData
-	if err = r.ParseForm(&draftData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "upload data error"}
-	}
-
-	// 获取达人昵称
-	var talentNickname string
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || rec == nil {
-		talentNickname = ""
-	} else {
-		talentNickname = rec[dao.TalentInfo.Columns.TalentWxNickname].String()
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", draftData.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于等待上传初稿状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageDraft) ||
-		procedureInfo.StepInStage != 1 {
-		return &TalentHttpResult{Code: -7, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	// 记录初稿信息,并将订单执行步骤记录为初稿上传后的步骤
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		_, err1 := tx.Ctx(ctx).Model(dao.OrderDraftReview.Table).Save(model.OrderDraftReview{
-			OrderId:      draftData.OrderId,
-			OnlineLink:   draftData.OnlineLink,
-			AuditStatus: 1,
-			AuditOpinion: "",
-			CreatedAt:    gtime.Now(),
-			ConfirmTime:  nil,
-		})
-		if err1 != nil {
-			return err
-		}
-
-		return utils.OrderProcedureManager.OnOperateOrder(draftData.OrderId, true, tid, talentNickname)
-	})
-
-
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "update data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-func OnGetArticleInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	rec, err = g.DB().Model(dao.OrderArticleReview.Table).Fields(
-		dao.OrderArticleReview.Columns.ArticleLink,
-		dao.OrderArticleReview.Columns.AuditStatus,
-		dao.OrderArticleReview.Columns.AuditOpinion,
-		dao.OrderArticleReview.Columns.ConfirmTime).One(dao.OrderArticleReview.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "获取作品信息失败"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnUploadArticle 上传作品
-func OnUploadArticle(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var articleData talent_model.UploadArticleData
-	if err = r.ParseForm(&articleData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "upload data error"}
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", articleData.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于等待上传作品状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageArticle) ||
-		procedureInfo.StepInStage != 1 {
-		return &TalentHttpResult{Code: -7, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	// 获取达人昵称
-	var talentNickname string
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || rec == nil {
-		talentNickname = ""
-	} else {
-		talentNickname = rec[dao.TalentInfo.Columns.TalentWxNickname].String()
-	}
-
-	// 记录作品信息,并将订单执行步骤记录为作品上传后的步骤
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		// 将作品信息记录再order_audit_review表中
-		_, err1 := tx.Ctx(ctx).Model(dao.OrderArticleReview.Table).Save(model.OrderArticleReview{
-			OrderId:      articleData.OrderId,
-			ArticleLink:  articleData.ArticleUrls,
-			AuditStatus:  1,
-			AuditOpinion:   "",
-			CreatedAt:    gtime.Now(),
-			ConfirmTime:  nil,
-		})
-		if err1 != nil {
-			return err
-		}
-
-		return utils.OrderProcedureManager.OnOperateOrder(int(articleData.OrderId), true, tid, talentNickname)
-	})
-
-
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "update data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// OnGetPublishLinkInfo 获取发布链接信息
-func OnGetPublishLinkInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	rec, err = g.DB().Model(dao.OrderLinkQuality.Table).Fields(
-		dao.OrderLinkQuality.Columns.PostLink,
-		dao.OrderLinkQuality.Columns.PhotoLink,
-		dao.OrderLinkQuality.Columns.AuditStatus,
-		dao.OrderLinkQuality.Columns.AuditOpinion,
-		dao.OrderLinkQuality.Columns.ConfirmTime).One(dao.OrderLinkQuality.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "获取质检链接信息失败"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: rec}
-}
-
-// OnUploadLink 上传发布链接
-func OnUploadLink(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var linkData talent_model.UploadLinkData
-	if err = r.ParseForm(&linkData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "upload data error"}
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", linkData.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于等待上传发布链接状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageLinkExamine) ||
-		procedureInfo.StepInStage != 1 {
-		return &TalentHttpResult{Code: -7, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	// 获取达人昵称
-	var talentNickname string
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || rec == nil {
-		talentNickname = ""
-	} else {
-		talentNickname = rec[dao.TalentInfo.Columns.TalentWxNickname].String()
-	}
-
-	// 记录发布链接信息,并将订单执行步骤记录为发布链接上传后的步骤
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		// 将作品信息记录再order_audit_review表中
-		_, err1 := tx.Ctx(ctx).Model(dao.OrderLinkQuality.Table).Save(model.OrderLinkQuality{
-			PostLink:      linkData.LinkUrl,
-			PhotoLink:     linkData.PhotoLink,
-			AuditStatus: 1,
-			AuditOpinion:    "",
-			CreatedAt:     gtime.Now(),
-			ConfirmTime:   nil,
-			OrderId:       linkData.OrderId,
-		})
-		if err1 != nil {
-			return err
-		}
-
-		return utils.OrderProcedureManager.OnOperateOrder(int(linkData.OrderId), true, tid, talentNickname)
-	})
-
-
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "update data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// OnGetDataLinkInfo 获取数据质检信息
-func OnGetDataLinkInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	combineData := talent_model.OrderDataAuditCombineData{}
-
-	rec, err = g.DB().Model(dao.OrderLinkQuality.Table).
-		Fields(dao.OrderLinkQuality.Columns.PostLink, dao.OrderLinkQuality.Columns.PhotoLink).
-		One(dao.OrderLinkQuality.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -5, Msg: "查询发布链接信息失败"}
-	}
-
-	combineData.OrderLinkInfoData = &talent_model.OrderLinkInfoData{
-		PostLink:  rec[dao.OrderLinkQuality.Columns.PostLink].String(),
-		PhotoLink: rec[dao.OrderLinkQuality.Columns.PhotoLink].String(),
-	}
-
-	rec, err = g.DB().Model(dao.OrderDataReview.Table).Fields(
-		dao.OrderDataReview.Columns.AuditStatus,
-		dao.OrderDataReview.Columns.AuditOpinion,
-		dao.OrderDataReview.Columns.LikeNumber,
-		dao.OrderDataReview.Columns.LittleEye,
-		dao.OrderDataReview.Columns.CommitNum,
-		dao.OrderDataReview.Columns.CollectNum,
-		dao.OrderDataReview.Columns.DataLink,
-		dao.OrderDataReview.Columns.ConfirmTime).One(dao.OrderDataReview.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "获取数据链接信息失败"}
-	}
-
-	if rec != nil {
-		combineData.OrderDataAuditData = &talent_model.OrderDataAuditData{
-			LikeNumber:   rec[dao.OrderDataReview.Columns.LikeNumber].Int(),
-			LittleEye:    rec[dao.OrderDataReview.Columns.LittleEye].Int(),
-			CommitNum:    rec[dao.OrderDataReview.Columns.CommitNum].Int(),
-			CollectNum:   rec[dao.OrderDataReview.Columns.CollectNum].Int(),
-			DataLink:     rec[dao.OrderDataReview.Columns.DataLink].String(),
-			AuditStatus:  rec[dao.OrderDataReview.Columns.AuditStatus].Int(),
-			AuditOpinion: rec[dao.OrderDataReview.Columns.AuditOpinion].String(),
-			ConfirmTime:  rec[dao.OrderDataReview.Columns.ConfirmTime].GTime(),
-		}
-	}
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: combineData}
-}
-
-// OnUploadData 上传质检数据
-func OnUploadData(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var dataData talent_model.UploadDataData
-	if err = r.ParseForm(&dataData); err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "upload data error"}
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", dataData.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于等待上传数据状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageDataExamine) ||
-		procedureInfo.StepInStage != 1 {
-		return &TalentHttpResult{Code: -7, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	// 获取达人昵称
-	var talentNickname string
-	rec, err := g.DB().Model(dao.TalentInfo.Table).One("id", tid)
-	if err != nil || rec == nil {
-		talentNickname = ""
-	} else {
-		talentNickname = rec[dao.TalentInfo.Columns.TalentWxNickname].String()
-	}
-
-	// 记录数据信息,并将订单执行步骤记录为数据上传后的步骤
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		// 将作品信息记录再order_audit_review表中
-		_, err1 := tx.Ctx(ctx).Model(dao.OrderDataReview.Table).Save(model.OrderDataReview{
-			OrderId:       dataData.OrderId,
-			LikeNumber:    dataData.LikeNumber,
-			LittleEye:     dataData.LittleEye,
-			CommitNum:     dataData.CommitNum,
-			CollectNum:    dataData.CollectNum,
-			DataLink:      dataData.DataLink,
-			AuditStatus:   1,
-			AuditOpinion:  "",
-			CreatedAt:     gtime.Now(),
-			ConfirmTime:   nil,
-		})
-		if err1 != nil {
-			return err
-		}
-
-		return utils.OrderProcedureManager.OnOperateOrder(int(dataData.OrderId), true, tid, talentNickname)
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -8, Msg: "update data failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// OnPostSampleReturnPostInfo 上传返还样品快递信息
-func OnPostSampleReturnPostInfo(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	var expressInfo *talent_model.SamplesReturnPostInfo
-	err = r.ParseForm(&expressInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "请正确填写快递信息"}
-	}
-
-	// 查询订单及订单的执行阶段信息
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).
-		Where("order_id = ?", expressInfo.OrderId).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "order or procedure info not found"}
-	}
-
-	// 判定达人是否拥有此订单
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "talent have no this order"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	var procedureInfo *model.WorkflowNodeContainer
-	err = g.DB().Model(dao.WorkflowNodeContainer.Table).
-		Where("order_id = ? and sort_id = ?", orderInfo.OrderId, orderInfo.OrderStatus).Scan(&procedureInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "order procedure info not  found"}
-	}
-
-	// 如果订单当前执行步骤不处于拍单寄回状态则不处理
-	if procedureInfo.ProcedureStage != int(orderStageSamplesReturn) ||
-		procedureInfo.StepInStage != 1 {
-		return &TalentHttpResult{Code: -6, Msg: "order procedure is not wait for upload draft"}
-	}
-
-	//// 记录作品信息,并将订单执行步骤记录为初稿上传后的步骤
-	//err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-	//	// 将作品信息记录再order_audit_review表中
-	//	_, err1 := tx.Ctx(ctx).Model(dao.OrderAuditReview.Table).Insert(model.OrderDataReview{
-	//		OrderId:       dataData.OrderId,
-	//		PostLink:      dataData.PostLink,
-	//		PhotoLink:     dataData.PhotoLink,
-	//		LikeNumber:    dataData.LikeNumber,
-	//		LittleEye:     dataData.LittleEye,
-	//		CommitNum:     dataData.CommitNum,
-	//		CollectNum:    dataData.CollectNum,
-	//		DataLink:      dataData.DataLink,
-	//		AuditStatus:   1,
-	//		AuditOpinion:  "",
-	//		CreatedAt:     gtime.Now(),
-	//		ConfirmTime:   nil,
-	//	})
-	//	if err1 != nil {
-	//		return err
-	//	}
-	//
-	//	return utils.OrderProcedureManager.OnOperateOrder(int(dataData.OrderId), true, tid, talentNickname, ctx, tx)
-	//})
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-// OnGetOrderCompleteData 获取任务完成数据
-func OnGetOrderCompleteData(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetQueryInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	rec, err := g.DB().Model(dao.OrderInfo.Table).Fields(dao.OrderInfo.Columns.TalentId).One(dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil || rec == nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if rec[dao.OrderInfo.Columns.TalentId].Int() != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	incomeRec, err := g.DB().Model(dao.BobocoinIncomeRecord.Table).One(dao.BobocoinIncomeRecord.Columns.OrderId, oid)
-	if err != nil || incomeRec == nil {
-		return &TalentHttpResult{Code: -5, Msg: "query income value failed"}
-	}
-
-	deductRecs, err := g.DB().Model(dao.BobocoinDeductRecord.Table).All(dao.BobocoinDeductRecord.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -6, Msg: "query deduct records failed"}
-	}
-
-	incomeValue := incomeRec[dao.BobocoinIncomeRecord.Columns.BobocoinValue].Int()
-
-	var deductValue int
-	if deductRecs != nil {
-		for _, v := range deductRecs {
-			deductValue += v[dao.BobocoinDeductRecord.Columns.BobocoinValue].Int()
-		}
-	}
-
-	incomeDetail := talent_model.OrderIncomeDetailInfo{
-		OrderIncome: incomeValue,
-		DeductList:  deductRecs,
-		RealIncome:  incomeValue - deductValue,
-		OrderCompleteDate: incomeRec[dao.BobocoinIncomeRecord.Columns.CompleteDate].GTime(),
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: incomeDetail}
-}
-
-// CancelOrder 达人取消订单
-func CancelOrder(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
-	}
-
-	oid := r.GetRequestInt("order_id", 0)
-	if oid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "请输入订单id"}
-	}
-
-	var orderInfo *model.OrderInfo
-	err = g.DB().Model(dao.OrderInfo.Table).Where(dao.OrderInfo.Columns.OrderId, oid).Scan(&orderInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "没有此订单"}
-	}
-
-	if orderInfo.TalentId != tid {
-		return &TalentHttpResult{Code: -4, Msg: "达人未接此任务"}
-	}
-
-	// 判断订单是否已完结
-	if orderInfo.CompleteStatus > int(utils.OrderCompleteTypeNoComp) {
-		return &TalentHttpResult{Code: -5, Msg: "order has complete"}
-	}
-
-	_, err = g.DB().Model(dao.OrderInfo.Table).Update(g.Map{
-		dao.OrderInfo.Columns.CompleteStatus: utils.OrderCompleteTypeCancel,
-		dao.OrderInfo.Columns.CompleteDate: gtime.Now(),
-	}, dao.OrderInfo.Columns.OrderId, oid)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "cancel order failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}

+ 0 - 113
app/service/talent_service/wxlogin.go

@@ -1,113 +0,0 @@
-package talent_service
-
-import (
-	"encoding/json"
-	"fmt"
-	"github.com/gogf/gf/crypto/gmd5"
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"net/http"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model/talent_model"
-)
-
-type WxLoginResult struct {
-	OpenId     string `json:"openid"`
-	SessionKey string `json:"session_key"`
-	UnionId    string `json:"unionid"`
-	ErrCode    int    `json:"errcode"`
-	ErrMsg     string `json:"errmsg"`
-}
-
-const (
-	urlformat = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code"
-)
-
-func WxLogin(r *ghttp.Request) *TalentHttpResult {
-	l := talent_model.WxLoginInfo{}
-	err := r.ParseForm(&l)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "param error"}
-	}
-
-	//if e := gvalid.CheckStruct(context.TODO(), l, nil); e != nil {
-	//	return &TalentHttpResult{Code: -2, Msg: "param invalid "}
-	//}
-
-	appId := g.Config().GetString("miniapp.appid")
-	secret := g.Config().GetString("miniapp.appsecret")
-
-	url := fmt.Sprintf(urlformat, appId, secret, l.Code)
-	resp, err := http.Get(url)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
-	defer resp.Body.Close()
-
-	// 解码微信服务端传来的信息
-	wxResp := WxLoginResult{}
-	decoder := json.NewDecoder(resp.Body)
-	if err = decoder.Decode(&wxResp); err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "decode json from wx fail"}
-	}
-
-	if wxResp.ErrCode != 0 {
-		return &TalentHttpResult{Code: -4, Msg: fmt.Sprintf("errCode:%d, errmsg:%s", wxResp.ErrCode, wxResp.ErrMsg)}
-	}
-
-	// 根据openid查询达人信息
-	rec, err := g.DB().Model("talent_info").One("talent_wx_openid", wxResp.OpenId)
-	if err != nil {
-		return &TalentHttpResult{Code: -5, Msg: "get talent info failed"}
-	}
-
-	// 如果达人被拉黑,则返回
-	if rec != nil && rec[dao.TalentInfo.Columns.InBlacklist].Int() > 0 {
-		return &TalentHttpResult{Code: -6, Msg: "in black list"}
-	}
-
-	var newTalentId int64
-	if rec == nil {
-		// 如果数据库中不存在此达人,则插入新的达人信息
-		newTalentId, err = g.DB().Model(dao.TalentInfo.Table).
-			Data(g.Map{"talent_wx_openid": wxResp.OpenId, "last_login_date": gtime.Now(),
-				"talent_wx_nickname": l.Nickname}).InsertAndGetId()
-
-		if err != nil {
-			return &TalentHttpResult{Code: -7, Msg: "add talent info failed"}
-		}
-	} else {
-		// 如果已存在达人,则读取达人id
-		newTalentId = rec["id"].Int64()
-
-		// 更新达人最近登录时间
-		_, err = g.DB().Model(dao.TalentInfo.Table).Data(
-			g.Map{
-				"last_login_date": gtime.Now(),
-			}).Where("id", newTalentId).Update()
-		if err != nil {
-			return &TalentHttpResult{Code: -8, Msg: "update talent last login date failed"}
-		}
-	}
-
-	// 用微信的openid和SessionKey的md5做为token
-	token, err := gmd5.EncryptString(wxResp.OpenId + wxResp.SessionKey)
-	if err != nil {
-		return &TalentHttpResult{Code: -9, Msg: "generate key failed"}
-	}
-
-	// 以token为键保存session
-	err = r.Session.Set(token, g.Map{
-		"talentId":     newTalentId,
-		"wxOpenId":     wxResp.OpenId,
-		"wxSessionKey": wxResp.SessionKey,
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -10, Msg: "set session failed"}
-	}
-
-	// 生成自己的session_key返回给小程序
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: talent_model.LoginResultData{Token: token}}
-}

+ 0 - 289
app/service/talent_service/wxpay_handler.go

@@ -1,289 +0,0 @@
-package talent_service
-
-import (
-	"context"
-	"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/wechatpay-apiv3/wechatpay-go/core"
-	"github.com/wechatpay-apiv3/wechatpay-go/core/option"
-	"github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi"
-	wxUtils "github.com/wechatpay-apiv3/wechatpay-go/utils"
-	"math/rand"
-	"strconv"
-	"time"
-	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
-	"youngmini_server/app/model/talent_model"
-	"youngmini_server/app/utils"
-)
-
-var (
-	mchID                      string = "1615933939"                                // 商户号
-	mchCertificateSerialNumber string = "636DC3B258E436FAD123DAC6453E485CCDBF8770"  // 商户证书序列号
-	mchAPIv3Key                string = "zwbx8iae5llhpwj48guterlpodt3xngo"          // 商户APIv3密钥
-	keyFilePath                string = "./config/secret/apiclient_key.pem"         // 密钥文件路径
-)
-
-func generatePayOrderNumber(talentId int) string {
-	orderNo := gtime.Now().Format("YmdHis")
-	rand.Seed(time.Now().UnixNano())
-	r := rand.Intn(899)
-	orderNo += strconv.Itoa(r + 100)
-	orderNo += fmt.Sprintf("%04d", talentId)
-
-	return orderNo
-}
-
-func WxPayOnTalentRequestPay(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent id failed"}
-	}
-
-	// 获取上传参数
-	var payInfo *talent_model.WxPrepayRequestData
-	err = r.ParseForm(&payInfo)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "param error"}
-	}
-
-	// 获取达人信息
-	var talentInfo *model.TalentInfo
-	err = g.DB().Model(dao.TalentInfo.Table).Scan(&talentInfo, dao.TalentInfo.Columns.Id, tid)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "query talent info failed"}
-	}
-
-	if talentInfo.InBlacklist >= 1 {
-		return &TalentHttpResult{Code: -4, Msg: "talent in blacklist"}
-	}
-
-	// 获取任务信息
-	var taskInfo *talent_model.TaskDetail
-	err = g.DB().Model(dao.TaskBaseInfo.Table).WithAll().Where(dao.TaskBaseInfo.Columns.TaskId, payInfo.TaskId).Scan(&taskInfo)
-	if err != nil || taskInfo == nil {
-		return &TalentHttpResult{Code: -5, Msg: "query task info failed"}
-	}
-
-	// 任务当前不是执行状态,返回
-	if taskInfo.TaskStatus != 2 {
-		return &TalentHttpResult{Code: -6, Msg: "task can not sign up"}
-	}
-
-	// 任务已截止报名
-	if taskInfo.DeadlineTime.Before(gtime.Now()) {
-		return &TalentHttpResult{Code: -7, Msg: "task sign up has finished"}
-	}
-
-	// 如果任务不需要拍单,或拍单方式为不拍单则返回
-	if taskInfo.IsBuySamples == nil || taskInfo.IsBuySamples.BuySamplesType != 1 {
-		return &TalentHttpResult{Code: -8, Msg: "task do not need buy samples"}
-	}
-
-	// 任务拍单费用和上传的拍单费用不符,返回
-	if taskInfo.IsBuySamples.BuySamplesCost != payInfo.BuySamplesCost {
-		return &TalentHttpResult{Code: -9, Msg: "task buy samples cost != input cost"}
-	}
-
-	mchPrivateKey, err := wxUtils.LoadPrivateKeyWithPath(keyFilePath)
-	if err != nil {
-		glog.Error("load merchant private key error")
-		return &TalentHttpResult{Code: -10, Msg: "load client key failed"}
-	}
-
-	ctx := context.Background()
-	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
-	opts := []core.ClientOption{
-		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
-	}
-	client, err := core.NewClient(ctx, opts...)
-	if err != nil {
-		glog.Error("new wechat pay client err:", err)
-		return &TalentHttpResult{Code: -11, Msg: "create client failed"}
-	}
-
-	orderNumber := generatePayOrderNumber(talentInfo.Id)
-	svc := jsapi.JsapiApiService{Client: client}
-	// 得到prepay_id,以及调起支付所需的参数和签名
-	resp, result, err := svc.PrepayWithRequestPayment(ctx,
-		jsapi.PrepayRequest{
-			Appid:       core.String(g.Config().GetString("miniapp.appid")),
-			Mchid:       core.String(mchID),
-			Description: core.String("拍单费用_" + strconv.Itoa(taskInfo.TaskId) + "_" +taskInfo.TaskName + "_" + payInfo.PlatformNickname),
-			OutTradeNo:  core.String(orderNumber),
-			Attach:      core.String("报名任务拍单费用"),
-			NotifyUrl:   core.String("https://www.weixin.qq.com/wxpay/pay.php"),
-			Amount: &jsapi.Amount{
-				Total: core.Int64(payInfo.BuySamplesCost),
-			},
-			Payer: &jsapi.Payer{
-				Openid: core.String(talentInfo.TalentWxOpenid),
-			},
-		},
-	)
-
-	if err != nil {
-		// 处理错误
-		glog.Error("call Prepay err:%s", err)
-		return &TalentHttpResult{Code: -12, Msg: "request prepay info failed"}
-	}
-
-	// 处理返回结果
-	glog.Println("status=%d resp=%s", result.Response.StatusCode, resp)
-
-	if result.Response.StatusCode != 200 {
-		glog.Println(result.Response)
-	}
-
-	// 将支付记录写入数据库
-	_, err = g.DB().Model(dao.WxPayOrder.Table).Insert(model.WxPayOrder{
-		OutTradeNo:                orderNumber,
-		WxOrderNo:                 "",
-		PayAmount:                 payInfo.BuySamplesCost,
-		TaskName:                  taskInfo.TaskName,
-		PayReason:                 1,
-		TalentId:                  talentInfo.Id,
-		TalentWxNickname:          talentInfo.TalentWxNickname,
-		TalentPlatformAccountName: payInfo.PlatformNickname,
-		TaskId:                    taskInfo.TaskId,
-		TaskPlatform:              taskInfo.TaskPlatform,
-		Success:                   0,
-		CreateAt:                  gtime.Now(),
-		Desc:                      "",
-	})
-
-	if err != nil {
-		return &TalentHttpResult{Code: -13, Msg: "insert wx pay order failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: talent_model.WxPrepayResponseData{
-		OutTradeNo: orderNumber,
-		WxResp: resp,
-	}}
-}
-
-func WxPayQueryOrderById(r *ghttp.Request) *TalentHttpResult {
-
-	transactionId := r.GetRequestString("transaction_id", "nil")
-	if transactionId == "nil" {
-		glog.Error("not input transaction_id param")
-		return &TalentHttpResult{Code: -2, Msg: "input transaction_id param"}
-	}
-
-
-	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
-	mchPrivateKey, err := wxUtils.LoadPrivateKeyWithPath(keyFilePath)
-	if err != nil {
-		glog.Error("load merchant private key error")
-		return &TalentHttpResult{Code: -3, Msg: "load merchant private key error"}
-	}
-
-	ctx := context.Background()
-	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
-	opts := []core.ClientOption{
-		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
-	}
-	client, err := core.NewClient(ctx, opts...)
-	if err != nil {
-		glog.Error("new wechat pay client err:%s", err)
-		return &TalentHttpResult{Code: -4, Msg: "load merchant private key error"}
-	}
-
-	svc := jsapi.JsapiApiService{Client: client}
-	resp, _, err := svc.QueryOrderById(ctx,
-		jsapi.QueryOrderByIdRequest{
-			TransactionId: core.String(transactionId),
-			Mchid:         core.String(mchID),
-		},
-	)
-
-	if err != nil {
-		// 处理错误
-		glog.Error("call WxPayQueryOrderById err:%s", err)
-		return &TalentHttpResult{Code: -5, Msg: "call WxPayQueryOrderById failed"}
-	}
-
-	// TODO:支付结果写入数据库
-	_, err = g.DB().Model(dao.WxPayOrder.Table).Update(g.Map{
-		dao.WxPayOrder.Columns.WxOrderNo: resp.TransactionId,
-		dao.WxPayOrder.Columns.Success: 1,
-		dao.WxPayOrder.Columns.Desc: resp.TradeStateDesc,
-	}, dao.WxPayOrder.Columns.OutTradeNo, resp.OutTradeNo)
-	if err != nil {
-		glog.Error("wxpay_handler.WxPayQueryOrderById Update database failed, order number = ", resp.OutTradeNo)
-		return &TalentHttpResult{Code: -6, Msg: "Update database failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-func QueryOrderByOutTradeNo(r *ghttp.Request) *TalentHttpResult {
-	outTradeNo := r.GetRequestString("out_trade_no", "nil")
-	if outTradeNo == "nil" {
-		glog.Error("not input out_trade_no param")
-		return &TalentHttpResult{Code: -2, Msg: "input transaction_id param"}
-	}
-
-	g.DB().Model()
-	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
-	mchPrivateKey, err := wxUtils.LoadPrivateKeyWithPath(keyFilePath)
-	if err != nil {
-		glog.Error("load merchant private key error")
-		return &TalentHttpResult{Code: -3, Msg: "load merchant private key error"}
-	}
-
-	ctx := context.Background()
-	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
-	opts := []core.ClientOption{
-		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
-	}
-	client, err := core.NewClient(ctx, opts...)
-	if err != nil {
-		glog.Error("new wechat pay client err:%s", err)
-		return &TalentHttpResult{Code: -4, Msg: "load merchant private key error"}
-	}
-
-	svc := jsapi.JsapiApiService{Client: client}
-	resp, _, err := svc.QueryOrderByOutTradeNo(ctx,
-		jsapi.QueryOrderByOutTradeNoRequest{
-			OutTradeNo: core.String(outTradeNo),
-			Mchid:      core.String(mchID),
-		},
-	)
-
-	if err != nil {
-		// 处理错误
-		glog.Error("call QueryOrderByOutTradeNo err:%s", err)
-		return &TalentHttpResult{Code: -5, Msg: "call QueryOrderByOutTradeNo failed"}
-	}
-
-	// TODO:支付结果写入数据库
-	_, err = g.DB().Model(dao.WxPayOrder.Table).Update(g.Map{
-		dao.WxPayOrder.Columns.WxOrderNo: resp.TransactionId,
-		dao.WxPayOrder.Columns.Success: 1,
-		dao.WxPayOrder.Columns.Desc: resp.TradeStateDesc,
-	}, dao.WxPayOrder.Columns.OutTradeNo, resp.OutTradeNo)
-	if err != nil {
-		glog.Error("wxpay_handler.WxPayQueryOrderById Update database failed, order number = ", resp.OutTradeNo)
-		return &TalentHttpResult{Code: -6, Msg: "Update database failed"}
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success"}
-}
-
-func OnWxPayNotify(r *ghttp.Request)  {
-
-	wxSignature := r.GetHeader("Wechatpay-Signature")
-	if wxSignature == "" {
-		glog.Error("OnWxPayNotify header not contain Wechatpay-Signature property")
-
-		r.Response.WriteJsonExit(g.Map{
-			"code": "FAILED",
-			"message": "header中不包括Wechatpay-Signature",
-		})
-	}
-
-}

+ 6 - 1
app/service/youngee_talent_service/info_tables.go

@@ -20,7 +20,12 @@ func GetInfoTables() *TalentHttpResult {
 		return &TalentHttpResult{Code: -3, Msg: "query skilled area failed"}
 	}
 
-	err = g.DB().Model(model.InfoProductClassify{}).Scan(&allInfos.ProductClassify)
+	err = g.DB().Model(model.InfoProductType{}).Scan(&allInfos.ProductType)
+	if err != nil {
+		return &TalentHttpResult{Code: -4, Msg: "query product classify failed"}
+	}
+
+	err = g.DB().Model(model.InfoTaskStage{}).Scan(&allInfos.TaskStage)
 	if err != nil {
 		return &TalentHttpResult{Code: -4, Msg: "query product classify failed"}
 	}

+ 58 - 24
app/service/youngee_talent_service/project_info.go

@@ -3,11 +3,15 @@ package youngee_talent_service
 import (
 	"fmt"
 	"reflect"
+	"strconv"
+	"strings"
 	"youngmini_server/app/dao"
+	"youngmini_server/app/model"
 	"youngmini_server/app/model/youngee_talent_model"
 
 	"github.com/gogf/gf/frame/g"
 	"github.com/gogf/gf/net/ghttp"
+	"github.com/wxnacy/wgo/arrays"
 )
 
 type projectStatus int
@@ -37,15 +41,15 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "参数错误"}
 	}
 
-	// 如果有平台的过滤条件,则将平台列表保存于platformList
-	var platformList []interface{}
-	if platform != nil {
-		if reflect.TypeOf(platform).Kind() != reflect.Slice {
-			return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
+	// 如果有稿费形式的过滤条件,则将过滤条件保存于taskModeList
+	var feeFormList []interface{}
+	if feeForm != nil {
+		if reflect.TypeOf(feeForm).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -3, Msg: "搜索条件稿费形式错误"}
 		}
 
-		platformList = make([]interface{}, 0)
-		platformList = platform.([]interface{})
+		feeFormList = make([]interface{}, 0)
+		feeFormList = feeForm.([]interface{})
 	}
 
 	// 如果有任务形式的过滤条件,则将过滤条件保存于taskModeList
@@ -59,20 +63,21 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 		projectFormList = projectForm.([]interface{})
 	}
 
-	// 如果有稿费形式的过滤条件,则将过滤条件保存于taskModeList
-	var feeFormList []interface{}
-	if feeForm != nil {
-		if reflect.TypeOf(feeForm).Kind() != reflect.Slice {
-			return &TalentHttpResult{Code: -3, Msg: "搜索条件稿费形式错误"}
+	// 如果有平台的过滤条件,则将平台列表保存于platformList
+	var platformList []interface{}
+	if platform != nil {
+		if reflect.TypeOf(platform).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
 		}
 
-		feeFormList = make([]interface{}, 0)
-		feeFormList = feeForm.([]interface{})
+		platformList = make([]interface{}, 0)
+		platformList = platform.([]interface{})
 	}
 
 	// 构造查询的条件
 	startId := pageIndex * cntPerPage
-	whereStr := fmt.Sprintf("project_status = %d or project_status = %d", projectStatusRecruiting, projectStatusRecruited)
+	// whereStr := fmt.Sprintf("")
+	whereStr := fmt.Sprintf("(project_status >= %d)", projectStatusRecruiting)
 	if platformList != nil {
 		whereStr = whereStr + " and project_platform in ("
 		for _, v := range platformList {
@@ -93,20 +98,49 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 		whereStr += ")"
 	}
 
-	if feeFormList != nil {
-		whereStr += " and fee_form in ("
-		for _, v := range feeFormList {
-			whereStr += v.(string) + ", "
+	// 查询所有project
+	var projectList = []model.ProjectInfo{}
+	var projectIdList []int
+	err := g.Model(dao.ProjectInfo.Table).Where(whereStr).Scan(&projectList)
+	if err != nil {
+		return &TalentHttpResult{Code: -6, Msg: "查询数据库失败"}
+	}
+	fmt.Println("feeFormList:", feeFormList)
+	fmt.Println("projectList:", projectList)
+	// 筛选出满足稿费形式条件的项目id列表
+	for _, v := range projectList {
+		string_slice := strings.Split(v.FeeForm, ",")
+		// fmt.Println("str:", string_slice)
+		tmp := 0
+		for _, w := range feeFormList {
+			i := arrays.ContainsString(string_slice, w.(string))
+			if i < 0 {
+				tmp = 0
+				break
+			}
+			tmp = 1
+		}
+		if tmp == 1 {
+			projectIdList = append(projectIdList, v.ProjectId)
+		}
+	}
+
+	if projectIdList != nil {
+		whereStr += " and project_id in ("
+		for _, v := range projectIdList {
+			whereStr += strconv.Itoa(v) + ", "
 		}
 
 		whereStr = whereStr[0 : len(whereStr)-2]
 		whereStr += ")"
+	} else if feeForm != nil {
+		return &TalentHttpResult{Code: -4, Msg: "has no project", Data: nil}
 	}
 
+	fmt.Println("whereStr: ", whereStr)
+
 	// 判断请求页面是否超过最大页面
-	c, err := g.DB().Model(dao.ProjectInfo.Table).Fields("project_id").
-		Count()
-	// c, err := g.DB().Model("project_info").WithAll().Where(whereStr).Count()
+	c, err := g.DB().Model(dao.ProjectInfo.Table).Fields("project_id").Where(whereStr).Count()
 
 	if c <= 0 {
 		return &TalentHttpResult{Code: -4, Msg: "has no project", Data: nil}
@@ -122,8 +156,7 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	var projectInfoList = youngee_talent_model.ProjectInfoList{}
-	err = g.DB().Model("project_info").WithAll().
-		Where(whereStr).
+	err = g.DB().Model("project_info").WithAll().Where(whereStr).
 		Order("recruit_ddl DESC, project_id").Limit(startId, cntPerPage).Scan(&projectInfoList.ProjectInfos)
 
 	if err != nil {
@@ -148,5 +181,6 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
 	}
+
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
 }

+ 6 - 0
app/service/youngee_talent_service/talent_account.go

@@ -47,6 +47,12 @@ func OnAddTalentAccount(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
 
+	// 修改talent表字段is_bind_account值为1
+	_, err = g.Model(dao.YoungeeTalentInfo.Table).Data("is_bind_account=1").Where("id", tid).Update()
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	}
+
 	return &TalentHttpResult{Code: 0, Msg: "success"}
 }
 

+ 26 - 0
app/service/youngee_talent_service/talent_address.go

@@ -12,6 +12,21 @@ import (
 	"github.com/gogf/gf/net/ghttp"
 )
 
+// 获取达人默认收货地址
+func GetTalentDefaultAddress(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	res, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Where("talent_id = ? and default_tag = 1", tid).One()
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
+}
+
 // 获取达人收货地址
 func GetTalentAddress(r *ghttp.Request) *TalentHttpResult {
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
@@ -63,6 +78,7 @@ func OnAddTalentAddress(r *ghttp.Request) *TalentHttpResult {
 		if err != nil {
 			return tErr
 		}
+
 		// 如果设置的是地址是默认地址,则把当前默认地址设为非默认
 		if tAddr.DefaultTag > 0 {
 			_, tErr = tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).
@@ -71,6 +87,16 @@ func OnAddTalentAddress(r *ghttp.Request) *TalentHttpResult {
 				return tErr
 			}
 		}
+
+		// 如果当前无地址则将其设为默认地址
+		c, tErr := tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Where("talent_id", tid).Count()
+		if tErr != nil {
+			return tErr
+		}
+		if c == 0 {
+			tAddr.DefaultTag = 1
+		}
+
 		// 将达人id存入结构体
 		tAddr.TalentId = tid
 		// 插入新的收货地址记录

+ 377 - 0
app/service/youngee_talent_service/task_info.go

@@ -0,0 +1,377 @@
+package youngee_talent_service
+
+import (
+	"context"
+	"fmt"
+	"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/encoding/gjson"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// 新建任务service
+func SignUpTask(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	var signTaskInfo *youngee_talent_model.SignTaskInfo
+	err = r.ParseForm(&signTaskInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	}
+	var projectDetail *youngee_talent_model.ProjectDetail
+	err = g.DB().Model(youngee_talent_model.ProjectDetail{}).WithAll().Where("project_id", signTaskInfo.ProjectId).Scan(&projectDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
+	}
+
+	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.PlatformAccountInfo
+	err = g.DB().Model("youngee_platform_account_info").WithAll().Where("talent_id = ? and platform_id = ?", tid, projectDetail.ProjectPlatform).Scan(&accountInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: err.Error()}
+	}
+
+	address, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).One("talent_id = ? and address_id = ?", tid, signTaskInfo.AddressId)
+	if err != nil {
+		return &TalentHttpResult{Code: -6, Msg: err.Error()}
+	}
+
+	// 生成达人平台账号信息快照
+	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"}
+	}
+
+	// 生成收货地址快照
+	addrSnap, err := gjson.Encode(address)
+	if err != nil {
+		return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
+	}
+
+	// 计算平台服务费
+	// 先获取稿费形式
+	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: -5, Msg: err.Error()}
+	}
+
+	// 根据稿费形式、平台、粉丝数查询服务费
+	whereStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, accountInfo.FansCount, accountInfo.FansCount)
+	var serviceCharge = 0.0
+	var serviceRate = 0
+	var allReward = 0.0
+	var allPayment = 0.0
+	switch strategy.FeeForm {
+	case 1: // 产品置换,服务费固定,在项目生成时确定
+		serviceCharge = float64(strategy.ServiceCharge)
+		allPayment = serviceCharge
+		break
+	case 2: // 固定稿费,m2  =  y2 * r2
+		allPayment = float64(strategy.Offer)
+		var pricing *model.InfoPricingStrategy
+		err = g.DB().Model("info_pricing_strategy").WithAll().Where(whereStr1).Scan(&pricing)
+		if err != nil {
+			return &TalentHttpResult{Code: -5, Msg: err.Error()}
+		}
+		serviceRate = pricing.ServiceRate
+		serviceCharge = allPayment * float64(serviceRate) / 1000
+		allReward = allPayment - serviceCharge
+		break
+	case 3: // 自报价,m3 = x3 * r3
+		allReward = float64(signTaskInfo.Offer)
+		var pricing *model.InfoPricingStrategy
+		err = g.DB().Model("info_pricing_strategy").WithAll().Where(whereStr1).Scan(&pricing)
+		if err != nil {
+			return &TalentHttpResult{Code: -5, Msg: err.Error()}
+		}
+		serviceRate = pricing.ServiceRate
+		serviceCharge = allReward * float64(serviceRate) / 1000
+		allPayment = allReward + serviceCharge
+		break
+	default:
+		break
+	}
+
+	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
+		// 在task_info表中插入任务
+		taskId, err1 := tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(model.YoungeeTaskInfo{
+			ProjectId:              int(signTaskInfo.ProjectId),
+			TalentId:               tid,
+			AccountId:              accountInfo.AccountId,
+			TalentPlatformInfoSnap: string(accountSnap),
+			TalentPersonalInfoSnap: string(talentSnap),
+			TalentPostAddrSnap:     string(addrSnap),
+			StrategyId:             signTaskInfo.StrategyId,
+			TaskReward:             allReward,
+			SettleAmount:           allReward,
+			AllPayment:             allPayment,
+			TaskStage:              1,
+			RealPayment:            allPayment,
+			Penalty:                0,
+			FeeForm:                strategy.FeeForm,
+			ServiceCharge:          serviceCharge,
+			ServiceRate:            serviceRate,
+			TaskStatus:             1,
+			CreateDate:             gtime.Now(),
+			CompleteStatus:         1,
+		}).InsertAndGetId()
+		if err1 != nil {
+			return err1
+		}
+
+		// 对应项目的报名人数自增
+		_, err1 = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.ProjectId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
+		if err1 != nil {
+			return err1
+		}
+		fmt.Printf("%+v", taskId)
+		return nil
+	})
+	if err != nil {
+		return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success"}
+}
+
+// 判断是否已报名任务
+func IsSignUpTask(r *ghttp.Request) *TalentHttpResult {
+	projectId := r.GetQueryInt("project_id", -1)
+	accountId := r.GetQueryInt("account_id", -1)
+	fmt.Printf("%+v\n", projectId)
+	fmt.Printf("%+v\n", accountId)
+	isSignUp, err := g.Model(dao.YoungeeTaskInfo.Table).Where("project_id = ? and account_id = ?", projectId, accountId).Count()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: isSignUp}
+}
+
+// 查询所有任务
+func GetTaskBriefList(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	// 构造查询条件
+	whereStr := fmt.Sprintf("talent_id = '%s'", tid)
+
+	fmt.Print(whereStr)
+	// 获取任务列表
+	var taskList []*model.YoungeeTaskInfo
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr).Scan(&taskList)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
+	}
+
+	// 为每个任务根据项目id查询项目名称和主图
+	taskBriefList := youngee_talent_model.TaskInfoBriefList{}
+	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 project info failed"}
+		}
+		mainPhoto, err := g.Model(dao.YounggeeProductPhoto.Table).One("product_id = ? and symbol = 1", projectInfo[dao.ProjectInfo.Columns.ProductId])
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get product mainphoto failed"}
+		}
+		platform, err := g.Model(dao.InfoThirdPlatform.Table).One("platform_id = ?", projectInfo[dao.ProjectInfo.Columns.ProjectPlatform])
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
+		}
+		account, err := g.Model(dao.YoungeePlatformAccountInfo.Table).One("platform_id = ? and talent_id = ?", projectInfo[dao.ProjectInfo.Columns.ProjectPlatform], v.TalentId)
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+		}
+		taskInfoBrief := &youngee_talent_model.TaskInfoBrief{
+			TaskId:           uint64(v.TaskId),
+			PlatformIconUrl:  platform[dao.InfoThirdPlatform.Columns.PlatformIcon].String(),
+			PlatformName:     platform[dao.InfoThirdPlatform.Columns.PlatformName].String(),
+			PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
+			ProjectName:      projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
+			ProductImgUrl:    mainPhoto[dao.YounggeeProductPhoto.Columns.PhotoUrl].String(),
+			TaskStatus:       v.TaskStatus,
+			TaskStage:        v.TaskStage,
+		}
+		taskBriefList.AllTaskInfoList = append(taskBriefList.AllTaskInfoList, taskInfoBrief)
+
+		if v.TaskStage <= 3 {
+			taskBriefList.SignUpTaskInfoList = append(taskBriefList.SignUpTaskInfoList, taskInfoBrief)
+		} else if v.TaskStage <= 9 && v.TaskStage >= 5 {
+			taskBriefList.GoingOnTaskInfoList = append(taskBriefList.GoingOnTaskInfoList, taskInfoBrief)
+		} else {
+			taskBriefList.CompletedTaskInfoList = append(taskBriefList.CompletedTaskInfoList, taskInfoBrief)
+		}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
+}
+
+// 查询所有任务
+func GetExeTaskBriefList(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	// 获取任务列表
+	var taskList []*model.YoungeeTaskInfo
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("task_stage IN(?)", g.Slice{8, 11, 14, 17}).Scan(&taskList)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
+	}
+
+	// 为每个任务根据项目id查询项目名称和主图
+	taskBriefList := youngee_talent_model.EXETaskInfoBriefList{}
+	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 project info failed"}
+		}
+		mainPhoto, err := g.Model(dao.YounggeeProductPhoto.Table).One("product_id = ? and symbol = 1", projectInfo[dao.ProjectInfo.Columns.ProductId])
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get product mainphoto failed"}
+		}
+		platform, err := g.Model(dao.InfoThirdPlatform.Table).One("platform_id = ?", projectInfo[dao.ProjectInfo.Columns.ProjectPlatform])
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
+		}
+		account, err := g.Model(dao.YoungeePlatformAccountInfo.Table).One("platform_id = ? and talent_id = ?", projectInfo[dao.ProjectInfo.Columns.ProjectPlatform], v.TalentId)
+		if err != nil {
+			return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+		}
+		taskInfoBrief := &youngee_talent_model.TaskInfoBrief{
+			TaskId:           uint64(v.TaskId),
+			PlatformIconUrl:  platform[dao.InfoThirdPlatform.Columns.PlatformIcon].String(),
+			PlatformName:     platform[dao.InfoThirdPlatform.Columns.PlatformName].String(),
+			PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
+			ProjectName:      projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
+			ProductImgUrl:    mainPhoto[dao.YounggeeProductPhoto.Columns.PhotoUrl].String(),
+			TaskStatus:       v.TaskStatus,
+			TaskStage:        v.TaskStage,
+		}
+		if v.TaskStage == 8 {
+			taskBriefList.List1 = append(taskBriefList.List1, taskInfoBrief)
+		} else if v.TaskStage == 11 {
+			taskBriefList.List2 = append(taskBriefList.List2, taskInfoBrief)
+		} else if v.TaskStage == 14 {
+			taskBriefList.List3 = append(taskBriefList.List3, taskInfoBrief)
+		} else if v.TaskStage == 17 {
+			taskBriefList.List4 = append(taskBriefList.List4, taskInfoBrief)
+		}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
+}
+
+func GetTaskNum(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+
+	// 构造查询条件
+	whereStr1 := fmt.Sprintf("talent_id = '%s'", tid)
+	whereStr2 := fmt.Sprintf("talent_id = '%s' and task_stage <= 3", tid)
+	whereStr3 := fmt.Sprintf("talent_id = '%s' and task_stage <= 19 and task_stage >= 5", tid)
+	whereStr4 := fmt.Sprintf("talent_id = '%s' and (task_stage = 4 or task_stage >= 20)", tid)
+
+	num1, err := g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr1).Count()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+	}
+	num2, err := g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr2).Count()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+	}
+	num3, err := g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr3).Count()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+	}
+	num4, err := g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr4).Count()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
+	}
+
+	TaskNum := &youngee_talent_model.TaskNum{
+		AllNum:       num1,
+		SignUpNum:    num2,
+		GoingOnNum:   num3,
+		CompletedNum: num4,
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: TaskNum}
+}
+
+// 获取任务详情
+func GetTaskDetail(r *ghttp.Request) *TalentHttpResult {
+	taskId := r.GetQueryInt("task_id", -1)
+
+	var task *model.YoungeeTaskInfo
+	err := g.Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", taskId).Scan(&task)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get task info failed"}
+	}
+
+	var projectDetail *youngee_talent_model.ProjectDetail
+	err = g.Model(youngee_talent_model.ProjectDetail{}).WithAll().Where("project_id", task.ProjectId).Scan(&projectDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
+	}
+
+	var productPhoto *model.YounggeeProductPhoto
+	err = g.Model(dao.YounggeeProductPhoto.Table).Where("product_id = ? and symbol = 1", projectDetail.ProductId).Scan(&productPhoto)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
+	}
+
+	var strategy *model.RecruitStrategy
+	err = g.Model(dao.RecruitStrategy.Table).Where("project_id = ? and strategy_id = ?", task.ProjectId, task.StrategyId).Scan(&strategy)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "data query failed"}
+	}
+
+	taskDetail := &youngee_talent_model.TaskDetail{
+		TaskInfo:      task,
+		ProjectDetail: projectDetail,
+		ProductPhoto:  productPhoto,
+		Strategy:      strategy,
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskDetail}
+}
+
+// 获取物流信息
+func GetTaskLogisticsInfo(r *ghttp.Request) *TalentHttpResult {
+	taskId := r.GetQueryInt("task_id", -1)
+
+	var logistics *model.YoungeeTaskLogistics
+	err := g.Model(dao.YoungeeTaskLogistics.Table).Where("task_id = ?", taskId).Scan(&logistics)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get logistics info failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: logistics}
+}

+ 50 - 0
app/service/youngee_talent_service/task_script.go

@@ -0,0 +1,50 @@
+package youngee_talent_service
+
+import (
+	"youngmini_server/app/dao"
+	"youngmini_server/app/model"
+	"youngmini_server/app/model/youngee_talent_model"
+
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// 上传脚本service
+func AddTaskScript(r *ghttp.Request) *TalentHttpResult {
+	var scriptInfoReq *youngee_talent_model.AddTaskScriptRequest
+	err := r.ParseForm(&scriptInfoReq)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+	}
+
+	scriptInfo := model.YounggeeScriptInfo{
+		TaskId:   scriptInfoReq.TaskId,
+		Content:  scriptInfoReq.Content,
+		CreateAt: gtime.Now(),
+		IsReview: 0,
+	}
+	_, err = g.DB().Model(model.YounggeeScriptInfo{}).Data(scriptInfo).Insert()
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: "YounggeeScriptInfo insert failed"}
+	}
+
+	_, err = g.Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", scriptInfoReq.TaskId).Increment("script_status", 1)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: "Get task info failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success"}
+}
+
+// 查询脚本service
+func GetTaskScript(r *ghttp.Request) *TalentHttpResult {
+	taskId := r.Get("task_id")
+
+	res, err := g.DB().Model(dao.YounggeeScriptInfo.Table).All("task_id", taskId)
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
+}

BIN
bin/v2.0.1/linux_amd64/youngmini_server


BIN
bin/v2.0.1/windows_amd64/youngmini_server.exe


BIN
bin/v2.0.2/linux_amd64/youngmini_server


BIN
bin/v2.0.2/windows_amd64/youngmini_server.exe


BIN
bin/v2.0.3/linux_amd64/youngmini_server


BIN
bin/v2.0.3/windows_amd64/youngmini_server.exe


BIN
bin/v2.0.4/linux_amd64/youngmini_server


BIN
bin/v2.0.4/windows_amd64/youngmini_server.exe


BIN
bin/v2.0.5/linux_amd64/youngmini_server


BIN
bin/v2.0.5/windows_amd64/youngmini_server.exe


+ 2 - 2
config/config.toml

@@ -2,7 +2,7 @@ SessionStorage = "redis"
 
 # HTTP Server
 [server]
-Address = ":8199"
+Address = ":8200"
 ServerAgent = "gf-app"
 ServerRoot = "public"
 
@@ -19,7 +19,7 @@ name = "youngmini_server"
 output = "./bin"
 pack = ""
 system = "linux,windows"
-version = "v1.0.3"
+version = "v2.0.5"
 [gfcli.gen.dao]
 jsonCase = "Snake"
 link = "mysql:talent:talentDB_123@tcp(139.9.53.143:3306)/youngmini"

+ 1 - 0
go.mod

@@ -7,6 +7,7 @@ require (
 	github.com/gogf/gf v1.16.6
 	github.com/rs/xid v1.4.0
 	github.com/wechatpay-apiv3/wechatpay-go v0.2.9
+	github.com/wxnacy/wgo v1.0.4
 	gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
 )
 

+ 2 - 0
go.sum

@@ -52,6 +52,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/wechatpay-apiv3/wechatpay-go v0.2.9 h1:FnFdYLquHWEB0pBacOHC9BePgXcf26vZfn2X3uYbo0c=
 github.com/wechatpay-apiv3/wechatpay-go v0.2.9/go.mod h1:W8ucVAOCKOii933cWROLaDLmRQ2cg/vHHVF4vGAVq9Q=
+github.com/wxnacy/wgo v1.0.4 h1:UEkzjlW3pMAXcTUCgMekrCvFYLKKwc0p5GAQrMIphs8=
+github.com/wxnacy/wgo v1.0.4/go.mod h1:8hqUwCgvMGgAIr4MLIeFur2YXS/Ns3vbyx5abx0e8iM=
 go.opentelemetry.io/otel v0.16.0/go.mod h1:e4GKElweB8W2gWUqbghw0B8t5MCTccc9212eNHnOHwA=
 go.opentelemetry.io/otel v1.0.0-RC2 h1:SHhxSjB+omnGZPgGlKe+QMp3MyazcOHdQ8qwo89oKbg=
 go.opentelemetry.io/otel v1.0.0-RC2/go.mod h1:w1thVQ7qbAy8MHb0IFj8a5Q2QU0l2ksf8u/CN8m3NOM=

+ 1 - 1
middleware/middleware_wx_auth.go

@@ -10,7 +10,7 @@ func WxAuth(r *ghttp.Request) {
 	if !r.Session.Contains(token) {
 		r.Response.WriteJson(g.Map{
 			"code": 403,
-			"msg": "请重新登录",
+			"msg":  "请重新登录",
 		})
 
 		return

+ 6 - 0
router/router.go

@@ -72,6 +72,12 @@ func init() {
 	s.Group("/youngee/c", func(group *ghttp.RouterGroup) {
 		group.Middleware(middleware.ErrorHandler)
 
+		s.BindHandler("/ping", func(r *ghttp.Request) {
+			r.Response.Write("哈喽世界!")
+		})
+		// group.GET("/ping", func(r *ghttp.Request) {
+		// 	r.Response.Write("哈喽世界!")
+		// })
 		// 达人不需要鉴权的接口
 		group.GET("/g", youngeetalentapi.TalentGetApi)
 		group.POST("/p", youngeetalentapi.TalentPostApi)

+ 21 - 0
vendor/github.com/wxnacy/wgo/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 wxnacy
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 82 - 0
vendor/github.com/wxnacy/wgo/arrays/arrays.go

@@ -0,0 +1,82 @@
+package arrays
+
+import (
+)
+
+
+func StringsContains(array []string, val string) (index int) {
+    index = ContainsString(array, val)
+    return
+}
+
+// func IntsContains(array []int, val int) (index int) {
+    // index = ContainsInt(array, val)
+    // return
+// }
+
+// func FloatsContains(array []float64, val float64) (index int) {
+    // index = ContainsFloat64(array, val)
+    // return
+// }
+
+// []string deduplicate
+func StringsDeduplicate(array []string) []string {
+    var arr = make([]string, 0)
+    var m = make(map[string]bool)
+    for _, d := range array {
+        _, ok := m[d]
+        if !ok {
+            m[d] = true
+            arr = append(arr, d)
+        }
+    }
+    return arr
+}
+
+// []string equal
+func StringsEqual(a, b []string) bool {
+    if len(a) != len(b) {
+        return false
+    }
+    if (a == nil) != (b == nil) {
+        return false
+    }
+    b = b[:len(a)]
+    for i, v := range a {
+        if v != b[i] {
+            return false
+        }
+    }
+    return true
+}
+
+// []int deduplicate
+func IntsDeduplicate(array []int) []int {
+    var arr = make([]int, 0)
+    var m = make(map[int]bool)
+    for _, d := range array {
+        _, ok := m[d]
+        if !ok {
+            m[d] = true
+            arr = append(arr, d)
+        }
+    }
+    return arr
+}
+
+// []int equal
+func IntsEqual(a, b []int) bool {
+    if len(a) != len(b) {
+        return false
+    }
+    if (a == nil) != (b == nil) {
+        return false
+    }
+    b = b[:len(a)]
+    for i, v := range a {
+        if v != b[i] {
+            return false
+        }
+    }
+    return true
+}

+ 95 - 0
vendor/github.com/wxnacy/wgo/arrays/contains.go

@@ -0,0 +1,95 @@
+package arrays
+
+import (
+    "reflect"
+)
+
+// Contains Returns the index position of the val in array
+func Contains(array interface{}, val interface{}) (index int) {
+    index = -1
+    switch reflect.TypeOf(array).Kind() {
+        case reflect.Slice: {
+            s := reflect.ValueOf(array)
+            for i := 0; i < s.Len(); i++ {
+                if reflect.DeepEqual(val, s.Index(i).Interface()) {
+                    index = i
+                    return
+                }
+            }
+        }
+    }
+    return
+}
+
+// ContainsString Returns the index position of the string val in array
+func ContainsString(array []string, val string) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+
+// ContainsInt Returns the index position of the int64 val in array
+func ContainsInt(array []int64, val int64) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+
+// ContainsUint Returns the index position of the uint64 val in array
+func ContainsUint(array []uint64, val uint64) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+
+// ContainsBool Returns the index position of the bool val in array
+func ContainsBool(array []bool, val bool) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+
+// ContainsFloat Returns the index position of the float64 val in array
+func ContainsFloat(array []float64, val float64) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+
+// ContainsComplex Returns the index position of the complex128 val in array
+func ContainsComplex(array []complex128, val complex128) (index int) {
+    index = -1
+    for i := 0; i < len(array); i++ {
+        if array[i] == val {
+            index = i
+            return
+        }
+    }
+    return
+}
+

+ 113 - 0
vendor/github.com/wxnacy/wgo/arrays/set.go

@@ -0,0 +1,113 @@
+package arrays
+
+import (
+    // "sort"
+    "sync"
+    "reflect"
+)
+
+type Set struct {
+	m map[interface{}]bool
+	sync.RWMutex
+}
+
+func MakeSet(i ...interface{}) *Set {
+    s := &Set{
+		m: map[interface{}]bool{},
+	}
+
+    for _, d := range i {
+        s.m[d] = true
+
+    }
+
+    return s
+}
+
+func (s *Set) Add(item interface{}) {
+	s.Lock()
+	defer s.Unlock()
+	s.m[item] = true
+
+}
+
+// func (s *Set) Remove(item int) {
+	// s.Lock()
+	// defer s.Unlock()
+	// delete(s.m, item)
+// }
+
+func (s *Set) Has(item interface{}) bool {
+    s.RLock()
+    defer s.RUnlock()
+    _, ok := s.m[item]
+    return ok
+}
+
+func (s *Set) Len() int {
+    return len(s.List())
+}
+
+func (s *Set) Clear() {
+    s.Lock()
+    defer s.Unlock()
+    s.m = map[interface{}]bool{}
+}
+
+func (s *Set) IsEmpty() bool {
+    if s.Len() == 0 {
+        return true
+    }
+    return false
+}
+
+func (s *Set) List() []interface{} {
+    s.RLock()
+    defer s.RUnlock()
+    list := make([]interface{}, 0)
+    for item := range s.m {
+        list = append(list, item)
+    }
+    return list
+}
+
+func (s *Set) Strings() []string {
+    s.RLock()
+    defer s.RUnlock()
+    list := make([]string, 0)
+    for item := range s.m {
+        list = append(list, reflect.ValueOf(item).String())
+    }
+    return list
+}
+
+func (s *Set) Ints() []int64 {
+    s.RLock()
+    defer s.RUnlock()
+    list := make([]int64, 0)
+    for item := range s.m {
+        list = append(list, reflect.ValueOf(item).Int())
+    }
+    return list
+}
+
+func (s *Set) Floats() []float64 {
+    s.RLock()
+    defer s.RUnlock()
+    list := make([]float64, 0)
+    for item := range s.m {
+        list = append(list, reflect.ValueOf(item).Float())
+    }
+    return list
+}
+
+// func (s *Set) SortList() []interface{} {
+    // s.RLock()
+    // defer s.RUnlock()
+    // list := make([]interface{}, 0)
+    // for item := range s.m {
+        // list = append(list, item)
+    // }
+    // sort.Ints(list)
+    // return list
+// }

+ 3 - 0
vendor/modules.txt

@@ -144,6 +144,9 @@ github.com/wechatpay-apiv3/wechatpay-go/services/payments
 github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi
 github.com/wechatpay-apiv3/wechatpay-go/utils
 github.com/wechatpay-apiv3/wechatpay-go/utils/task
+# github.com/wxnacy/wgo v1.0.4
+## explicit
+github.com/wxnacy/wgo/arrays
 # go.opentelemetry.io/otel v1.0.0-RC2
 ## explicit; go 1.15
 go.opentelemetry.io/otel