public IHttpActionResult UserLogin(ZB_FEED_COMPANY info)
        {
            using (StarOracle db = new StarOracle())
            {
                string userName  = info.CODE.Trim();
                string _password = info.PASSWORD;// MD51.StrMD5(passwordStr + info.PASSWORD);

                var user = db.ZB_FEED_COMPANY.AsQuery().Where(w => w.CODE == userName && w.PASSWORD == _password).ToList();

                if (user.Count == 1)
                {
                    return(Succeed(user, user, 0, user[0].NAME, user[0].CODE, user[0].PORTION));
                }
                else
                {
                    string path = HttpContext.Current.Server.MapPath("~/user.json");
                    using (StreamReader r = new StreamReader(path, Encoding.Default))
                    {
                        string  json  = r.ReadToEnd();
                        dynamic array = JsonConvert.DeserializeObject(json);
                        foreach (var item in array.user)
                        {
                            if (item.userCode == userName && item.userPwd == _password)
                            {
                                string portion = item.userPortion;
                                var    query   = db.ZB_FEED_COMPANY.AsQuery().Where(w => w.PORTION == portion).OrderBy(w => w.CODE).ToList();
                                return(Succeed(query, query, 0, (string)item.userName, (string)item.userCode, (string)portion));
                            }
                        }
                    }
                    return(Succeed("拒绝访问", 1, "", ""));
                }
            }
        }
        public IHttpActionResult UserEditPwd(ZB_FEED_COMPANY info)
        {
            using (StarOracle db = new StarOracle())
            {
                string code      = info.CODE;
                string oldpwd    = info.SCHEMA;
                string _password = info.PASSWORD;// MD51.StrMD5(passwordStr + info.PASSWORD);

                var sqlNum = "update ZB_FEED_COMPANY set password='******' where code='" + code + "' and password='******'";
                int allnum = db.ExecuteNoQuery(sqlNum);
                db.Save();
                if (allnum == 1)
                {
                    return(Succeed("修改成功", 0, ""));
                }
                else
                {
                    string  path    = HttpContext.Current.Server.MapPath("~/user.json");
                    string  jsonStr = File.ReadAllText(path, Encoding.Default);
                    JObject jo      = JObject.Parse(jsonStr); //解析Json
                    bool    skin    = false;
                    for (int i = 0; i < jo["user"].Count(); i++)
                    {
                        if ((string)jo["user"][i]["userCode"] == code && (string)jo["user"][i]["userPwd"] == oldpwd)
                        {
                            jo["user"][i]["userPwd"] = _password;
                            skin = true;
                            break;
                        }
                    }
                    if (skin)
                    {
                        string convertString = Convert.ToString(jo);
                        File.WriteAllText(path, convertString, Encoding.Default);   //将转换后的文件写入
                        return(Succeed("修改成功", 0, ""));
                    }
                    else
                    {
                        return(Succeed("修改失败", 1, "", "旧密码错误"));
                    }
                }
            }
        }