123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- *
- * @author: xaboy<365615158@qq.com>
- * @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;
- }
- }
|