Subversion Repositories SmartDukaan

Rev

Rev 14002 | Rev 14037 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14002 Rev 14005
Line 156... Line 156...
156
            val['source_product_name'] = ""
156
            val['source_product_name'] = ""
157
            val['skuBundleId'] = ""
157
            val['skuBundleId'] = ""
158
        data.append(val)
158
        data.append(val)
159
    return data
159
    return data
160
 
160
 
161
def getMerchantOrdersByUser(userId, page=1, window=50):
161
def getMerchantOrdersByUser(userId, page=1, window=50, searchMap={}):
-
 
162
    if searchMap is None:
-
 
163
        searchMap = {}
162
    if page==None:
164
    if page==None:
163
        page = 1
165
        page = 1
164
        
166
        
165
    if window==None:
167
    if window==None:
166
        window = 50
168
        window = 50
167
    result = {}
169
    result = {}
168
    skip = (page-1)*window
170
    skip = (page-1)*window
-
 
171
    
-
 
172
    searchMap['userId'] = userId
169
    collection = get_mongo_connection().Dtr.merchantOrder
173
    collection = get_mongo_connection().Dtr.merchantOrder
170
    cursor = collection.find({"userId":userId}).sort("_id",-1)
174
    cursor = collection.find(searchMap).sort("_id",-1)
171
    total_count = cursor.count()
175
    total_count = cursor.count()
172
    pages = total_count/window + (0 if total_count%window==0 else 1)  
176
    pages = total_count/window + (0 if total_count%window==0 else 1)  
173
    print "total_count", total_count
177
    print "total_count", total_count
174
    if total_count > skip:
178
    if total_count > skip:
175
        cursor = cursor.skip(skip).limit(window)
179
        cursor = cursor.skip(skip).limit(window)