|
@@ -62,6 +62,30 @@ func getApiCodeMap(reqCode string) string {
|
|
return retCode
|
|
return retCode
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
|
+func newResponse(respConf []apis.ManagementBaseApiParam) map[string]interface{}{
|
|
|
|
+ retMap := make(map[string]interface{})
|
|
|
|
+ for _,v := range respConf{
|
|
|
|
+ //if v.Selected{
|
|
|
|
+ key := v.Name
|
|
|
|
+ if v.Type == "int"{
|
|
|
|
+ retMap[key] = 0
|
|
|
|
+ }else if v.Type == "float"{
|
|
|
|
+ retMap[key] = 0
|
|
|
|
+ }else if v.Type == "bool"{
|
|
|
|
+ retMap[key] = false
|
|
|
|
+ }else if v.Type == "string"{
|
|
|
|
+ retMap[key] = ""
|
|
|
|
+ }else if v.Type == "struct"{
|
|
|
|
+ retMap[key] = make(map[string]interface{})
|
|
|
|
+ }else if strings.Contains(v.Type,"list"){
|
|
|
|
+ retMap[key] = make([]interface{},0)
|
|
|
|
+ }
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return retMap
|
|
|
|
+}
|
|
|
|
+
|
|
func Query(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) (err error) {
|
|
func Query(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) (err error) {
|
|
defer func() {
|
|
defer func() {
|
|
//IsReuse(&reply.IsReuse, &reply.LReq)
|
|
//IsReuse(&reply.IsReuse, &reply.LReq)
|
|
@@ -90,6 +114,7 @@ func Query(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) (e
|
|
err = errors.NoRecord
|
|
err = errors.NoRecord
|
|
if v, ok := interfaces[strings.ToUpper(req.Code)]; ok {
|
|
if v, ok := interfaces[strings.ToUpper(req.Code)]; ok {
|
|
req.NeedVehicleInfo = v.NeedVehicleInfo
|
|
req.NeedVehicleInfo = v.NeedVehicleInfo
|
|
|
|
+ reply.Data = newResponse(req.ResponseParamConf)
|
|
err = v.Func(ctx, req, reply)
|
|
err = v.Func(ctx, req, reply)
|
|
if err == nil {
|
|
if err == nil {
|
|
if v.NeedFormat {
|
|
if v.NeedFormat {
|