コード例 #1
0
        public object Do_PickupOrderGoods(BaseApi baseApi)
        {
            PickupOrderGoodsParam pickupOrderGoodsParam = JsonConvert.DeserializeObject <PickupOrderGoodsParam>(baseApi.param.ToString());

            if (pickupOrderGoodsParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));
            StoreDao  storeDao  = new StoreDao();

            if (!storeDao.UpdateOrderState(pickupOrderGoodsParam.orderId, storeUser.storeUserId))
            {
                throw new ApiException(CodeMessage.PickupGoodsError, "PickupGoodsError");
            }
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = pickupOrderGoodsParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.ORDER,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);
            return("");
        }
コード例 #2
0
        public object Do_MemberCheckStore(BaseApi baseApi)
        {
            MemberCheckStoreParam memberCheckStoreParam = JsonConvert.DeserializeObject <MemberCheckStoreParam>(baseApi.param.ToString());

            if (memberCheckStoreParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            MemberCheckStoreCodeParam memberCheckStoreCodeParam = new MemberCheckStoreCodeParam
            {
                code = memberCheckStoreParam.code,
            };

            MemberCheckStoreCode memberCheckStoreCode = Utils.GetCache <MemberCheckStoreCode>(memberCheckStoreCodeParam);

            if (memberCheckStoreCode == null)
            {
                throw new ApiException(CodeMessage.InvalidMemberCkeckStoreCode, "InvalidMemberCkeckStoreCode");
            }

            StoreDao storeDao = new StoreDao();
            string   phone    = storeDao.CheckStoreMember(storeUser.storeId, memberCheckStoreCode.memberId);

            if (phone == "")
            {
                throw new ApiException(CodeMessage.NeedStoreMember, "NeedStoreMember");
            }

            if (memberCheckStoreParam.consume == 0 && !storeDao.CheckMemberCheckStore(storeUser.storeId, memberCheckStoreCode.memberId))
            {
                throw new ApiException(CodeMessage.AlreadyCheckThisStoreToday, "AlreadyCheckThisStoreToday");
            }

            if (!storeDao.InserMemberCheckStore(storeUser.storeId, memberCheckStoreCode.memberId, memberCheckStoreParam.consume, storeUser.storeUserId))
            {
                throw new ApiException(CodeMessage.MemberCkeckStoreError, "MemberCkeckStoreError");
            }

            Utils.DeleteCache <MemberCheckStoreCode>(memberCheckStoreCodeParam);
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = memberCheckStoreCodeParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.CHECK,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);

            return("");
        }
コード例 #3
0
        public object Do_Exchange(BaseApi baseApi)
        {
            ExchangeParam exchangeParam = JsonConvert.DeserializeObject <ExchangeParam>(baseApi.param.ToString());

            if (exchangeParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }

            ScanExchangeCodeParam scanExchangeCodeParam = new ScanExchangeCodeParam
            {
                code = exchangeParam.code
            };

            ExchangeCode exchangeCode = Utils.GetCache <ExchangeCode>(scanExchangeCodeParam);

            if (exchangeCode == null)
            {
                throw new ApiException(CodeMessage.InvalidExchangeCode, "InvalidExchangeCode");
            }

            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            StoreDao storeDao = new StoreDao();
            string   phone    = storeDao.CheckStoreMember(storeUser.storeId, exchangeCode.memberId);

            if (phone == "")
            {
                throw new ApiException(CodeMessage.NeedStoreMember, "NeedStoreMember");
            }

            if (!storeDao.InserRemoteCommit(storeUser.storeId, phone, exchangeParam.score))
            {
                throw new ApiException(CodeMessage.ExchangeError, "ExchangeError");
            }

            Utils.DeleteCache <ExchangeCode>(scanExchangeCodeParam);
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = scanExchangeCodeParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.EXCHANGE,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);
            return("");
        }