package model import ( "cu-helper/cus-eng-con-sys/cryptokit" "reflect" ) /* /zjgd/frm/acceptanceComfirmController/searchAccSendList */ /* 用途:取消交付 1、获取assignScrap接口入参:deliveryId */ type SearchAccSendList struct { Start string `map:"start"` Length string `map:"length"` ParentProcInsId string `map:"parentProcInsId"` Ranstr string `map:"ranstr"` Timestamp string `map:"timestamp"` } func NewSearchAccSendList(parenProcInsId string) *SearchAccSendList { searchAccSendList := new(SearchAccSendList) searchAccSendList.Start = "1" searchAccSendList.Length = "10" searchAccSendList.ParentProcInsId = parenProcInsId searchAccSendList.Ranstr = cryptokit.RandomStr(true, 10, 32) searchAccSendList.Timestamp = cryptokit.GetTimeStamp() return searchAccSendList } func (th *SearchAccSendList) GenReqParam() map[string]string { th.encrypt() return th.structToMap() } func (th *SearchAccSendList) structToMap() map[string]string { result := make(map[string]string) t := reflect.TypeOf(*th) v := reflect.ValueOf(*th) for i := 0; i < t.NumField(); i++ { field := t.Field(i) value := v.Field(i) // Use the tag value as the key in the map, if it exists; otherwise, use the field name. tag := field.Tag.Get("map") if tag == "" { tag = field.Name } result[tag] = value.String() } return result } func (th *SearchAccSendList) encrypt() { v := reflect.ValueOf(th).Elem() for i := 0; i < v.NumField(); i++ { field := v.Field(i) if field.CanSet() { field.SetString(cryptokit.Encrypt(field.String())) } } }