示例#1
0
        //实现获取请求参数方法
        protected override AbstractRequestParams GetParams()
        {
            //查历史同步记录
            var jobRecord = Helper.GetWhere(new SyncJob_Definition()
            {
                JobClassName = this.JobName
            }).FirstOrDefault();

            var pars = new LH_ProductParam();

            pars.attr1 = DealerCode;
            if (jobRecord == null)
            {
                pars.attr2 = "2019-01-02 10:28:54";

                jobRecord = new SyncJob_Definition();
                jobRecord.JobClassName = this.JobName;
                jobRecord.LastExecute  = DateTime.Now;
            }
            else
            {
                var attrs = JsonConvert.DeserializeAnonymousType(jobRecord.ParsJson,
                                                                 new { attr1 = "", attr2 = "", attr3 = "" });
                //如果已存在同步历史,取上一次同步参数的结束时间再往前5分钟作为本次同步的开始时间
                pars.attr2 = DateTime.Parse(attrs.attr3).AddMinutes(-5).ToString(DateTimeFormat);
            }

            pars.attr3 = DateTime.Now.ToString(DateTimeFormat);

            return(pars);
        }
 /// <summary>
 ///     5、物料下载接口
 /// </summary>
 /// <param name="token"></param>
 /// <returns></returns>
 public AbsRequestResult <LH_Product> QueryProdPage(string token, LH_ProductParam pars)
 {
     return(BaseRequest <AbsRequestResult <LH_Product>, LH_Product>(GlobParams.Item_QueryProdPage, token, pars.ToDictionary()));
 }