* @day: 2018/01/22 */ namespace app\models\store; use crmeb\basic\BaseModel; use crmeb\traits\ModelTrait; /** * TODO 优惠券Model * Class StoreCoupon * @package app\models\store */ class StoreOrderIncrement extends BaseModel { /** * 数据表主键 * @var string */ protected $pk = 'id'; /** * 模型名称 * @var string */ protected $name = 'store_order_increment'; use ModelTrait; public static function list($where) { $model = self::alias('a') ->leftJoin('user b', 'a.increment_uid = b.uid') ->leftJoin('user c', 'a.uid = c.uid') ->field('a.*,b.nickname,c.nickname as c_nickname') ->order('a.id DESC'); if ($where['name'])$model->where('b.nickname|b.uid' , 'like', '%'.$where['name'],'%'); if ($where['order'])$model->where('order' , '=', $where['name']); if (trim($where['data']) != '') $model = self::getModelTime($where, $model, 'a.add_time'); $data['count'] = $model->count(); if ($where['page'] && $where['limit']){ $model->page($where['page'], $where['limit']); }else{ $model->page(20, 1); } $list = $model->select()->toArray(); foreach ($list as &$item){ $item['add_time'] = date('Y-m-d H:i:s',$item['add_time']); } $data['data'] = $list; return $data; } }