private void redpacket_used(HttpContext context)
        {
            string unique_code = DTRequest.GetQueryString("code");
            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(unique_code) || unique_code == "unsafe string")
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            BLL.redpacket bll_redpacket = new BLL.redpacket();
            int count = 0;
            DataSet ds_redpacket = bll_redpacket.GetRedPacketList_WebService(1, 1, "unique_code='" + unique_code + "'", "status desc", out count);
            if (ds_redpacket == null || count == 0)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            //验证红包状态
            if (int.Parse(ds_redpacket.Tables[0].Rows[0]["status"].ToString()) != 1)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码状态不符合,请检查消费码状态!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            //验证是否过期
            string start_date =ds_redpacket.Tables[0].Rows[0]["start_date"].ToString();
            string end_date=ds_redpacket.Tables[0].Rows[0]["end_date"].ToString();
            if (DateTime.Now < DateTime.Parse(start_date) || DateTime.Now > DateTime.Parse(end_date))
            {
                sb.Append("  <dl><dt></dt><dd>不在红包有效期内,请检查红包有限期!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            int guid_id = 0;
            int redpacket_id = 0;
            int.TryParse(ds_redpacket.Tables[0].Rows[0]["guid_id"].ToString(), out  guid_id);
            int.TryParse(ds_redpacket.Tables[0].Rows[0]["redpacket_id"].ToString(), out  redpacket_id);
            if (guid_id == 0 || redpacket_id == 0)
            {
                sb.Append("  <dl><dt></dt><dd>数据异常,请联系管理员!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            BLL.redpacket_guid bll_redpacket_guid = new BLL.redpacket_guid();
            if (bll_redpacket_guid.UpdateField(guid_id, redpacket_id, "status=2"))
            {
                sb.Append("  <dl><dt></dt><dd>消费成功!</dd></dl>");
            }
            else
            {
                sb.Append("  <dl><dt></dt><dd>消费失败!</dd></dl>");
            }
            context.Response.Write(sb.ToString());
            return;
        }
        public void GetRedPacketShare(int userId, int redpacketId, string version, string equType, string equName)
        {
            //redpacketId 红包ID   userId导游ID
            string json = string.Empty;
            BLL.redpacket_guid bll_redpacket_guid = new BLL.redpacket_guid();
            try
            {
                if (bll_redpacket_guid.UpdateField(userId, redpacketId, "status=1"))
                { json = "{\"status\":\"true\"}"; }
                else
                { json = "{\"status\":\"false\"}"; }

            }
            catch (Exception ex)
            {
                json = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}";
            }
            WriteWebServiceLog(version, equType, equName, "GetRedPacketShare", "");
            Context.Response.Write(json);
            Context.Response.End();
        }