1 Star 0 Fork 38

星尘 / weixinHttpApi2.0

forked from codeman35 / weixinHttpApi2.0 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
MainForm_11_SENDFILE.cs 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
codeman35 提交于 2016-01-13 08:26 . no commit message
using HttpSocket;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace demo_win_httpsocket
{
partial class MainForm
{
void _11_SENDFILE(string userid,string filename)
{
_ShowMessage(System.Reflection.MethodInfo.GetCurrentMethod().Name);
var MediaId = _17_WEBWXUPLOADMEDIA(filename);
var type = MimeMapping.GetMimeMappingByFile(filename).ToLower();
//if(type.StartsWith("audio/"))
//{
//}
if (type.StartsWith("image/"))
{
//发送图片
_15_WEBWXSENDEMOTICON(userid, UserName, MediaId, 47);
}
else
{
var Message = "<appmsg appid='" + WEB["APPID"] + "' sdkver=''><title>{filename}</title><des></des><action></action><type>6</type><content></content><url></url><lowurl></lowurl><appattach><totallen>{filelength}</totallen><attachid>{attachid}</attachid><fileext>{filetype}</fileext></appattach><extinfo></extinfo></appmsg>";
Message = Message.Replace("{attachid}", MediaId);
Message = Message.Replace("{filename}", Path.GetFileName(filename));
Message = Message.Replace("{filelength}", "" + File.ReadAllBytes(filename).Length);
Message = Message.Replace("{filetype}", Path.GetExtension(filename).TrimStart(new char[] { '.' }));
_16_WEBWXSENDAPPMSG(userid, UserName, Message, 6);
}
}
}
}
1
https://gitee.com/xingchensoft/weixinHttpApi2.0.git
git@gitee.com:xingchensoft/weixinHttpApi2.0.git
xingchensoft
weixinHttpApi2.0
weixinHttpApi2.0
master

搜索帮助