コード例 #1
0
ファイル: Program.cs プロジェクト: KqSMea8/globalshopping
        static void Main(string[] args)
        {
            //me no permission
            //var appkey = "25313721";
            //var secret = "7baeb2a26918600d6e3a2fa3209c9211";

            //coo
            //var appkey = "23346767";
            //var secret = "0e3e924ebec051da26438087571f242c";

            //d
            //var appkey = "12193480";
            //var secret = "3091a169a0106c59f0e2fb769939ca8a";

            var appkey = "23238713";
            var secret = "35bc06de312ac2999c0b3930ce8c1e56";



            var        url    = "http://gw.api.taobao.com/router/rest";
            ITopClient client = new DefaultTopClient(url, appkey, secret);

            TaeItemsListRequest req = new TaeItemsListRequest();

            req.Fields  = "location,cid,price";
            req.NumIids = "16790041596";
            var response = client.Execute(req);

            if (response.Items != null && response.Items.Count > 0)
            {
                var item = response.Items[0];
                TaeItemDetailGetRequest detailReq = new TaeItemDetailGetRequest();
                detailReq.BuyerIp = "127.0.0.1";
                detailReq.Fields  = "itemInfo,priceInfo,skuInfo,stockInfo,descInfo,sellerInfo,mobileDescInfo,deliveryInfo,storeInfo,itemBuyInfo,couponInfo";
                detailReq.Id      = item.OpenIid;
                var result = client.Execute(detailReq);


                var itemRequest = new ItemGetRequest
                {
                    Fields = DefaultFields, //如果需要查询的字段为空,则取默认的查询属性
                    NumIid = 16790041596    //查询主键
                };
                var itemResponse = client.Execute(itemRequest);
            }



            //TimeGetRequest req = new TimeGetRequest();
            //TimeGetResponse rsp = client.Execute(req);
            Console.WriteLine(response.Body);
        }
コード例 #2
0
ファイル: SendMessage.aspx.cs プロジェクト: amiezhang/Youbang
 protected void Button1_Click(object sender, EventArgs e)
 {
     string url = " 	http://gw.api.taobao.com/router/rest";
     string appkey = "23303886";
     string secret = "1adacc8621fdf01eab3cf627ccc020b2";
     ITopClient client = new DefaultTopClient(url, appkey, secret);
     AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
     req.Extend = "123456";
     req.SmsType = "normal";
     req.SmsFreeSignName = "活动验证";
     req.SmsParam = "yigdsaf";
     req.RecNum = "18819257475";
     req.SmsTemplateCode = "SMS_4970603";
     try
     {
         AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
         Console.WriteLine(rsp.Body);
         Response.Write("<script>alert('成功')</script>");
     }
     catch
     {
         Response.Write("<script>alert('shibai')</script>");
     }
    
 }
コード例 #3
0
ファイル: SmsHelper.cs プロジェクト: chengliangkaka/Prepaid
        public static bool Send(string phone, string data)
        {
            bool isSuccess = true;
            try
            {
                string url = m_config.AppSettings.Settings["SmsUrl"].Value;
                string appkey = m_config.AppSettings.Settings["SmsAppkey"].Value;
                string secret = m_config.AppSettings.Settings["SmsSecret"].Value; ;
                ITopClient client = new DefaultTopClient(url, appkey, secret);
                AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
                req.Extend = "";
                req.SmsType = "normal";
                req.SmsFreeSignName = "预付费管理系统";
                req.SmsParam = data;
                req.RecNum = phone;
                req.SmsTemplateCode = "SMS_20160057";
                AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
                Match match = Regex.Match(rsp.Body, "<success>(.*?)</success>", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                if (match.Success && match.Groups.Count > 1)
                    isSuccess = Convert.ToBoolean(match.Groups[1].Value);
            }
            catch
            {
                isSuccess = false;
            }

            return isSuccess;
        }
コード例 #4
0
        public JsonResult SendRandomCodeToMobile(string phone, string username = "", int type = 0)
        {
            ITopClient client = new DefaultTopClient(url, appkey, secret);
            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();

            req.Extend          = "";
            req.SmsType         = "normal";
            req.SmsFreeSignName = "好油菜";
            var randomCode = GetID();

            //req.SmsParam = "{name:'stone',number:'3345'}";
            req.SmsParam        = "{name:'" + username + "',number:'" + randomCode + "'}";
            req.RecNum          = phone;
            req.SmsTemplateCode = "SMS_36290127";
            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            //存储结果,发送时间,随机数和手机号
            var code = new PhoneCode
            {
                Mobile        = phone,
                Code          = randomCode.ToString(),
                Successed     = !rsp.IsError,
                ErrorCode     = rsp.ErrCode,
                ErrorMsg      = rsp.ErrMsg,
                PhoneCodeType = (PhoneCodeType)type
            };

            _phoneCodeSerice.Insert(code);
            if (rsp.IsError)
            {
                Logger.Debug(rsp.ErrCode + " " + rsp.ErrMsg);
            }
            return(Json(new { success = !rsp.IsError, message = rsp.ErrMsg, code = rsp.ErrCode }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public IHttpActionResult FavoritesGet(TbkUatmFavoritesGetRequest req)
        {
            ITopClient client = new DefaultTopClient(_tbkApiUrl, _appkey, _secret, _format);
            TbkUatmFavoritesGetResponse rsp = client.Execute(req);

            return(Json(rsp.Body));
        }
コード例 #6
0
 public ActionResult GetInvitecode(long relation_id, long code_type)
 {
     try
     {
         GetAuthoCode();
         ITopClient client             = new DefaultTopClient(AliPayConfig.tkapp_url, AliPayConfig.tkapp_key, AliPayConfig.tkapp_secret, "json");
         TbkScInvitecodeGetRequest req = new TbkScInvitecodeGetRequest();
         if (relation_id != 0)
         {
             req.RelationId = relation_id;
         }
         req.RelationApp = "common";
         req.CodeType    = code_type;
         TbkScInvitecodeGetResponse rsp = client.Execute(req);
         var    jsondataformain         = Newtonsoft.Json.JsonConvert.DeserializeObject(rsp.Body) as JContainer; //转json格式
         string s          = jsondataformain.SelectToken("tbk_sc_invitecode_get_response").ToString();
         var    data       = Newtonsoft.Json.JsonConvert.DeserializeObject(s) as JContainer;                     //转json格式
         string returndata = data.SelectToken("data").ToString();
         return(Json(Comm.ToJsonResult("Success", "成功", returndata), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(Comm.ToJsonResult("Fail", "获取失败", ex.Message), JsonRequestBehavior.AllowGet));
     }
 }
コード例 #7
0
        /// <summary>
        /// 通知预警
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="room"></param>
        /// <param name="deviceName"></param>
        /// <returns></returns>
        public static string NotifyDanger(string mobile, string room, string deviceName)
        {
            ITopClient client = new DefaultTopClient(url, appkey, secret);

            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();

            req.Extend          = "";
            req.SmsType         = "normal";
            req.SmsFreeSignName = "易指控";

            /*
             * ${name}向您发起了一笔交易请求,您的初始密码是${password}
             */

            //req.SmsParam = "{'room:'"+room+ ",'device:'"+deviceName+"}";
            req.SmsParam = "{room:'" + room + "',device:'" + deviceName + "'}";

            req.RecNum          = mobile;
            req.SmsTemplateCode = "SMS_151995664";

            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            var body = rsp.Body;

            return(body);
        }
コード例 #8
0
        private bool sendphone(String phoneNum)
        {
            if (flag == 1) return false;
            else flag = 1;
            //生成验证码
            System.Random Random = new System.Random();
            int Result = Random.Next(1000, 9999);
            String codeNum = Result.ToString();

            //下面是发送短信验证码的代码,在这之前需要引入TopSdk.dll
            ITopClient client = new DefaultTopClient(url, appkey, secret);
            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
            req.Extend = "";
            req.SmsType = "normal";
            req.SmsFreeSignName = "Csharp作业";
            req.SmsParam = "{name:'" + "先生" + "',codeNum:'" + codeNum + "'}";
            req.RecNum = phoneNum;
            req.SmsTemplateCode = "SMS_11030283";
            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            //Console.WriteLine(rsp.Body);

            Session["PHONE_CHECK_NUM"] = codeNum;

            return true;
        }
コード例 #9
0
        protected override IDictionary <string, string> GetUserData(string accessToken)
        {
            log.Info("GetUserData");
            const string url = "http://gw.api.taobao.com/router/rest";
            //沙箱环境:http://gw.api.tbsandbox.com/router/rest
            ITopClient myclient = new DefaultTopClient(url, this._clientId, this._clientSecret, "json"); //实例化ITopClient类
            var        req      = new UserSellerGetRequest
            {
                Fields = "nick,user_id,type"
            };                                                              //实例化具体API对应的Request类
            UserSellerGetResponse rsp = myclient.Execute(req, accessToken); //执行API请求并将该类转换为response对象

            log.Info("response:" + rsp.Body);
            try
            {
                var data      = JsonConvert.DeserializeObject <TaobaoResponseData>(rsp.Body);
                var extraData = new Dictionary <string, string>
                {
                    { "id", data.user_seller_get_response.user.user_id },
                    { "name", data.user_seller_get_response.user.nick },
                };
                return(extraData);
            }
            catch (Exception ex)
            {
                log.Error("Deserialize UserData Failed", ex);
                throw;
            }
        }
コード例 #10
0
        /// <summary>
        /// 执行方法
        /// </summary>
        /// <typeparam name="TResponse"></typeparam>
        /// <param name="request"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public ServiceResult Execute <TResponse>(ITopRequest <TResponse> request, Func <TResponse, ServiceResult> callback) where TResponse : TopResponse
        {
            var client = new DefaultTopClient(this.Url, _apiConfig.AppKey, _apiConfig.AppSecret);
            var result = client.Execute(request, _apiConfig.SessionKey) as TResponse;

            return(callback.Invoke(result));
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: forestsheep/NewPCDL
 private void btn_upload_Click(object sender, EventArgs e)
 {
     if (tb_filename.Text.Equals(string.Empty))
     {
         appendLine("文件名不能为空");
         return;
     }
     try
     {
         ITopClient           client = new DefaultTopClient(setit.ApiUrl, setit.AppKey, setit.Secret);
         PictureUploadRequest req    = new PictureUploadRequest();
         req.PictureCategoryId = 0L;
         req.Img             = new FileItem(tb_filename.Text);
         req.ImageInputTitle = tb_up_filename.Text;
         req.Title           = tb_up_title.Text;
         //req.PictureId = 10000L;
         req.ClientType = "client:computer";
         req.IsHttps    = true;
         PictureUploadResponse rsp = client.Execute(req, setit.SessionKey);
         OnMessage(rsp.Body);
         Console.WriteLine(rsp.Body);
     }
     catch (Exception ex)
     {
         appendLine(ex.ToString());
     }
     appendLine(setit.ApiUrl);
     appendLine(setit.AppKey);
     appendLine(setit.Secret);
     appendLine(setit.SessionKey);
 }
コード例 #12
0
        public IHttpActionResult TPWDCreate(TbkTpwdCreateRequest req)
        {
            ITopClient            client = new DefaultTopClient(_tbkApiUrl, _appkey, _secret, _format);
            TbkTpwdCreateResponse rsp    = client.Execute(req);

            return(Json(rsp.Body));
        }
コード例 #13
0
        public static bool SendCodeByAliDaYu(string mobile, int code, out string errorMessage)
        {
            errorMessage = null;
            try
            {
                ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", ConfigManager.SystemConfigInfo.SmsAliDaYuAppKey, ConfigManager.SystemConfigInfo.SmsAliDaYuAppSecret);
                var        req    = new AlibabaAliqinFcSmsNumSendRequest
                {
                    SmsType         = "normal",
                    SmsFreeSignName = ConfigManager.SystemConfigInfo.SmsAliDaYuSignName,
                    SmsParam        = "{code:'" + code + "'}",
                    RecNum          = mobile,
                    SmsTemplateCode = ConfigManager.SystemConfigInfo.SmsAliDaYuCodeTplId
                };

                var rsp    = client.Execute(req);
                var retval = rsp.Body;
                if (!retval.Contains("error_response"))
                {
                    return(true);
                }
                errorMessage = RegexUtils.GetInnerContent("msg", retval);
            }
            catch (Exception e)
            {
                errorMessage = e.Message;
            }
            return(false);
        }
コード例 #14
0
        /// <summary>
        /// 获取店铺信息
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="ScoreId"></param>
        /// <returns></returns>
        internal tbShopInfo GetInfoFromTb(string NickName, int ScoreId)
        {
            tbShopInfo     shopinfo = new tbShopInfo();
            ITopClient     client   = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret);
            ShopGetRequest req      = new ShopGetRequest();

            req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
            req.Nick   = NickName;
            ShopGetResponse response = client.Execute(req);

            Top.Api.Domain.Shop shop = response.Shop;

            shopinfo.Bulletin      = shop.Bulletin;
            shopinfo.CateId        = (int)shop.Cid;
            shopinfo.Created       = DateTime.Parse(shop.Created);
            shopinfo.Desc          = shop.Desc;
            shopinfo.Modified      = DateTime.Parse(shop.Modified);
            shopinfo.NickName      = shop.Nick;
            shopinfo.PicPath       = shop.PicPath;
            shopinfo.Score         = new tbShopScore();
            shopinfo.Score.ScoreId = ScoreId;
            if (shop.ShopScore != null)
            {
                shopinfo.Score.ItemScore     = shop.ShopScore.ItemScore;
                shopinfo.Score.ServiceScore  = shop.ShopScore.ServiceScore;
                shopinfo.Score.DeliveryScore = shop.ShopScore.DeliveryScore;
            }
            shopinfo.TbShopId = (int)shop.Sid;
            shopinfo.Title    = shop.Title;

            return(shopinfo);
        }
コード例 #15
0
        /// <summary>
        /// 得到状态
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        protected override string GetSendStatus(MobileEntity info)
        {
            var builder = new StringBuilder("{");

            builder.AppendFormat("code:'{0}'", info.Body.Replace("'", "''"));
            builder.Append("}");
            string     url                       = Setting.Url;
            string     appKey                    = Setting.AppKey;
            string     appSecret                 = Setting.AppSecret;
            string     smsFreeSignName           = Setting.SmsFreeSignName;
            string     smsType                   = Setting.SmsType;
            string     smsTemplateCode           = Setting.SmsTemplateCode;
            ITopClient client                    = new DefaultTopClient(url, appKey, appSecret);
            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();

            req.Extend  = "";
            req.SmsType = smsType;
            //单引号转义.
            req.SmsParam        = builder.ToString();
            req.RecNum          = string.Join(",", info.ToMobiles);
            req.SmsTemplateCode = smsTemplateCode;
            req.SmsFreeSignName = smsFreeSignName;
            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);

            return(rsp.SerializeJson());
        }
コード例 #16
0
        public static Result <int> SendMessageByAlidayuVoice(string serverUrl, string appKey, string appSecret, string format, string calledNum, string calledShowNum, string voiceCode)
        {
            Result <int> result = new Result <int>();

            try
            {
                ITopClient client = new DefaultTopClient(serverUrl, appKey, appSecret, format);
                AlibabaAliqinFcVoiceNumSinglecallRequest req = new AlibabaAliqinFcVoiceNumSinglecallRequest();
                //req.Extend = "";
                req.CalledNum     = calledNum;
                req.CalledShowNum = calledShowNum;
                req.VoiceCode     = voiceCode;
                AlibabaAliqinFcVoiceNumSinglecallResponse rsp = client.Execute(req);
                if (rsp.Result.Success)
                {
                    result.Data = 1;
                    result.Flag = EResultFlag.Success;
                }
                else
                {
                    result.Data = -1;
                    result.Flag = EResultFlag.Failure;
                    throw new Exception(rsp.SubErrCode + ":" + rsp.SubErrMsg);
                }
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "SendMessageByAlidayuVoice");
            }

            return(result);
        }
コード例 #17
0
ファイル: GetTraderates.cs プロジェクト: giagiigi/MYDZ
        /// <summary>
        /// 商城评价解释接口[注:在评价之前需要对订单成功的时间进行判定(end_time),如果超过30天,不能再通过该接口进行评价)]
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="Oid">子订单ID</param>
        /// <param name="Reply">评价解释内容,最大长度: 500个汉字</param>
        /// <returns>完成结果</returns>
        internal bool AddTradeRateExplain(string sessionKey, long Oid, string Reply)
        {
            ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret);
            TraderateExplainAddRequest req = new TraderateExplainAddRequest();

            if (Oid != null)
            {
                req.Oid = Oid;
            }
            else
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(Reply))
            {
                req.Reply = Reply;
            }
            else
            {
                return(false);
            }
            TraderateExplainAddResponse response = client.Execute(req, sessionKey);

            if (response.IsError)
            {
                return(false);
            }
            else
            {
                return(response.IsSuccess);
            }
        }
コード例 #18
0
ファイル: VCode.cs プロジェクト: realyrare/GamePlay
 /// <summary>
 /// 阿里大鱼api验证码发送
 /// </summary>
 /// <param name="mobile"></param>
 /// <param name="outCode"></param>
 /// <returns></returns>
 public static string SendVCode(string mobile, string outCode)
 {
     try
     {
         ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "23450194", "52b5a70bc10ba56ccfe6e50bdb9fa8d4");
         AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
         req.Extend          = "";
         req.SmsType         = "normal";
         req.SmsFreeSignName = "爽赞游戏网"; //签名,将来要改
         req.SmsParam        = "{\"code\":\"" + outCode + "\",\"product\":\"爽赞游戏网(www.shuangzan.com)\"}";
         //  req.SmsFreeSignName = "躺鹰网"; //签名,将来要改
         // req.SmsParam = "{\"code\":\"" + outCode + "\",\"product\":\"躺鹰网(www.tangying.com)\"}";
         req.RecNum          = mobile;
         req.SmsTemplateCode = "SMS_14720884"; //短信模板
         AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
         if (rsp.Result.Success)
         {
             return("ok,验证码发送成功");
         }
         else
         {
             return("no,验证码发送失败");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #19
0
        /// <summary>
        /// 物料传播方式获取,输入一个原始的链接,转换得到指定的传播方式,如二维码,淘口令,短连接; 现阶段只支持短链接。
        /// </summary>
        /// <param name="sourceUrl">原始的链接</param>
        /// <returns></returns>
        public string taobao_tbk_spread_get(string sourceUrl, string _appkey, string _appsecret)
        {
            try
            {
                ITopClient          client = new DefaultTopClient(url, string.IsNullOrEmpty(_appkey) ? appkey : _appkey, string.IsNullOrEmpty(_appsecret) ? appsecret : _appsecret);
                TbkSpreadGetRequest req    = new TbkSpreadGetRequest();

                List <TbkSpreadGetRequest.TbkSpreadRequestDomain> requests = new List <TbkSpreadGetRequest.TbkSpreadRequestDomain>();

                TbkSpreadGetRequest.TbkSpreadRequestDomain obj3 = new TbkSpreadGetRequest.TbkSpreadRequestDomain();
                requests.Add(obj3);
                obj3.Url      = sourceUrl;
                req.Requests_ = requests;

                TbkSpreadGetResponse response = client.Execute(req);
                if (!response.IsError)
                {
                    return(response.Results[0].Content);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Log(string.Format("taobao_tbk_spread_get:{0},{1}", ex.Message, ex.StackTrace));
            }

            return("");
        }
コード例 #20
0
 /// <summary>
 /// 生产淘口令
 /// </summary>
 /// <param name="logo"></param>
 /// <param name="goodsUrl"></param>
 /// <param name="goodsName"></param>
 /// <returns></returns>
 public string taobao_wireless_share_tpwd_create(string logo, string goodsUrl, string goodsName, string _appkey, string _appsecret)
 {
     try
     {
         ITopClient client = new DefaultTopClient(url, string.IsNullOrEmpty(_appkey) ? appkey : _appkey, string.IsNullOrEmpty(_appsecret) ? appsecret : _appsecret);
         WirelessShareTpwdCreateRequest req = new WirelessShareTpwdCreateRequest();
         IsvTpwdInfoDomain obj1             = new IsvTpwdInfoDomain();
         obj1.Logo      = logo;
         obj1.Text      = goodsName;
         obj1.Url       = goodsUrl;
         obj1.UserId    = 24234234234L;//userid必须填写,我也不知道为什么,不传就报参数错误
         req.TpwdParam_ = obj1;
         WirelessShareTpwdCreateResponse response = client.Execute(req);
         if (!response.IsError)
         {
             return(response.Model);
         }
         LogHelper.Log(string.Format("taobao_wireless_share_tpwd_create:ErrCode:{0},ErrMsg:{1},SubErrCode:{2},SubErrMsg:{3},Body:{4}",
                                     response.ErrCode, response.ErrMsg, response.SubErrCode, response.SubErrMsg, response.Body), LogHelperTag.ERROR);
     }
     catch (Exception ex)
     {
         LogHelper.Log(string.Format("taobao_wireless_share_tpwd_create:{0},{1}", ex.Message, ex.StackTrace));
     }
     return("");
 }
コード例 #21
0
    public string getYanzheng(string phone)
    {
        ITopClient client = new DefaultTopClient(urlstr, appkey, secret);
        AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
        Random rd = new Random();

        //Response.Write(rd.Next().ToString().Substring(0, 6));
        //string scode = rd.Next().ToString().Substring(1, 4);//随机验码
        req.Extend          = "123456";
        req.SmsType         = "normal";
        req.SmsFreeSignName = "科技成果交易网";
        //req.SmsParam = "{\"code\":\"1234\",\"product\":\"alidayu\"}";
        req.SmsParam = "{\"name\":\"" + phone + "\"}";
        req.RecNum   = phone;                 //手机号 //13701122500
        //req.SmsTemplateCode = "SMS_63820762";
        req.SmsTemplateCode = "SMS_94215014"; // "SMS_72830026";
        AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);

        //Response.Write(rsp.Body);
        if (rsp.Body.Contains("true"))
        {
            //Response.Write("sms send true" + scode);
            return(phone);
        }
        else
        {
            //Response.Write("sms send false:" + rsp.Body + scode);
            return("error");
        }
        //0107285666712^1109815260840trueeibuufdkzges
        //0107285744472^1109815397495true439gth0asr0y
        //0107286008344^1109815661785true3gtqrtumy02l
    }
コード例 #22
0
        public string GetTMAPIDelivery(string OrderId, string LogisticsCode, string Waybill, XMOrderInfoApp xMorderInfoApp)
        {
            try
            {
                string AppKey      = xMorderInfoApp.AppKey;
                string AppSecret   = xMorderInfoApp.AppSecret;
                string CallbackUrl = xMorderInfoApp.CallbackUrl;//"http://www.hozest.com";
                string AccessToken = xMorderInfoApp.AccessToken;

                ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", AppKey, AppSecret);
                Top.Api.Request.LogisticsOfflineSendRequest req = new Top.Api.Request.LogisticsOfflineSendRequest();
                req.Tid         = long.Parse(OrderId);
                req.OutSid      = Waybill;
                req.CompanyCode = LogisticsCode;
                Top.Api.Response.LogisticsOfflineSendResponse rsp = client.Execute(req, AccessToken);
                //Top.Api.Response.LogisticsOfflineSendResponse m = JsonConvert.DeserializeObject<Top.Api.Response.LogisticsOfflineSendResponse>(rsp.Body);

                if (rsp.Shipping != null)
                {
                    if (rsp.Shipping.IsSuccess)
                    {
                        return(rsp.Shipping.Modified);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception ex)
            {
                IoC.Resolve <IRecordErrorLogs>().WriteErrorLog("负责人:" + HozestERPContext.Current.User.CustomerID.ToString() + ";   方法名:GetTMAPIDelivery;  异常提示:" + ex.Message.ToString() + ";   InnerException:" + ex.InnerException);
            }
            return(null);
        }
コード例 #23
0
        public ActionResult UserGetPass(string mobile, string code)
        {
            var model = PersonalUserBll.UserGetPass(mobile, new Random().Next(100000, 999999).ToString());

            try
            {
                ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "23450194", "52b5a70bc10ba56ccfe6e50bdb9fa8d4");
                AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
                req.Extend          = "";
                req.SmsType         = "normal";
                req.SmsFreeSignName = "爽赞网"; //签名,将来要改
                req.SmsParam        = "{\"code\":\"" + model.Pass + "\",\"product\":\"爽赞\"}";
                req.RecNum          = mobile;
                req.SmsTemplateCode = "SMS_35430038"; //短信模板

                AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);

                if (rsp.Result.Success)
                {
                    return(Json(new { success = "true", str = "验证码发送成功" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = "false", str = "验证码发送失败" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e) { return(Json(new { success = "false", str = "短信发送失败,原因未知" + e.Message }, JsonRequestBehavior.AllowGet)); }
        }
コード例 #24
0
ファイル: TopManager.cs プロジェクト: qaz734913414/Topawes
            public ApiResult CanBeClose(long tid, Models.UserTaoOAuth taoUserOAuth)
            {
                bool result = false;

                try
                {
                    ITopClient      client  = new DefaultTopClient(url_api, this.AppKey, this.AppSecret);
                    TradeGetRequest request = new TradeGetRequest
                    {
                        Fields = "status",
                        Tid    = tid
                    };
                    TradeGetResponse response = client.Execute <TradeGetResponse>(request, taoUserOAuth.access_token);
                    if (response.Trade.Status == "TRADE_NO_CREATE_PAY")//没有创建支付宝交易
                    {
                        result = true;
                    }
                    else if (response.Trade.Status == "WAIT_BUYER_PAY")//等待买家付款
                    {
                        result = true;
                    }
                    return(new ApiResult(result, response.Trade.Status));
                }
                catch (Exception e)
                {
                    throw new Exception("TradeGetRequest Failure.", e);
                }
            }
コード例 #25
0
        /// <summary>
        /// 根据搜索信息搜索商品列表
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AliGoodSerarchRes GetAliGoodsList(AliGoodSerarchReq req)
        {
            AliGoodSerarchRes res     = new AliGoodSerarchRes();
            TbkItemGetRequest request = new TbkItemGetRequest()
            {
                Fields      = "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick",
                Q           = req.QueryKey,
                Cat         = req.Cat,
                EndPrice    = req.EndPrice,
                EndTkRate   = req.EndTkRate,
                IsOverseas  = req.IsOverseas,
                IsTmall     = req.IsTmall,
                Itemloc     = req.Itemloc,
                PageNo      = req.PageNo,
                PageSize    = req.PageSize,
                Platform    = req.Platform,
                Sort        = req.Sort,
                StartPrice  = req.StartPrice,
                StartTkRate = req.StartTkRate
            };
            ITopClient client = new DefaultTopClient(AliUrl, AliAppKey, AliAppSecret);

            TbkItemGetResponse rsp = client.Execute(request);

            res = DeserializeObject <AliGoodSerarchRes>(SerializeObject(rsp));
            return(res);
        }
コード例 #26
0
        public int Send(string phone, string Content)
        {
#if !FB
            return(0);
#endif
            ITopClient client = new DefaultTopClient(App_Url, App_Key, App_Secret, "json");
            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
            req.Extend          = "";
            req.SmsType         = "normal";
            req.SmsFreeSignName = "番茄卷";
            req.SmsParam        = "{\"code\":\"" + Content + "\"}";
            req.RecNum          = phone;
            req.SmsTemplateCode = "SMS_143711741";
            //if (type == SMSType.CODE)
            //    req.SmsTemplateCode = "SMS_67180723";
            //else if (type == SMSType.SMS)
            //    req.SmsTemplateCode = "SMS_67125710";
            //else if (type == SMSType.TEST)
            //{
            //    req.SmsFreeSignName = "注册验证";
            //    req.SmsTemplateCode = "SMS_671355717";
            //    req.SmsParam = "{\"code\":\"" + Content + "\",\"product\":\"百业宝\"}";
            //}
            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            resultMsg = rsp.Body;
            if (rsp.IsError)
            {
                return(int.Parse(rsp.ErrCode));
            }
            return(0);
        }
コード例 #27
0
ファイル: CouponHelper.cs プロジェクト: xuhang2015/TBK
        private static string GetTaobaoKePassword(string url, string log_url)
        {
            try
            {
                ITopClient           client = new DefaultTopClient(taobaoApiUrl, taobaoAppkey, taobaoSecret);
                TbkTpwdCreateRequest req    = new TbkTpwdCreateRequest();

                if (url.Substring(0, 4) != "http")
                {
                    url = "https:" + url;
                }
                req.Text = "关注“网购有券”,超值活动,惊喜多多!";
                req.Url  = url;
                req.Logo = log_url;

                TbkTpwdCreateResponse rsp = client.Execute(req);
                return(rsp.Data.Model);
            }
            catch (Exception ex)
            {
                //LogHelper.WriteLog(typeof(config), "生成淘宝口令失败" + ex.Message);
                //LogHelper.WriteLog(typeof(config), "生成淘宝口令失败,url为" + url);
                return("");
            }
        }
コード例 #28
0
        private void button1_Click(object sender, EventArgs e)
        {
            ITopClient client = new DefaultTopClient(url, this.tb_appkey.Text.Trim(), this.tb_appsecret.Text.Trim());
            //实例化PortalRest请求
            IES_VIP_SALE_ProcessOrder_Request req = new IES_VIP_SALE_ProcessOrder_Request();

            req.IsAutoSubmit = true;
            //头表
            req.IES_Vip_Sale = BuildIESVipSaleObject();
            //明细表
            req.IES_Vip_SaleItem = BuildIESVipSaleItem(req.IES_Vip_Sale.EXTORDERID);
            //关联表
            req.DetailObjsRefTables = new int[] { 4275 };


            IES_VIP_SALE_ProcessOrder_Response rep = client.Execute <IES_VIP_SALE_ProcessOrder_Response>(req);


            this.richTextBox1.Text = rep.ReqUrl;
            this.richTextBox2.Text = rep.Body;
            if (!rep.IsError)
            {
                this.lbl_result.Text = "成功!返回单号:" + rep.ObjectId;
            }
            else
            {
                this.lbl_result.Text = "失败!";
            }
        }
コード例 #29
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //获取卖家信息
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Display(TextBox1.Text);
        /*
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);//实例化ITopClient类
        UserGetRequest req = new UserGetRequest(); //实例化具体API对应的Request类
        req.Fields = "user_id,nick,created,buyer_credit,type,sex";
        req.Nick = "sandbox_c_1";
        UserGetResponse rsp = client.Execute(req);//执行API请求并将该类转换为response对象
         */

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        UserBuyerGetRequest req = new UserBuyerGetRequest();
        req.Fields = "nick,sex";
        UserBuyerGetResponse response = client.Execute(req, sessionKey);
        Label1.Text = response.Body;

        /* 暂时关闭卖家查询,以便调试买家信息查询
            ITopClient client = new DefaultTopClient(url, appkey, appsecret);
            UserSellerGetRequest req = new UserSellerGetRequest();
            //req.Fields = "nick,sex";
            req.Fields = "user_id,nick,sex,seller_credit,type,has_more_pic,item_img_num,item_img_size,prop_img_num,prop_img_size,auto_repost,promoted_type,status,alipay_bind,consumer_protection,avatar,liangpin,sign_food_seller_promise,has_shop,is_lightning_consignment,has_sub_stock,is_golden_seller,vip_info,magazine_subscribe,vertical_market,online_gamin";

            UserSellerGetResponse response = client.Execute(req, sessionKey);

            //Label1.Text = response.Body;
            Label3.Text = response.User.Nick;
            Label2.Text = sessionKey;

            Label1.Text = response.User.Type;
        */
    }
コード例 #30
0
        public static string AliSendMsg(string mobile, string randcode, string modelid, bool israndcode = true)
        {
            ITopClient client = new DefaultTopClient(url, appkey, secret);

            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();

            req.Extend          = "";
            req.SmsType         = "normal";
            req.SmsFreeSignName = "测试";


            if (!israndcode)
            {
                req.SmsParam = "{name:'" + randcode + "'}";
            }
            else
            {
                req.SmsParam = "{number:'" + randcode + "'}";
            }
            req.RecNum          = mobile;
            req.SmsTemplateCode = modelid;

            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            var body = rsp.Body;

            return(body);
        }
コード例 #31
0
ファイル: TopManager.cs プロジェクト: qaz734913414/Topawes
 /// <summary>
 /// 获取订单状态
 /// </summary>
 /// <param name="Tid"></param>
 /// <returns></returns>
 public string GetStatus(long Tid, Models.UserTaoOAuth taoUserOAuth)
 {
     try
     {
         string          result  = "拦截失败";
         ITopClient      client  = new DefaultTopClient(url_api, this.AppKey, this.AppSecret);
         TradeGetRequest request = new TradeGetRequest
         {
             Fields = "status",
             Tid    = Tid
         };
         TradeGetResponse response = client.Execute <TradeGetResponse>(request, taoUserOAuth.access_token);
         if (response.Trade.Status == "TRADE_CLOSED")
         {
             result = "拦截成功[退款关单]";
         }
         else if (response.Trade.Status == "TRADE_CLOSED_BY_TAOBAO")
         {
             result = "拦截成功[直接关单]";
         }
         else
         {
             result = "拦截失败[" + response.Trade.Status + "]";
         }
         return(result);
     }
     catch (Exception e)
     {
         throw new Exception("TradeGetRequest Failure.", e);
     }
 }
コード例 #32
0
ファイル: TbkController.cs プロジェクト: TenderLover/JdwxWeb
        public async Task <object> GetGoods(string q, long?pageNo, long?pageSize)
        {
            if (string.IsNullOrEmpty(q))
            {
                q = "母婴";
            }
            string            url    = "http://gw.api.taobao.com/router/rest";
            string            format = "json";
            ITopClient        client = new DefaultTopClient(url, appkey, appsecret, format);
            TbkItemGetRequest req    = new TbkItemGetRequest();

            req.Fields  = "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick";
            req.Q       = q;
            req.IsTmall = true;//是否商城商品,设置为true表示该商品是属于淘宝商城商品,设置为false或不设置表示不判断这个属性
            //req.Cat = "16,18";
            req.PageNo   = pageNo ?? 1;
            req.PageSize = pageSize ?? 40;
            //req.StartTkRate = 1000;//淘客佣金比率上限,如:1234表示12.34%
            req.EndTkRate = 1000;//淘客佣金比率下限,如:1234表示12.34%
            //req.StartPrice = 10;//折扣价范围下限,单位:元
            //req.EndPrice = 10;//折扣价范围上限,单位:元
            TbkItemGetResponse response = client.Execute(req);

            return(response.Body);
        }
コード例 #33
0
ファイル: KoulingUtil.cs プロジェクト: jackyhwb/youpp
        public static string get_kouling(string appid, string appkey
                                         , string url, string pic, string text, string ext)
        {
            ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest	", appid, appkey);
            WirelessShareTpwdCreateRequest req = new WirelessShareTpwdCreateRequest();

            WirelessShareTpwdCreateRequest.IsvTpwdInfoDomain obj1 = new WirelessShareTpwdCreateRequest.IsvTpwdInfoDomain();
            if (!string.IsNullOrEmpty(ext))
            {
                obj1.Ext = ext;
            }
            if (!string.IsNullOrEmpty(pic))
            {
                obj1.Logo = pic;
            }
            if (!string.IsNullOrEmpty(text))
            {
                obj1.Text = text;
            }
            obj1.Url    = url;
            obj1.UserId = 24234234234L;

            obj1.Ext = "{\"xx\":\"xx\"}";
            //obj1.Logo = "http://m.taobao.com/xxx.jpg";
            //obj1.Text = "超值活动,惊喜活动多多";
            //obj1.Url = "http://m.taobao.com";
            //obj1.UserId = 24234234234L;

            req.TpwdParam_ = obj1;
            WirelessShareTpwdCreateResponse rsp = client.Execute(req);
            string body = rsp.Body;

            //Console.WriteLine(rsp.Body);
            return(rsp.Body);
        }
コード例 #34
0
ファイル: TbkController.cs プロジェクト: TenderLover/JdwxWeb
        public ReturnResult <string> CreateTpwd(string text, string url, string logo)
        {
            ReturnResult <string> result = new ReturnResult <string>();

            string               urlVisit = "http://gw.api.taobao.com/router/rest";
            string               format   = "json";
            ITopClient           client   = new DefaultTopClient(urlVisit, appkey, appsecret, format);
            TbkTpwdCreateRequest req      = new TbkTpwdCreateRequest();

            req.Logo   = logo;
            req.Text   = "【闪荐福利券】" + text;
            req.Url    = url;
            req.UserId = "28771534";
            TbkTpwdCreateResponse response = client.Execute(req);

            if (response == null)
            {
                result.code    = -118;
                result.message = "淘宝口令生成失败";
            }
            else
            {
                result.code    = 1;
                result.message = response.Body;
                return(result);
            }
            return(result);
        }
コード例 #35
0
 public User GetSellerUserInfo(string sessionKey)
 {
     ITopClient client = new DefaultTopClient(authModel.BaseUrl, authModel.AppKey, authModel.AppSecret);
     UserSellerGetRequest req = new UserSellerGetRequest();
     req.Fields = "user_id,nick,sex";
     UserSellerGetResponse response = client.Execute(req, sessionKey);
     return response.User;
 }
コード例 #36
0
ファイル: Default.aspx.cs プロジェクト: eavia/tts
 private void GetGoods()
 {
     ITopClient client = new DefaultTopClient(TaobaoTesting.Global.ApiAddress, TaobaoTesting.Global.AppKey
     , TaobaoTesting.Global.AppSecret);
     TradesSoldGetRequest req = new TradesSoldGetRequest();
     req.Fields = "seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_rate,status,payment,discount_fee,adjust_fee,post_fee,total_fee,pay_time,end_time,modified,consign_time,buyer_obtain_point_fee,point_fee,real_point_fee,received_payment,commission_fee,pic_path,num_iid,num_iid,num,price,cod_fee,cod_status,shipping_type,receiver_name,receiver_state,receiver_city,receiver_district,receiver_address,receiver_zip,receiver_mobile,receiver_phone,orders.title,orders.pic_path,orders.price,orders.num,orders.iid,orders.num_iid,orders.sku_id,orders.refund_status,orders.status,orders.oid,orders.total_fee,orders.payment,orders.discount_fee,orders.adjust_fee,orders.sku_properties_name,orders.item_meal_name,orders.buyer_rate,orders.seller_rate,orders.outer_iid,orders.outer_sku_id,orders.refund_id,orders.seller_type";
     TradesSoldGetResponse response = client.Execute(req, SessionKey);
 }
コード例 #37
0
ファイル: ImagesUtil.cs プロジェクト: kldcty/movepic
        public static bool reUploadImage(Picture picture, string AppKey, string AppSecret, string SessionKey, StreamWriter MovePicLogWriter)
        {
            int tryCount = 0;
            while (true)
            {
                if (tryCount < 3)
                {
                    tryCount++;
                }
                else
                {
                    break;
                }
                try
                {
                    ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", AppKey, AppSecret);
                    Console.WriteLine("重新上传图片:" + picture.PicturePath);
                    MovePicLogWriter.WriteLine("重新上传图片:" + picture.PicturePath);
                    HttpWebResponse resp = (HttpWebResponse)WebRequest.Create(picture.PicturePath).GetResponse();
                    if (resp.StatusCode == HttpStatusCode.OK)
                    {
                        Stream sm = resp.GetResponseStream();
                        MemoryStream ms = new MemoryStream();
                        byte[] buffer = new byte[4096];
                        int len;
                        len = sm.Read(buffer, 0, 4096);
                        while (len > 0)
                        {
                            ms.Write(buffer, 0, len);
                            len = sm.Read(buffer, 0, 4096);
                        }
                        byte[] imageBuffer = ms.GetBuffer();

                        PictureReplaceRequest pictureReplaceRequest = new PictureReplaceRequest();
                        pictureReplaceRequest.PictureId = picture.PictureId;
                        string fileName = System.DateTime.Now.ToString("yyyyMMddHH:mm:ss");
                        FileItem fItem = new FileItem(fileName, imageBuffer);
                        pictureReplaceRequest.ImageData = fItem;
                        PictureReplaceResponse pictureReplaceResponse = client.Execute(pictureReplaceRequest, SessionKey);
                        if (pictureReplaceResponse != null)
                        {
                            return pictureReplaceResponse.Done;
                        }
                        Console.WriteLine("已重新上传");
                        MovePicLogWriter.WriteLine("已重新上传");
                        break;
                    }
                }
                catch (System.Net.WebException e)
                {
                    Console.WriteLine("异常:" + e.Status + " " + e.Message);
                    MovePicLogWriter.WriteLine("异常:" + e.Status + " " + e.Message);
                }
                Thread.Sleep(5000);
            }
            return false;
        }
コード例 #38
0
ファイル: Default.aspx.cs プロジェクト: eavia/tts
 private void TestShipping()
 {
     ITopClient client = new DefaultTopClient(TaobaoTesting.Global.ApiAddress, TaobaoTesting.Global.AppKey
     , TaobaoTesting.Global.AppSecret);
     LogisticsTraceSearchRequest req = new LogisticsTraceSearchRequest();
     req.Tid = 92062670026941L;
     req.SellerNick = "sandbox_c_20";
     LogisticsTraceSearchResponse response = client.Execute(req);
 }
コード例 #39
0
 public static Trade GetOrderInfo(string strUrl, string strAppKey, string strAppSecret, long lTid, string strSessionKey)
 {
     ITopClient client = new DefaultTopClient(strUrl, strAppKey, strAppSecret);
     TradeFullinfoGetRequest req = new TradeFullinfoGetRequest();
     req.Fields = "seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_rate,status,payment,discount_fee,adjust_fee,post_fee,total_fee,pay_time,end_time,modified,consign_time,buyer_obtain_point_fee,point_fee,real_point_fee,received_payment,commission_fee,pic_path,num_iid,num_iid,num,price,cod_fee,cod_status,shipping_type,receiver_name,receiver_state,receiver_city,receiver_district,receiver_address,receiver_zip,receiver_mobile,receiver_phone,orders.title,orders.pic_path,orders.price,orders.num,orders.iid,orders.num_iid,orders.sku_id,orders.refund_status,orders.status,orders.oid,orders.total_fee,orders.payment,orders.discount_fee,orders.adjust_fee,orders.sku_properties_name,orders.item_meal_name,orders.buyer_rate,orders.seller_rate,orders.outer_iid,orders.outer_sku_id,orders.refund_id,orders.seller_type";
     req.Tid = lTid;
     TradeFullinfoGetResponse response = client.Execute(req);
     if (response == null)
     {
         return null;
     }
     return response.Trade;
 }
コード例 #40
0
ファイル: TradeUtilizer.cs プロジェクト: nash306/TaoPrinter
 /// <summary>
 /// 获取某个订单的详情
 /// </summary>
 /// <param name="tid">trade id</param>
 /// <param name="sessionKey"></param>
 /// <param name="error">如果出错,则储存错误信息,否则为空。</param>
 /// <returns>如果操作成功,则返回true。否则为false。</returns>
 public static bool GetTrade(int tid, string sessionKey, out Trade trade)
 {
     bool isSuccess = false;
     trade = null;
     try
     {
         ITopClient client = new DefaultTopClient(Constants.ApiUrl, Constants.AppKey, Constants.AppSecret);
         TradeFullinfoGetRequest req = new TradeFullinfoGetRequest();
         req.Fields = tradeFieldList;
         req.Tid = tid;
         TradeFullinfoGetResponse rsp = client.Execute(req, sessionKey);
         trade = rsp.Trade;
         isSuccess = true;
     }
     catch (Exception ex)
     {
         errorMsg = ex.Message;
     }
     return isSuccess;
 }
コード例 #41
0
ファイル: UserUtilizer.cs プロジェクト: nash306/TaoPrinter
 public static bool LoadSender(string sessionKey,out string error,out Sender sender)
 {
     error = string.Empty;
     sender = new Sender();
     bool isSuccess = false;
     try
     {
         ITopClient client = new DefaultTopClient(Constants.ApiUrl, Constants.AppKey, Constants.AppSecret);
         UserSellerGetRequest req = new UserSellerGetRequest();
         req.Fields = "user_id,sex";
         UserSellerGetResponse response = client.Execute(req, sessionKey);
         sender.User_Id = response.User.UserId;
         sender.Sender_Nick = response.User.Nick;
         isSuccess = true;
     }
     catch (Exception ex)
     {
         error = ex.Message;
     }
     return isSuccess;
 }
コード例 #42
0
ファイル: WebForm1.aspx.cs プロジェクト: tiantiannet/zq
        protected void Button1_Click(object sender, EventArgs e)
        {
            String name = this.TextBox1.Text;//用户名
            String phoneNum = this.TextBox2.Text;//电话号
            //生成验证码
            System.Random Random = new System.Random();
            int Result = Random.Next(1000, 9999);
            codeNum = Result.ToString();

            //下面是发送短信验证码的代码,在这之前需要引入TopSdk.dll
            ITopClient client = new DefaultTopClient(url, appkey, secret);
            AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
            req.Extend = "";
            req.SmsType = "normal";
            req.SmsFreeSignName = "Csharp作业";
            req.SmsParam = "{name:'" + name + "',codeNum:'" + codeNum + "'}";
            req.RecNum = phoneNum;
            req.SmsTemplateCode = "SMS_11030283";
            AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            //Console.WriteLine(rsp.Body);
        }
コード例 #43
0
ファイル: ImagesUtil.cs プロジェクト: kldcty/movepic
 public static List<Picture> getPictures(string image, string AppKey, string AppSecret, string SessionKey, StreamWriter MovePicLogWriter)
 {
     int tryCount = 0;
     while (tryCount < 3)
     {
         try
         {
             ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", AppKey, AppSecret);
             PictureGetRequest req = new PictureGetRequest();
             req.Urls = image;
             PictureGetResponse response = client.Execute(req, SessionKey);
             return response.Pictures;
         }
         catch (System.Net.WebException e)
         {
             Console.WriteLine("异常:" + e.Status + " " + e.Message);
             MovePicLogWriter.WriteLine("异常:" + e.Status + " " + e.Message);
         }
         Thread.Sleep(5000);
     }
     return null;
 }
コード例 #44
0
ファイル: Program.cs プロジェクト: MasterGao/DevWinFormFrame
        static long Clear() {
            IOptionConfig cfg = new OptionConfig(EnOptionConfigType.App);
            appkey = cfg.Get<string>("appkey");
            if (string.IsNullOrEmpty(appkey)) {
                cfg.Set<string>("appkey", "12517536");
                appkey = cfg.Get<string>("appkey");
            }
            appsecret = cfg.Get<string>("appsecret");
            if (string.IsNullOrEmpty(appsecret)) {
                cfg.Set<string>("appsecret", "d86d510e5a9dfab841e00ff7e7f63e4f");
                appsecret = cfg.Get<string>("appsecret");
            }
            //sessionkey = cfg.Get<string>("sessionkey");
            //if (string.IsNullOrEmpty(sessionkey))
            //{
            //    cfg.Set<string>("sessionkey", "610081760d1be039e230a41061de2a3bae98a9a4112df92143584903");
            //    sessionkey = cfg.Get<string>("sessionkey");
            //}

            ITopClient client = new DefaultTopClient(url, appkey, appsecret);
            TopatsJushitaJdpDatadeleteRequest req = new TopatsJushitaJdpDatadeleteRequest();
            req.SyncType = "tb_trade;tb_item;tb_refund;fx_trade;tm_refund";
            req.StartModified = DateTime.Now.AddDays(-10);
            DateTime end = DateTime.Now.AddDays(-5);
            req.EndModified = end;
            try {
                TopatsJushitaJdpDatadeleteResponse response = client.Execute(req);
                if (response.IsError) {
                    AppLog.DebugException(new Exception(string.Format("ErrCode:{0} ErrMsg:{1} SubErrCode:{2} SubErrMsg:{3}", response.ErrCode,
                        response.ErrMsg, response.SubErrCode, response.SubErrMsg)));
                    return -1L;
                } else
                    return response.Task.TaskId;
            } catch (Exception ex) {
                AppLog.DebugException(ex);
                return -1L;
            }
        }
コード例 #45
0
ファイル: taobao.aspx.cs プロジェクト: uvbs/taobaoke
    protected void Page_Load(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;
        string strDim = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id";
        string[] strValue = new string[30];

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);

        Response.Write("根据分类自动同步淘宝客开始,如出现死机或出错,重新点击<a href=\"taobao.aspx\">自动更新</a>即可;<br />");
        Response.Flush();

        this.js();  //定时刷新

        //更新店铺
        DateTime t = DateTime.Now.Date;
        string strSql = "select top 1 * from NewsTree with(nolock) where taobaoKe <>'' and PostDate<'" + t.ToString() + "' order by newid()";
        dt = db.getDataTable(strSql); //当天不再请求更新
        if (dt.Rows.Count > 0)
        {
            string classID = dt.Rows[0]["Tid"].ToString().Trim();
            Response.Write("<br />" + dt.Rows[0]["treeNameTxt"].ToString().Trim() + " 同步完成!");
            Response.Flush();
            //System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 10));

            ItemsGetRequest req = new ItemsGetRequest();
            req.Fields = "num_iid,title,nick,pic_url,cid,price,type,delist_time,post_fee,score,volume";
            req.Nicks = dt.Rows[0]["taobaoKe"].ToString().Trim();
            req.PageNo = 1L;
            req.OrderBy = "volume";
            req.StartPrice = 50L;
            req.EndPrice = 100000L;
            req.PageSize = 200L;    //取最畅销前200个商品
            ItemsGetResponse response = client.Execute(req);
            long shopNums = response.TotalResults;

            if (shopNums > 0)
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步

                for (int ii = 0; ii < response.Items.Count; ii++)
                {
                    strValue[0] = classID;
                    strValue[1] = response.Items[ii].NumIid.ToString();
                    strValue[2] = response.Items[ii].Title;
                    strValue[3] = response.Items[ii].Nick;
                    strValue[4] = response.Items[ii].PicUrl;
                    strValue[5] = response.Items[ii].Price;
                    strValue[6] = @"http://item.taobao.com/item.htm?id=" + response.Items[ii].NumIid.ToString();
                    strValue[7] = "0";
                    strValue[8] = "0";
                    strValue[9] = "0";
                    strValue[10] = "0";
                    strValue[11] = @"http://www.zdianpu.com";
                    strValue[12] = "0";
                    strValue[13] = "找店铺";
                    strValue[14] = response.Items[ii].Volume.ToString();
                    strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                    strValue[16] = "sys";
                    strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[18] = xc.GetIP();
                    strValue[19] = "1";
                    strValue[20] = "0";
                    strValue[21] = "0";

                    if (response.Items[ii].Title.IndexOf("邮费") < 0 || response.Items[ii].Title.IndexOf("补差") < 0)
                    {
                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + response.Items[ii].NumIid.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[6] = dtIf.Rows[0]["click_url"].ToString().Trim();
                            strValue[7] = dtIf.Rows[0]["commission"].ToString().Trim();
                            strValue[8] = dtIf.Rows[0]["commission_rate"].ToString().Trim();
                            strValue[9] = dtIf.Rows[0]["commission_num"].ToString().Trim();
                            strValue[10] = dtIf.Rows[0]["commission_volume"].ToString().Trim();
                            strValue[11] = dtIf.Rows[0]["shop_click_url"].ToString().Trim();
                            strValue[12] = dtIf.Rows[0]["seller_credit_score"].ToString().Trim();
                            strValue[13] = dtIf.Rows[0]["item_location"].ToString().Trim();
                            strValue[15] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            strValue[17] = dtIf.Rows[0]["postDate"].ToString().Trim();
                            strValue[20] = dtIf.Rows[0]["isGood"].ToString().Trim();
                            strValue[21] = dtIf.Rows[0]["poster_id"].ToString().Trim(); //淘画报

                            db.InsertUpdateDB("taobaoKe", strDim, strValue, "num_iid=" + response.Items[ii].NumIid.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }
                }
            }
            else
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步时出错或非淘宝客,防止死锁
            }
        }
        //宝贝同步结束

        dt.Dispose();

        //淘宝客自动更新操作
        for (int f = 0; f < 5; f++)
        {
            string id = string.Empty;

            DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
            if (tkIDs.Rows.Count > 0)
            {
                for (int i = 0; i < tkIDs.Rows.Count; i++)
                {
                    id += tkIDs.Rows[i]["num_iid"].ToString().Trim() + ",";
                }
                id = id.Substring(0, id.Length - 1);

                //锁定淘宝客更新条数
                strValue[0] = "0";
                string updateID = id.Replace(",", " or num_iid=");
                updateID = "num_iid=" + updateID;
                //Response.Write(updateID);
                //Response.End();
                db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);

                Response.Write("<br />淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString()+",请等待10秒...");
                Response.Flush();
            }
            else
            {
                Response.Write("<br />当前淘宝客数据转换已全部完成,请明天再手动更新!");
                break;
            }
            tkIDs.Dispose();

            //Response.Write(id.ToString());

            if (!string.IsNullOrEmpty(id as string))
            {
                TaobaokeItemsConvertRequest req = new TaobaokeItemsConvertRequest();
                req.Fields = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                req.Nick = alimamaID;
                req.NumIids = id;
                TaobaokeItemsConvertResponse response = client.Execute(req);

                int tkCount = response.TaobaokeItems.Count; //转换后得到的淘客数量

                strDim = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                for (int i = 0; i < tkCount; i++)
                {
                    strValue[0] = response.TaobaokeItems[i].NumIid.ToString();
                    strValue[1] = response.TaobaokeItems[i].Title.ToString();
                    strValue[2] = response.TaobaokeItems[i].Nick.ToString();
                    strValue[3] = response.TaobaokeItems[i].PicUrl.ToString();
                    strValue[4] = response.TaobaokeItems[i].Price.ToString();
                    strValue[5] = response.TaobaokeItems[i].ClickUrl.ToString();
                    strValue[6] = response.TaobaokeItems[i].Commission.ToString();
                    strValue[7] = response.TaobaokeItems[i].CommissionRate;
                    strValue[8] = response.TaobaokeItems[i].CommissionNum.ToString();
                    strValue[9] = response.TaobaokeItems[i].CommissionVolume.ToString();
                    strValue[10] = response.TaobaokeItems[i].ShopClickUrl.ToString();
                    strValue[11] = response.TaobaokeItems[i].SellerCreditScore.ToString();
                    strValue[12] = response.TaobaokeItems[i].ItemLocation.ToString();
                    strValue[13] = response.TaobaokeItems[i].Volume.ToString();
                    strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[15] = "1";

                    db.InsertUpdateDB("taobaoKe", strDim, strValue, " num_iid =" + response.TaobaokeItems[i].NumIid.ToString());
                }
            }
        }
    }
コード例 #46
0
ファイル: Sms.cs プロジェクト: julinn/LinnStudio
 /// <summary>
 /// 发送短信
 /// </summary>
 /// <param name="extend">公共回传参数(可选,如会员ID)</param>
 /// <param name="smsType">短信类型,默认值:normal</param>
 /// <param name="smsSignName">短信签名,必须是阿里大鱼管理中心可用签名</param>
 /// <param name="smsParas">短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开,示例:{"code":"1234","product":"alidayu"}</param>
 /// <param name="telNo">短信接收号码(11位手机号码,不能加0或+86)群发短信需传入多个号码,以英文逗号分隔,一次调用最多传入200个号码</param>
 /// <param name="smsTemplateCode">短信模板ID,必须是阿里大鱼管理中心可用模板ID</param>
 /// <returns></returns>
 public static string Send(string extend, string smsType, string smsSignName, string smsParas,string telNo, string smsTemplateCode)
 {
     string ret = "";
     try
     {
         ITopClient client = new DefaultTopClient(Furl, Fappkey, Fappsecret);
         AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
         req.Extend = extend;
         req.SmsType = smsType;
         req.SmsFreeSignName = smsSignName;
         req.SmsParam = smsParas;
         req.RecNum = telNo;
         req.SmsTemplateCode = smsTemplateCode;
         AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
         if (rsp.IsError)
         {
             ret = rsp.ErrMsg;
             if (ret == "")
                 ret = rsp.SubErrMsg;
             if (ret == "")
                 ret = "发送失败";
         }
     }
     catch(Exception ex)
     {
         ret = "发送失败:"+ex.Message;
     }
     return ret;
 }
コード例 #47
0
ファイル: posterSearch.aspx.cs プロジェクト: uvbs/taobaoke
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        Response.Write("自动同步淘画报,如出现死机或出错,重新点击自动更新即可;<br /><br />");
        Response.Flush();

        string requestType = Request.QueryString["type"];
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        PosterPostersSearchRequest req = new PosterPostersSearchRequest();
        req.PageSize = 20L;
        req.PageNo = 1L;
        req.EditorRecommend = 1L;
        req.SortType = 4L;

        string strDim = "@id,@channel_id,@cover_pic_url_w,@cover_pic_url_h,@title,@title_short,@tag,@hits,@weight,@create_date,@modified_date,@isGood,@postID,@postIP,@postDate,@flagID";
        string[] strValue = new string[30];

        string posterId = string.Empty;
        dt = db.getDataTable("select id from posterChannelIDs where isFlag>0 order by newid()");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            //获取画报标题
            req.ChannelIds = dt.Rows[i]["id"].ToString().Trim();
            PosterPostersSearchResponse response = client.Execute(req);

            for (int ii = 0; ii < response.Posters.Count; ii++)
            {
                strValue[0] = response.Posters[ii].Id.ToString();
                //标题ID赋值
                posterId = strValue[0];
                strValue[1] = response.Posters[ii].ChannelId.ToString();
                strValue[2] = string.Empty;
                strValue[3] = string.Empty;
                string pic = response.Posters[ii].CoverPicUrl.ToString();
                if (!string.IsNullOrEmpty(pic as string))
                {
                    string[] img = pic.Split(new char[] { ',' });
                    strValue[2] = img[0];
                    strValue[3] = img[img.GetUpperBound(0)];
                }
                strValue[4] = response.Posters[ii].Title;
                strValue[5] = response.Posters[ii].TitleShort;
                strValue[6] = response.Posters[ii].Tag;
                strValue[7] = response.Posters[ii].Hits.ToString();
                strValue[8] = response.Posters[ii].Weight.ToString();
                strValue[9] = response.Posters[ii].CreateDate.ToString();
                strValue[10] = response.Posters[ii].ModifiedDate.ToString();
                strValue[11] = "0";
                strValue[12] = xc.adminID;
                strValue[13] = xc.GetIP();
                strValue[14] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                strValue[15] = "1"; //默认正常

                DataTable dtIF = db.getDataTable("select * from posterChannelTitle where id=" + posterId);  //防止重复插入
                if (dtIF.Rows.Count > 0)
                {
                    strValue[8] = dtIF.Rows[0]["weight"].ToString().Trim();
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, "id=" + posterId);
                }
                else
                {
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, string.Empty);
                }
                dtIF.Dispose();

                Response.Write("<br />同步 " + strValue[4] + " 已完成;<br />");
                Response.Flush();

                //获取关联商品
                PosterPostauctionsGetRequest poster = new PosterPostauctionsGetRequest();
                poster.PosterId = long.Parse(posterId);
                PosterPostauctionsGetResponse rsp = client.Execute(poster);
                int c = rsp.Posterauctions.Count;
                if (c > 9)
                {
                    string strDim2 = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id,@auction_short_title";
                    for (int s = 0; s < c; s++)
                    {
                        strValue[0] = "0";
                        strValue[1] = rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[2] = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                        strValue[3] = "找店铺 ZdianPU.com";
                        strValue[4] = "/images/WaterMark.png";
                        strValue[5] = rsp.Posterauctions[s].AuctionPrice.ToString();
                        strValue[6] = @"http://item.taobao.com/item.htm?id=" + rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[7] = "0";
                        strValue[8] = "0";
                        strValue[9] = "0";
                        strValue[10] = "0";
                        strValue[11] = @"http://www.zdianpu.com";
                        strValue[12] = "0";
                        strValue[13] = "找店铺";
                        strValue[14] = "0";
                        strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                        strValue[16] = xc.adminID;
                        strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        strValue[18] = xc.GetIP();
                        strValue[19] = "1";
                        strValue[20] = "0";
                        strValue[21] = rsp.Posterauctions[s].PosterId.ToString();
                        strValue[22] = rsp.Posterauctions[s].AuctionShortTitle.ToString();

                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[0] = rsp.Posterauctions[s].PosterId.ToString();
                            strValue[1] = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                            db.InsertUpdateDB("taobaoKe", "@poster_id,@auction_short_title", strValue, "num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim2, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }

                    //淘宝客自动更新操作
                    for (int f = 0; f < 100; f++)
                    {
                        string id = string.Empty;

                        DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where poster_id=" + posterId + " and isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
                        if (tkIDs.Rows.Count > 0)
                        {
                            Response.Write("淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString() + "<br />");
                            Response.Flush();

                            for (int t = 0; t < tkIDs.Rows.Count; t++)
                            {
                                id += tkIDs.Rows[t]["num_iid"].ToString().Trim() + ",";
                            }
                            id = id.Substring(0, id.Length - 1);

                            //锁定淘宝客更新条数
                            strValue[0] = "0";
                            string updateID = id.Replace(",", " or num_iid=");
                            updateID = "num_iid=" + updateID;
                            //Response.Write(updateID);
                            //Response.End();
                            db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);
                        }
                        else
                        {
                            break;
                        }
                        tkIDs.Dispose();

                        //Response.Write(id.ToString());

                        if (!string.IsNullOrEmpty(id as string))
                        {
                            TaobaokeItemsConvertRequest reqTk = new TaobaokeItemsConvertRequest();
                            reqTk.Fields = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                            reqTk.Nick = alimamaID;
                            reqTk.NumIids = id;
                            TaobaokeItemsConvertResponse responseTk = client.Execute(reqTk);

                            int tkCount = responseTk.TaobaokeItems.Count; //转换后得到的淘客数量

                            string strDim3 = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                            for (int tk = 0; tk < tkCount; tk++)
                            {
                                strValue[0] = responseTk.TaobaokeItems[tk].NumIid.ToString();
                                strValue[1] = responseTk.TaobaokeItems[tk].Title.ToString();
                                strValue[2] = responseTk.TaobaokeItems[tk].Nick.ToString();
                                strValue[3] = responseTk.TaobaokeItems[tk].PicUrl.ToString();
                                strValue[4] = responseTk.TaobaokeItems[tk].Price.ToString();
                                strValue[5] = responseTk.TaobaokeItems[tk].ClickUrl.ToString();
                                strValue[6] = responseTk.TaobaokeItems[tk].Commission.ToString();
                                strValue[7] = responseTk.TaobaokeItems[tk].CommissionRate;
                                strValue[8] = responseTk.TaobaokeItems[tk].CommissionNum.ToString();
                                strValue[9] = responseTk.TaobaokeItems[tk].CommissionVolume.ToString();
                                strValue[10] = responseTk.TaobaokeItems[tk].ShopClickUrl.ToString();
                                strValue[11] = responseTk.TaobaokeItems[tk].SellerCreditScore.ToString();
                                strValue[12] = responseTk.TaobaokeItems[tk].ItemLocation.ToString();
                                strValue[13] = responseTk.TaobaokeItems[tk].Volume.ToString();
                                strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                                strValue[15] = "1";

                                db.InsertUpdateDB("taobaoKe", strDim3, strValue, " num_iid =" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                //更新商品一对多关联表
                                DataTable dtIf = db.getDataTable("select * from posterTkID with(nolock) where title_id=" + posterId + " and tK_num_iid=" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                if (dtIf.Rows.Count < 1)  //防止重复插入
                                {
                                    strValue[0] = posterId;
                                    strValue[1] = responseTk.TaobaokeItems[tk].NumIid.ToString();

                                    db.InsertUpdateDB("posterTkID", "@title_id,@tK_num_iid", strValue, "");
                                }
                                dtIf.Dispose();
                            }
                        }
                    }
                }
                else
                {
                    db.DelDB("posterChannelTitle", "id", response.Posters[ii].Id.ToString(), "", false, "");
                }
            }
        }
        dt.Dispose();
    }
コード例 #48
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //查询出售中的宝贝
    protected void Button3_Click(object sender, EventArgs e)
    {
        //Set to empty to avoid including previous value.
        ItemsInfo.Text = string.Empty;

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
        req.Fields = "num_iid,title,price,pic_url,has_showcase";
        ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);

        DataList1.DataSource = response.Items;
        DataList1.DataBind();

        /* print all the tital of items
        for (int i = 1; i < (response.TotalResults / 200 + 2); i++)
        {
            //int y = 1;
            req.Fields = "num_iid,title,price";
            //req.Q = "N97";
            //req.Cid = 1512L;
            //req.SellerCids = "11";
            req.PageNo = i;
            //req.HasDiscount = true;
            //req.HasShowcase = true;
            //req.OrderBy = "num:desc";
            //req.IsTaobao = true;
            //req.IsEx = true;
            req.PageSize = 200L;
            //DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            //req.StartModified = dateTime;
            //DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            //req.EndModified = dateTime;
            response = client.Execute(req, sessionKey);
            foreach (Item I in response.Items)
            {

                ItemsInfo.Text += I.Title + "<br />";
                //y++;
            }
            //DataList1.DataSource = response.Items;
            //DataList1.DataBind();
        }
         */
    }
コード例 #49
0
ファイル: Default.aspx.cs プロジェクト: uvbs/taobaoke
    protected void Page_Load(object sender, EventArgs e)
    {
        string classNav = "找店铺_ZDianPU.com";

        if (!IsPostBack)
        {
            DataTable dt;

            dt = db.getDataTable("select top 5 Tid,TreeName from NewsTree where taobaoKe<>'' order by newid() ");
            for (int i = 0; i < 5; i++)
            {
                ppRnd.Text += "<a href=\"/" + dt.Rows[i]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\">" + dt.Rows[i]["TreeName"].ToString().Trim() + "</a>";
                if (i < 4)
                {
                    ppRnd.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
            }
            dt.Dispose();
            ad468.Text = ad.getAdCode(0, 468, 60, 1, 0, true, string.Empty);

            long cidTemp = xc.SafeNum(Request.QueryString["id"]);
            if (cidTemp < 1)
            {
                string urlID = Page.RouteData.Values["cID"].ToString();
                urlID = urlID.Replace(".htm", "");
                cidTemp = xc.SafeNum(urlID);
            }
            //Response.Write(cidTemp.ToString());
            listTop.Text = "<a href=\"" + cidTemp.ToString() + ".htm\" target=\"_top\">默认</a>";

            string ifStr = string.Empty;
            string pageStr = string.Empty;
            string searchStr = xc.SafeSql(Server.UrlDecode(Request["keyWord"]));
            string searchIf = string.Empty;
            string orderBy = " Order By isGood desc,volume DESC";
            long sale = xc.SafeNum(Request.QueryString["sale"]);
            if (sale > 0)
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"" + cidTemp.ToString() + ".htm?sale=1\" style=\"color:#cb0201; font-weight:bold;\" target=\"_top\">销售</a>";
                orderBy = " Order By volume DESC";
                pageStr += "&sale=1";
            }
            else
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"" + cidTemp.ToString() + ".htm?sale=1\" target=\"_top\">销售</a>";
            }
            long price = xc.SafeNum(Request.QueryString["price"]);
            if (price > 0)
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"" + cidTemp.ToString() + ".htm?price=1\" style=\"color:#cb0201; font-weight:bold;\" target=\"_top\">价格</a>";
                orderBy = " Order By price ASC";
                pageStr += "&price=1";
            }
            else
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"" + cidTemp.ToString() + ".htm?price=1\" target=\"_top\">价格</a>";
            }

            navClass.Text = xClass.getClass(cidTemp, "*.htm", "");

            if (!string.IsNullOrEmpty(searchStr as string))
            {
                if (xc.SafeNum(searchStr) > 0)
                {
                    searchIf = " and num_iid=" + searchStr;
                }
                else
                {
                    searchIf = " and title like '%" + searchStr + "%'";
                }

                searchWord.Text = HttpUtility.HtmlEncode(searchStr);
                pageStr = "&keyWord=" + Server.UrlEncode(searchStr);

                classNav = "搜索结果";
                navClass.Text = classNav;
            }

            dt = db.getDataTable("select Tid,TreeID,treeNameTxt,idLayerStr from newsTree where Tid=" + cidTemp.ToString());
            if (dt.Rows.Count > 0)
            {
                string tID = dt.Rows[0]["Tid"].ToString().Trim();
                string treeID = dt.Rows[0]["TreeID"].ToString().Trim();
                classNav = dt.Rows[0]["treeNameTxt"].ToString().Trim();

                //读取二级分类
                string id = dt.Rows[0]["idLayerStr"].ToString().Trim();
                if (!string.IsNullOrEmpty(id as string))
                {
                    string[] bigID = id.Split(new char[] { '|' });
                    id = bigID[1];
                }
                else
                {
                    id = cidTemp.ToString();
                }
                dt = db.getDataTable("select Tid,TreeName from NewsTree where TreeID=" + id + " order by ListID ASC,Tid ASC");
                for (int l = 0; l < dt.Rows.Count; l++)
                {
                    string css = string.Empty;
                    long tidTree = xc.SafeNum(dt.Rows[l]["Tid"].ToString().Trim());
                    if (tidTree == cidTemp || classNav.IndexOf(dt.Rows[l]["TreeName"].ToString().Trim() + "&nbsp;") > -1)
                    {
                        css = " style=\"color:#cb0201; font-weight:bold;\"";
                    }
                    navList.Text += "<a href=\"" + tidTree.ToString() + ".htm\" target=\"_top\" " + css + ">" + dt.Rows[l]["TreeName"].ToString().Trim() + "</a>&nbsp;&nbsp;";
                }
                dt.Dispose();

                //读取品牌
                ppClass.Text = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:960px;\">";
                dt = db.getDataTable("select Tid,TreeName from newsTree where taobaoKe<>'' and TreeID=" + treeID + " order by ListID ASC,Tid ASC");
                if (dt.Rows.Count > 0)
                {
                    for (int p = 0; p < dt.Rows.Count; p++)
                    {
                        if ((p + 1) % 6 == 1)
                        {
                            ppClass.Text += "<tr>";
                        }
                        string css = string.Empty;
                        long tidTree = xc.SafeNum(dt.Rows[p]["Tid"].ToString().Trim());
                        if (tidTree == cidTemp)
                        {
                            css = " style=\"color:#cb0201; font-weight:bold;\"";
                        }
                        ppClass.Text += "<td style=\"height:22px; line-height:22px; text-align:left; width:160px;\"><a href=\"" + tidTree.ToString() + ".htm\" target=\"_top\" " + css + ">" + dt.Rows[p]["TreeName"].ToString().Trim() + "</a></td>";
                        if ((p + 1) % 6 == 0)
                        {
                            ppClass.Text += "</tr>";
                        }
                    }
                }
                else
                {
                    dt = db.getDataTable("select Tid,TreeName from newsTree where taobaoKe<>'' and idLayerStr like '%|" + tID + "|%' order by ListID ASC,Tid ASC");
                    if (dt.Rows.Count > 0)
                    {
                        for (int p = 0; p < dt.Rows.Count; p++)
                        {
                            if ((p + 1) % 6 == 1)
                            {
                                ppClass.Text += "<tr>";
                            }
                            string css = string.Empty;
                            long tidTree = xc.SafeNum(dt.Rows[p]["Tid"].ToString().Trim());
                            if (tidTree == cidTemp)
                            {
                                css = " style=\"color:#cb0201; font-weight:bold;\"";
                            }
                            ppClass.Text += "<td style=\"height:22px; line-height:22px; text-align:left; width:160px;\"><a href=\"" + tidTree.ToString() + ".htm\" target=\"_top\" " + css + ">" + dt.Rows[p]["TreeName"].ToString().Trim() + "</a></td>";
                            if ((p + 1) % 6 == 0)
                            {
                                ppClass.Text += "</tr>";
                            }
                        }
                    }
                }
            }
            dt.Dispose();
            ppClass.Text += "</table>";

            //导航
            headMenu.Text = "<td valign=\"middle\" class=\"headBg1\"><a href=\"/\" target=\"_top\" class=\"head\">网站首页</a></td>";
            dt = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();
                string className = "headBg1";
                if (xc.SafeNum(tid) == cidTemp || classNav.IndexOf(treeName + "&nbsp;") > -1)
                {
                    className = "headBg2";
                }

                headMenu.Text += "<td valign=\"middle\" class=\"" + className + "\"><a href=\"/" + tid + ".htm\" target=\"_top\" class=\"head\">" + treeName + "</a></td>";
            }
            headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/default.htm\" target=\"_top\" class=\"head\">图搜画报</a></td><td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/\" target=\"_top\" class=\"head\">画报淘宝</a></td>";
            dt.Dispose();

            if (cidTemp > 0)
            {
                string cidStr = xClass.getClassAllID("taobaoke", cidTemp); //得到所有ID

                if (cidStr.IndexOf(",") > 0)
                {
                    string[] ids = cidStr.Split(new char[] { ',' });
                    for (int i = 0; i <= ids.GetUpperBound(0); i++)
                    {
                        ifStr += " select * from taobaoke where classID=" + ids[i].ToString().Trim() + searchIf + " union ";
                    }
                }
                else
                {
                    ifStr = " select * from taobaoke where classID=" + cidTemp.ToString().Trim() + searchIf + " union ";
                }
            }
            else
            {
                ifStr = " select * from taobaoke where isBad=1 " + searchIf + " union ";
            }

            ifStr = "(" + ifStr.Substring(0, ifStr.Length - 6) + ") as news";

            string strSql = "select top 3000 * from " + ifStr + orderBy;
            //Response.Write(strSql);
            //Response.End();
            lblCurrentPage.Text = db.RepeaterDB(RepeaterList, strSql, pageStr, 30, "page", "right", true);
            string[] inputStr = lblCurrentPage.Text.Replace("<!-- input -->", "@").Split(new char[] { '@' });
            pageTop.Text = inputStr[0] + "</tr></table>";
            if (this.RepeaterList.Items.Count < 1)
            {
                if (string.IsNullOrEmpty(searchStr as string))
                {
                    errInfo.Text = "目前暂没有任何信息!";
                    errDiv.Visible = true;
                }
                else
                {
                    //即时搜索淘宝客显示商品
                    string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
                    string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
                    string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
                    string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID
                    ITopClient client = new DefaultTopClient(url, appkey, appsecret);
                    TaobaokeListurlGetRequest req = new TaobaokeListurlGetRequest();
                    req.Q = searchStr;
                    req.Nick = alimamaID;
                    TaobaokeListurlGetResponse response = client.Execute(req);

                    Response.Redirect(response.TaobaokeItem.KeywordClickUrl, true);
                }
            }
            else
            {
                errDiv.Visible = false;
            }

            //热搜关键词
            string hot = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "hotSearch");
            string[] hotWord = hot.Split(new char[] { ',' });
            for (int h = 0; h <= hotWord.GetUpperBound(0); h++)
            {
                hotSearch.Text += "<a href=\"/search.htm?keyWord=" + Server.UrlEncode(hotWord[h]) + "\" target=\"_top\" title=\"搜索 " + hotWord[h] + "\">" + hotWord[h] + "</a>&nbsp;";
            }

            xc.webMeta(this.Page, XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "KeyWord"), XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr"));
        }

        this.Page.Title = classNav + " " + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");
    }
コード例 #50
0
ファイル: SmsHelper.cs プロジェクト: neilchennan/Xiaolu
        public static BaseActionResult GenVercode(string mobile)
        {
            String msg;
            try
            {
                ITopClient client = new DefaultTopClient(URL, APP_KEY, APP_SECRET, "json");
                OpenSmsSendvercodeRequest req = new OpenSmsSendvercodeRequest();

                req.SendVerCodeRequest = "{\"external_id\":\"wb121212\",\"template_id\":\"142571913\",\"signature_id\":\"786\",\"ver_code_length\":\"4\", \"mobile\":\""
                    + mobile + "\",\"context\":{\"minute\":\"2\", \"name\":\"小鹿\"}}";

                OpenSmsSendvercodeResponse rsp = client.Execute(req);

                string respBody = rsp.Body;
                bool isSuccess = !rsp.IsError;

                if (isSuccess)
                {
                    sendvercode_success_response responseObj = JsonConvert.DeserializeObject<sendvercode_success_response>(respBody);
                    msg = responseObj.open_sms_sendvercode_response.result.message;
                }
                else
                {
                    AlibaichuanMsgError errRspObj = JsonConvert.DeserializeObject<AlibaichuanMsgError>(respBody);
                    msg = errRspObj.error_response.msg;
                }
                return new BaseActionResult() { IsSuccess = isSuccess, Message = msg };
            }
            catch (Exception e)
            {
                msg = XiaoluResources.MSG_GEN_VERCODE_FAIL + string.Format(XiaoluResources.STR_FAIL_RESAON, ExceptionHelper.GetInnerExceptionInfo(e));
                return new BaseActionResult() { IsSuccess = false, Message = msg };
            }
        }
コード例 #51
0
ファイル: Default.aspx.cs プロジェクト: uvbs/taobaoke
    protected void Page_Load(object sender, EventArgs e)
    {
        string classNav = "图搜画报 - 画报淘宝";

        if (!IsPostBack)
        {
            DataTable dt;

            dt = db.getDataTable("select top 5 Tid,TreeName from NewsTree where taobaoKe<>'' order by newid() ");
            for (int i = 0; i < 5; i++)
            {
                ppRnd.Text += "<a href=\"/" + dt.Rows[i]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\">" + dt.Rows[i]["TreeName"].ToString().Trim() + "</a>";
                if (i < 4)
                {
                    ppRnd.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
            }
            dt.Dispose();
            ad468.Text = ad.getAdCode(0, 468, 60, 1, 0, true, string.Empty);

            listTop.Text = "<a href=\"/huabao/\" target=\"_top\">默认</a>";

            string pageStr = string.Empty;
            string searchStr = Server.UrlDecode(Request.QueryString["keyWord"]);
            string searchIf = string.Empty;
            string orderBy = " and volume > 100 Order By commission DESC,isGood desc";
            long sale = xc.SafeNum(Request.QueryString["sale"]);
            if (sale > 0)
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"/huabao/?sale=1\" style=\"color:#cb0201; font-weight:bold;\" target=\"_top\">销售</a>";
                orderBy = " Order By volume DESC";
                pageStr += "&sale=1";
            }
            else
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"/huabao/?sale=1\" target=\"_top\">销售</a>";
            }
            long price = xc.SafeNum(Request.QueryString["price"]);
            if (price > 0)
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"/huabao/?price=1\" style=\"color:#cb0201; font-weight:bold;\" target=\"_top\">价格</a>";
                orderBy = " Order By price ASC";
                pageStr += "&price=1";
            }
            else
            {
                listTop.Text += "&nbsp;&nbsp;<a href=\"/huabao/?price=1\" target=\"_top\">价格</a>";
            }

            //导航
            headMenu.Text = "<td valign=\"middle\" class=\"headBg1\"><a href=\"/\" target=\"_top\" class=\"head\">网站首页</a></td>";
            dt = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();
                string className = "headBg1";

                headMenu.Text += "<td valign=\"middle\" class=\"" + className + "\"><a href=\"/" + tid + ".htm\" target=\"_top\" class=\"head\">" + treeName + "</a></td>";
            }
            headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/default.htm\" target=\"_top\" class=\"head\">图搜画报</a></td><td valign=\"middle\" class=\"headBg2\"><a href=\"/huabao/\" target=\"_top\" class=\"head\">画报淘宝</a></td>";
            dt.Dispose();

            navClass.Text = "图搜画报 - 画报淘宝";
            if (!string.IsNullOrEmpty(searchStr as string))
            {
                if (xc.SafeNum(searchStr) > 0)
                {
                    searchIf = " and num_iid=" + searchStr;
                }
                else
                {
                    searchIf = " and title like '%" + searchStr + "%'";
                }

                searchWord.Text = searchStr;
                pageStr = "&keyWord=" + Server.UrlEncode(searchStr);

                classNav = "搜索结果";
                navClass.Text = classNav;
            }

            string strSql = "select top 3000 * from taobaoke where commission>5 " + searchIf + orderBy;
            //Response.Write(strSql);
            //Response.End();
            lblCurrentPage.Text = db.RepeaterDB(RepeaterList, strSql, pageStr, 30, "page", "right", true);
            string[] inputStr = lblCurrentPage.Text.Replace("<!-- input -->", "@").Split(new char[] { '@' });
            pageTop.Text = inputStr[0] + "</tr></table>";
            if (this.RepeaterList.Items.Count < 1)
            {
                if (string.IsNullOrEmpty(searchStr as string))
                {
                    errInfo.Text = "目前暂没有任何信息!";
                    errDiv.Visible = true;
                }
                else
                {
                    //即时搜索淘宝客显示商品
                    string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
                    string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
                    string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
                    string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID
                    ITopClient client = new DefaultTopClient(url, appkey, appsecret);
                    TaobaokeListurlGetRequest req = new TaobaokeListurlGetRequest();
                    req.Q = searchStr;
                    req.Nick = alimamaID;
                    TaobaokeListurlGetResponse response = client.Execute(req);

                    Response.Redirect(response.TaobaokeItem.KeywordClickUrl, true);
                }
            }
            else
            {
                errDiv.Visible = false;
            }

            //热搜关键词
            string hot = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "hotSearch");
            string[] hotWord = hot.Split(new char[] { ',' });
            for (int h = 0; h <= hotWord.GetUpperBound(0); h++)
            {
                hotSearch.Text += "<a href=\"/search.htm?keyWord=" + Server.UrlEncode(hotWord[h]) + "\" target=\"_top\" title=\"搜索 " + hotWord[h] + "\">" + hotWord[h] + "</a>&nbsp;";
            }

            xc.webMeta(this.Page, XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "KeyWord"), XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr"));

            this.Page.Title = classNav + " " + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");
        }
    }
コード例 #52
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //查询评价
    protected void Button2_Click(object sender, EventArgs e)
    {
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        TraderatesGetRequest req = new TraderatesGetRequest();
        req.Fields = "tid,oid,role,nick,result,created,rated_nick,item_title,item_price,content,reply,num_iid";
        req.RateType = "get";
        req.Role = "buyer";
        req.Result = "neutral";
        req.PageNo = 1L;
        req.PageSize = 100L;
        DateTime StartdateTime = DateTime.Parse("2012-09-01 00:00:00");
        req.StartDate = StartdateTime;
        //DateTime EnddateTime = DateTime.Parse("2012-12-30 00:00:00");
        DateTime EnddateTime = DateTime.UtcNow;
        req.EndDate = EnddateTime;
        //req.Tid = 123456L;
        req.UseHasNext = false;
        //req.NumIid = 1234L;
        TraderatesGetResponse response = client.Execute(req, sessionKey);
        //response.TradeRates;

        pingjianum.Text = Convert.ToString(response.TotalResults);
        评价详情.Text = response.Body;
        //订单编号.Text = Convert.ToString(response.TradeRates[0].Tid);

        GetUserAddress(ref client, ref req, ref response);
    }
コード例 #53
0
ファイル: FrmMain.cs プロジェクト: jiguixin/MyDemo
        private void PublishProduct()
        {
            string authCode = null;
            if (!GetAuthorizeCode( out authCode))
            {
                MessageBox.Show("没有找到相应的 authCode");
                return;
            }

            context = TopUtils.GetTopContext(authCode);

            ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "21479233", "98dd6f00daf3f94322ec1a4ff72370b7");

            #region 获取店铺类目

            SellercatsListGetRequest reqCats = new SellercatsListGetRequest();
            reqCats.Nick = context.UserNick;
            SellercatsListGetResponse responseCats = client.Execute(reqCats);
            sellerCats = responseCats.SellerCats;

            // var cats = responseCats.SellerCats.FirstOrDefault(f => f.Name == "");

            //714827841
            #endregion

            ItemAddRequest req = new ItemAddRequest();
            req.Num = 30L;
            req.Price = "2000.07";
            req.Type = "fixed";
            req.StuffStatus = "new";
            req.Title = "美邦男装";
            req.Desc = "这是一个好商品";
            req.LocationState = "浙江";
            req.LocationCity = "杭州";
            //req.ApproveStatus = "onsale";
            req.Cid = 50000436;
               // req.Props = "20000:33564;21514:38489";
            req.FreightPayer = "buyer";
            //req.ValidThru = 7L;
            req.HasInvoice = false;
            req.HasWarranty = false;
            req.HasShowcase = false;
            req.SellerCids = GetCatsList("T恤 - 长袖T恤;T恤 - 短袖T恤;T恤 - 圆领T恤", "Metersbonwe - 女装");
            req.HasDiscount = true;
            req.PostFee = "15.07";
            req.ExpressFee = "15.07";
            req.EmsFee = "25.07";
            DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            req.ListTime = dateTime;
            req.Increment = "2.50";
            FileItem fItem = new FileItem(@"C:\Users\Administrator\Desktop\a.png");
            req.Image = fItem;
               // req.PostageId = 775752L;
            //req.AuctionPoint = 5L;
            req.PropertyAlias = "pid:vid:别名;pid1:vid1:别名1";
            req.InputPids = "20000";
            req.SkuProperties = "pid:vid;pid:vid";
            req.SkuQuantities = "2,3,4";
            req.SkuPrices = "200.07";
            req.SkuOuterIds = "1234,1342";
            req.Lang = "zh_CN";
            req.OuterId = "12345";
            req.ProductId = 123456789L;
            req.PicPath = "i7/T1rfxpXcVhXXXH9QcZ_033150.jpg";
            req.AutoFill = "time_card";
            req.InputStr = "耐克;";
            req.IsTaobao = true;
            req.IsEx = true;
            req.Is3D = true;
            req.SellPromise = true;
            req.AfterSaleId = 47758L;
            req.CodPostageId = 53899L;
            req.IsLightningConsignment = true;
            req.Weight = 100L;
            req.IsXinpin = false;
            req.SubStock = 1L;
            req.FoodSecurityPrdLicenseNo = "QS410006010388";
            req.FoodSecurityDesignCode = "Q/DHL.001-2008";
            req.FoodSecurityFactory = "远东恒天然乳品有限公司";
            req.FoodSecurityFactorySite = "台北市仁爱路4段85号";
            req.FoodSecurityContact = "00800-021216";
            req.FoodSecurityMix = "有机乳糖、有机植物油";
            req.FoodSecurityPlanStorage = "常温";
            req.FoodSecurityPeriod = "2年";
            req.FoodSecurityFoodAdditive = "磷脂 、膨松剂";
            req.FoodSecuritySupplier = "深圳岸通商贸有限公司";
            req.FoodSecurityProductDateStart = "2012-06-01";
            req.FoodSecurityProductDateEnd = "2012-06-10";
            req.FoodSecurityStockDateStart = "2012-06-20";
            req.FoodSecurityStockDateEnd = "2012-06-30";
            req.GlobalStockType = "1";
            req.ScenicTicketPayWay = 1L;
            req.ScenicTicketBookCost = "5.99";
            req.ItemSize = "bulk:8";
            req.ItemWeight = "10";
            req.ChangeProp = "162707:28335:28335,28338";
            req.LocalityLifeChooseLogis = "0";
            req.LocalityLifeExpirydate = "2012-08-06,2012-08-16";
            req.LocalityLifeNetworkId = "5645746";
            req.LocalityLifeMerchant = "56879:码商X";
            req.LocalityLifeVerification = "101";
            req.LocalityLifeRefundRatio = 50L;
            req.LocalityLifeOnsaleAutoRefundRatio = 80L;
            req.PaimaiInfoMode = 1L;
            req.PaimaiInfoDeposit = 20L;
            req.PaimaiInfoInterval = 5L;
            req.PaimaiInfoReserve = "11";
            req.PaimaiInfoValidHour = 2L;
            req.PaimaiInfoValidMinute = 22L;
            ItemAddResponse response = client.Execute(req, context.SessionKey);
        }
コード例 #54
0
ファイル: ImagesUtil.cs プロジェクト: kldcty/movepic
 public static string uploadLocalImage(string image, string AppKey, string AppSecret, string SessionKey, StreamWriter MovePicLogWriter)
 {
     int tryCount = 0;
     while (true)
     {
         if (tryCount < 3)
         {
             tryCount++;
             if (tryCount > 1)
             {
                 Console.WriteLine("重试上传图片");
                 MovePicLogWriter.WriteLine("重试上传图片");
             }
         }
         else
         {
             break;
         }
         try
         {
             ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", AppKey, AppSecret);
             PictureUploadRequest req = new PictureUploadRequest();
             req.PictureCategoryId = 0L;
             FileItem fItem = new FileItem(image);
             req.Img = fItem;
             req.ImageInputTitle = Path.GetFileName(image);
             PictureUploadResponse response = client.Execute(req, SessionKey);
             if (response != null && response.Picture != null)
             {
                 Console.WriteLine("上传完成 " + response.Picture.PicturePath);
                 MovePicLogWriter.WriteLine("上传完成 " + response.Picture.PicturePath);
                 return response.Picture.PicturePath;
             }
         }
         catch (System.Net.WebException e)
         {
             Console.WriteLine("异常:" + e.Status + " " + e.Message);
             MovePicLogWriter.WriteLine("异常:" + e.Status + " " + e.Message);
         }
         Thread.Sleep(5000);
     }
     return "";
 }
コード例 #55
0
ファイル: ImagesUtil.cs プロジェクト: kldcty/movepic
        public static string uploadImage(string image, string AppKey, string AppSecret, string SessionKey, StreamWriter MovePicLogWriter)
        {
            Console.WriteLine("上传网络图片:" + image);
            MovePicLogWriter.WriteLine("上传网络图片:" + image);
            int tryCount = 0;
            while (true)
            {
                if (tryCount < 3)
                {
                    tryCount++;
                    if (tryCount > 1)
                    {
                        Console.WriteLine("重试上传图片");
                        MovePicLogWriter.WriteLine("重试上传图片");
                    }
                }
                else
                {
                    break;
                }
                try
                {
                    ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", AppKey, AppSecret);
                    HttpWebResponse resp = (HttpWebResponse)WebRequest.Create(image).GetResponse();
                    Console.WriteLine("获取图片返回状态码:" + resp.StatusCode);
                    MovePicLogWriter.WriteLine("获取图片返回状态码:" + resp.StatusCode);
                    if (resp.StatusCode == HttpStatusCode.OK)
                    {
                        Stream sm = resp.GetResponseStream();
                        MemoryStream ms = new MemoryStream();
                        byte[] buffer = new byte[4096];
                        int len;
                        len = sm.Read(buffer, 0, 4096);
                        while (len > 0)
                        {
                            ms.Write(buffer, 0, len);
                            len = sm.Read(buffer, 0, 4096);
                        }
                        byte[] imageBuffer = ms.GetBuffer();

                        ms.Close();
                        sm.Close();

                        PictureUploadRequest req = new PictureUploadRequest();
                        req.PictureCategoryId = 0L;
                        string fileName = System.DateTime.Now.ToString("yyyyMMddHH:mm:ss");
                        FileItem fItem = new FileItem(fileName, imageBuffer);
                        req.Img = fItem;
                        req.ImageInputTitle = fileName;
                        PictureUploadResponse response = client.Execute(req, SessionKey);
                        if (response != null && response.Picture != null)
                        {
                            Console.WriteLine("上传完成 " + response.Picture.PicturePath);
                            MovePicLogWriter.WriteLine("上传完成 " + response.Picture.PicturePath);
                            return response.Picture.PicturePath;
                        }
                    }
                }
                catch (System.Net.WebException e)
                {
                    Console.WriteLine("异常:" + e.Status + " " + e.Message);
                    MovePicLogWriter.WriteLine("异常:" + e.Status + " " + e.Message);
                }
                Thread.Sleep(5000);
            }
            return "";
        }
コード例 #56
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //get trade detail information by trade ID(tid) which is got from Traderates result.
    private void GetUserAddress(ref ITopClient client, ref TraderatesGetRequest req, ref TraderatesGetResponse GetUserAddress_response)
    {
        ITopClient GetUserAddressclient = new DefaultTopClient(url, appkey, appsecret);
        TradeFullinfoGetRequest GetUserAddress_req = new TradeFullinfoGetRequest();
        GetUserAddress_req.Fields = "alipay_no,commission_fee,received_payment,buyer_alipay_no,receiver_name,receiver_state, receiver_city, receiver_district, receiver_address, receiver_zip, receiver_mobile, receiver_phone,seller_flag";
        GetUserAddress_req.Tid = GetUserAddress_response.TradeRates[0].Tid;

        TradeFullinfoGetResponse response = GetUserAddressclient.Execute(GetUserAddress_req, sessionKey);
        //买家信息.Text = response.Trade.ReceiverAddress;

        NamePhone.Text = response.Trade.ReceiverName + response.Trade.ReceiverPhone + response.Trade.ReceiverMobile;
        BuyerAddress.Text = response.Trade.ReceiverState + " " + response.Trade.ReceiverCity + " " + response.Trade.ReceiverDistrict + " " + response.Trade.ReceiverAddress;
    }
コード例 #57
0
ファイル: SmsHelper.cs プロジェクト: neilchennan/Xiaolu
        public static BaseActionResult CheckVercode(string mobile, string ver_code)
        {
            String msg;
            try
            {
                ITopClient client = new DefaultTopClient(URL, APP_KEY, APP_SECRET, "json");
                OpenSmsCheckvercodeRequest req = new OpenSmsCheckvercodeRequest();

                req.CheckVerCodeRequest = "{\"ver_code\":\"" + ver_code + "\", \"mobile\":\"" + mobile + "\", \"check_fail_limit\" : \"100\"}";

                OpenSmsCheckvercodeResponse rsp = client.Execute(req);

                string respBody = rsp.Body;
                bool isSuccess = !rsp.IsError;

                if (isSuccess)
                {
                    checkvercode_success_response responseObj = JsonConvert.DeserializeObject<checkvercode_success_response>(respBody);
                    msg = responseObj.open_sms_checkvercode_response.result.message;
                }
                else
                {
                    AlibaichuanMsgError errRspObj = JsonConvert.DeserializeObject<AlibaichuanMsgError>(respBody);
                    msg = errRspObj.error_response.msg;
                }
                return new BaseActionResult() { IsSuccess = isSuccess, Message = msg };
            }
            catch (Exception e)
            {
                msg = XiaoluResources.MSG_CHECK_VERCODE_FAIL + string.Format(XiaoluResources.STR_FAIL_RESAON, ExceptionHelper.GetInnerExceptionInfo(e));
                return new BaseActionResult() { IsSuccess = false, Message = msg };
            }
        }
コード例 #58
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //根据卖家的所有出售中的宝贝的标题在蘑菇街中搜索,如果搜到则加入到<List>ItemsExt中。
    protected void Button5_Click(object sender, EventArgs e)
    {
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
        req.Fields = "num_iid";
        ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);

        // Items is List of Item, got from response.
        // ItemsExt it List of ItemExt, used for adding other information in DataList.

        baobeinumber.Text = Convert.ToString(response.TotalResults);

        for (int i = 1; i < (response.TotalResults / 40 + 2); i++)
        //for (int i = 1; i < 2; i++)
        {
            req.Fields = "num_iid,title,price,pic_url,has_showcase";
            req.PageNo = i;
            req.PageSize = 40L;
            ItemsOnsaleGetResponse response2 = client.Execute(req, sessionKey);

            int j = 1;
            foreach (Item ItemElement in response2.Items)
            {
                sousuojindu.Text = Convert.ToString((i - 1) * 40 + j);

                ItemExt ItemExtElement = new ItemExt(ItemElement);

                //根据宝贝标题进行搜索
                SearchInMogujie(ItemExtElement); //To get ItemExtElement.MogujieAddress and ItemExtElement.MogujieFavNum using title

                if (ItemExtElement.MogujieAddress != "您的宝贝尚未收录")
                {
                    ItemsExt.Add(ItemExtElement);
                    ItemExtElement.index = ItemsExt.IndexOf(ItemExtElement);

                    //如果发现宝贝被收录成功了,下一步是查该宝贝被收录的具体情况

            //WebBrowser web = new WebBrowser();
            //web.Navigate(ItemExtElement.MogujieAddress);
            //web.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(web_DocumentCompleted);

                    uploadDate.Text = ItemExtElement.MogujieAddress;
                    //FavoriteNum.Text = mogujienotehtml;

                    //using (StreamWriter sw = new StreamWriter(@"D:\00_Data\99_debugdata\" + ItemExtElement.Title + ".html"))//将获取的内容写入文本
                    //{
                    //    sw.Write(mogujienotehtml);
                    //}
                }
                j++;
            }
            //MogujieDataList.DataSource = ItemsExt;
            //MogujieDataList.DataBind();
        }
            MogujieDataList.DataSource = ItemsExt;
            MogujieDataList.DataBind();
            sousuojindu.Text = Convert.ToString(ItemsExt.Count);
    }
コード例 #59
0
ファイル: SmsHelper.cs プロジェクト: neilchennan/Xiaolu
        //发送短信验证码
        public static BaseActionResult SendMsg(string mobile, string ver_code, bool realsend = true)
        {
            String msg;
            if (!realsend)
            {
                return new BaseActionResult() { IsSuccess = true, Message = @"
                <open_sms_sendmsg_response>
                <result>
                    <code>1</code>
                    <datas>
                        <task_id>421206248265132472</task_id>
                    </datas>
                    <message>SUCCESS</message>
                    <successful>true</successful>
                </result>
                <request_id>101yxmwbhzd8t</request_id>
                </open_sms_sendmsg_response>
                <!--top010178059118.n.et2-->"
                };
            }
            try
            {
                ITopClient client = new DefaultTopClient(URL, APP_KEY, APP_SECRET, "json");
                OpenSmsSendmsgRequest req = new OpenSmsSendmsgRequest();
                req.SendMessageRequest = "{\"external_id\":\"wb121212\",\"template_id\":\"142571913\",\"signature_id\":\"786\",\"mobile\":\""
                    + mobile + "\",\"context\":{\"code\":\"" + ver_code + "\", \"minute\":\"2\", \"name\":\"小鹿\"}}";

                OpenSmsSendmsgResponse rsp = client.Execute(req);

                string respBody = rsp.Body;
                bool isSuccess = !rsp.IsError;

                if (isSuccess)
                {
                    sendmsg_success_response responseObj = JsonConvert.DeserializeObject<sendmsg_success_response>(respBody);
                    msg = responseObj.open_sms_sendmsg_response.result.message;
                }
                else
                {
                    AlibaichuanMsgError errRspObj = JsonConvert.DeserializeObject<AlibaichuanMsgError>(respBody);
                    msg = errRspObj.error_response.msg;
                }
                return new BaseActionResult() { IsSuccess = isSuccess, Message = msg };
            }
            catch (Exception e)
            {
                msg = XiaoluResources.MSG_SEND_VERCODE_FAIL + string.Format(XiaoluResources.STR_FAIL_RESAON, ExceptionHelper.GetInnerExceptionInfo(e));
                return new BaseActionResult() { IsSuccess = false, Message = msg };
            }
        }
コード例 #60
0
ファイル: posterIDs.aspx.cs プロジェクト: uvbs/taobaoke
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        PosterChannelsGetRequest req = new PosterChannelsGetRequest();
        PosterChannelsGetResponse response = client.Execute(req);

        Response.Write("自动同步淘画报频道ID,如出现死机或出错,重新点击自动更新即可;<br />");
        Response.Flush();

        string strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP,@isFlag";
        string[] strValue = new string[7];

        for (int ii = 0; ii < response.Channels.Count; ii++)
        {
            strValue[0] = response.Channels[ii].Id.ToString();
            strValue[1] = response.Channels[ii].ChannelName.ToString();
            strValue[2] = response.Channels[ii].NameEn.ToString();
            if (string.IsNullOrEmpty(response.Channels[ii].Description as string))
            {
                strValue[3] = string.Empty;
            }
            else
            {
                strValue[3] = response.Channels[ii].Description;
            }
            strValue[4] = xc.adminID;
            strValue[5] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            strValue[6] = xc.GetIP();

            dt = db.getDataTable("select * from posterChannelIDs where id=" + response.Channels[ii].Id.ToString());  //防止重复插入
            if (dt.Rows.Count > 0)
            {
                strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP";
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, "id=" + response.Channels[ii].Id.ToString());
            }
            else
            {
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, string.Empty);
            }
            dt.Dispose();

            Response.Write("同步 " + strValue[1] + " [" + strValue[2] + "] " + " 已完成;<br />");
            Response.Flush();
        }
        //宝贝同步结束
    }