request->only([ 'start_date' => '', 'end_date' => '', 'standBookNo' => '', 'projectNo' => '', 'infoNo' => '', 'bargainNo' => '', 'bk_code' => '', 'orderCode' => '', 'cgdNo' => '', 'spuCode' => '', 'skuCode' => '', 'supplierNo' => '', 'companyNo' => '', 'customer_code' => '', 'page' => 1, 'size' => 15 ], 'post', 'trim'); $where = []; if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']]; if ($param['standBookNo'] != '') $where[] = ['standBookNo', 'like', '%' . $param['standBookNo'] . '%']; if ($param['projectNo'] != '') $where[] = ['projectNo', 'like', '%' . $param['projectNo'] . '%']; if ($param['infoNo'] != '') $where[] = ['infoNo', 'like', '%' . $param['infoNo'] . '%']; if ($param['bargainNo'] != '') $where[] = ['bargainNo', 'like', '%' . $param['bargainNo'] . '%']; if ($param['bk_code'] != '') $where[] = ['bk_code', 'like', '%' . $param['bk_code'] . '%']; if ($param['orderCode'] != '') $where[] = ['orderCode', 'like', '%' . $param['orderCode'] . '%']; if ($param['cgdNo'] != '') $where[] = ['cgdNo', 'like', '%' . $param['cgdNo'] . '%']; if ($param['spuCode'] != '') $where[] = ['spuCode', 'like', '%' . $param['spuCode'] . '%']; if ($param['skuCode'] != '') $where[] = ['skuCode', 'like', '%' . $param['skuCode'] . '%']; if ($param['supplierNo'] != '') $where[] = ['supplierNo', 'like', '%' . $param['supplierNo'] . '%']; if ($param['companyNo'] != '') $where[] = ['companyNo', 'like', '%' . $param['companyNo'] . '%']; if ($param['customer_code'] != '') $where[] = ['customer_code', 'like', '%' . $param['customer_code'] . '%']; $count = Db::name('standing_book') ->where($where) ->count('id'); $list = Db::name('standing_book') ->where($where) ->order('addtime', 'desc') ->page($param['page'], $param['size']) ->withAttr('outCode', function ($val) { //有可能第一个是,开头 return trim($val, ','); }) ->withAttr('returnCode', function ($val) { return trim($val, ','); }) ->withAttr('thNo', function ($val) { return trim($val, ','); }) ->withAttr('returnGoodCode', function ($val) { return trim($val, ','); }) ->withAttr('wsm_in_code', function ($val) { return trim($val, ','); }) ->withAttr('cgdReturnCode', function ($val) { return trim($val, ','); }) ->select() ->toArray(); return app_show(0, "获取成功", ['list' => $list, 'count' => $count]); } //台账详情 public function getDetail() { $id = $this->request->post('id/d', 0, 'trim'); $res = Db::name('standing_book') ->where('id', $id) ->withAttr('outCode', function ($val) { //有可能第一个是,开头 return trim($val, ','); }) ->withAttr('returnCode', function ($val) { return trim($val, ','); }) ->withAttr('thNo', function ($val) { return trim($val, ','); }) ->withAttr('returnGoodCode', function ($val) { return trim($val, ','); }) ->withAttr('wsm_in_code', function ($val) { return trim($val, ','); }) ->withAttr('cgdReturnCode', function ($val) { return trim($val, ','); }) ->find(); return app_show(0, '请求成功', $res); } }