|
@@ -37,18 +37,16 @@ class StoreCouponUser extends BaseModel
|
|
|
public static function systemPage($where)
|
|
public static function systemPage($where)
|
|
|
{
|
|
{
|
|
|
$model = new self;
|
|
$model = new self;
|
|
|
- if ($where['status'] != '') $model = $model->where('status', $where['status']);
|
|
|
|
|
- if ($where['is_fail'] != '') $model = $model->where('status', $where['is_fail']);
|
|
|
|
|
- if ($where['coupon_title'] != '') $model = $model->where('coupon_title', 'LIKE', "%$where[coupon_title]%");
|
|
|
|
|
- if ($where['nickname'] != '') {
|
|
|
|
|
- $uid = UserModel::where('nickname', 'LIKE', "%$where[nickname]%")->column('uid', 'uid');
|
|
|
|
|
- $model = $model->where('uid', 'IN', implode(',', $uid));
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ $model = $model->alias('a')
|
|
|
|
|
+ ->field('a.*,b.nickname')
|
|
|
|
|
+ ->leftJoin('user b', 'a.uid=b.uid');
|
|
|
|
|
+ if ($where['status'] != '') $model = $model->where('a.status', $where['status']);
|
|
|
|
|
+ if ($where['is_fail'] != '') $model = $model->where('a.status', $where['is_fail']);
|
|
|
|
|
+ if ($where['coupon_title'] != '') $model = $model->where('a.coupon_title', 'LIKE', "%$where[coupon_title]%");
|
|
|
|
|
+ if ($where['nickname'] != '') $model = $model->where('b.nickname|b.uid', 'LIKE', "%".$where['nickname']."%");
|
|
|
// $model = $model->where('is_del',0);
|
|
// $model = $model->where('is_del',0);
|
|
|
$model = $model->order('id desc');
|
|
$model = $model->order('id desc');
|
|
|
- return self::page($model, function ($item) {
|
|
|
|
|
- $item['nickname'] = UserModel::where('uid', $item['uid'])->value('nickname');
|
|
|
|
|
- }, $where);
|
|
|
|
|
|
|
+ return self::page($model);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|