Esempio n. 1
0
        /// <summary>
        /// 读取IC卡信息
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="sessionPool"></param>
        /// <param name="sendIP"></param>
        public static void GetICCard(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string receiveIP        = string.Empty;
            string dogId            = string.Empty;
            string answerMsgType    = Convert.ToInt32(TCPMessageType.读取IC卡).ToString();
            string cardMsg          = string.Empty;
            string storePassword    = string.Empty;
            string icCardId         = string.Empty;
            string repeatCode       = string.Empty;
            string memberRepeatCode = string.Empty;
            string errMsg           = string.Empty;
            //解析消息对象
            SocketDataModel <UserSendObject> socketDataModel = Utils.DataContractJsonDeserializer <SocketDataModel <UserSendObject> >(msg);
            UserSendObject sendObj = socketDataModel.SendObject;

            //接受信息方是否存在
            if (!GetIP(sessionPool, sendObj.UserToken, out receiveIP))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "用户未注册");
                return;
            }
            //获取店密码接口
            string userToken = sendObj.UserToken;

            if (!StoreBusiness.GetStorePassword(userToken, out storePassword, out errMsg))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取门店信息出错");
                return;
            }

            object result_data = null;

            //读取IC卡信息
            if (ICCardUtility.GetICCardID(storePassword, out icCardId, out repeatCode, out errMsg))
            {
                if (MemberBusiness.GetMember(userToken, sendObj.StoreId, icCardId, ref result_data, out errMsg))
                {
                    SendSuccessData(answerMsgType, sessionPool, sendIP, "读取会员信息成功", result_data);
                }
                else
                {
                    SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                }
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
            }
        }