| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\agent\controller\order;
- use app\common\controller\AgentController;
- use app\http\IResponse;
- use Lettered\Support\Auth as IAuth;
- use think\App;
- class Goods extends AgentController
- {
- protected $model;
- public function __construct(App $app = null, IAuth $auth)
- {
- parent::__construct($app, $auth);
- $this->model = new \app\agent\model\order\Goods();
- }
- public function index()
- {
- $user = $this->auth->user();
- $where[] = ['area_id', 'eq', $user['area_id']];
- //组合搜索
- !empty(input('name')) && $where[]
- = ['name', 'like', '%' . input('name') . '%'];
- (!empty(input('pin')) || input('pin') == '0') &&
- $where[] = ['is_pin', 'eq', input('pin')];
- (!empty(input('status')) || input('status') == '0') &&
- $where[] = ['status', 'eq', input('status')];
- !empty(input('area')) && $where[]
- = ['area_id', 'eq', input('area')];
- !empty(input('keywords')) && $where[]
- = ['user_id|order_no', 'like', '%' . input('keywords') . '%'];
- // 时间处理
- if (!empty(input('created_at'))){
- list($start, $end) = str2arr(input('created_at'),'-');
- $where[] = ['created_at', 'between', [strtotime($start), strtotime($end)]];
- }
- return IResponse::paginate($this->model->where($where)->with(['user','seller','addr'])
- ->order(['created_at' => 'desc'])
- ->paginate(input('limit'),false));
- }
- }
|