作者 陈志颖

fix:修改活动截止日期格式

... ... @@ -14,7 +14,6 @@ func main() {
for {
now := time.Now()
next := now.Add(time.Hour * 24)
//next := now.Add(time.Minute * 5)
nextZero := time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())
dispatchTicker := time.NewTimer(nextZero.Sub(now))
<-dispatchTicker.C
... ...
... ... @@ -489,9 +489,25 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var activitiesWithTs []interface{}
for _, activity := range activities {
activityWithTs := map[string]interface{} {
"activityId": activity.ActivityId,
"exchangeActivityName": activity.ExchangeActivityName,
"companyId": activity.CompanyId,
"exchangedCash": activity.ExchangedCash,
"exchangedSuMoney": activity.ExchangedSuMoney,
"deadline": activity.Deadline.Unix(),
"countDown": activity.CountDown,
"rate": activity.Rate,
"createTime": "2020-11-13T09:32:45.259856Z",
}
activitiesWithTs = append(activitiesWithTs, activityWithTs)
}
return map[string]interface{}{
"count": count,
"activities": activities,
"activities": activitiesWithTs,
}, nil
}
}
... ... @@ -1652,6 +1668,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashPersonById(exportExchang
exchangeCashPersonListRepository = value
}
if len(exportExchangeCashListCommand.IDs) == 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
}
if _, people, err := exchangeCashPersonListRepository.FindById(tool_funs.SimpleStructToMap(exportExchangeCashListCommand)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ...
... ... @@ -238,6 +238,10 @@ func (suMoneyService *SuMoneyService) ListSuMoneyTransactionRecordById(exportSuM
transactionContext.RollbackTransaction()
}()
if len(exportSuMoneyTransactionRecordCommand.IDs) == 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
}
var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
if value, err := factory.CreateSuMoneyTransactionRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ...
... ... @@ -77,7 +77,7 @@ func (dao *CashPoolDao) CalculateActivityExchangedSuMoney(activityId int64) (map
}, nil
}
// 返回兑换清单榜单
// 返回兑换活动清单榜单
func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interface{}) (map[string]interface{}, error) {
var retPeople []struct {
Uid int
... ...
... ... @@ -349,14 +349,14 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
}
tx := dao.transactionContext.PgTx
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
// 财富值榜单
queryWealth := tx.Model(suMoneyTransactionRecordModel)
queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
//queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
queryWealth = queryWealth.Where(`e.status = ?`, 1)
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
... ... @@ -368,8 +368,12 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if endTime, ok := queryOptions["endTime"]; ok {
queryWealth = queryWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
}
queryWealth = queryWealth.Group("su_money_transaction_record.employee")
queryWealth = queryWealth.Group("su_money_transaction_record.create_time")
//queryWealth = queryWealth.Group("su_money_transaction_record.employee")
//queryWealth = queryWealth.Group("su_money_transaction_record.employee #>> '{uid}'")
queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
//queryWealth = queryWealth.Group("su_money_transaction_record.create_time")
//queryWealth = queryWealth.Group(`su_money_transaction_record->'employee'->>'employeeName'`)
if offset, ok := queryOptions["offset"]; ok {
offset := offset.(int)
if offset > -1 {
... ... @@ -396,7 +400,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
queryEmployeeWealth = queryEmployeeWealth.Where(`e.status = ?`, 1)
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
... ... @@ -408,8 +412,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if endTime, ok := queryOptions["endTime"]; ok {
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
}
queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee")
queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.create_time")
//queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee")
//queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee #>> '{uid}' ")
//queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.create_time")
queryEmployeeWealth = queryEmployeeWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
if uid, ok := queryOptions["uid"]; ok {
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
}
... ... @@ -423,13 +429,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
retCurrentEmployeeWealth = retEmployeeWealth[0]
}
// 贡献值榜单
// 贡献值榜单-减少的贡献致富
queryContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
queryContributionsDecrease = queryContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId)
}
... ... @@ -441,8 +447,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if endTime, ok := queryOptions["endTime"]; ok {
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
}
contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee").Group("su_money_transaction_record.create_time")
//contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee").Group("su_money_transaction_record.create_time")
//contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee #>> '{uid}'").Group("su_money_transaction_record.create_time")
contributionsDecrease := queryContributionsDecrease.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
// 贡献值排行榜
queryContributions := tx.Model()
queryContributions = queryContributions.With("t", contributionsDecrease)
queryContributions = queryContributions.Table("t")
... ... @@ -451,7 +460,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
queryContributions = queryContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC,su_money_transaction_records.create_time) AS ranking")
queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
}
... ... @@ -463,9 +472,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if endTime, ok := queryOptions["endTime"]; ok {
queryContributions = queryContributions.Where(`su_money_transaction_records.create_time < ?`, endTime)
}
queryContributions = queryContributions.Group("su_money_transaction_records.employee")
queryContributions = queryContributions.Group("t.employee_contributions_decrease")
queryContributions = queryContributions.Group("su_money_transaction_records.create_time")
//queryContributions = queryContributions.Group("su_money_transaction_records.employee")
//queryContributions = queryContributions.Group("su_money_transaction_records.employee #>> '{uid}'")
//queryContributions = queryContributions.Group("t.employee_contributions_decrease")
//queryContributions = queryContributions.Group("su_money_transaction_records.create_time")
queryContributions = queryContributions.GroupExpr("su_money_transaction_records.employee->>'uid',su_money_transaction_records.employee->>'employeeName',t.employee_contributions_decrease")
if offset, ok := queryOptions["offset"]; ok {
offset := offset.(int)
if offset > -1 {
... ... @@ -486,13 +497,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
return nil, err
}
// 当前员工贡献值排名
// 当前员工贡献值-减少的贡献值排名
queryEmployeeContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where("e.company_id = ?", companyId)
}
... ... @@ -504,8 +515,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if endTime, ok := queryOptions["endTime"]; ok {
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
}
employeeContributionsDecrease := queryEmployeeContributionsDecrease.Group("su_money_transaction_record.employee")
//employeeContributionsDecrease := queryEmployeeContributionsDecrease.Group("su_money_transaction_record.employee")
employeeContributionsDecrease := queryEmployeeContributionsDecrease.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
// 当前员工贡献值排名
queryEmployeeContributions := tx.Model()
queryEmployeeContributions = queryEmployeeContributions.With("t", employeeContributionsDecrease)
queryEmployeeContributions = queryEmployeeContributions.Table("t")
... ... @@ -514,7 +527,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryEmployeeContributions = queryContributions.Where("e.company_id = ?", companyId)
}
... ... @@ -529,8 +542,9 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
if uid, ok := queryOptions["uid"]; ok {
queryEmployeeContributions = queryEmployeeContributions.Where(`su_money_transaction_records.employee @> '{"uid":?}'`, uid)
}
queryEmployeeContributions = queryEmployeeContributions.Group("su_money_transaction_records.employee")
queryEmployeeContributions = queryEmployeeContributions.Group("t.employee_contributions_decrease")
//queryEmployeeContributions = queryEmployeeContributions.Group("su_money_transaction_records.employee")
queryEmployeeContributions = queryEmployeeContributions.GroupExpr("su_money_transaction_records.employee->>'uid',su_money_transaction_records.employee->>'employeeName',t.employee_contributions_decrease")
//queryEmployeeContributions = queryEmployeeContributions.Group("t.employee_contributions_decrease")
if err := queryEmployeeContributions.Order("employees_contributions DESC").Select(&retEmployeeContributions); err != nil {
return nil, err
}
... ...
... ... @@ -18,6 +18,7 @@ type SuMoneyController struct {
beego.Controller
}
// 操作素币
func (controller *SuMoneyController) OperationSuMoney() {
suMoneyService := service.NewSuMoneyService(nil)
operationSuMoneyCommand := &command.OperationSuMoneyCommand{}
... ... @@ -33,6 +34,7 @@ func (controller *SuMoneyController) OperationSuMoney() {
controller.ServeJSON()
}
// 获取素币事务记录
func (controller *SuMoneyController) GetSuMoneyTransactionRecord() {
suMoneyService := service.NewSuMoneyService(nil)
getSuMoneyTransactionRecordQuery := &query.GetSuMoneyTransactionRecordQuery{}
... ... @@ -49,6 +51,7 @@ func (controller *SuMoneyController) GetSuMoneyTransactionRecord() {
controller.ServeJSON()
}
// 兑换素币
func (controller *SuMoneyController) ExchangeSuMoney() {
suMoneyService := service.NewSuMoneyService(nil)
exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{}
... ... @@ -64,6 +67,7 @@ func (controller *SuMoneyController) ExchangeSuMoney() {
controller.ServeJSON()
}
// 搜索素币事务
func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
suMoneyService := service.NewSuMoneyService(nil)
searchSuMoneyTransactionRecordCommand := &command.SearchSuMoneyTransactionRecordCommand{}
... ... @@ -150,12 +154,12 @@ func (controller *SuMoneyController) GetCashPool() {
controller.ServeJSON()
}
// 搜索返回兑换活动列表
func (controller *SuMoneyController) SearchExchangeActivities () {
// 新增兑换活动
func (controller *SuMoneyController) CreateExchangeActivities () {
cashPoolService := service.NewCashPoolService(nil)
searchExchangeCashActivityCommand := &command.SearchExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchExchangeCashActivityCommand)
data, err := cashPoolService.SearchExchangeCashActivity(searchExchangeCashActivityCommand)
createExchangeCashActivityCommand := &command.CreateExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), createExchangeCashActivityCommand)
data, err := cashPoolService.CreateExchangeCashActivity(createExchangeCashActivityCommand)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -189,14 +193,12 @@ func (controller *SuMoneyController) ListExchangeActivities () {
controller.ServeJSON()
}
// 更新兑换活动信息
func (controller *SuMoneyController) UpdateExchangeActivities () {
// 搜索返回兑换活动列表
func (controller *SuMoneyController) SearchExchangeActivities () {
cashPoolService := service.NewCashPoolService(nil)
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), updateExchangeCashActivityCommand)
activityId, _ := controller.GetInt64(":activityId")
updateExchangeCashActivityCommand.ExchangeCashActivityId = activityId
data, err := cashPoolService.UpdateExchangeCashActivity(updateExchangeCashActivityCommand)
searchExchangeCashActivityCommand := &command.SearchExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchExchangeCashActivityCommand)
data, err := cashPoolService.SearchExchangeCashActivity(searchExchangeCashActivityCommand)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -207,12 +209,13 @@ func (controller *SuMoneyController) UpdateExchangeActivities () {
controller.ServeJSON()
}
// 新增兑换活动
func (controller *SuMoneyController) CreateExchangeActivities () {
// 返回兑换现金活动
func (controller *SuMoneyController) GetExchangeCashActivity () {
cashPoolService := service.NewCashPoolService(nil)
createExchangeCashActivityCommand := &command.CreateExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), createExchangeCashActivityCommand)
data, err := cashPoolService.CreateExchangeCashActivity(createExchangeCashActivityCommand)
getExchangeCashActivityQuery := &query.GetExchangeCashActivityQuery{}
activityId, _ := controller.GetInt64(":activityId")
getExchangeCashActivityQuery.ExchangeCashActivityId = activityId
data, err := cashPoolService.GetExchangeCashActivity(getExchangeCashActivityQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -223,14 +226,14 @@ func (controller *SuMoneyController) CreateExchangeActivities () {
controller.ServeJSON()
}
// 移除兑换活动
func (controller *SuMoneyController) RemoveExchangeActivities () {
// 更新兑换活动信息
func (controller *SuMoneyController) UpdateExchangeActivities () {
cashPoolService := service.NewCashPoolService(nil)
removeExchangeCashActivityCommand := &command.RemoveExchangeCashActivityCommand{}
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), updateExchangeCashActivityCommand)
activityId, _ := controller.GetInt64(":activityId")
beego.Info(activityId)
removeExchangeCashActivityCommand.ActivityId = activityId
data, err := cashPoolService.RemoveExchangeCashActivity(removeExchangeCashActivityCommand)
updateExchangeCashActivityCommand.ExchangeCashActivityId = activityId
data, err := cashPoolService.UpdateExchangeCashActivity(updateExchangeCashActivityCommand)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -241,13 +244,14 @@ func (controller *SuMoneyController) RemoveExchangeActivities () {
controller.ServeJSON()
}
// 返回兑换现金活动
func (controller *SuMoneyController) GetExchangeCashActivity () {
// 移除兑换活动
func (controller *SuMoneyController) RemoveExchangeActivities () {
cashPoolService := service.NewCashPoolService(nil)
getExchangeCashActivityQuery := &query.GetExchangeCashActivityQuery{}
removeExchangeCashActivityCommand := &command.RemoveExchangeCashActivityCommand{}
activityId, _ := controller.GetInt64(":activityId")
getExchangeCashActivityQuery.ExchangeCashActivityId = activityId
data, err := cashPoolService.GetExchangeCashActivity(getExchangeCashActivityQuery)
beego.Info(activityId)
removeExchangeCashActivityCommand.ActivityId = activityId
data, err := cashPoolService.RemoveExchangeCashActivity(removeExchangeCashActivityCommand)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -353,6 +357,39 @@ func (controller *SuMoneyController) GetExchangeCashPerson () {
controller.ServeJSON()
}
// 返回兑换活动截止时间列表
func (controller *SuMoneyController) ListDeadline() {
cashPoolService := service.NewCashPoolService(nil)
listExchangeCashActivityDeadlineQuery := &query.ListExchangeCashActivityDeadlineQuery{}
companyId, _ := controller.GetInt64("companyId")
listExchangeCashActivityDeadlineQuery.CompanyId = companyId
data, err := cashPoolService.ListExchangeCashActivityDeadline(listExchangeCashActivityDeadlineQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
// 返回兑换素币清单排行榜
func (controller *SuMoneyController) ExchangeCashListRanking() {
cashPoolService := service.NewCashPoolService(nil)
exchangeListRankingQuery := &query.ExchangeListRankingQuery{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)
data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
// 导入兑换素币清单
func (controller *SuMoneyController) ImportExchangeList () {
cashPoolService := service.NewCashPoolService(nil)
... ... @@ -412,40 +449,6 @@ func (controller *SuMoneyController) ImportExchangeList () {
controller.ServeJSON()
}
// 返回兑换活动截止时间列表
func (controller *SuMoneyController) ListDeadline() {
cashPoolService := service.NewCashPoolService(nil)
listExchangeCashActivityDeadlineQuery := &query.ListExchangeCashActivityDeadlineQuery{}
companyId, _ := controller.GetInt64("companyId")
listExchangeCashActivityDeadlineQuery.CompanyId = companyId
data, err := cashPoolService.ListExchangeCashActivityDeadline(listExchangeCashActivityDeadlineQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
// 返回兑换素币清单排行榜
func (controller *SuMoneyController) ExchangeCashListRanking() {
cashPoolService := service.NewCashPoolService(nil)
exchangeListRankingQuery := &query.ExchangeListRankingQuery{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)
data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
// 导出素币兑换清单,选择导出(ids),增加导出失败信息
func (controller *SuMoneyController) ExportExchangeList() {
cashPoolService := service.NewCashPoolService(nil)
... ...