Exemplo n.º 1
0
 public int selectCountByOrderId(OrderInfo phoneInfo)
 {
     OrderInfoDao dao = new OrderInfoDao();
     return dao.selectCountByOrderId(phoneInfo);
 }
Exemplo n.º 2
0
        private void loop(HttpListener httpListenner)
        {
            while (startMark)
            {
                HttpListenerRequest request = null;
                HttpListenerResponse response = null;
                StreamWriter writer = null;
                try
                {
                    HttpListenerContext context = httpListenner.GetContext();
                    request = context.Request;
                    //分析插入订单
                    StateHandle handle = new StateHandle();
                    OrderInfo phoneInfo = new OrderInfo();
                    phoneInfo.vender_id = request.QueryString["venderId"];
                    phoneInfo.order_id = request.QueryString["orderId"];
                    phoneInfo.face_price = request.QueryString["facePrice"];
                    phoneInfo.phone_no = request.QueryString["phoneNo"];
                    phoneInfo.provider = request.QueryString["provider"];
                    phoneInfo.province_code = request.QueryString["provinceCode"];
                    phoneInfo.city_code = request.QueryString["cityCode"];
                    phoneInfo.order_status = "0";
                    String inTime = request.QueryString["inTime"];
                    String sign = request.QueryString["sign"];
                    StringBuilder sb = new StringBuilder();
                    sb.Append("venderId=").Append(phoneInfo.vender_id)
                    .Append("&orderId=").Append(phoneInfo.order_id)
                    .Append("&phoneNo=").Append(phoneInfo.phone_no)
                    .Append("&facePrice=").Append(phoneInfo.face_price)
                    .Append("&provider=").Append(phoneInfo.provider)
                    .Append("&provinceCode=").Append(phoneInfo.province_code)
                    .Append("&cityCode=").Append(phoneInfo.city_code)
                    .Append("&inTime=").Append(inTime)
                    .Append("&key=").Append(Config.md5Key);
                    String _sign = Share.MD5(sb.ToString()).ToLower();
                    String res = "";
                    if (phoneInfo.vender_id == null || "".Equals(phoneInfo.vender_id) || phoneInfo.order_id == null || "".Equals(phoneInfo.order_id)
                        || phoneInfo.face_price == null || "".Equals(phoneInfo.face_price) || phoneInfo.phone_no == null || "".Equals(phoneInfo.phone_no)
                        || inTime == null || "".Equals(inTime) || sign == null || "".Equals(sign)
                        )
                    {
                        res = "000001";
                    }
                    else if (!_sign.Equals(sign))
                    {
                        res = "000005";
                    }
                    else
                    {
                        //验证时间戳(略)

                        //验证订单号
                        int count = handle.selectCountByOrderId(phoneInfo);
                        if (count <= 0)
                        {
                            int insertCount = handle.insertOrderService(phoneInfo);
                            if (insertCount > 0)
                            {
                                res = "000000";
                            }
                            else
                            {
                                res = "000003";
                            }
                        }
                        else
                        {
                            res = "000004";
                        }
                    }
                    response = context.Response;
                    response.StatusCode = 200;
                    writer = new StreamWriter(response.OutputStream);
                    writer.Write(res);
                    writer.Close();
                    response.Close();
                    View.write("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                    log.Debug("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                }
                catch (Exception ex)
                {
                    log.Debug("收单接口异常:" + ex);
                }
                finally
                {
                    try
                    {
                        if (writer != null)
                        {
                            writer.Close();
                        }
                        if (response != null)
                        {
                            response.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Debug("收单接口异常:" + ex);
                        View.write("收单接口异常:" + ex);
                    }
                }
            }
        }
Exemplo n.º 3
0
 public int insertOrderService(OrderInfo phoneInfo)
 {
     OrderInfoDao dao = new OrderInfoDao();
     return dao.insertOrderDao(phoneInfo);
 }