/// <summary> /// 获取小票列表 /// </summary> /// <param name="param"></param> /// <returns></returns> public object Do_GetTicketList(object param) { ListParam listParam = JsonConvert.DeserializeObject <ListParam>(param.ToString()); if (listParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } #if DEBUG var openId = listParam.token; #endif #if !DEBUG AppBag appBag = AppContainer.GetAppBag(listParam.token); if (appBag == null) { throw new ApiException(CodeMessage.GetUserError, "GetUserError"); } var openId = appBag.Values; #endif UserDao userDao = new UserDao(); userDao.insertUser(openId); TicketDao ticketDao = new TicketDao(); ListResult listResult = ticketDao.getListByOpenId(openId); return(listResult); }
/// <summary> /// 删除小票信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public object Do_DelTicket(object param) { TicketParam listParam = JsonConvert.DeserializeObject <TicketParam>(param.ToString()); if (listParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } #if DEBUG var openId = listParam.token; #endif #if !DEBUG AppBag appBag = AppContainer.GetAppBag(listParam.token); if (appBag == null) { throw new ApiException(CodeMessage.GetUserError, "GetUserError"); } var openId = appBag.Values; #endif TicketDao ticketDao = new TicketDao(); CodeMessage s = ticketDao.deleteTicket(openId, listParam); if (s.ToString() == "deleteTicketSuccess") { return("deleteTicketSuccess"); } else { throw new ApiException(s, s.ToString()); } }
/// <summary> /// 根据小票编号获取小票信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public object Do_UpdateQRCoder(object param) { ItemParam itemParam = JsonConvert.DeserializeObject <ItemParam>(param.ToString()); if (itemParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } #if DEBUG var openId = itemParam.token; #endif #if !DEBUG AppBag appBag = AppContainer.GetAppBag(itemParam.token); if (appBag == null) { throw new ApiException(CodeMessage.GetUserError, "GetUserError"); } var openId = appBag.Values; #endif UserDao userDao = new UserDao(); UserResult ur = new UserResult(); ur.url = userDao.updateQRCode(openId); return(ur); }
/// <summary> /// 获取二维码 /// </summary> /// <param name="param"></param> /// <returns></returns> public object Do_GetQRCoder(object param) { ListParam listParam = JsonConvert.DeserializeObject <ListParam>(param.ToString()); if (listParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } #if DEBUG var openId = listParam.token; #endif #if !DEBUG AppBag appBag = AppContainer.GetAppBag(listParam.token); if (appBag == null) { throw new ApiException(CodeMessage.GetUserError, "GetUserError"); } var openId = appBag.Values; #endif UserDao userDao = new UserDao(); string s = userDao.getQRCoder(openId); if (s != "") { UserResult ur = new UserResult(); ur.url = s; return(ur); } else { throw new ApiException(CodeMessage.QRCoderError, "QRCoderError"); } }
/// <summary> /// 根据小票编号获取小票信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public object Do_GetTicketItem(object param) { ItemParam itemParam = JsonConvert.DeserializeObject <ItemParam>(param.ToString()); if (itemParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } #if DEBUG var openId = itemParam.token; #endif #if !DEBUG AppBag appBag = AppContainer.GetAppBag(itemParam.token); if (appBag == null) { throw new ApiException(CodeMessage.GetUserError, "GetUserError"); } var openId = appBag.Values; #endif TicketDao ticketDao = new TicketDao(); return(ticketDao.getTicketItem(openId, itemParam.ticketNum)); }