|
@@ -137,32 +137,37 @@ func (rpc *JyUser) AddUserInfo(info *CompletionUserInfo, res *Resp) error {
|
|
|
Mgo.Save("user", data)
|
|
|
//个人职位
|
|
|
//职位表添加
|
|
|
- userPositionMap := map[string]interface{}{
|
|
|
- "ent_id": 0,
|
|
|
- "user_id": userId,
|
|
|
- "account_id": userAccountId,
|
|
|
- "person_name": personName,
|
|
|
- "account_name": accountName,
|
|
|
- "type": 0,
|
|
|
- }
|
|
|
- userPositionId = BaseMysql.Insert(BasePosition, userPositionMap)
|
|
|
- if userPositionId == 0 {
|
|
|
- return false
|
|
|
+ if !ExistDecide(0, int64(0), userId, entAccountId) {
|
|
|
+ userPositionMap := map[string]interface{}{
|
|
|
+ "ent_id": 0,
|
|
|
+ "user_id": userId,
|
|
|
+ "account_id": userAccountId,
|
|
|
+ "person_name": personName,
|
|
|
+ "account_name": accountName,
|
|
|
+ "type": 0,
|
|
|
+ }
|
|
|
+ userPositionId = BaseMysql.Insert(BasePosition, userPositionMap)
|
|
|
+ if userPositionId == 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
}
|
|
|
//企业职位
|
|
|
//职位表添加
|
|
|
- entPositionMap := map[string]interface{}{
|
|
|
- "ent_id": info.EntId,
|
|
|
- "user_id": userId,
|
|
|
- "account_id": entAccountId,
|
|
|
- "person_name": personName,
|
|
|
- "account_name": accountName,
|
|
|
- "type": 1,
|
|
|
- }
|
|
|
- entPositionId = BaseMysql.Insert(BasePosition, entPositionMap)
|
|
|
- if entPositionId == 0 {
|
|
|
- return false
|
|
|
+ if !ExistDecide(1, common.Int64All(info.EntId), userId, entAccountId) {
|
|
|
+ entPositionMap := map[string]interface{}{
|
|
|
+ "ent_id": info.EntId,
|
|
|
+ "user_id": userId,
|
|
|
+ "account_id": entAccountId,
|
|
|
+ "person_name": personName,
|
|
|
+ "account_name": accountName,
|
|
|
+ "type": 1,
|
|
|
+ }
|
|
|
+ entPositionId = BaseMysql.Insert(BasePosition, entPositionMap)
|
|
|
+ if entPositionId == 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
personId = common.Int64All((*userData)["person_id"])
|
|
|
userId = common.Int64All((*userData)["id"])
|
|
@@ -209,17 +214,19 @@ func (rpc *JyUser) AddUserInfo(info *CompletionUserInfo, res *Resp) error {
|
|
|
}
|
|
|
personName = common.InterfaceToStr((*personData)["name"])
|
|
|
//职位表添加
|
|
|
- positionMap := map[string]interface{}{
|
|
|
- "ent_id": info.EntId,
|
|
|
- "user_id": userId,
|
|
|
- "account_id": entAccountId,
|
|
|
- "person_name": personName,
|
|
|
- "account_name": accountName,
|
|
|
- "type": 1,
|
|
|
- }
|
|
|
- entPositionId = BaseMysql.Insert(BasePosition, positionMap)
|
|
|
- if entPositionId == 0 {
|
|
|
- return false
|
|
|
+ if !ExistDecide(1, common.Int64All(info.EntId), userId, entAccountId) {
|
|
|
+ positionMap := map[string]interface{}{
|
|
|
+ "ent_id": info.EntId,
|
|
|
+ "user_id": userId,
|
|
|
+ "account_id": entAccountId,
|
|
|
+ "person_name": personName,
|
|
|
+ "account_name": accountName,
|
|
|
+ "type": 1,
|
|
|
+ }
|
|
|
+ entPositionId = BaseMysql.Insert(BasePosition, positionMap)
|
|
|
+ if entPositionId == 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
}
|
|
|
//个人职位信息查询
|
|
|
userPositionData := BaseMysql.FindOne(BasePosition, map[string]interface{}{
|
|
@@ -241,3 +248,17 @@ func (rpc *JyUser) AddUserInfo(info *CompletionUserInfo, res *Resp) error {
|
|
|
res.UserPositionId = userPositionId
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+//判断某个人之前是否在企业里边
|
|
|
+func ExistDecide(userType, entId, user_id, account_id int64) bool {
|
|
|
+ if count := BaseMysql.Count(BasePosition, map[string]interface{}{
|
|
|
+ "ent_id": entId,
|
|
|
+ "user_id": user_id,
|
|
|
+ "account_id": account_id,
|
|
|
+ "type": userType,
|
|
|
+ }); count > 0 {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+
|
|
|
+}
|