Example #1
0
 def get(self, request):
     title = request.GET.get('title')
     news_id = request.GET.get('news_id')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     if news_id:
         sql = f"SELECT * FROM information WHERE title LIKE '%{title}%' ORDER BY create_time DESC "
         info = mysql.getAll(sql)
         mysql.dispose()
         if info:
             for i in info:
                 i['details'] = html.unescape(i.get('details'))
             sum_page, info = Pagings.paging(info, row=row, page=page)
             data = {}
             data['sum_page'] = sum_page
             data['info'] = info
             data = json.dumps(data, ensure_ascii=False, sort_keys=True, indent=4, cls=ComplexEncode)
             return HttpResponse(data)
         return HttpResponse(0)
     else:
         print('id形式')
         sql = f"SELECT * FROM information WHERE id = '{news_id}'"
         info = mysql.getOne(sql)
         info['details'] = html.unescape(info.get('details'))
         mysql.dispose()
         if info:
             info = json.dumps(info, ensure_ascii=False, sort_keys=True, indent=4, cls=ComplexEncode)
             return HttpResponse(info)
         else:
             return HttpResponse(0)
Example #2
0
 def get(self, request):
     self.params = {}
     self.params['mer_id'] = request.GET.get('mer_id')
     self.params['row'] = request.GET.get('row')
     self.params['page'] = request.GET.get('page')
     self.params['product_name'] = request.GET.get('product_name')
     mysql = Mysql()
     sql = "SELECT * FROM mer_product WHERE mer_id = {mer_id} AND product_name \
         LIKE '%{product_name}%'".format(
         mer_id=self.params['mer_id'],
         product_name=self.params['product_name'])
     print(sql)
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info,
                                        row=self.params['row'],
                                        page=self.params['page'])
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data,
                           ensure_ascii=False,
                           sort_keys=True,
                           indent=4,
                           cls=ComplexEncode)
         return HttpResponse(data)
     return HttpResponse(0)
Example #3
0
    def get(self, request):
        recurrence_no = request.GET.get('recurrence_no')
        recurrence_name = request.GET.get('recurrence_name')
        row = int(request.GET.get('row'))
        page = int(request.GET.get('page'))
        mysql = Mysql()
        if recurrence_no:
            sql = f"SELECT * FROM recurrence WHERE recurrence_no \
                = '{recurrence_no}'"

        if recurrence_name:
            sql = f"SELECT * FROM recurrence WHERE recurrence_name \
                LIKE '%{recurrence_name}%'"

        if not recurrence_no and not recurrence_name:
            sql = "SELECT * FROM recurrence"
        info = mysql.getAll(sql)
        mysql.dispose()
        if info:
            sum_page, info = Pagings.paging(info, row=row, page=page)
            data = {}
            data['sum_page'] = sum_page
            data['info'] = info
            data = json.dumps(data,
                              ensure_ascii=False,
                              sort_keys=True,
                              indent=4)
            return HttpResponse(data)
        return HttpResponse(0)
Example #4
0
    def get(self, request):
        start_time = request.GET.get('start_time')
        end_time = request.GET.get('end_time')
        row = request.GET.get('row')
        page = request.GET.get('page')
        mysql = Mysql()
        sql = f"SELECT \
                    COUNT(*) AS numbs, \
                    s.store_name, \
                    sum(o.orderMoney) AS sum_money \
                FROM  orders AS o ON  \
                LEFT JOIN store AS s ON o.store_id = s.id \
                WHERE o.state = 4  AND \
                o.createTime BETWEEN '{start_time}' AND '{end_time}' GROUP BY s.id "

        info = mysql.getAll(sql)
        mysql.dispose()
        if info:
            sum_page, info = Pagings.paging(info, row=row, page=page)
            data = {}
            data['sum_page'] = sum_page
            data['info'] = info
            data = json.dumps(data,
                              ensure_ascii=False,
                              sort_keys=True,
                              indent=4,
                              cls=ComplexEncode)
            return HttpResponse(data)
        return HttpResponse(0)
Example #5
0
 def get(self, request):
     area_name = request.GET.get('area_name')
     row = request.GET.get('row')
     page = request.GET.get('page')
     area_id = request.GET.get('area_id')
     get_school = request.GET.get('get_school')
     mysql = Mysql()
     if int(get_school) == 0:
         sql = "SELECT * FROM school_area WHERE area_name like '%{area_name}%'".format(
             area_name=area_name)
     if int(get_school) == 1:
         sql = "SELECT * FROM school WHERE area_id = '{area_id}'".format(
             area_id=area_id)
     print(sql)
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info, row=row, page=page)
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data,
                           ensure_ascii=False,
                           sort_keys=True,
                           indent=4)
         return HttpResponse(data)
     return HttpResponse(0)
Example #6
0
    def get(self, request):
        user_id = request.GET.get("user_id")
        row = request.GET.get('row')
        page = request.GET.get('page')
        mysql = Mysql()
        page, row = Pagings.mysqlPagings(page=page, row=row)
        sql = f"SELECT id, logtime, detail, prize_type, `get` FROM \
            reward_log WHERE user_id = {user_id} AND prize_type !=8 \
            ORDER BY logtime DESC limit {page}, {row}"

        info = mysql.getAll(sql)
        sql = f"SELECT COUNT(id) as c FROM reward_log WHERE \
            user_id = {user_id} AND prize_type !=8"

        sum_page = mysql.getOne(sql)
        sum_page = math.ceil(int(sum_page.get('c')) / int(row))
        mysql.dispose()
        if info:
            data = {}
            data['sum_page'] = sum_page
            data['info'] = info
            data = json.dumps(data,
                              ensure_ascii=False,
                              sort_keys=True,
                              indent=4,
                              cls=ComplexEncode)
            return HttpResponse(data)
        return HttpResponse(0)
Example #7
0
 def get(self, request):
     info, iswin = self.sel_activity()
     data = {}
     data['iswin'] = iswin
     if info:
         sumpage, Asoder = Pagings.paging(info, request.GET.get('row'),
                                          request.GET.get('page'))
         if len(Asoder) == 0:
             pass
         else:
             data['pagecount'] = sumpage
             asos = []
             data['info'] = asos
             for aso in Asoder:
                 asos.append({
                     'act_id': aso.get('id'),
                     'activityName': aso.get('activityName'),
                     'activityImg': aso.get('activityImg'),
                     'startTime': aso.get('startTime'),
                     'endTime': aso.get('endTime'),
                     'poster': aso.get('poster'),
                     'class_id': aso.get('acti_class_id')
                 })
     else:
         pass
     return JsonResponse(data)
Example #8
0
 def get(self, request):
     state = request.GET.get('state') #0未领取 1领取
     re_id = request.GET.get('re_id')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = ""
     if state:
         sql = f"SELECT reward_log.*, userInfo.wxname, userInfo.user_img FROM reward_log \
                 LEFT JOIN userInfo ON reward_log.user_id = userInfo.id WHERE \
                 (prize_type = 1 or prize_type = 2) AND `get` = {state}"
     else:
         sql = "SELECT reward_log.*, userInfo.wxname, userInfo.user_img FROM reward_log \
                 LEFT JOIN userInfo ON reward_log.user_id = userInfo.id WHERE \
                 (prize_type = 1 or prize_type = 2)"
     if re_id:
         sql = f"SELECT reward_log.*, userInfo.wxname, userInfo.user_img FROM reward_log \
                 LEFT JOIN userInfo ON reward_log.user_id = userInfo.id WHERE \
                 (prize_type = 1 or prize_type = 2) AND reward_log.id = {re_id}"
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info, row=row, page=page)
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data, ensure_ascii=False, sort_keys=True, indent=4, cls=ComplexEncode)
         return HttpResponse(data)
     return HttpResponse(0)
Example #9
0
    def get(self, request):
        name = request.GET.get('store_name')
        row = request.GET.get('row')
        page = request.GET.get('page')
        sql = f"SELECT s.*, \
                    sum( \
                        CASE \
                        WHEN p.upper_shelf IS NULL THEN \
                            0 \
                        ELSE \
                            p.upper_shelf \
                        END \
                    ) iRackNum, \
                    count(p.id) iTotalNum \
                FROM \
                    store AS s \
                LEFT JOIN product AS p ON s.id = p.store_id \
                WHERE s.store_name LIKE '%{name}%' \
                GROUP BY s.id"

        info = query(sql)
        if info['result']:
            sum_page, new_info = Pagings.paging(info['result'],
                                                row=row,
                                                page=page)
            data = {}
            data['sum_page'] = sum_page
            data['info'] = new_info
            info['result'] = data
        return HttpResponse(callJson(data=info))
Example #10
0
File: mer.py Project: echodia/mixed
    def selProduct(self):
        mysql = Mysql()
        sql = "SELECT * FROM mer_product WHERE mer_id = %s limit %s, %s"
        page, row = Pagings.mysqlPagings(self.params['page'],
                                         self.params['row'])
        product = mysql.getAll(sql, param=[self.params['mer_id'], page, row])
        for i in product:
            sql = "SELECT * FROM mer_stock WHERE product_id = %s"
            stock = mysql.getAll(sql, param=[i.get('product_id')])
            if stock:
                i['stock'] = stock
                sql = "SELECT spec_id, spec_name FROM mer_spec WHERE product_id = %s"
                spec_name = mysql.getAll(sql, param=[i.get('product_id')])
                spec_info = []
                if stock[0].get('stock_specs'):
                    for x in spec_name:
                        spec_deatil_dic = {}
                        spec_deatil_dic['spec'] = x
                        sql = "SELECT spec_detail_id, detail_name FROM mer_specdetail \
                            WHERE spec_id = %s"

                        spec_detail = mysql.getAll(sql,
                                                   param=[x.get('spec_id')])
                        spec_deatil_dic['spec_detail'] = spec_detail
                        spec_info.append(spec_deatil_dic)
                    i['spec_info'] = spec_info
        mysql.dispose()
        return HttpResponse(returnJson(0, '查询成功', product))
Example #11
0
    def get(self, request):
        store_id = request.GET.get('store_id')
        order_num = request.GET.get('order_num')  #订单编号
        order_state = request.GET.get(
            'order_state')  #订单状态0待付款1代发货2待收货3售后4已完成5取消6抽奖
        row = request.GET.get('row')
        page = request.GET.get('page')
        print(request.GET)
        mysql = Mysql()
        sql = "SELECT orders.*, userInfo.wxname, store.store_name FROM orders \
                LEFT JOIN userInfo ON orders.createUser = userInfo.id \
                LEFT JOIN store ON store.id = orders.store_id \
                ORDER BY createTime DESC"

        if order_num:
            sql = f"SELECT orders.*, userInfo.wxname, store.store_name FROM orders \
                LEFT JOIN userInfo ON orders.createUser = userInfo.id \
                LEFT JOIN store ON store.id = orders.store_id \
                WHERE orders.orderNum = '{order_num}' \
                ORDER BY createTime DESC"

        if order_state:
            sql = f"SELECT orders.*, userInfo.wxname, store.store_name FROM orders \
                LEFT JOIN userInfo ON orders.createUser = userInfo.id \
                LEFT JOIN store ON store.id = orders.store_id \
                WHERE orders.state = '{order_state}' \
                ORDER BY createTime DESC"

        if store_id:
            sql = f"SELECT orders.*, userInfo.wxname, store.store_name FROM orders \
                LEFT JOIN userInfo ON orders.createUser = userInfo.id \
                LEFT JOIN store ON store.id = orders.store_id \
                WHERE orders.store_id = '{store_id}' \
                ORDER BY createTime DESC"

        if store_id and order_state:
            sql = f"SELECT orders.*, userInfo.wxname, store.store_name FROM orders \
                LEFT JOIN userInfo ON orders.createUser = userInfo.id \
                LEFT JOIN store ON store.id = orders.store_id \
                WHERE orders.store_id = '{store_id}' AND orders.state = '{order_state}' \
                ORDER BY createTime DESC"

        info = mysql.getAll(sql)
        mysql.dispose()
        if info:
            sumpage, info = Pagings.paging(info, row=row, page=page)
            data = {}
            data['sumpage'] = sumpage
            data['info'] = info
            data = json.dumps(data,
                              ensure_ascii=False,
                              sort_keys=True,
                              indent=4,
                              cls=ComplexEncode)
            return HttpResponse(data)
        return HttpResponse(0)
Example #12
0
 def post(self, request):
     self.__reqData['name'] = request.POST.get('name', False)
     self.__reqData['row'] = request.POST.get('row')
     self.__reqData['page'] = request.POST.get('page')
     info = self.sel_class_list()
     if not info:
         return HttpResponse(0)
     pages, classes = Pagings.paging(info, self.__reqData['row'],
                                     self.__reqData['page'])
     data = {}
     data["pages"] = pages
     data['classes'] = classes
     return HttpResponse(callJson(data))
Example #13
0
    def get(self, request):
        page = request.GET.get('page')
        row = request.GET.get('row')
        store_id = request.GET.get('store_id', False)  #店铺id
        product_name = request.GET.get('product_name', '')  #名字 不传返全部
        upper_shelf = request.GET.get('upper_shelf', False)  #1上架 0下架, 不传就全部

        sql = f"SELECT \
                    p.id, \
                    p.store_id, \
                    p.productName, \
                    p.productImg, \
                    p.hehecoin, \
                    p.minPrice AS price, \
                    p.user_goods_limit, \
                    p.remark, \
                    p.label, \
                    p.notes, \
                    upper_shelf, \
                    s.store_name, \
                    p.productTypeId AS ziji_id, \
                    pc.`name` AS ziji_name, \
                    pc.parentId AS fuji_id, \
                    pc1.`name` AS fuji_name \
                FROM \
                    product p \
                LEFT JOIN proclass pc ON p.productTypeId = pc.id \
                LEFT JOIN proclass pc1 ON pc.parentId = pc1.id \
                LEFT JOIN store s ON p.store_id = s.id \
                WHERE \
                    p.productName LIKE '%{product_name}%' \
                    AND p.state = 1 "

        if upper_shelf:
            sql = sql + f"AND p.upper_shelf = {upper_shelf} "
        if store_id:
            sql = sql + f"AND p.store_id = {store_id} "
        sql = sql + 'ORDER BY p.create_time DESC'
        info = query(sql)

        if info['result']:
            sum_page, new_info = Pagings.paging(info['result'],
                                                row=row,
                                                page=page)
            data = {}
            data['sum_page'] = sum_page
            data['info'] = new_info
            info['result'] = data
        return HttpResponse(callJson(data=info))
Example #14
0
 def get(self, request):
     store_id = request.GET.get('store_id')
     start_time = request.GET.get('start_time')
     end_time = request.GET.get('end_time')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = f'''SELECT \
                 COUNT(*) AS numbs, \
                 SUM(orderMoney) AS sum_money \
             FROM \
                 orders \
             WHERE \
                 store_id = "{store_id}" \
             AND state = 4 \
             AND createTime BETWEEN "{start_time}" \
             AND "{end_time}"'''
     month_info = mysql.getOne(sql)
     sql = f'''SELECT \
                 COUNT(*) AS numbs, \
                 DATE_FORMAT(createTime, "%Y-%m-%d") AS creata_time, \
                 SUM(orderMoney) AS sum_money \
             FROM \
                 orders \
             WHERE \
                 store_id = "{store_id}" \
             AND state = 4 \
             AND createTime BETWEEN "{start_time}" \
             AND "{end_time}" \
             GROUP BY \
                 DATE_FORMAT(createTime, "%Y-%m-%d")'''
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sum_page, info = Pagings.paging(info, row=row, page=page)
         data = {}
         data['sum_page'] = sum_page
         data['month_info'] = month_info
         data['info'] = info
         data = json.dumps(data,
                           ensure_ascii=False,
                           sort_keys=True,
                           indent=4,
                           cls=ComplexEncode)
         return HttpResponse(data)
     return HttpResponse(0)
Example #15
0
 def get(self, request):
     quiz_name = request.GET.get('quiz_name')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = f"SELECT * from daily_quiz as d \
         WHERE d.quiz_name LIKE '%{quiz_name}%'"
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sum_page, info = Pagings.paging(info, row=row, page=page)
         data = {}
         data['sum_page'] = sum_page
         data['info'] = info
         data = json.dumps(data, ensure_ascii=False, sort_keys=True, indent=4, cls=ComplexEncode)
         return HttpResponse(data)
     return HttpResponse(0)
Example #16
0
 def get(self, request, **payload):
     user_id = payload.get('user_id')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     page, row = Pagings.mysqlPagings(page=page, row=row)
     sql = f"SELECT mp.order_num, mp.order_money, mp.wx_money, mp.balance, \
             mp.hhcoin, mp.state, mp.create_time, mr.mer_name FROM mer_pay \
             AS mp LEFT JOIN merchant AS mr ON mp.mer_id = mr.mer_id WHERE \
             mr.mer_id IS NOT NULL AND mp.user_id = {user_id} limit {page}, {row}"
     info = mysql.getAll(sql)
     if info:
         # 总页数
         sql = f"SELECT ceil(COUNT(mp.id) / 5) AS sum_page \
             FROM mer_pay AS mp WHERE mp.user_id = {user_id} "
         sum_page = mysql.getOne(sql)
         # 总金额
         sql = f"SELECT sum(wx_money+balance+0.1*hhcoin) AS sum_money \
             FROM mer_pay WHERE user_id = {user_id}"
         sum_money = mysql.getOne(sql)
         # 本月订单数
         sql = f"SELECT COUNT(*) AS month_orders FROM mer_pay \
             WHERE DATE_FORMAT( create_time, '%Y%m' ) = \
             DATE_FORMAT( CURDATE( ) , '%Y%m' ) AND user_id = {user_id}"
         month_orders = mysql.getOne(sql)
         # 总订单数
         sql = f"SELECT COUNT(id) AS sum_order FROM mer_pay WHERE user_id = {user_id}"
         sum_order = mysql.getOne(sql)
         # 本月金额
         sql = f"SELECT SUM(wx_money+balance) AS month_money \
             FROM mer_pay WHERE DATE_FORMAT( create_time, '%Y%m' ) \
             = DATE_FORMAT( CURDATE( ) , '%Y%m' ) AND user_id = {user_id}"
         month_money = mysql.getOne(sql)
         data = {}
         data['sum_page'] = sum_page.get('sum_page')
         data['sum_money'] = sum_money.get('sum_money')
         data['month_orders'] = month_orders.get('month_orders')
         data['sum_order'] = sum_order.get('sum_order')
         data['month_money'] = month_money.get('month_money')
         data['info'] = info
         mysql.dispose()
         return HttpResponse(callJson(data))
     mysql.dispose()
     return HttpResponse(0)
Example #17
0
    def get(self, request):
        pro_typeid = request.GET.get('class_id')
        page = request.GET.get('page')
        row = request.GET.get('row')

        mysql = Mysql()
        sql = "SELECT * FROM product WHERE productTypeId \
             = %s"

        info = mysql.getAll(sql, param=[pro_typeid])
        mysql.dispose()

        if info:
            page_count, info = Pagings.paging(info, row=row, page=page)
            data = {}
            data['page_count'] = page_count
            data['info'] = info
            return HttpResponse(callJson(data))
        return HttpResponse(0)
Example #18
0
 def get(self, request):
     prize_name = request.GET.get('prize_name')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = "SELECT prize.*, prize_class.class_name, prize_type_class.prize_type_name FROM prize \
         LEFT JOIN prize_class ON prize.class_id = prize_class.id \
         LEFT JOIN prize_type_class ON prize.prize_type = prize_type_class.prize_type_id \
         WHERE prize.prize_detail LIKE '%{prize_name}%'".format(prize_name=prize_name)
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info, row=row, page=page)
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data, ensure_ascii=False, sort_keys=True, indent=4)
         return HttpResponse(data)
     return HttpResponse(0)
Example #19
0
 def get(self, request):
     school_id = request.GET.get('school_id')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = "SELECT * FROM school_address WHERE school_id = '{school_id}'".format(
         school_id=school_id)
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info, row, page)
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data,
                           ensure_ascii=False,
                           sort_keys=True,
                           indent=4)
         return HttpResponse(data)
     return HttpResponse(0)
Example #20
0
 def get(self, request):
     school_name = request.GET.get('school_name')
     row = request.GET.get('row')
     page = request.GET.get('page')
     mysql = Mysql()
     sql = "SELECT school.*, school_area.area_name FROM school LEFT JOIN school_area \
             ON school.area_id = school_area.id \
             WHERE school_name like '%{school_name}%'".format(
         school_name=school_name)
     info = mysql.getAll(sql)
     mysql.dispose()
     if info:
         sumpage, info = Pagings.paging(info, row, page)
         data = {}
         data['sumpage'] = sumpage
         data['info'] = info
         data = json.dumps(data,
                           ensure_ascii=False,
                           sort_keys=True,
                           indent=4)
         return HttpResponse(data)
     return HttpResponse(0)
Example #21
0
    def post(self, request, **payload):

        handle = payload.get('handle')
        self.info['order_num'] = request.POST.get('order_num')
        self.info['row'] = request.POST.get('row')
        self.info['page'] = request.POST.get('page')
        self.info['order_type'] = request.POST.get('order_type')

        self.info['as_type'] = request.POST.get('as_type')  # 退货0,换货1
        self.info['order_state'] = request.POST.get('order_state') #订单状态
        self.info['why'] = request.POST.get('why')  #补充说明

        #下单
        self.info['user_id'] = payload.get('user_id')  #用户id
        self.info['sendTime'] = request.POST.get('send_time')    #送货时间
        self.info['address'] = request.POST.get('address')  #收货地址
        self.info['phone'] = request.POST.get('phone')  #手机号码
        self.info['remark'] = request.POST.get('remark')    #备注
        self.info['Consignee'] = request.POST.get('consignee')  #收货人
        self.info['order_num'] = getOrderNum('ShopOrder')  #订单编号
        self.info['freight'] = request.POST.get('freight') #运费状态,为0则运费为3,否则运费为0
        self.info['stock_list'] = request.POST.get('stock_list')
        #库存列表 传列表套对象[{stock_id:1,num:1, store_id:1},{stock_id:1,num:1, store_id:1}]
        
        cache_name = 'order-' + self.info['order_num']

        if handle == 'confirm':
            mysql = Mysql()
            sql = 'UPDATE orders SET state = %s WHERE orderNum = %s'
            mysql.update(sql, param=[4, self.info['order_num']])
            mysql.dispose()
            return HttpResponse(returnJson(0, '确认成功'))

        if handle == 'allOrders':
            page, row = Pagings.mysqlPagings(self.info['page'], self.info['row'])
            sql = "SELECT orderNum, balance, wxMoney, state \
                FROM orders WHERE createUser = %s \
                ORDER BY createTime DESC limit %s, %s"
            info = query(sql, param=[self.info['user_id'], page, row])
            data = self.orderDeatil(info)
            return HttpResponse(returnJson(0, '查询成功', data))
        
        if handle == 'typeOrder':
            page, row = Pagings.mysqlPagings(self.info['page'], self.info['row'])
            sql = "SELECT orderNum, orderMoney, heheCoin, \
                wxMoney, balance, state FROM orders \
                WHERE createUser = %s AND state = %s \
                ORDER BY createTime DESC limit %s, %s"
            info = query(sql, param=[self.info['user_id'], self.info['order_type'], page, row])
            data = self.orderDeatil(info)
            return HttpResponse(returnJson(0, '查询成功', data))

        if handle == 'cancel':
            return self.cancel()

        if handle == 'placeOrder':
            self.info['stock_list'] = json.loads(request.POST.get('stock_list')) 
            return self.placeOrder()

        if handle == 'cancelAsOrder':
            mysql = Mysql()
            sql = "SELECT order_state FROM as_orders WHERE order_id = %s"
            state = mysql.getOne(sql, param=[self.info['order_num']])
            sql = "UPDATE orders SET state = %s WHERE orderNum = %s"
            mysql.update(sql, param=[state.get('order_state'), self.info['order_num']])
            sql = "DELETE FROM as_orders WHERE order_id = %s"
            mysql.delete(sql, param=[self.info['order_num']])
            mysql.dispose()
            return HttpResponse(returnJson(0, '取消售后订单成功'))

        if handle == 'selAsOrder':
            sql = "SELECT * FROM as_orders WHERE order_id=%s"
            info = query(sql, param=[self.info['order_num']])
            return HttpResponse(returnJson(0, '查询成功', info))

        if handle == 'upAsOrder':
            mysql = Mysql()
            sql = 'UPDATE orders SET state="3" WHERE orderNum = %s'
            mysql.update(sql, param=[self.info['order_num']])
            sql = "insert into as_orders SET order_id=%s, type=%s, \
                why=%s, isCheck=0, create_time=NOW(), order_state=%s"
            mysql.insertOne(sql, param=[
                self.info['order_num'], 
                self.info['as_type'], 
                self.info['way'], 
                self.info['order_state']])
            mysql.dispose()
            return HttpResponse(returnJson(0, '提交售后成功'))

        return HttpResponse(returnJson(-2, '非法路径'))