欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > asp.net >内容正文

asp.net

金山文档服务器暂不可用,wps金山文档在线编辑--.Net 接入指南

发布时间:2023/12/20 asp.net 39 豆豆
生活随笔 收集整理的这篇文章主要介绍了 金山文档服务器暂不可用,wps金山文档在线编辑--.Net 接入指南 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

///

///获取文件元数据///

///

[Route("v1/3rd/file/info")]

[HttpGet]public JsonResult info(string _w_signature,string_w_appid)

{var res = newJsonResult();

response_wpsModel wpsModel= newresponse_wpsModel();

userModel user= newuserModel();

user.id= "576590854";

user.name= "kls-dev";

//用户权限

user.permission= "write";

user.avatar_url= "http://XXXXX.com/图片20180813135932.jpg";

fileModel f= newfileModel();

//文件主键,要确保唯一

f.id= "id2019110609261";

f.name= "文件名.xlsx";

f.version= 1;

f.size= 200;

f.creator=user.name;

f.create_time= long.Parse(TimeHelper.GetCurrentTimestamp(false));

f.modifier=user.name;

f.modify_time=long.Parse(TimeHelper.GetCurrentTimestamp(false)) ;

//文件的云地址

f.download_url= "";

user_aclModel acl= newuser_aclModel();

acl.rename= 1;

acl.history= 1;

f.user_acl=acl;

f.watermark=newwatermarkModel();

wpsModel.file=f;

wpsModel.user=user;returnJson(wpsModel,JsonRequestBehavior.AllowGet);

}

//补充时间戳帮助类

///

/// 时间相关

///

public static class TimeHelper

{

///

/// 获取当前时间戳

///

/// 精度(毫秒)设置 true,则生成13位的时间戳;精度(秒)设置为 false,则生成10位的时间戳;默认为 true

///

public static string GetCurrentTimestamp(bool millisecond = true)

{

return DateTime.Now.ToTimestamp(millisecond);

}

///

/// 转换指定时间得到对应的时间戳

///

///

/// 精度(毫秒)设置 true,则生成13位的时间戳;精度(秒)设置为 false,则生成10位的时间戳;默认为 true

/// 返回对应的时间戳

public static string ToTimestamp(this DateTime dateTime, bool millisecond = true)

{

return dateTime.ToTimestampLong(millisecond).ToString();

}

///

/// 转换指定时间得到对应的时间戳

///

///

/// 精度(毫秒)设置 true,则生成13位的时间戳;精度(秒)设置为 false,则生成10位的时间戳;默认为 true

/// 返回对应的时间戳

public static long ToTimestampLong(this DateTime dateTime, bool millisecond = true)

{

var ts = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);

return millisecond ? Convert.ToInt64(ts.TotalMilliseconds) : Convert.ToInt64(ts.TotalSeconds);

}

///

/// 转换指定时间戳到对应的时间

///

/// (10位或13位)时间戳

/// 返回对应的时间

public static DateTime ToDateTime(this string timestamp)

{

var tz = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0, 0));

return timestamp.Length == 13

? tz.AddMilliseconds(Convert.ToInt64(timestamp))

: tz.AddSeconds(Convert.ToInt64(timestamp));

}

}

总结

以上是生活随笔为你收集整理的金山文档服务器暂不可用,wps金山文档在线编辑--.Net 接入指南的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。