liumiaomiao 3 ani în urmă
părinte
comite
1c0b00ab6b

+ 0 - 1
README.md

@@ -1,4 +1,3 @@
 企业相关的服务
 v2.9.1
 商机管理画像优化
-

+ 2 - 1
entbase/src/config.json

@@ -56,5 +56,6 @@
     "associationLimit":5,
     "uploadPath":"./uploadFile/",
     "userInEntLimit":9999,
-    "appPushServiceRpc": "127.0.0.1:5566"
+    "appPushServiceRpc": "127.0.0.1:5566",
+    "smsServiceRpc":"127.0.0.1:932"
 }

+ 1 - 0
entbase/src/config/config.go

@@ -56,6 +56,7 @@ type config struct {
 	AssociationLimit  int
 	UploadPath        string
 	AppPushServiceRpc string
+	SmsServiceRpc     string
 }
 type timeTaskConfig struct {
 	CheckIsExpire string //定时更新用户状态

+ 3 - 2
entbase/src/service/phone/phone.go

@@ -3,6 +3,7 @@ package phone
 
 import (
 	. "api"
+	"config"
 	"database/sql"
 	. "ent/entity"
 	. "ent/util"
@@ -83,12 +84,12 @@ func (a *Action) SendIdentCode() {
 		}
 		if tmp := a.GetSession("checkCodeId"); tmp == nil || !captcha.VerifyString(tmp.(string), a.GetString("code")) {
 			status = -1
-		} else if jy.SendPhoneIdentCode(token, a.Session()) {
+		} else if jy.SendPhoneIdentCode(config.Config.SmsServiceRpc, token, a.Session()) {
 			status = 1
 		}
 	} else {
 		token = jy.CheckSendMsg(token)
-		if PhoneReg.MatchString(token) && jy.SendPhoneIdentCode(token, a.Session()) {
+		if PhoneReg.MatchString(token) && jy.SendPhoneIdentCode(config.Config.SmsServiceRpc, token, a.Session()) {
 			status = 1
 		}
 	}

+ 0 - 57
entniche/src/service/phone/phone.go

@@ -1,57 +0,0 @@
-//人员手机号绑定、更换
-package phone
-
-import (
-	. "api"
-	. "ent/entity"
-	. "ent/util"
-	"qfw/util/jy"
-
-	"github.com/go-xweb/xweb"
-)
-
-type Action struct {
-	*xweb.Action
-	bind          xweb.Mapper `xweb:"/phone/bind"`          //手机号绑定
-	sendIdentCode xweb.Mapper `xweb:"/phone/sendidentcode"` //发短信
-}
-
-//手机号绑定
-func (a *Action) Bind() {
-	if !R.CheckReqParam(a.ResponseWriter, a.Request, "code") {
-		return
-	}
-	status := 0
-	phone := jy.CheckPhoneIdent(a.Session(), a.GetString("code"))
-	if phone == "" { //验证码不正确
-		status = -1
-	} else {
-		userId, _ := a.GetSession("userId").(string)
-		if bondPhone, _ := VarCurrentUser.Phone(userId); bondPhone != "" {
-			R.NoPermissionReq(a.ResponseWriter, a.Request, "该用户已经绑定过手机号")
-			return
-		}
-		//查询是否绑定过微信号
-		if bindOk, _ := VarCurrentUser.BindPhone(userId, phone); bindOk {
-			//go jy.AutoMerge(MQFW, a.Session())
-			status = 1 //绑定成功
-		} else {
-			status = 0 //已经绑定过
-		}
-	}
-	a.ServeJson(Result{Data: M{"status": status, "phone": phone}})
-}
-
-//发短信
-func (a *Action) SendIdentCode() {
-	if !R.CheckReqParam(a.ResponseWriter, a.Request, "token") {
-		return
-	}
-	status := 0
-	token := a.GetString("token")
-	phone := jy.CheckSendMsg(token)
-	if PhoneReg.MatchString(phone) && jy.SendPhoneIdentCode(phone, a.Session()) {
-		status = 1
-	}
-	a.ServeJson(Result{Data: M{"status": status}})
-}