示例#1
0
        public object Do_ScanOrderCode(BaseApi baseApi)
        {
            ScanOrderCodeParam scanOrderCodeParam = JsonConvert.DeserializeObject <ScanOrderCodeParam>(baseApi.param.ToString());

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

            StoreGoodsCode storeGoodsCode = Utils.GetCache <StoreGoodsCode>(scanOrderCodeParam);

            if (storeGoodsCode == null)
            {
                throw new ApiException(CodeMessage.InvalidOrderCode, "InvalidOrderCode");
            }
            StoreDao  storeDao  = new StoreDao();
            string    storeId   = storeDao.GetStoreId(storeGoodsCode.order.storeCode);
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            if (storeUser.storeId != storeId)
            {
                throw new ApiException(CodeMessage.NotStoreUserOrder, "NotStoreUserOrder");
            }
            Utils.DeleteCache <StoreGoodsCode>(scanOrderCodeParam);
            return(storeGoodsCode.order);
        }