package controllers import ( "XT_New/service" "encoding/json" "fmt" "github.com/astaxie/beego" ) type SignApiController struct { BaseAuthAPIController } func SignApiRegistRouters() { //获取短信验证码 beego.Router("/api/sign/getsign", &SignApiController{}, "Get:GetSign") //创建个人用户并实名 beego.Router("/api/sign/createrusername", &SignApiController{}, "Get:CreateUserName") //创建个人印章 beego.Router("/api/sign/createpersionseal", &SignApiController{}, "Get:CreatePersionSeal") //上传文件创建创建合同 beego.Router("/api/sign/createuploadpact", &SignApiController{}, "Get:CreateUploadPact") } // 短信服务接口 func (this *SignApiController) GetSign() { phone := this.GetString("phone") fmt.Println("phone", phone) var tempphone string tempphone = "13318464642" sign := service.GetSignNameByPhone(tempphone) this.ServeSuccessJSON(map[string]interface{}{ "sign": sign, }) return } type Result2121 struct { Phone string `json:"phone"` DisPlayName string `json:"dis_play_name"` Authentication string `json:"authentication"` TwAuthReq struct { OneLineAuth string `json:"oneLineAuth"` ApiAuthReq struct { RealName float64 `json:"real_name"` IdCardType string `json:"id_card_type"` IdCardNum string `json:"id_card_num"` BankCard string `json:"bank_card"` CodeNumber string `json:"code_number"` VerifyCode string `json:"verify_code"` } `json:"apiAuthReq"` } `json:"twAuthReq"` } type MapData struct { dat struct { Code float64 `json:"code"` data struct { userId string `json:"userId"` } } } // 创建个人用户并实名 func (this *SignApiController) CreateUserName() { phone := this.GetString("phone") disPlayName := this.GetString("disPlayName") sign, userId := service.CreateUserName(phone, disPlayName) var dat map[string]interface{} if err := json.Unmarshal([]byte(sign), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } this.ServeSuccessJSON(map[string]interface{}{ "sign": sign, "dat": dat, "userId": userId, }) return } // 创建个人印章 func (this *SignApiController) CreatePersionSeal() { user_id := this.GetString("user_id") person_seal_type, _ := this.GetInt64("person_seal_type") person_seal_name := this.GetString("person_seal_name") person_seal_base := this.GetString("person_seal_base") color, _ := this.GetInt64("color") alpha, _ := this.GetInt64("alpha") width, _ := this.GetInt64("width") height, _ := this.GetInt64("height") border, _ := this.GetInt64("border") font_type, _ := this.GetInt64("font_type") sign, personSealId := service.CreatePersionSeal(user_id, person_seal_type, person_seal_name, person_seal_base, color, alpha, width, height, border, font_type) var dat map[string]interface{} if err := json.Unmarshal([]byte(sign), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } this.ServeSuccessJSON(map[string]interface{}{ "sign": sign, "dat": dat, "personSealId": personSealId, }) return } func (this *SignApiController) CreateUploadPact() { contractcode := this.GetString("contractcode") contractname := this.GetString("contractname") signcount, _ := this.GetInt64("signcount") docname := this.GetString("docname") contractbase := this.GetString("contractbase") creator := this.GetString("creator") enterpriseid := this.GetString("enterpriseid") signvalidays, _ := this.GetInt64("signvalidays") sysncurl := this.GetString("sysncurl") asyncurl := this.GetString("asyncurl") sign := service.CreateUploadPact(contractcode, contractname, signcount, docname, contractbase, creator, enterpriseid, signvalidays, sysncurl, asyncurl) this.ServeSuccessJSON(map[string]interface{}{ "sign": sign, }) return }