|
|
@@ -3,7 +3,8 @@ package register
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/oilrtx"
|
|
|
"encoding/json"
|
|
|
- "io/ioutil"
|
|
|
+ "fmt"
|
|
|
+ "math/rand"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
@@ -294,27 +295,27 @@ func (this *OilCorporateInfoController) ComAudit() {
|
|
|
_, err3 := svcRegister.InsertEntityBytbl(OilCorporateInfoName, &model)
|
|
|
if err3 == nil {
|
|
|
//编辑短信内容
|
|
|
- toMobile:=model.UserTelephone
|
|
|
- msg:="恭喜您!市场管理信息系统账号注册成功,系统登录用户名为: "+model.UserName
|
|
|
+ //toMobile:=model.UserTelephone
|
|
|
+ //msg:="恭喜您!市场管理信息系统账号注册成功,系统登录用户名为: "+model.UserName
|
|
|
|
|
|
//调用短信接口发送短信
|
|
|
- rtxSvc := oilrtx.GetRtxService(utils.DBE)
|
|
|
- resp:=rtxSvc.HandleSendMsg("", toMobile, msg)
|
|
|
- jsonBlob, _ := ioutil.ReadAll(resp.Body)
|
|
|
- var rtxRespToken oilrtx.RtxRespToken
|
|
|
- json.Unmarshal(jsonBlob, &rtxRespToken)
|
|
|
+ //rtxSvc := oilrtx.GetRtxService(utils.DBE)
|
|
|
+ //resp:=rtxSvc.HandleSendMsg("", toMobile, msg)
|
|
|
+ //jsonBlob, _ := ioutil.ReadAll(resp.Body)
|
|
|
+ //var rtxRespToken oilrtx.RtxRespToken
|
|
|
+ //json.Unmarshal(jsonBlob, &rtxRespToken)
|
|
|
|
|
|
//如果发送返回代码存入短信信息记录表
|
|
|
- var resultMsg oilrtx.BaseMsg
|
|
|
- resultMsg.Type="1-1"
|
|
|
- resultMsg.UserName=model.UserName
|
|
|
- resultMsg.UserRealName=model.UserRealName
|
|
|
- resultMsg.UserId=strconv.Itoa(model.UserId)
|
|
|
- resultMsg.ToMobile=toMobile
|
|
|
- resultMsg.Msg=msg
|
|
|
- resultMsg.ToTime=time.Now().Format("2006-01-02 15:04:05")
|
|
|
- resultMsg.Status=strconv.Itoa(rtxRespToken.Code)
|
|
|
- svcRegister.InsertEntityBytbl("Base_Msg", &resultMsg)
|
|
|
+ //var resultMsg oilrtx.BaseMsg
|
|
|
+ //resultMsg.Type="1-1"
|
|
|
+ //resultMsg.UserName=model.UserName
|
|
|
+ //resultMsg.UserRealName=model.UserRealName
|
|
|
+ //resultMsg.UserId=strconv.Itoa(model.UserId)
|
|
|
+ //resultMsg.ToMobile=toMobile
|
|
|
+ //resultMsg.Msg=msg
|
|
|
+ //resultMsg.ToTime=time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ //resultMsg.Status=strconv.Itoa(rtxRespToken.Code)
|
|
|
+ //svcRegister.InsertEntityBytbl("Base_Msg", &resultMsg)
|
|
|
|
|
|
errinfo.Message = "审核通过!"
|
|
|
errinfo.Code = 0
|
|
|
@@ -349,29 +350,29 @@ func (this *OilCorporateInfoController) ComAudit() {
|
|
|
|
|
|
//编辑短信内容
|
|
|
//查找审批人联系方式
|
|
|
- var sPerson userRole.Base_User
|
|
|
- svc.GetEntity(&sPerson,"Id="+model.CheckUserId)
|
|
|
- toMobile:=model.UserTelephone
|
|
|
- msg:="市场管理信息系统账号注册失败,因“"+Remark+"”,请按照要求重新注册,联系人:"+model.CheckUserName+",联系电话:"+sPerson.Mobile+""
|
|
|
+ //var sPerson userRole.Base_User
|
|
|
+ //svc.GetEntity(&sPerson,"Id="+model.CheckUserId)
|
|
|
+ //toMobile:=model.UserTelephone
|
|
|
+ //msg:="市场管理信息系统账号注册失败,因“"+Remark+"”,请按照要求重新注册,联系人:"+model.CheckUserName+",联系电话:"+sPerson.Mobile+""
|
|
|
|
|
|
//调用短信接口发送短信
|
|
|
- rtxSvc := oilrtx.GetRtxService(utils.DBE)
|
|
|
- resp:=rtxSvc.HandleSendMsg("", toMobile, msg)
|
|
|
- jsonBlob, _ := ioutil.ReadAll(resp.Body)
|
|
|
- var rtxRespToken oilrtx.RtxRespToken
|
|
|
- json.Unmarshal(jsonBlob, &rtxRespToken)
|
|
|
-
|
|
|
+ //rtxSvc := oilrtx.GetRtxService(utils.DBE)
|
|
|
+ //resp:=rtxSvc.HandleSendMsg("", toMobile, msg)
|
|
|
+ //jsonBlob, _ := ioutil.ReadAll(resp.Body)
|
|
|
+ //var rtxRespToken oilrtx.RtxRespToken
|
|
|
+ //json.Unmarshal(jsonBlob, &rtxRespToken)
|
|
|
+ //
|
|
|
//如果发送返回代码存入短信信息记录表
|
|
|
- var resultMsg oilrtx.BaseMsg
|
|
|
- resultMsg.Type="1-2"
|
|
|
- resultMsg.UserName=model.UserName
|
|
|
- resultMsg.UserRealName=model.UserRealName
|
|
|
- resultMsg.UserId=strconv.Itoa(model.UserId)
|
|
|
- resultMsg.ToMobile=toMobile
|
|
|
- resultMsg.Msg=msg
|
|
|
- resultMsg.ToTime=time.Now().Format("2006-01-02 15:04:05")
|
|
|
- resultMsg.Status=strconv.Itoa(rtxRespToken.Code)
|
|
|
- svc.InsertEntityBytbl("Base_Msg", &resultMsg)
|
|
|
+ //var resultMsg oilrtx.BaseMsg
|
|
|
+ //resultMsg.Type="1-2"
|
|
|
+ //resultMsg.UserName=model.UserName
|
|
|
+ //resultMsg.UserRealName=model.UserRealName
|
|
|
+ //resultMsg.UserId=strconv.Itoa(model.UserId)
|
|
|
+ //resultMsg.ToMobile=toMobile
|
|
|
+ //resultMsg.Msg=msg
|
|
|
+ //resultMsg.ToTime=time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ //resultMsg.Status=strconv.Itoa(rtxRespToken.Code)
|
|
|
+ //svc.InsertEntityBytbl("Base_Msg", &resultMsg)
|
|
|
|
|
|
if err == nil {
|
|
|
errinfo.Message = "审核未通过!"
|
|
|
@@ -569,4 +570,107 @@ func (this *OilCorporateInfoController) GetAuditerByDept() {
|
|
|
datainfo.Item = &userlist
|
|
|
this.Data["json"] = &datainfo
|
|
|
this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// @Title 获取验证码
|
|
|
+// @Description 获取验证码
|
|
|
+// @router /getCode [get]
|
|
|
+func (this *OilCorporateInfoController) GetCode() {
|
|
|
+ svcRegister := register.GetOilCorporateInfoService(utils.DBE)
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ //得到用户名参数
|
|
|
+ userName:=this.GetString("userName")
|
|
|
+ mobile:=this.GetString("mobile")
|
|
|
+ //查出用户名的id
|
|
|
+ var sPerson userRole.Base_User
|
|
|
+ svcRegister.GetEntity(&sPerson,"UserName='"+userName+"'")
|
|
|
+ if sPerson.Username==""{
|
|
|
+ errinfo.Message = "无此用户名"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }else{
|
|
|
+ //生成一个随机数
|
|
|
+ randomNumber:=fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
|
|
|
+ //将数据存入
|
|
|
+ err2 := svcRegister.DeleteEntityBytbl("Base_VCode", "UserName='"+userName+"'")
|
|
|
+ if err2==nil{
|
|
|
+ var model oilrtx.BaseVCode
|
|
|
+ model.UserName=userName
|
|
|
+ model.UserId=strconv.Itoa(sPerson.Id)
|
|
|
+ model.Code=randomNumber
|
|
|
+ _, err:= svcRegister.InsertEntityBytbl("Base_VCode", &model)
|
|
|
+ if err==nil{
|
|
|
+ //发短信
|
|
|
+ //编辑短信内容
|
|
|
+ toMobile:=mobile
|
|
|
+ msg:="验证码为: "+ randomNumber+",5分钟内有效"
|
|
|
+
|
|
|
+ //调用短信接口发送短信
|
|
|
+ //rtxSvc := oilrtx.GetRtxService(utils.DBE)
|
|
|
+ //resp:=rtxSvc.HandleSendMsg("", toMobile, msg)
|
|
|
+ //jsonBlob, _ := ioutil.ReadAll(resp.Body)
|
|
|
+ var rtxRespToken oilrtx.RtxRespToken
|
|
|
+ //json.Unmarshal(jsonBlob, &rtxRespToken)
|
|
|
+
|
|
|
+ //如果发送返回代码存入短信信息记录表
|
|
|
+ var resultMsg oilrtx.BaseMsg
|
|
|
+ resultMsg.Type="2-1"
|
|
|
+ resultMsg.UserName=userName
|
|
|
+ resultMsg.UserRealName=sPerson.Realname
|
|
|
+ resultMsg.UserId=strconv.Itoa(sPerson.Id)
|
|
|
+ resultMsg.ToMobile=toMobile
|
|
|
+ resultMsg.Msg=msg
|
|
|
+ resultMsg.ToTime=time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ resultMsg.Status=strconv.Itoa(rtxRespToken.Code)
|
|
|
+ svcRegister.InsertEntityBytbl("Base_Msg", &resultMsg)
|
|
|
+
|
|
|
+ errinfo.Message = "请等待接收验证码,5分钟内有效"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// @Title 更新密码
|
|
|
+// @Description 更新密码
|
|
|
+// @router /updatePassword [get]
|
|
|
+func (this *OilCorporateInfoController) UpdatePassword() {
|
|
|
+ svcRegister := register.GetOilCorporateInfoService(utils.DBE)
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ userName:=this.GetString("userName")
|
|
|
+ //mobile:=this.GetString("mobile")
|
|
|
+ yzCode:=this.GetString("yzCode")
|
|
|
+ passWord:=this.GetString("passWord")
|
|
|
+
|
|
|
+ var res oilrtx.BaseVCode
|
|
|
+ svcRegister.GetEntity(&res,"UserName='"+userName+"' and Code='"+yzCode+"'")
|
|
|
+
|
|
|
+ if res.UserName!=""{
|
|
|
+ pwd, key, error := utils.TripleDesEncrypt(passWord)
|
|
|
+ var updateTo userRole.Base_User
|
|
|
+ updateTo.Userpassword=pwd
|
|
|
+ updateTo.Publickey=key
|
|
|
+ if error==nil{
|
|
|
+ cols := []string{"UserPassword", "PublicKey"}
|
|
|
+ err11 := svcRegister.UpdateEntityBytbl("Base_User",res.UserId , &updateTo, cols)
|
|
|
+ if err11==nil{
|
|
|
+ errinfo.Message = "密码重置成功"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ errinfo.Message = "验证码不正确,请重新获取"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|