Bläddra i källkod

income_bug_fixed

Xingyu Xian 2 veckor sedan
förälder
incheckning
28fec4d5b3

+ 11 - 0
db/supplier.go

@@ -45,3 +45,14 @@ func GetSupplierById(ctx context.Context, supplierId int) (*gorm_model.YoungeeSu
 	}
 	return supplierInfo, nil
 }
+
+// UpdateSupplier 服务商信息更新
+func UpdateSupplier(ctx context.Context, supplierInfo *gorm_model.YoungeeSupplier) error {
+	db := GetWriteDB(ctx)
+	whereCondition := gorm_model.YoungeeSupplier{SupplierId: supplierInfo.SupplierId}
+	err := db.Model(&gorm_model.YoungeeSupplier{}).Where(whereCondition).Updates(supplierInfo).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 12 - 0
db/task.go

@@ -466,3 +466,15 @@ func CountTaskNumByTaskStage(ctx context.Context, taskStage int, supplierStatus
 	}
 	return taskNum, nil
 }
+
+// GetTaskListByOpenId 根据OpenId查询达人全部种草子任务
+func GetTaskListByOpenId(ctx context.Context, openId string, nickName string, orderBy []string, orderDesc []int, pageNum int64, pageSize int64) ([]gorm_model.YoungeeTaskInfo, error) {
+	db := GetReadDB(ctx)
+	tasks := []gorm_model.YoungeeTaskInfo{}
+
+	err := db.Where("open_id=? and task_status = 2", openId).Find(&tasks).Error
+	if err != nil {
+		return nil, err
+	}
+	return tasks, nil
+}

+ 2 - 1
handler/company_review.go

@@ -37,7 +37,7 @@ func (h *CompanyReviewHandler) getResponse() interface{} {
 }
 func (h *CompanyReviewHandler) run() {
 	config := service.GetConfig()
-	err := config.CheckBusinessLicense(h.req)
+	data, err := config.CheckBusinessLicense(h.req)
 	if err != nil {
 		logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
 		h.resp.Status = 40000
@@ -46,6 +46,7 @@ func (h *CompanyReviewHandler) run() {
 	}
 	h.resp.Status = 20000
 	h.resp.Message = "ok"
+	h.resp.Data = data
 }
 
 func (h *CompanyReviewHandler) checkParam() error {

+ 58 - 0
handler/create_contact_info.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapCreateContactInfoHandler(ctx *gin.Context) {
+	handler := newCreateContactInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newCreateContactInfoHandler(ctx *gin.Context) *CreateContactInfoHandler {
+	return &CreateContactInfoHandler{
+		req:  http_model.NewCreateContactInfoRequest(),
+		resp: http_model.NewCreateContactInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type CreateContactInfoHandler struct {
+	req  *http_model.CreateContactInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *CreateContactInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *CreateContactInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *CreateContactInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *CreateContactInfoHandler) run() {
+	data, err := service.Supplier.GetSupplierContactInfo(h.ctx, h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *CreateContactInfoHandler) checkParam() error {
+	return nil
+}

+ 2 - 1
handler/id_card_review.go

@@ -37,7 +37,7 @@ func (h *IdCardReviewHandler) getResponse() interface{} {
 }
 func (h *IdCardReviewHandler) run() {
 	config := service.GetConfig()
-	err := config.CheckIdCard(h.req)
+	data, err := config.CheckIdCard(h.req)
 	if err != nil {
 		logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
 		h.resp.Status = 40000
@@ -46,6 +46,7 @@ func (h *IdCardReviewHandler) run() {
 	}
 	h.resp.Status = 20000
 	h.resp.Message = "ok"
+	h.resp.Data = data
 }
 
 func (h *IdCardReviewHandler) checkParam() error {

+ 56 - 0
handler/save_review.go

@@ -0,0 +1,56 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapSaveReviewHandler(ctx *gin.Context) {
+	handler := newSaveReviewHandler(ctx)
+	baseRun(handler)
+}
+
+func newSaveReviewHandler(ctx *gin.Context) *SaveReviewHandler {
+	return &SaveReviewHandler{
+		req:  http_model.NewSaveReviewRequest(),
+		resp: http_model.NewSaveReviewResponse(),
+		ctx:  ctx,
+	}
+}
+
+type SaveReviewHandler struct {
+	req  *http_model.SaveReviewRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *SaveReviewHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *SaveReviewHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *SaveReviewHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *SaveReviewHandler) run() {
+	err := service.Supplier.SaveSupplierReviewInfo(h.ctx, h.req)
+	if err != nil {
+		logrus.Errorf("[GetSupplierAccountInfo] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		// log.Info("GetSupplierAccountInfo fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *SaveReviewHandler) checkParam() error {
+	return nil
+}

+ 58 - 0
handler/update_contact_info.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapUpdateContactInfoHandler(ctx *gin.Context) {
+	handler := newUpdateContactInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newUpdateContactInfoHandler(ctx *gin.Context) *UpdateContactInfoHandler {
+	return &UpdateContactInfoHandler{
+		req:  http_model.NewCreateContactInfoRequest(),
+		resp: http_model.NewCreateContactInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type UpdateContactInfoHandler struct {
+	req  *http_model.CreateContactInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *UpdateContactInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *UpdateContactInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *UpdateContactInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *UpdateContactInfoHandler) run() {
+	data, err := service.Supplier.GetSupplierContactInfo(h.ctx, h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *UpdateContactInfoHandler) checkParam() error {
+	return nil
+}

+ 4 - 5
main.go

@@ -2,7 +2,6 @@ package main
 
 import (
 	"fmt"
-	"log"
 	"youngee_b_api/config"
 	_ "youngee_b_api/docs"
 	"youngee_b_api/route"
@@ -18,9 +17,9 @@ func main() {
 	mailConfig := "./config/mail.json"
 	service.SMTPMailServiceIstance.Init(mailConfig)
 	addr := fmt.Sprintf("%v:%v", config.Host, config.Port)
-	err := service.AutoTask()
-	if err != nil {
-		log.Println("service AutoTask error:", err)
-	}
+	// err := service.AutoTask()
+	// if err != nil {
+	// 	log.Println("service AutoTask error:", err)
+	// }
 	r.Run(addr) // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
 }

+ 2 - 2
model/gorm_model/project_task.go

@@ -47,8 +47,8 @@ type YoungeeTaskInfo struct {
 	DraftFee               float64   `gorm:"column:draft_fee"`                            // 达人稿费
 	SignedTime             time.Time `gorm:"column:signed_time"`                          // 签收时间
 	FansNum                int       `gorm:"column:fans_num"`                             // 粉丝数
-	VoteAvg                int       `gorm:"column:vote_avg"`                             // 平均点赞数
-	CommitAvg              int       `gorm:"column:commit_avg"`                           // 平均评论数
+	VoteAvg                int       `gorm:"column:vote_avg"`                             // 点赞数
+	CommitAvg              int       `gorm:"column:commit_avg"`                           // 评论数
 	BOperator              string    `gorm:"column:b_operator"`                           // 商家确定达人操作人ID
 	BOperatorType          int       `gorm:"column:b_operator_type"`                      // 商家操作人类型,1商家用户,2商家子账号,3管理后台
 	SOperator              int       `gorm:"column:s_operator"`                           // 服务商提报达人操作人ID

+ 2 - 2
model/http_model/company_review.go

@@ -6,8 +6,8 @@ type CompanyReviewRequest struct {
 }
 
 type CompanyReviewData struct {
-	USCI        string `json:"usci"`         // 统一社会信用代码
-	CompanyName string `json:"company_name"` // 公司名称
+	USCI        *string `json:"usci"`         // 统一社会信用代码
+	CompanyName *string `json:"company_name"` // 公司名称
 }
 
 func NewCompanyReviewRequest() *CompanyReviewRequest {

+ 22 - 0
model/http_model/create_contact_info.go

@@ -0,0 +1,22 @@
+package http_model
+
+type CreateContactInfoRequest struct {
+	SupplierId   int `json:"supplier_id"`    // 服务商ID
+	SubAccountId int `json:"sub_account_id"` // 子账号ID
+}
+
+type CreateContactInfoData struct {
+	ContactPhone string `json:"contact_phone"`  // 联系电话
+	WechatNumber string `json:"wechat_number"`  // 微信号
+	WechatQRCode string `json:"wechat_qr_code"` // 微信二维码
+}
+
+func NewCreateContactInfoRequest() *CreateContactInfoRequest {
+	return new(CreateContactInfoRequest)
+}
+
+func NewCreateContactInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(CreateContactInfoData)
+	return resp
+}

+ 3 - 0
model/http_model/full_s_project_income_list.go

@@ -37,6 +37,9 @@ type FullSProjectIncomeListResponse struct {
 	StoreMainPhotoSymbol int64   `json:"store_main_photo_symbol"` // 标志位
 	StoreMainPhotoUid    string  `json:"store_main_photo_uid"`    // uid
 	StoreName            string  `json:"store_name"`              // 门店名称
+	SOperatorId          int     `json:"s_operator_id"`           // 添加商单操作人ID
+	SOperatorType        int     `json:"s_operator_type"`         // 添加商单操作人类型,1服务商,2子账号,3管理后台
+	SOperatorName        string  `json:"s_operator_name"`         // 添加商单操作人名称
 }
 
 func NewFullSProjectIncomeRequest() *FullSProjectIncomeListRequest {

+ 6 - 6
model/http_model/id_card_review.go

@@ -1,15 +1,15 @@
 package http_model
 
 type IdCardReviewRequest struct {
-	IdCardUrl    string `json:"id_card_url"`
-	Side         string `json:"side"`
-	SupplierId   int    `json:"supplier_id"`
-	SubAccountId int    `json:"sub_account_id"`
+	IdCardUrl  string `json:"id_card_url"` // 身份证人像面
+	IdBack     string `json:"id_back"`     // 身份证国徽面
+	Side       string `json:"side"`        // front
+	SupplierId int    `json:"supplier_id"` // 服务商ID
 }
 
 type IdCardReviewData struct {
-	Name     string `json:"name"`      // 姓名
-	IdNumber string `json:"id_number"` // 身份证号
+	Name     *string `json:"name"`      // 姓名
+	IdNumber *string `json:"id_number"` // 身份证号
 }
 
 func NewIdCardReviewRequest() *IdCardReviewRequest {

+ 26 - 0
model/http_model/save_review.go

@@ -0,0 +1,26 @@
+package http_model
+
+type SaveReviewRequest struct {
+	SupplierId         int    `json:"supplier_id"`          // 服务商ID
+	SupplierType       int    `json:"supplier_type"`        // 服务商认证类型,1为个人PR,2为机构
+	USCI               string `json:"usci"`                 // 统一社会信用代码
+	CompanyName        string `json:"company_name"`         // 公司名称
+	BusinessLicenseUrl string `json:"business_license_url"` // 营业执照url
+	IdCardUrl          string `json:"id_card_url"`          // 身份证人像面
+	IdBack             string `json:"id_back"`              // 身份证国徽面
+	Name               string `json:"name"`                 // 姓名
+	IdNumber           string `json:"id_number"`            // 身份证号
+}
+
+type SaveReviewData struct {
+}
+
+func NewSaveReviewRequest() *SaveReviewRequest {
+	return new(SaveReviewRequest)
+}
+
+func NewSaveReviewResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(SaveReviewData)
+	return resp
+}

+ 6 - 4
model/http_model/talent_project_list.go

@@ -1,10 +1,12 @@
 package http_model
 
 type TalentProjectListRequest struct {
-	PageSize       int64  `json:"page_size"`
-	PageNum        int64  `json:"page_num"`
-	PlatformUserId int    `json:"platform_user_id"` // 平台用户ID
-	Nickname       string `json:"nickname"`         // 昵称
+	PageSize       int64    `json:"page_size"`
+	PageNum        int64    `json:"page_num"`
+	PlatformUserId int      `json:"platform_user_id"` // 平台用户ID
+	Nickname       string   `json:"nickname"`         // 昵称
+	OrderBy        []string `json:"order_by"`         // 排序条件 fans_num,vote_avg,commit_avg,collect_avg
+	OrderDesc      []int    `json:"order_desc"`       // 是否降序 1是,2否
 }
 
 type TalentProjectListData struct {

+ 21 - 17
route/init.go

@@ -14,22 +14,26 @@ func InitRoute(r *gin.Engine) {
 	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // nothing
 	a := r.Group("/youngee")
 	{
-		a.POST("/register", handler.WrapRegisterHandler)                   // 服务商主账号注册
-		a.POST("/addNewSubAccount", handler.WrapAddNewSubAccountHandler)   // 服务商子账号注册
-		a.POST("/findAllSubAccount", handler.WrapFindAllSubAccountHandler) // 查找全部所属子账号
-		a.POST("/deleteSubAccount", handler.WrapDeleteSubAccountHandler)   // 删除子账号
-		a.POST("/findAllJob", handler.WrapFindAllJobHandler)               // 查找服务商全部所属岗位
-		a.POST("/addNewJob", handler.WrapaddNewJobHandler)                 // 服务商新增岗位
-		a.POST("/updateJob", handler.WrapupdateJobHandler)                 // 服务商修改岗位
-		a.POST("/deleteJob", handler.WrapdeleteJobHandler)                 // 服务商删除岗位
-		a.POST("/sendCode", handler.WrapSendCodeHandler)                   // 发送登录验证码
-		a.POST("/login", handler.WrapCodeLoginHandler)                     // 服务商登录
-		a.POST("/getUserInfo", handler.WrapGetUserInfoHandler)             // 服务商用户信息
-		a.POST("/getAccountInfo", handler.WrapGetAccountInfoHandler)       // 账号管理-账号信息查询
-		a.POST("/getReviewInfo", handler.WrapGetReviewInfoHandler)         // 账号管理-认证信息查询
-		a.POST("/getContactInfo", handler.WrapGetContactInfoHandler)       // 账号管理-联系方式查询
-		a.POST("/company/review", handler.WrapCompanyReviewHandler)        // 营业执照审核
-		a.POST("/idCard/review", handler.WrapIdCardReviewHandler)          // 身份证认证
+		a.POST("/register", handler.WrapRegisterHandler)                    // 服务商主账号注册
+		a.POST("/addNewSubAccount", handler.WrapAddNewSubAccountHandler)    // 服务商子账号注册
+		a.POST("/findAllSubAccount", handler.WrapFindAllSubAccountHandler)  // 查找全部所属子账号
+		a.POST("/deleteSubAccount", handler.WrapDeleteSubAccountHandler)    // 删除子账号
+		a.POST("/findAllJob", handler.WrapFindAllJobHandler)                // 查找服务商全部所属岗位
+		a.POST("/addNewJob", handler.WrapaddNewJobHandler)                  // 服务商新增岗位
+		a.POST("/updateJob", handler.WrapupdateJobHandler)                  // 服务商修改岗位
+		a.POST("/deleteJob", handler.WrapdeleteJobHandler)                  // 服务商删除岗位
+		a.POST("/sendCode", handler.WrapSendCodeHandler)                    // 发送登录验证码
+		a.POST("/login", handler.WrapCodeLoginHandler)                      // 服务商登录
+		a.POST("/getUserInfo", handler.WrapGetUserInfoHandler)              // 服务商用户信息
+		a.POST("/getAccountInfo", handler.WrapGetAccountInfoHandler)        // 账号管理-账号信息查询
+		a.POST("/reviewInfo/get", handler.WrapGetReviewInfoHandler)         // 账号管理-认证信息查询
+		a.POST("/reviewInfo/create", handler.WrapSaveReviewHandler)         // 账号管理-认证信息创建
+		a.POST("/contactInfo/get", handler.WrapGetContactInfoHandler)       // 联系方式-查询
+		a.POST("/contactInfo/create", handler.WrapCreateContactInfoHandler) // 联系方式-创建
+		a.POST("/contactInfo/update", handler.WrapUpdateContactInfoHandler) // 联系方式-更新
+		a.POST("/company/review", handler.WrapCompanyReviewHandler)         // 营业执照认证
+		a.POST("/idCard/review", handler.WrapIdCardReviewHandler)           // 身份证认证
+
 		a.GET("/test/ping", func(c *gin.Context) {
 			resp := http_model.CommonResponse{
 				Status:  0,
@@ -194,7 +198,7 @@ func InitRoute(r *gin.Engine) {
 
 		c.POST("/cooperate/talentList", handler.WrapTalentListHandler)                   // 达人库达人列表
 		c.POST("/cooperate/talentData", handler.WrapTalentDataHandler)                   // 达人库核心数据、达人信息查询
-		c.POST("/cooperate/talentCooperateData", handler.WrapTalentCooperateDataHandler) // 达人库合作数据 - 活跃数据查询
+		c.POST("/cooperate/talentCooperateData", handler.WrapTalentCooperateDataHandler) // 达人库合作数据-活跃数据查询
 		c.POST("/cooperate/projectList", handler.WrapTalentProjectListHandler)           // 达人种草表现
 		c.POST("/cooperate/localList", handler.WrapTalentLocalListHandler)               // 达人本地生活表现
 	}

+ 10 - 9
service/company_review.go

@@ -1,12 +1,13 @@
 package service
 
 import (
-	"fmt"
 	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/model"
 	"youngee_b_api/model/http_model"
 )
 
-func (c *Config) CheckBusinessLicense(param *http_model.CompanyReviewRequest) error {
+func (c *Config) CheckBusinessLicense(param *http_model.CompanyReviewRequest) (*http_model.CompanyReviewData, error) {
+	var companyInfo *http_model.CompanyReviewData
+	companyInfo = &http_model.CompanyReviewData{}
 	request := &model.RecognizeBusinessLicenseRequest{}
 	request.Body = &model.BusinessLicenseRequestBody{
 		Url: &param.BusinessLicenseUrl,
@@ -17,12 +18,12 @@ func (c *Config) CheckBusinessLicense(param *http_model.CompanyReviewRequest) er
 		//if err.StatusCode == 400 {
 		//	return "false", err
 		//}
-		return err
+		return nil, err
 	}
-	result := response.Result
-
-	// 2. 识别结果入库并修改认证状态
-	fmt.Println(result)
-
-	return nil
+	if response.Result != nil {
+		result := response.Result
+		companyInfo.CompanyName = result.Name
+		companyInfo.USCI = result.RegistrationNumber
+	}
+	return companyInfo, nil
 }

+ 10 - 7
service/id_card_review.go

@@ -1,12 +1,13 @@
 package service
 
 import (
-	"fmt"
 	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/model"
 	"youngee_b_api/model/http_model"
 )
 
-func (c *Config) CheckIdCard(param *http_model.IdCardReviewRequest) error {
+func (c *Config) CheckIdCard(param *http_model.IdCardReviewRequest) (*http_model.IdCardReviewData, error) {
+	var IdCardInfo *http_model.IdCardReviewData
+	IdCardInfo = &http_model.IdCardReviewData{}
 	request := &model.RecognizeIdCardRequest{}
 	request.Body = &model.IdCardRequestBody{
 		Url:  &param.IdCardUrl,
@@ -17,10 +18,12 @@ func (c *Config) CheckIdCard(param *http_model.IdCardReviewRequest) error {
 		//if err.StatusCode == 400 {
 		//	return "false", err
 		//}
-		return err
+		return nil, err
 	}
-	result := response.Result
-	fmt.Println(result)
-
-	return nil
+	if response.Result != nil {
+		result := response.Result
+		IdCardInfo.Name = result.Name
+		IdCardInfo.IdNumber = result.Number
+	}
+	return IdCardInfo, nil
 }

+ 3 - 2
service/qrcode.go

@@ -37,7 +37,8 @@ func QrCodeInit(config *system_model.Session) {
 // getAndCacheWxAccessToken 获取并缓存微信的access token
 func getAndCacheWxAccessToken(ctx context.Context) (string, error) {
 	appId := "wxac396a3be7a16844"
-	secret := "c82ae9e75b4ed7d8022db5bda5371892"
+	//secret := "c82ae9e75b4ed7d8022db5bda5371892"
+	secret := "abbf27d46c46212c86e60f2ed3c534ee"
 	url := fmt.Sprintf(accessTokenUrlFormat, appId, secret)
 
 	resp, err := http.Get(url)
@@ -84,7 +85,7 @@ func (q *qrcode) GetWxQrCode(ctx context.Context, Scene string, Page string) (*h
 	qrRequest := http_model.WxQrCodeRequest{
 		Scene:      Scene,
 		Page:       Page,
-		Width:      430,
+		Width:      150,
 		CheckPath:  false,
 		EnvVersion: "release",
 	}

+ 22 - 0
service/s_t_cooperate.go

@@ -203,6 +203,28 @@ func (*stcooperate) CountTalentTaskNum(ctx context.Context, request *http_model.
 // GetTalentProjectList 达人种草表现
 func (*stcooperate) GetTalentProjectList(ctx context.Context, request *http_model.TalentProjectListRequest) (*http_model.TalentProjectListData, error) {
 
+	// 1. 查询openId
+	platformUserInfo, platformUserErr := db.FindUserInfoById(ctx, request.PlatformUserId)
+	if platformUserErr != nil {
+		return nil, platformUserErr
+	}
+	if platformUserInfo != nil {
+		// 2. 查询种草子任务信息
+		var projectTasks *http_model.TalentProjectListData
+		projectTasks = &http_model.TalentProjectListData{}
+		projectTaskInfo, projectTaskInfoErr := db.GetTaskListByOpenId(ctx, platformUserInfo.OpenId, request.Nickname, request.OrderBy, request.OrderDesc, request.PageNum, request.PageSize)
+		if projectTaskInfoErr != nil {
+			return nil, projectTaskInfoErr
+		}
+		if projectTaskInfo != nil {
+			for _, task := range projectTaskInfo {
+				var projectTask *http_model.TalentProjectData
+				projectTask = &http_model.TalentProjectData{}
+
+			}
+
+		}
+	}
 	return nil, nil
 }
 

+ 63 - 0
service/supplier.go

@@ -166,6 +166,41 @@ func (*supplier) GetSupplierContactInfo(ctx context.Context, req *http_model.Get
 	return contactInfo, nil
 }
 
+// SaveSupplierReviewInfo 保存服务商联系方式
+func (*supplier) SaveSupplierReviewInfo(ctx context.Context, req *http_model.SaveReviewRequest) error {
+	var supplierInfo *gorm_model.YoungeeSupplier
+	supplierInfo = &gorm_model.YoungeeSupplier{}
+	// 1. 个人服务商
+	if req.SupplierType == 1 {
+		supplierInfo.SupplierId = req.SupplierId
+		supplierInfo.IdFront = req.IdCardUrl
+		supplierInfo.IdNumber = req.IdNumber
+		supplierInfo.Name = req.Name
+		supplierInfo.IdBack = req.IdBack
+		supplierInfo.SupplierType = req.SupplierType
+		supplierInfo.ReviewStatus = 2
+		updateErr := db.UpdateSupplier(ctx, supplierInfo)
+		if updateErr != nil {
+			log.Infof("[UpdateSupplierReviewInfo] fail,err:%+v", updateErr)
+			return updateErr
+		}
+	} else if req.SupplierType == 2 {
+		// 2. 企业服务商
+		supplierInfo.SupplierId = req.SupplierId
+		supplierInfo.ReviewStatus = 2
+		supplierInfo.SupplierType = req.SupplierType
+		supplierInfo.CompanyName = req.CompanyName
+		supplierInfo.Usci = req.USCI
+		supplierInfo.BusinessLicense = req.BusinessLicenseUrl
+		updateErr := db.UpdateSupplier(ctx, supplierInfo)
+		if updateErr != nil {
+			log.Infof("[UpdateSupplierReviewInfo] fail,err:%+v", updateErr)
+			return updateErr
+		}
+	}
+	return nil
+}
+
 // GetSupplierIncomeList 查询服务商收入列表
 func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.FullSProjectIncomeListRequest) (*http_model.FullSProjectIncomeData, error) {
 	var sProjectIncomeData *http_model.FullSProjectIncomeData
@@ -228,6 +263,33 @@ func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.Full
 							}
 						}
 					}
+					// 2.4. 加入商单操作人信息
+					if sProjectData.SubAccountId == 0 {
+						sProjectInfo.SOperatorType = 1
+						sProjectInfo.SOperatorId = sProjectData.SupplierId
+						supplierInfo, supplierInfoErr := db.GetSupplierById(ctx, sProjectData.SupplierId)
+						if supplierInfoErr != nil {
+							log.Infof("[GetSupplierById] fail,err:%+v", supplierInfoErr)
+							return nil, supplierInfoErr
+						}
+						if supplierInfo != nil {
+							sProjectInfo.SOperatorName = supplierInfo.Name
+						}
+						sProjectInfo.SOperatorName = conv.MustString(sProjectData.SupplierId)
+					} else {
+						sProjectInfo.SOperatorType = 2
+						sProjectInfo.SOperatorId = sProjectData.SubAccountId
+						subAccountInfo, subAccountInfoErr := db.FindSubAccountById(ctx, sProjectData.SubAccountId)
+						if subAccountInfoErr != nil {
+							log.Infof("[FindSubAccountById] fail,err:%+v", subAccountInfoErr)
+							return nil, subAccountInfoErr
+						}
+						if subAccountInfo != nil {
+							sProjectInfo.SOperatorName = subAccountInfo.SubAccountName
+						}
+					}
+
+					sProjectIncomeData.SupplierIncome = append(sProjectIncomeData.SupplierIncome, sProjectInfo)
 				}
 			}
 
@@ -277,6 +339,7 @@ func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.Full
 							}
 						}
 					}
+					sProjectIncomeData.SupplierIncome = append(sProjectIncomeData.SupplierIncome, sLocalInfo)
 				}
 			}
 		}