2637309949 преди 4 години
родител
ревизия
7314478059
променени са 4 файла, в които са добавени 77 реда и са изтрити 15 реда
  1. 33 1
      internal/logic/getuserlogic.go
  2. 1 0
      model/mktparttimeusermodel.go
  3. 3 0
      transform.proto
  4. 40 14
      transform/transform.pb.go

+ 33 - 1
internal/logic/getuserlogic.go

@@ -46,6 +46,8 @@ func (l *GetUserLogic) GetUser(in *transform.UserRequest) (*transform.UserRespon
 	tfr.Id = user.Id
 	tfr.Phone = user.Mobile
 	tfr.Status = user.Status.Int64
+	tfr.Gender = user.Gender
+	tfr.UserName = user.Name
 	ext, err := l.svcCtx.ErpUtil.InRoles(user.Id, "TMKZHUGUAN", "LAMK", "TMKmanager", "TMKassistant", "NetTMKdirector", "NetTMKassistant", "LAMKM", "LATMK")
 	if err != nil {
 		return &tfr, nil
@@ -53,9 +55,39 @@ func (l *GetUserLogic) GetUser(in *transform.UserRequest) (*transform.UserRespon
 		tfr.ErpRoleType = 1
 	}
 	if in.Phone != "" {
-		mk, err := l.svcCtx.MktPartTimeUser.FindOneByPhone(in.Phone)
+		var mk model.MktPartTimeUser
+		err := l.svcCtx.SqlConn.QueryRowPartial(&user, `
+			SELECT
+			mkt_part_time_user.*,
+			mkt_part_time_user_city.name city_name,
+			mkt_part_time_user_city.organ_id
+			FROM
+				mkt_part_time_user
+			LEFT JOIN (
+				SELECT
+					mkt_part_time_user_city.organ_id,
+					mkt_part_time_user_city.ptuser_id,
+					base_organ.name
+				FROM
+					mkt_part_time_user_city,base_organ
+				WHERE
+					base_organ.id = mkt_part_time_user_city.organ_id
+			
+			) mkt_part_time_user_city
+			ON
+			mkt_part_time_user_city.ptuser_id = mkt_part_time_user.id
+			WHERE
+				del_flag = 0 and ipone_number=?
+		`, in.Phone)
+		if err != nil {
+			logx.Error(err)
+			return &tfr, nil
+		}
 		if err == nil && mk.Id != 0 {
 			tfr.ErpRoleType = 2
+			tfr.Gender = mk.Sex.Int64
+			tfr.UserName = mk.Name.String
+			tfr.CityName = mk.CityName.String
 			return &tfr, nil
 		}
 	}

+ 1 - 0
model/mktparttimeusermodel.go

@@ -39,6 +39,7 @@ type (
 	MktPartTimeUser struct {
 		Id             int64          `db:"id"`
 		Name           sql.NullString `db:"name"`
+		CityName       sql.NullString `db:"city_name"`
 		Sex            sql.NullInt64  `db:"sex"`
 		CreateBy       sql.NullString `db:"create_by"`
 		CreateTime     sql.NullTime   `db:"create_time"`

+ 3 - 0
transform.proto

@@ -13,6 +13,9 @@ message UserResponse {
   string roles  = 3;
   int64 status  = 4;
   int64 erpRoleType = 5;
+  string userName       = 6;
+  string cityName       = 7;
+  int64 gender          = 8;
 }
 
 service Transform {

+ 40 - 14
transform/transform.pb.go

@@ -77,6 +77,9 @@ type UserResponse struct {
 	Roles                string   `protobuf:"bytes,3,opt,name=roles,proto3" json:"roles,omitempty"`
 	Status               int64    `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"`
 	ErpRoleType          int64    `protobuf:"varint,5,opt,name=erpRoleType,proto3" json:"erpRoleType,omitempty"`
+	UserName             string   `protobuf:"bytes,6,opt,name=userName,proto3" json:"userName,omitempty"`
+	CityName             string   `protobuf:"bytes,7,opt,name=cityName,proto3" json:"cityName,omitempty"`
+	Gender               int64    `protobuf:"varint,8,opt,name=gender,proto3" json:"gender,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
@@ -142,6 +145,27 @@ func (m *UserResponse) GetErpRoleType() int64 {
 	return 0
 }
 
+func (m *UserResponse) GetUserName() string {
+	if m != nil {
+		return m.UserName
+	}
+	return ""
+}
+
+func (m *UserResponse) GetCityName() string {
+	if m != nil {
+		return m.CityName
+	}
+	return ""
+}
+
+func (m *UserResponse) GetGender() int64 {
+	if m != nil {
+		return m.Gender
+	}
+	return 0
+}
+
 func init() {
 	proto.RegisterType((*UserRequest)(nil), "transform.UserRequest")
 	proto.RegisterType((*UserResponse)(nil), "transform.UserResponse")
@@ -150,20 +174,22 @@ func init() {
 func init() { proto.RegisterFile("transform.proto", fileDescriptor_cb4a498eeb2ba07d) }
 
 var fileDescriptor_cb4a498eeb2ba07d = []byte{
-	// 194 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x29, 0x4a, 0xcc,
-	0x2b, 0x4e, 0xcb, 0x2f, 0xca, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x28,
-	0x19, 0x73, 0x71, 0x87, 0x16, 0xa7, 0x16, 0x05, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x08, 0xf1,
-	0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x31, 0x65, 0xa6, 0x08, 0x89,
-	0x70, 0xb1, 0x16, 0x64, 0xe4, 0xe7, 0xa5, 0x4a, 0x30, 0x81, 0x85, 0x20, 0x1c, 0xa5, 0x16, 0x46,
-	0x2e, 0x1e, 0x88, 0xae, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xe2, 0xb4, 0x81, 0x44, 0x8b, 0xf2,
-	0x73, 0x52, 0x8b, 0x25, 0x98, 0x21, 0xa2, 0x60, 0x8e, 0x90, 0x18, 0x17, 0x5b, 0x71, 0x49, 0x62,
-	0x49, 0x69, 0xb1, 0x04, 0x8b, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x94, 0x27, 0xa4, 0xc0, 0xc5, 0x9d,
-	0x5a, 0x54, 0x10, 0x94, 0x9f, 0x93, 0x1a, 0x52, 0x59, 0x90, 0x2a, 0xc1, 0x0a, 0x96, 0x44, 0x16,
-	0x32, 0x72, 0xe7, 0xe2, 0x0c, 0x81, 0x79, 0x44, 0xc8, 0x8a, 0x8b, 0xdd, 0x3d, 0xb5, 0x04, 0xe4,
-	0x2a, 0x21, 0x31, 0x3d, 0x84, 0x87, 0x91, 0x3c, 0x27, 0x25, 0x8e, 0x21, 0x0e, 0x71, 0x7e, 0x12,
-	0x1b, 0x38, 0x58, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x23, 0x27, 0xdb, 0x29, 0x01,
-	0x00, 0x00,
+	// 232 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
+	0x10, 0x86, 0xe5, 0x94, 0xa6, 0xcd, 0x15, 0x81, 0x74, 0x42, 0xc5, 0xea, 0x14, 0x75, 0xea, 0xd4,
+	0x81, 0x6e, 0xbc, 0x40, 0x37, 0x06, 0xab, 0x3c, 0x40, 0x20, 0x07, 0x44, 0x6a, 0x6d, 0x73, 0xe7,
+	0x0c, 0x7d, 0x4f, 0x1e, 0x08, 0xd9, 0xa6, 0x21, 0x12, 0x0b, 0xe3, 0xf7, 0xfd, 0x3a, 0xff, 0xf2,
+	0x0f, 0xb7, 0x81, 0x1b, 0x2b, 0x6f, 0x8e, 0x4f, 0x5b, 0xcf, 0x2e, 0x38, 0xac, 0x06, 0xb1, 0xde,
+	0xc1, 0xe2, 0x59, 0x88, 0x0d, 0x7d, 0xf6, 0x24, 0x01, 0x6f, 0xa0, 0xe8, 0x5a, 0xad, 0x6a, 0xb5,
+	0xa9, 0x4c, 0xd1, 0xb5, 0x78, 0x07, 0x53, 0xff, 0xe1, 0x2c, 0xe9, 0x22, 0xa9, 0x0c, 0xeb, 0x2f,
+	0x05, 0xd7, 0xf9, 0x4a, 0xbc, 0xb3, 0x42, 0xff, 0x3b, 0x8b, 0x96, 0xdd, 0x91, 0x44, 0x4f, 0xb2,
+	0x4d, 0x80, 0x4b, 0x28, 0x25, 0x34, 0xa1, 0x17, 0x7d, 0x55, 0xab, 0xcd, 0xc4, 0xfc, 0x10, 0xd6,
+	0xb0, 0x20, 0xf6, 0xc6, 0x1d, 0xe9, 0x70, 0xf6, 0xa4, 0xa7, 0x29, 0x1c, 0x2b, 0x5c, 0xc1, 0xbc,
+	0x17, 0xe2, 0xa7, 0xe6, 0x44, 0xba, 0x4c, 0x4f, 0x0e, 0x1c, 0xb3, 0xd7, 0x2e, 0x9c, 0x53, 0x36,
+	0xcb, 0xd9, 0x85, 0x63, 0xe3, 0x3b, 0xd9, 0x96, 0x58, 0xcf, 0x73, 0x63, 0xa6, 0x87, 0x3d, 0x54,
+	0x87, 0xcb, 0x30, 0xf8, 0x08, 0xb3, 0x3d, 0x85, 0xf8, 0x4b, 0x5c, 0x6e, 0x7f, 0x07, 0x1c, 0x8d,
+	0xb5, 0xba, 0xff, 0xe3, 0xf3, 0x1c, 0x2f, 0x65, 0x9a, 0x79, 0xf7, 0x1d, 0x00, 0x00, 0xff, 0xff,
+	0x03, 0x6c, 0x0e, 0x00, 0x79, 0x01, 0x00, 0x00,
 }
 
 // Reference imports to suppress errors if they are not otherwise used.