예제 #1
0
        public UserInfoModel GetUserInfo()
        {
            try {
                marketSalesApp app = new marketSalesApp();

                UserInfoResultModel t = app.GetUserInfo(User.Identity.GetUserId());

                UserInfoModel model = new UserInfoModel
                {
                    No              = t.No,
                    Name            = t.Name,
                    PhoneNumber     = t.PhoneNumber,
                    SalesNo         = t.SalesNo
                    , POP_TYPE_CODE = t.POP_TYPE_CODE, id = User.Identity.GetUserId(),

                    PICUrl = "https://iretailerapp.flnet.com/userPic.jpg"

                             /// ShopNo = t.ShopNo
                };
                String         appKey     = "y745wfm8y1y6v";
                String         appSecret  = "njmewTIin5p";
                RongCloud      rongcloud  = RongCloud.getInstance(appKey, appSecret);
                JsonSerializer serializer = new JsonSerializer();


                // 获取 Token 方法
                TokenReslut usergetTokenResult = rongcloud.user.getToken(model.id, model.Name, model.PICUrl);
                if (usergetTokenResult.getCode() == 200)
                {
                    model.IMToken = usergetTokenResult.getToken();
                }

                marketShopApp shopApp = new marketShopApp();
                List <marketSalesShopEntity> shops = shopApp.getShopByUserId(User.Identity.GetUserId());
                model.Shops = new List <UserShopInfoModel>();
                foreach (marketSalesShopEntity shop in shops)
                {
                    UserShopInfoModel shopmodel = new UserShopInfoModel()
                    {
                        CustomerCode = shop.CUSTOMER_CODE, CustomerName = shop.CUSTOMER_NAME, ShopCode = shop.SHOP_CODE, ShopName = shop.SHOP_NAME, LATITUDE = shop.LATITUDE.Value, LONGITUDE = shop.LONGITUDE.Value
                    };
                    model.Shops.Add(shopmodel);
                }
                return(model);
            }
            catch (Exception ex)
            {
                var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent(ex.ToString()),
                    ReasonPhrase = "error"
                };
                throw new HttpResponseException(resp);
            }
        }
예제 #2
0
        public object GetToken(string uid, string uname)
        {
            //开发环境
            //String appKey = "kj7swf8o7wbw2";
            //String appSecret = "qeWNKGh2hPbp4";
            //生产环境
            String      appKey             = "qf3d5gbj35u5h";
            String      appSecret          = "blxSwWiIKq2vS";
            RongCloud   rongcloud          = RongCloud.getInstance(appKey, appSecret);
            TokenReslut usergetTokenResult = rongcloud.user.getToken(uid, uname, "http://www.rongcloud.cn/images/logo.png");

            return(new Dictionary <string, string>()
            {
                { "status", "200" }, { "token", usergetTokenResult.getToken() }
            });
        }