/// <summary> /// 创建红包 /// </summary> /// <param name="uniacid">商户识别ID</param> /// <param name="accountID">账户ID</param> /// <param name="packetsType">红包类型(0:语音口令红包)</param> /// <returns></returns> public async Task <string> CreateRedPacketsCmd(string uniacid, string accountID, PacketsType packetsType) { try { string json = new StreamReader(Request.Body).ReadToEnd(); switch (packetsType) { case PacketsType.Voice: var packetsModel = JsonConvert.DeserializeObject <VoicePacketsModel>(json); return(await thisData.CreateVoicePackets(uniacid, new ObjectId(accountID), packetsModel)); default: return(JsonResponseModel.ErrorJson); } } catch (ExceptionModel em) { return(JsonResponseModel.OtherJson(em.ExceptionParam)); } catch (Exception e) { e.Save(); return(JsonResponseModel.ErrorJson); } }
/// <summary> /// 提现 /// </summary> /// <param name="uniacid">商户识别ID</param> /// <param name="accountID">用户ID</param> /// <param name="money">提现金额</param> /// <returns></returns> public string PullBalance(string uniacid, string accountID, decimal money) { try { thisData.PullBalance(uniacid, new ObjectId(accountID), money); thisData.PullBalanceFinish(uniacid, new ObjectId(accountID), money); return(JsonResponseModel.SuccessJson); } catch (ExceptionModel em) { return(JsonResponseModel.OtherJson(em.ExceptionParam)); } catch (Exception e) { e.Save(); return(JsonResponseModel.ErrorJson); } }
/// <summary> /// 开启红包 /// </summary> /// <param name="uniacid">商户识别ID</param> /// <param name="accountID">领取者账户</param> /// <param name="packetsID">红包ID</param> /// <returns></returns> public async Task <string> OpenRedPackets(string uniacid, string accountID, string packetsID) { try { var files = Request.Form.Files; ActionParams ap = await thisData.OpenRedPacketsAsync(uniacid, new ObjectId(accountID), new ObjectId(packetsID), files[0]); return(ap == ActionParams.code_ok ? GetPacketsInfo(uniacid, packetsID, accountID) : JsonResponseModel.OtherJson(ap)); } catch (ExceptionModel em) { em.Save(); return(JsonResponseModel.OtherJson(em.ExceptionParam)); } catch (Exception e) { e.Save(); return(JsonResponseModel.ErrorJson); } }