下你所需,载你所想!
IT技术源码资料下载网站

C#微信刷步使用卓易健康官方接口

:其他软件 2019-10-03 11:22:40

C#微信刷步使用卓易健康官方接口源码

public class HomeController : Controller
    {
        //
        // GET: /Home/
 
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult SetWalkSteps()
        {
            model_openid mo = new model_openid();
            //获取卓易健康账号
            string zyCount = "";
            if (Request.Form["zyCount"] != null && !Request.Form["zyCount"].Equals(""))
            {
                zyCount = Request.Form["zyCount"];
            }
            else
            {
                mo.code = -999;
                mo.messsage = "账号不能空哦!";
                return Content(common.common.ObjectToJson(mo));
            }
            //获取要修改的步数
            string zyStep = "";
            if (Request.Form["zyStep"] != null && !Request.Form["zyStep"].Equals(""))
            {
                zyStep = Request.Form["zyStep"];
            }
            else
            {
                //如步数未获取到,在2000~2800中随机设置
                Random ran = new Random();
                zyStep = ran.Next(2000, 2800).ToString(); ;
            }        
            try
            {
                //实例化两个类
                model_openid op = new model_openid();
                model_stepSubmit ss = new model_stepSubmit();
                //通过卓易账号 获取官方微信返回的openid
                op = common.Dealwith.GetOPENid(zyCount);
                if (op.code == 0)
                {
                    //将得到的openid、卓易账号和步数一并发送给官方接口
                    ss = common.Dealwith.Setstep(zyCount, op.openid, zyStep);
                    return Content(common.common.ObjectToJson(ss));
                }
                else
                {
                    return Content(common.common.ObjectToJson(op));
                }
            }
            catch(Exception ex){
                return Content("{"code":"999","message":"我靠!系统给你玩废了!请稍后再试"}");
            }
        }    }

如遇到编译不成功,缺少文件DLL,请引用解压文件夹中“需要引用的第三方DLLHttpHelper.dll”

第三方DLL简介:HttpHelper实现了C# HttpWebRequest抓取时无视编码,无视证书,无视Cookie,并且实现的代{过}{滤}理的功能,使用它您可以进行Get和Post请求,可以很方便 的设置Cookie,证书,代{过}{滤}理,编码问题您不用管,因为类会自动为您识别网页的编码。
源码下载地址如下:链接: https://pan.baidu.com/s/1I9JH9N4hGOLdXgIVn-CZag 提取码: bd72