Exemple #1
0
        /// <summary>
        /// 新增或者更新用户信息
        /// </summary>
        /// <param name="baseApi"></param>
        /// <returns></returns>
        public object Do_UpdateUser(BaseApi baseApi)
        {
            UserParam param = JsonConvert.DeserializeObject <UserParam>(baseApi.param.ToString());

            if (param == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            if (param.userName == null || param.userName == "")
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            if (param.userPhone == null || param.userPhone == "")
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            if (param.userType == null || param.userType == "")
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            string  openId  = Utils.GetOpenID(baseApi.token);
            UserDao userDao = new UserDao();

            if (userDao.getUserByPhone(param.userPhone) == null)
            {
                userDao.addUser(param, openId);
            }
            else
            {
                userDao.updateUser(param);
            }
            return(userDao.getUserByPhone(param.userPhone));
        }
Exemple #2
0
        /// <summary>
        /// 充值
        /// </summary>
        /// <param name="baseApi"></param>
        /// <returns></returns>
        public object Do_Recharge(BaseApi baseApi)
        {
            UserParam param = JsonConvert.DeserializeObject <UserParam>(baseApi.param.ToString());

            if (param == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            if (param.userPhone == null || param.userPhone == "")
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            if (param.store == 0)
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            string  openId  = Utils.GetOpenID(baseApi.token);
            UserDao userDao = new UserDao();

            if (userDao.addRecharge(param, openId))
            {
                return(userDao.getUserByPhone(param.userPhone));
            }
            else
            {
                throw new ApiException(CodeMessage.RechargeError, "RechargeError");
            }
        }
Exemple #3
0
        /// <summary>
        /// 订单列表
        /// </summary>
        /// <param name="baseApi"></param>
        /// <returns></returns>
        public object Do_GetBookingList(BaseApi baseApi)
        {
            UserParam param = JsonConvert.DeserializeObject <UserParam>(baseApi.param.ToString());

            if (param == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            if (param.userPhone == null || param.userPhone == "")
            {
                throw new ApiException(CodeMessage.InterfaceValueError, "InterfaceValueError");
            }
            UserDao userDao = new UserDao();

            return(userDao.getBookingList(param.userPhone));
        }