Example #1
0
        public async Task <IHttpActionResult> SetClockV2(KaoQinModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            string adder = "";

            try
            {
                if (model.LONGITUDE > 0)
                {
                    var           client    = new RestClient("https://restapi.amap.com");
                    var           request   = new RestRequest("/v3/geocode/regeo?location=" + model.LONGITUDE + "," + model.LATITUDE + "&key=2daf078d66ac9f5a8aa661906a618710&radius=1000&extensions=base&output=JSON ", Method.GET);
                    IRestResponse response3 = client.Execute(request);

                    if (response3.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        JObject obj = JObject.Parse(response3.Content);
                        adder = ((JObject)obj.GetValue("regeocode")).GetValue("formatted_address").ToString();
                    }
                }
            }
            catch { }

            userKaoqinAPP    app = new userKaoqinAPP();
            userKaoqinEntity ent = new userKaoqinEntity
            {
                checkTime   = System.DateTime.Now,
                kaoqin_Type = model.KaoQinType,
                userId      = User.Identity.GetUserId(),
                LATITUDE    = model.LATITUDE,
                LONGITUDE   = model.LONGITUDE,
                file_id     = model.file_id,
                adder       = adder
            };

            salesActualChangeRes res = app.Submit2(ent);

            if (!res.isOk)
            {
                return(BadRequest(res.errorMessage));
            }
            return(Ok());
        }
Example #2
0
        public async Task <IHttpActionResult> SetClock(KaoQinModel model)
        {
            return(BadRequest("该版本已停用,请使用新版!"));

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            userKaoqinAPP    app = new userKaoqinAPP();
            userKaoqinEntity ent = new userKaoqinEntity {
                checkTime = System.DateTime.Now, kaoqin_Type = model.KaoQinType, userId = User.Identity.GetUserId(),
                LATITUDE  = model.LATITUDE,
                LONGITUDE = model.LONGITUDE
            };

            app.Submit(ent);
            return(Ok());
        }
Example #3
0
 public salesActualChangeRes Submit2(userKaoqinEntity itemsEntity)
 {
     //获取地址
     return(service.Submit2(itemsEntity));
 }
Example #4
0
 public void Submit(userKaoqinEntity itemsEntity)
 {
     //itemsEntity.id = Common.GuId();
     service.Submit(itemsEntity);
 }