Status.php 1.7 KB
<?php

namespace YHMOrders\SqlMap\Status;

class Status {

  //  const SELECT_ORDER_STATUS_HISTORY_BY_ORDER_CODE = 'select * from orders_status where order_code=:order_code group by order_status order by id asc ';
    //const SELECT_ORDER_STATUS_HISTORY_BY_ORDER_CODE = 'SELECT * from ( select * from orders_status where order_code=:order_code order by id desc) as k group by order_status  order by order_status asc,id asc ';
    //const SELECT_ORDER_STATUS_HISTORY_BY_ORDER_CODE = ' select * from orders_status where order_code=:order_code order by id asc ';
    const SELECT_ORDER_STATUS_HISTORY_BY_ORDER_CODE = ' select * from orders_status where order_code=:order_code order by create_time asc ';
    const SELECT_ORDER_STATUS_BY_ORDER_CODE = 'select * from orders_status where order_code=:order_code and order_status=:status limit 1';
    
    const SET_STATUS = 'insert into `orders_status`(`order_code`, `order_status`, `trigger_user`,`create_time`) values (:order_code,:order_status,:trigger_user,UNIX_TIMESTAMP())';
    const SELECT_ORDER_STATUS_BY_LIST="select * from orders_status where order_code=:order_code ";
    const SELECT_ORDER_STATUS_BY_TIME_LIST='select o.order_amount,o.order_code,buyer_uid,seller_uid,o.last_order_amount from orders as o left join orders_status as s  on o.order_code=s.order_code  where FROM_UNIXTIME(s.create_time,"%Y%m%d")<= :time and o.order_status=:order_status GROUP BY o.order_code';
    const SELECT_ORDER_STATUS_BY_EQTIME_LIST='select o.order_amount,o.order_code,buyer_uid,seller_uid,o.last_order_amount from orders as o left join orders_status as s  on o.order_code=s.order_code  where FROM_UNIXTIME(s.create_time,"%Y%m%d")= :time and o.order_status=:order_status GROUP BY o.order_code';
    
}