예제 #1
0
        public JObject GetInfo(dynamic in_data)
        {
            try
            {
                JObject data   = JObject.Parse(in_data.ToString());
                string  id     = data["id"].ToString();
                string  option = data["option"].ToString();
                if (id == "" || option == "")
                {
                    return(SendData(400, "请求错误"));
                }

                JObject car_json = null;
                switch (option)
                {
                case "0":    //用户id
                    car_json = CarDAL.GetInfo(id);
                    break;

                case "1":    //订单id
                    JObject or_json = OrderDAL.GetInfo(id);
                    car_json = CarDAL.GetInfo(or_json["us_id"].ToString());
                    break;

                default:
                    return(SendData(400, "请求错误"));
                }
                return(SendData(200, data: car_json));
            }
            catch (Exception e)
            {
                return(SendData(400, "请求错误"));
            }
        }
예제 #2
0
        public JObject Menu_user_info(dynamic in_data)
        {
            try
            {
                JObject data  = JObject.Parse(in_data?.ToString());
                string  us_id = data["CarpoolSSID"]?.ToString();
                if (us_id == null || Session["CarpoolSSID"]?.ToString() != us_id)
                {
                    return(SendData(15001, "未授权访问"));
                }
                JObject us_json           = UserDAL.GetInfo(us_id);
                JObject car_json          = CarDAL.GetInfo(us_id);
                int     or_processing_cnt = OrderDAL.GetProcessingCount(us_id);
                int     or_all_cnt        = OrderDAL.GetAllCount(us_id);
                int     or_completed_cnt  = OrderDAL.GetCompletedCount(us_id);
                JArray  nt_Unprocessed    = NoticeDAL.GetUnprocessed(us_id);

                JObject d_us = new JObject();
                d_us.Add("us_id", us_id);
                d_us.Add("tel", us_json["tel"]);
                d_us.Add("name", us_json["name"]);
                d_us.Add("headportrait", us_json["headportrait"]);

                JObject d_car = new JObject();
                d_car.Add("car_name", car_json == null ? null : car_json["car_name"]);
                d_car.Add("car_idcard", car_json == null ? null : car_json["car_idcard"]);

                JObject d_or = new JObject();
                d_or.Add("processing_count", or_processing_cnt);
                d_or.Add("all_count", or_all_cnt);
                d_or.Add("completed_count", or_completed_cnt);

                JObject d_nt = new JObject();
                d_nt.Add("unprocessed_count", nt_Unprocessed.Count);

                JObject ret_json = new JObject();
                ret_json.Add("user", d_us);
                ret_json.Add("car", d_car);
                ret_json.Add("order", d_or);
                ret_json.Add("notice", d_nt);

                return(SendData(200, data: ret_json));
            }
            catch (Exception e)
            {
                return(SendData(400, "请求错误"));
            }
        }
예제 #3
0
        public JObject GetOrderDetails(dynamic in_data)
        {
            try
            {
                JObject data  = JObject.Parse(in_data.ToString());
                string  or_id = data["or_id"]?.ToString();
                if (or_id == null || or_id == "")
                {
                    return(SendData(400, "请求错误"));
                }
                JObject od_json       = OrderDAL.GetInfo(or_id);
                JObject ods_json      = OrderDAL.GetOrderDetailsInfo(or_id, od_json["us_id"].ToString());
                int     applyedcount  = OrderDAL.GetApplyedCount(or_id);
                int     applyingcount = OrderDAL.GetApplyingCount(or_id);
                JObject apply_json    = new JObject();
                apply_json.Add("applyingcount", applyingcount);
                apply_json.Add("applyedcount", applyedcount);
                JObject car_json = CarDAL.GetInfo(od_json["us_id"].ToString());
                JObject us_json  = UserDAL.GetInfo(od_json["us_id"].ToString());

                JObject rt_us_json = new JObject();
                rt_us_json.Add("tel", us_json["tel"]);
                rt_us_json.Add("name", us_json["name"]);

                JObject ret_data = new JObject();
                ret_data.Add("order", od_json);
                ret_data.Add("orderdetails", ods_json);
                ret_data.Add("applycount", apply_json);
                ret_data.Add("car", car_json);
                ret_data.Add("userinfo", rt_us_json);


                return(SendData(200, data: ret_data));
            }
            catch (Exception e)
            {
                return(SendData(400, "请求错误"));
            }
        }