コード例 #1
0
        /// <summary>
        /// 记录上传情况:上传时间、上传数据、返回结果
        /// </summary>
        /// <param name="time"></param>
        /// <param name="data"></param>
        /// <param name="result"></param>
        private void SaveUpload(DateTime time, IUploadable data, OutputResult result)
        {
            bool   is_success = false;
            string code       = result.code;
            string status     = result.data?.SelectToken("status")?.ToString();

            if (OutputCode.成功.Equals(code) && AsyncStatus.处理成功.Equals(status))
            {
                is_success = true;
            }

            string sql = $"INSERT INTO upload_record ( data_type, data_id, upload_time, is_success, uploaded_data, upload_result, project_name ) VALUES  ( '{ data.GetType().Name }', { data.DataId }, '{ time.ToString("yyyy-MM-dd HH:mm:ss") }', { Convert.ToInt32(is_success) }, '{ data.Serialize2JSON() }', '{ result.Serialize2JSON() }', '{ HjApiCaller.ProjectName }' );";

            ArDBConnection.ExceuteSQLNoReturn(sql);
        }