|
@@ -10,7 +10,7 @@ import (
|
|
type BillService struct{}
|
|
type BillService struct{}
|
|
|
|
|
|
// 电商带货账单支付
|
|
// 电商带货账单支付
|
|
-func (p BillService) PaySelection(param *vo.PayParam) error {
|
|
|
|
|
|
+func (s BillService) PaySelection(param *vo.PayParam) error {
|
|
selectionId := param.ObjectId
|
|
selectionId := param.ObjectId
|
|
selectionInfo, err1 := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
|
|
selectionInfo, err1 := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
|
|
if err1 != nil {
|
|
if err1 != nil {
|
|
@@ -33,7 +33,7 @@ func (p BillService) PaySelection(param *vo.PayParam) error {
|
|
}
|
|
}
|
|
|
|
|
|
// 品牌种草账单支付
|
|
// 品牌种草账单支付
|
|
-func (p BillService) PayProject(param *vo.PayParam) error {
|
|
|
|
|
|
+func (s BillService) PayProject(param *vo.PayParam) error {
|
|
projectId := param.ObjectId
|
|
projectId := param.ObjectId
|
|
projectInfo, err1 := dao.ProjectDAO{}.GetProjectById(projectId)
|
|
projectInfo, err1 := dao.ProjectDAO{}.GetProjectById(projectId)
|
|
if err1 != nil {
|
|
if err1 != nil {
|
|
@@ -56,7 +56,7 @@ func (p BillService) PayProject(param *vo.PayParam) error {
|
|
}
|
|
}
|
|
|
|
|
|
// 本地生活账单支付
|
|
// 本地生活账单支付
|
|
-func (p BillService) PayLocalLife(param *vo.PayParam) error {
|
|
|
|
|
|
+func (s BillService) PayLocalLife(param *vo.PayParam) error {
|
|
localId := param.ObjectId
|
|
localId := param.ObjectId
|
|
localInfo, err1 := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
localInfo, err1 := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
if err1 != nil {
|
|
if err1 != nil {
|
|
@@ -77,3 +77,156 @@ func (p BillService) PayLocalLife(param *vo.PayParam) error {
|
|
|
|
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 电商带货账单列表
|
|
|
|
+func (s BillService) GetBillSelectionTaskList(param *vo.SelectionSearchParam) (vo.ResultVO, error) {
|
|
|
|
+ if param.Page == 0 {
|
|
|
|
+ param.Page = 1
|
|
|
|
+ }
|
|
|
|
+ if param.PageSize == 0 {
|
|
|
|
+ param.PageSize = 10
|
|
|
|
+ }
|
|
|
|
+ var result vo.ResultVO
|
|
|
|
+ reBillSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetBillSelectionPreviews(param)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return result, err
|
|
|
|
+ }
|
|
|
|
+ for i := range reBillSelectionTaskPreviews {
|
|
|
|
+ var creatorName string
|
|
|
|
+ var productName string
|
|
|
|
+ var productPrice float64
|
|
|
|
+ var mainImage string
|
|
|
|
+ var reward float64
|
|
|
|
+ if reBillSelectionTaskPreviews[i].SubAccountId == 0 {
|
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillSelectionTaskPreviews[i].EnterpriseId)
|
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillSelectionTaskPreviews[i].SubAccountId)
|
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
|
+ creatorName = subAccount.SubAccountName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ product, err := dao.ProductDAO{}.GetProductByID(reBillSelectionTaskPreviews[i].ProductId)
|
|
|
|
+ if err == nil && product != nil {
|
|
|
|
+ productName = product.ProductName
|
|
|
|
+ productPrice = product.ProductPrice
|
|
|
|
+ }
|
|
|
|
+ mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reBillSelectionTaskPreviews[i].ProductId)
|
|
|
|
+ rewardStrategys, err := dao.RewardStrategyDao{}.GetRewardStrategyBySelectionId(reBillSelectionTaskPreviews[i].SelectionId)
|
|
|
|
+ for _, rewardStrategy := range rewardStrategys {
|
|
|
|
+ reward += rewardStrategy.Reward
|
|
|
|
+ }
|
|
|
|
+ reBillSelectionTaskPreviews[i].CreatorName = creatorName
|
|
|
|
+ reBillSelectionTaskPreviews[i].ProductName = productName
|
|
|
|
+ reBillSelectionTaskPreviews[i].ProductPrice = productPrice
|
|
|
|
+ reBillSelectionTaskPreviews[i].MainImage = mainImage
|
|
|
|
+ reBillSelectionTaskPreviews[i].Reward = reward
|
|
|
|
+ }
|
|
|
|
+ result = vo.ResultVO{
|
|
|
|
+ Page: param.Page,
|
|
|
|
+ PageSize: param.PageSize,
|
|
|
|
+ Total: total,
|
|
|
|
+ Data: reBillSelectionTaskPreviews,
|
|
|
|
+ }
|
|
|
|
+ return result, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 品牌种草账单列表
|
|
|
|
+func (s BillService) GetBillProjectTaskList(param *vo.ProjectSearchParam) (vo.ResultVO, error) {
|
|
|
|
+ if param.Page == 0 {
|
|
|
|
+ param.Page = 1
|
|
|
|
+ }
|
|
|
|
+ if param.PageSize == 0 {
|
|
|
|
+ param.PageSize = 10
|
|
|
|
+ }
|
|
|
|
+ var result vo.ResultVO
|
|
|
|
+ reBillProjectTaskPreviews, total, err := (&dao.ProjectDAO{}).GetBillProjectPreviews(param)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return result, err
|
|
|
|
+ }
|
|
|
|
+ for i := range reBillProjectTaskPreviews {
|
|
|
|
+ var creatorName string
|
|
|
|
+ var productName string
|
|
|
|
+ var productPrice float64
|
|
|
|
+ var mainImage string
|
|
|
|
+ if reBillProjectTaskPreviews[i].SubAccountId == 0 {
|
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillProjectTaskPreviews[i].EnterpriseId)
|
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillProjectTaskPreviews[i].SubAccountId)
|
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
|
+ creatorName = subAccount.SubAccountName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ product, err := dao.ProductDAO{}.GetProductByID(reBillProjectTaskPreviews[i].ProductId)
|
|
|
|
+ if err == nil && product != nil {
|
|
|
|
+ productName = product.ProductName
|
|
|
|
+ productPrice = product.ProductPrice
|
|
|
|
+ }
|
|
|
|
+ mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reBillProjectTaskPreviews[i].ProductId)
|
|
|
|
+ reBillProjectTaskPreviews[i].CreatorName = creatorName
|
|
|
|
+ reBillProjectTaskPreviews[i].ProductName = productName
|
|
|
|
+ reBillProjectTaskPreviews[i].ProductPrice = productPrice
|
|
|
|
+ reBillProjectTaskPreviews[i].MainImage = mainImage
|
|
|
|
+ }
|
|
|
|
+ result = vo.ResultVO{
|
|
|
|
+ Page: param.Page,
|
|
|
|
+ PageSize: param.PageSize,
|
|
|
|
+ Total: total,
|
|
|
|
+ Data: reBillProjectTaskPreviews,
|
|
|
|
+ }
|
|
|
|
+ return result, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 本地生活账单列表
|
|
|
|
+func (s BillService) GetBillLocalLifeTaskList(param *vo.LocalSearchParam) (vo.ResultVO, error) {
|
|
|
|
+ if param.Page == 0 {
|
|
|
|
+ param.Page = 1
|
|
|
|
+ }
|
|
|
|
+ if param.PageSize == 0 {
|
|
|
|
+ param.PageSize = 10
|
|
|
|
+ }
|
|
|
|
+ var result vo.ResultVO
|
|
|
|
+ reBillLocalTaskPreviews, total, err := (&dao.LocalLifeDao{}).GetBillLocalPreviews(param)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return result, err
|
|
|
|
+ }
|
|
|
|
+ for i := range reBillLocalTaskPreviews {
|
|
|
|
+ var creatorName string
|
|
|
|
+ var storeName string
|
|
|
|
+ var storeLocation string
|
|
|
|
+ var mainImage string
|
|
|
|
+ if reBillLocalTaskPreviews[i].SubAccountId == 0 {
|
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillLocalTaskPreviews[i].EnterpriseId)
|
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillLocalTaskPreviews[i].SubAccountId)
|
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
|
+ creatorName = subAccount.SubAccountName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ store, err := dao.StoreDao{}.GetStoreByID(reBillLocalTaskPreviews[i].StoreId)
|
|
|
|
+ if err == nil && store != nil {
|
|
|
|
+ storeName = store.StoreName
|
|
|
|
+ storeLocation = store.StoreLocation
|
|
|
|
+ }
|
|
|
|
+ mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(reBillLocalTaskPreviews[i].StoreId)
|
|
|
|
+ reBillLocalTaskPreviews[i].CreatorName = creatorName
|
|
|
|
+ reBillLocalTaskPreviews[i].StoreName = storeName
|
|
|
|
+ reBillLocalTaskPreviews[i].StoreLocation = storeLocation
|
|
|
|
+ reBillLocalTaskPreviews[i].MainImage = mainImage
|
|
|
|
+ }
|
|
|
|
+ result = vo.ResultVO{
|
|
|
|
+ Page: param.Page,
|
|
|
|
+ PageSize: param.PageSize,
|
|
|
|
+ Total: total,
|
|
|
|
+ Data: reBillLocalTaskPreviews,
|
|
|
|
+ }
|
|
|
|
+ return result, nil
|
|
|
|
+}
|