Exemple #1
0
func (this *IndexController) parseQuery() error {
	if val, ok := this.Form["cmd"]; ok {
		aesObj := security.NewSecurityAES()
		str, err := aesObj.DecryptString(securitykey, val.(string))
		if err == nil {
			json.Unmarshal([]byte(str), &this.Form)
			delete(this.Form, "cmd")
			this.isEncrypt = true
		} else {
			return errors.New("非法数据请求,已经进行了记录")
		}
	} else if runmode == "product" {
		return errors.New("数据非法请求,已经进行了记录")
	}
	return nil

}
Exemple #2
0
func (this *IndexController) encode(d map[string]interface{}) (string, error) {
	data, _ := json.Marshal(d)
	aesObj := security.NewSecurityAES()
	return aesObj.EncryptString(securitykey, string(data))
}