...
|
...
|
@@ -394,26 +394,28 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { |
|
|
// 导入兑换素币清单
|
|
|
func (controller *SuMoneyController) ImportExchangeList () {
|
|
|
cashPoolService := service.NewCashPoolService(nil)
|
|
|
//importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}
|
|
|
//json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)
|
|
|
//fmt.Printf("命令:%+v\n", importExchangeCashListCommand.Where)
|
|
|
//fmt.Print(controller.GetString("where"), "\n")
|
|
|
where := controller.GetString("where")
|
|
|
//typeOf := reflect.TypeOf(where)
|
|
|
//if reflect.TypeOf(where) == Type.String() {
|
|
|
// jsonMap := make(map[string]interface{})
|
|
|
// _ := json.Unmarshal([]byte(where), &jsonMap)
|
|
|
// fmt.Printf("%+v\n", jsonMap)
|
|
|
//}
|
|
|
//fmt.Print(reflect.TypeOf(where), "\n")
|
|
|
importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}
|
|
|
|
|
|
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)
|
|
|
|
|
|
//where := controller.GetString("where")
|
|
|
|
|
|
file, h, _ := controller.GetFile("file")
|
|
|
|
|
|
jsonMap := make(map[string]interface{})
|
|
|
err := json.Unmarshal([]byte(where), &jsonMap)
|
|
|
|
|
|
//if reflect.TypeOf(where).Kind() == reflect.TypeOf(jsonMap).Kind() { // 传入json
|
|
|
// jsonMap = map[string]interface{}{
|
|
|
// "activityId": where.(map[string]interface{})["activityId"],
|
|
|
// "uid": where["uid"],
|
|
|
// }
|
|
|
//} else { // 传入json string
|
|
|
// _ := json.Unmarshal([]byte(where), &jsonMap)
|
|
|
//}
|
|
|
|
|
|
fmt.Printf("%+v\n", jsonMap)
|
|
|
|
|
|
tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
|
|
|
|
|
|
fmt.Print(tmp, "\n")
|
|
|
|
|
|
// 错误信息返回
|
...
|
...
|
@@ -490,13 +492,23 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
|
|
|
//fmt.Print(len(rows), "\n")
|
|
|
|
|
|
//if personNameMatch, ok := where.(map[string]interface{})["personNameMatch"]; ok && (personNameMatch != "") {
|
|
|
// query = query.Where(`exchange_cash_person_list.employee_name LIKE ?`, fmt.Sprintf("%%%s%%", personNameMatch.(string)))
|
|
|
//}
|
|
|
//if activityId, ok := where.(map[string]interface{})["activityId"]; ok && activityId != "" {
|
|
|
// float, _ := strconv.ParseFloat(activityId.(string),64)
|
|
|
// query = query.Where("exchange_cash_person_list.activity_id = ?", float)
|
|
|
//}
|
|
|
|
|
|
for i, row := range rows {
|
|
|
//fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row))
|
|
|
if i > 2 && len(row) > 1 {
|
|
|
// 创建兑换清单命令
|
|
|
createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{}
|
|
|
createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
|
|
|
createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
|
|
|
//createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
|
|
|
createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["activityId"].(string), 10, 64)
|
|
|
//createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
|
|
|
createExchangeCashPersonCommand.Operator = int64(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["uid"].(float64))
|
|
|
createExchangeCashPersonCommand.PersonName = row[0]
|
|
|
createExchangeCashPersonCommand.PersonAccount = row[1]
|
|
|
r2, _ := strconv.ParseFloat(row[2], 64)
|
...
|
...
|
|