Exemple #1
0
        public JsonResult GetWXCardData(long id, long rid)
        {
            Entities.WXJSCardModel result = new Entities.WXJSCardModel();
            bool isdataok = true;

            #region  步微信前信息准备
            if (isdataok)
            {
                if (this.PlatformType == PlatformType.WeiXin)
                {
                    result = _iWXCardService.GetJSWeiXinCard(id, rid, ThisCouponType);
                }
            }
            #endregion
            return(Json <dynamic>(success: true, data: result));
        }
Exemple #2
0
        /// <summary>
        /// 获取同步微信JS
        /// </summary>
        /// <param name="couponcodeid"></param>
        /// <param name="couponType"></param>
        /// <returns></returns>
        public Entities.WXJSCardModel GetJSWeiXinCard(long couponid, long couponcodeid, Entities.WXCardLogInfo.CouponTypeEnum couponType)
        {
            Entities.WXJSCardModel result = new Entities.WXJSCardModel();
            result.cardId = "0"; //默认不可同步
            bool isNeedSyncWX = false;

            Entities.WXCardLogInfo     wxcardinfo = null;
            Entities.WXCardCodeLogInfo wxcodeinfo = null;
            wxcardinfo = Get(couponid, couponType);
            if (wxcardinfo != null)
            {
                if (wxcardinfo.AuditStatus == (int)Entities.WXCardLogInfo.AuditStatusEnum.Audited)
                {
                    isNeedSyncWX = true;
                }
            }
            if (isNeedSyncWX)
            {
                wxcodeinfo = GetCodeInfo(couponcodeid, couponType);
                if (wxcodeinfo != null)
                {
                    if (wxcodeinfo.CodeStatus != (int)Entities.WXCardCodeLogInfo.CodeStatusEnum.WaitReceive)
                    {
                        isNeedSyncWX = false;
                    }
                }
            }
            if (isNeedSyncWX)
            {
                var data = MakeSyncWXJSInfo(wxcardinfo.CardId, couponcodeid, couponType);
                if (data != null)
                {
                    result.cardId            = data.card_id;
                    result.cardExt           = new Entities.WXJSCardExtModel();
                    result.cardExt.signature = data.signature;
                    result.cardExt.timestamp = data.timestamp;
                    result.cardExt.nonce_str = data.nonce_str;
                    result.cardExt.outer_id  = data.outerid;
                }
            }
            return(result);
        }