using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Helper;
using PTMedicalInsurance.Variables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PTMedicalInsurance.Business
{
    /// <summary>
    /// 签到
    /// </summary>
    class SignInProcess : AbstractProcess
    {
        public override CallResult Process(JObject input)
        {
            JObject joRtn = new JObject();
            string errMsg = "";
            //签到
            if (cBus.signIn(out joRtn) != 0)
            {
                return Exception("签到异常",joRtn["err_msg"].ToString());
            }
            else
            {
                Global.curEvt.signno = JsonHelper.getDestValue(joRtn, "output.signinoutb.sign_no");
                //插入签到表
                if (mIS.saveSignRecord(Global.curEvt.signno, out errMsg) != 0)
                {
                    return IrisReturn("中心签到成功但插入签到表失败:"+errMsg,null);
                }
                else
                {
                    return IrisReturn("签到成功", joRtn);
                }
            }
        }
    }
}
