getJsonData(); $rules = [ 'page' => 'nullable|integer', 'page_size' => 'nullable|integer', 'sttaus' => 'nullable|string', 'name' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(OriginalClassRepository::class)->pushCriteria(new OriginalClassCriteria($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); return new CommonPagesResponse($res); } /** * 添加分类 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function categoryAdd(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'name' => 'required|string', 'status' => 'required|in:1,2', 'type' => 'required|in:1,2', 'sort' => 'required|integer', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $setarr = [ 'name' => $inputData['name'], 'status' => $inputData['status'], 'type' => $inputData['type'], 'sort' => $inputData['sort'], ]; $result = make(OriginalClassRepository::class)->create($setarr); if (!$result) { return json_fail('添加失败'); } else { $logSubject = '添加一个原味分类,分类名字:' . $inputData['name']; $logSvalue = $result->uid; $logDbData = [ 'after_items' => [ $result->toArray(), ], 'before_items' => [], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($result->uid); } } /** * 修改分类 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function categoryEdit(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'name' => 'nullable|string', 'status' => 'nullable|in:1,2', 'type' => 'nullable|in:1,2', 'sort' => 'nullable|integer', 'uid' => 'required|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $categoryInfo = make(OriginalClassRepository::class)->findBy('uid', $inputData['uid']); if (!$categoryInfo) { return json_fail('该类型不存在!'); } $oldCategoryInfo = clone $categoryInfo; if (!empty($inputData['name'])) { $categoryInfo->name = $inputData['name']; } if (!empty($inputData['status'])) { $categoryInfo->status = $inputData['status']; } if (!empty($inputData['type'])) { $categoryInfo->type = $inputData['type']; } if (!empty($inputData['sort'])) { $categoryInfo->sort = $inputData['sort']; } $result = $categoryInfo->save(); if (!$result) { return json_fail('修改失败'); } else { $logSubject = '修改一个原味分类,名字:' . $oldCategoryInfo->name; $logSvalue = $oldCategoryInfo->uid; $logDbData = [ 'after_items' => [ $categoryInfo->toArray(), ], 'before_items' => [ $oldCategoryInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($categoryInfo->uid); } } /** * 删除分类 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function categoryDelete(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'uid' => 'required|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $categoryInfo = make(OriginalClassRepository::class)->findBy('uid', $inputData['uid']); if (!$categoryInfo) { return json_fail('该类型不存在!'); } $oldCategoryInfo = clone $categoryInfo; $result = $categoryInfo->delete(); if (!$result) { return json_fail('删除失败'); } else { $logSubject = '删除一个类原味分类,名字:' . $oldCategoryInfo->name; $logSvalue = $oldCategoryInfo->manager_id; $logDbData = [ 'after_items' => [ ], 'before_items' => [ $oldCategoryInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($inputData['uid']); } } /** * 评价列表 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|void */ public function assessLists(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'page' => 'nullable|integer', 'page_size' => 'nullable|integer', 'buy_uid' => 'nullable|string', 'goods_name' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(GoodsAssessRepository::class)->pushCriteria(new GoodsAssessCriteria($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); return new OriginaAssessListsResponse($res); } /** * 删除评论 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function assessDelete(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'uid' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $goodsAssessInfo = make(GoodsAssessRepository::class)->findBy('uid', $inputData['uid']); if (!$goodsAssessInfo) { return json_fail('该评论不存在!'); } $oldDoodsAssessInfo = $goodsAssessInfo; $result = $goodsAssessInfo->delete(); if (!$result) { return json_fail('删除失败'); } else { $logSubject = '删除一个类原味分类,名字:' . $goodsAssessInfo->name; $logSvalue = $oldDoodsAssessInfo->manager_id; $logDbData = [ 'after_items' => [ ], 'before_items' => [ $oldDoodsAssessInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($inputData['uid']); } } /** * 订单列表 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|OriginaOrderListsResponse */ public function orderLists(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'page' => 'nullable|integer', 'page_size' => 'nullable|integer', 'buy_uid' => 'nullable|string', 'sell_uid' => 'nullable|string', 'order_sn' => 'nullable|string', 'order_status' => 'nullable|in:1,2,3,4,5', 'pay_status' => 'nullable|in:1,2,3', 'redund_status' => 'nullable|in:1,2,3,4', 'goods_name' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(OriginalOrderRepository::class)->pushCriteria(new OriginalOrderCriteria($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); return new OriginaOrderListsResponse($res); } /** * 操作订单 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function orderUpdate(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'uid' => 'required|string', 'order_status' => 'nullable|in:3,4,5', 'redund_status' => 'nullable|in:3,4', 'denial_reason' => 'nullable|string|max:255', 'courier_number' => 'nullable|string', 'courier_firm' => 'nullable|string', 'logistics_info' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $OriginalOrderRep = make(OriginalOrderRepository::class); $orderInfo = $OriginalOrderRep->findBy('uid', $inputData['uid']); if (!$orderInfo) { return json_fail('该订单不存在!'); } $oldOrderInfo = clone $orderInfo; $msg = '订单状态改变, 订单号' . $oldOrderInfo->order_sn; if (!empty($inputData['order_status'])) { switch ($inputData['order_status']) { case 3: $msg = '待发货订单发货,订单号:' . $oldOrderInfo->order_sn; break; case 4: $data = [ 'goods_uid' => $orderInfo->goods_uid, 'buy_uid' => $orderInfo->buy_uid, 'goods_name' => $orderInfo->goods_name, 'order_sn' => $orderInfo->order_sn, 'comment_fraction' => 3, 'comment' => '商品很棒!' ]; // 确认收货 $res = $OriginalOrderRep->confirmReceipt($data); if (!$res) { return json_fail('确认收货失败'); } $msg = '待收货订单确认收货,订单号:' . $oldOrderInfo->order_sn; break; } $orderInfo->order_status = $inputData['order_status']; } if (!empty($inputData['redund_status'])) { switch ($inputData['redund_status']) { case 3: $msg = '订单退款驳回,订单号:' . $oldOrderInfo->order_sn; $oldOrderInfo->order_status = 1; break; case 4: // 退款 $res = $OriginalOrderRep->refund($oldOrderInfo->toArray()); if (!$res) { return json_fail('退款失败'); } $msg = '订单退款确认成功,订单号:' . $oldOrderInfo->order_sn; break; } $orderInfo->refund_end_time = date('Y-m-d H:i:s'); $orderInfo->redund_status = $inputData['redund_status']; } if (!empty($inputData['denial_reason'])) { $orderInfo->denial_reason = $inputData['denial_reason']; } if (!empty($inputData['courier_number'])) { $orderInfo->courier_number = $inputData['courier_number']; } if (!empty($inputData['courier_firm'])) { $orderInfo->courier_firm = $inputData['courier_firm']; } if (!empty($inputData['logistics_info'])) { $orderInfo->logistics_info = $inputData['logistics_info']; } $result = $orderInfo->save(); if (!$result) { return json_fail('操作成功'); } else { $logSubject = $msg; $logSvalue = $oldOrderInfo->manager_id; $logDbData = [ 'after_items' => [ $orderInfo->toArray() ], 'before_items' => [ $oldOrderInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($inputData['uid']); } } /** * 店铺列表 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed */ public function shopsList(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'title' => 'nullable|string', 'is_certified' => 'nullable|in:1,2', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(ShopsRepository::class)->pushCriteria(new ShopsCriteria($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); foreach ($res->items() as &$val) { $val->province = substr($val->province,0,strlen($val->province) - 6); $val->city = substr($val->city,0,strlen($val->city) - 6); $val->region = substr($val->region,0,strlen($val->region) - 6); $val->user_nick = $val->user->nick; $val->cover64 = ''; unset($val->user); } return json_success($res); } /** * 添加店铺 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function shopsAdd(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'user_uid' => 'required|string', 'title' => 'required|string', 'share_ratio' => 'required|integer', 'credit_value' => 'required|integer', 'sort' => 'required|integer', 'steer_level' => 'required|integer', 'is_certified' => 'required|in:1,2', 'cover' => 'required|string', 'delivery_address' => 'required', 'introduce' => 'required|string', 'tg' => 'nullable|string', 'qq' => 'nullable|string', 'margin' => 'required', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $userId = make(UserRepository::class)->findBy('code', $inputData['user_uid'], ['id']); if (empty($userId)) { return json_fail('绑定的用户不存在'); } $setArr = [ 'uid' => $inputData['user_uid'], 'title' => $inputData['title'], 'credit_value' => $inputData['credit_value'], 'sort' => $inputData['sort'], 'steer_level' => $inputData['steer_level'], 'is_certified' => $inputData['is_certified'], 'province' => $inputData['delivery_address'][0] . '000000', 'city' => $inputData['delivery_address'][1] . '000000', 'region' => $inputData['delivery_address'][2] . '000000', 'cover' => $inputData['cover'], 'margin' => $inputData['margin'], 'goods_count' => $inputData['goods_count'] ?: 0, 'goods_up_count' => $inputData['goods_up_count'] ?: 0, 'frozen_amount' => $inputData['frozen_amount'] ?: 0, 'amount' => $inputData['amount'] ?: 0, 'introduce' => $inputData['introduce'], 'share_ratio' => $inputData['share_ratio'], 'tg' => $inputData['tg'], 'qq' => $inputData['qq'], ]; $result = make(ShopsRepository::class)->create($setArr); if (!$result) { return json_fail('添加失败'); } else { $logSubject = '添加一个店铺:' . $inputData['title']; $logSvalue = $result->uid; $logDbData = [ 'after_items' => [ $result->toArray(), ], 'before_items' => [], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($result->uid); } } /** * 店铺修改 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function shopsEdit(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'user_uid' => 'required|string', 'title' => 'nullable|string', 'share_ratio' => 'nullable|integer', 'credit_value' => 'nullable|integer', 'sort' => 'nullable|integer', 'steer_level' => 'nullable|integer', 'is_certified' => 'nullable|in:1,2', 'cover' => 'nullable|string', 'delivery_address' => 'required', 'goods_count' => 'nullable|integer', 'goods_up_count' => 'nullable|integer', 'introduce' => 'nullable|string', 'tg' => 'nullable|string', 'qq' => 'nullable|string', 'margin' => 'required', 'frozen_amount' => 'required', 'amount' => 'required', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $shopsInfo = make(ShopsRepository::class)->findBy('uid', $inputData['user_uid']); if (empty($shopsInfo)) { return json_fail('店铺不存在'); } $oldShopsInfo = clone $shopsInfo; if (!empty($inputData['title'])) { $shopsInfo->title = $inputData['title']; } if (!empty($inputData['credit_value'])) { $shopsInfo->credit_value = $inputData['credit_value']; } if (!empty($inputData['stor'])) { $shopsInfo->stor = $inputData['stor']; } if (!empty($inputData['steer_level'])) { $shopsInfo->steer_level = $inputData['steer_level']; } if (!empty($inputData['is_certified'])) { $shopsInfo->is_certified = $inputData['is_certified']; } if (!empty($inputData['cover'])) { $shopsInfo->cover = $inputData['cover']; } if (!empty($inputData['is_certified'])) { $shopsInfo->is_certified = $inputData['is_certified']; } if (!empty($inputData['delivery_address'])) { $shopsInfo->province = $inputData['delivery_address'][0] . '000000'; $shopsInfo->city = $inputData['delivery_address'][1] . '000000'; $shopsInfo->region = $inputData['delivery_address'][2] . '000000'; } if (!empty($inputData['share_ratio'])) { $shopsInfo->share_ratio = $inputData['share_ratio']; } if (!empty($inputData['goods_count'])) { $shopsInfo->goods_count = $inputData['goods_count']; } if (!empty($inputData['goods_up_count'])) { $shopsInfo->goods_up_count = $inputData['goods_up_count']; } if (!empty($inputData['introduce'])) { $shopsInfo->introduce = $inputData['introduce']; } if (!empty($inputData['tg'])) { $shopsInfo->tg = $inputData['tg']; } if (!empty($inputData['qq'])) { $shopsInfo->qq = $inputData['qq']; } if (!empty($inputData['margin'])) { $shopsInfo->margin = $inputData['margin']; } $result = $shopsInfo->save(); if (!$result) { return json_fail('操作失败'); } else { $logSubject = $inputData['title']; $logSvalue = $oldShopsInfo->uid; $logDbData = [ 'after_items' => [ $shopsInfo->toArray() ], 'before_items' => [ $oldShopsInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($inputData['uid']); } } /** * 商品列表 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|OriginaGoodsListsResponse */ public function goodsList(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'title' => 'nullable|string', 'sell_uid' => 'nullable|string', 'status' => 'nullable|in:1,2,3,4' ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(OriginalRepository::class)->pushCriteria(new GoodsCriteria($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); return new OriginaGoodsListsResponse($res); } /** * 添加商品 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse\ */ public function goodsAdd(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'title' => 'required|string', 'class_uid' => 'required|string', 'shops_uid' => 'required|string', 'sort' => 'required|integer', 'steer_level' => 'required|integer', 'cover' => 'required|string', 'status' => 'required|in:1,2,3,4', 'coins' => 'required|integer', 'original_cions' => 'required|integer', 'member_coins' => 'required|integer', 'stock' => 'required|integer', 'likes' => 'required|integer', 'browse' => 'required|integer', 'number_orders' => 'required|integer', 'appraise' => 'required|integer', 'introduce' => 'required|string', 'photo_address' => 'required', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $result = make(OriginalRepository::class)->createOne($inputData); if (!$result) { return json_fail('添加失败'); } else { $logSubject = '添加一个商品:' . $inputData['title']; $logSvalue = $result->uid; $logDbData = [ 'after_items' => [ $result->toArray(), ], 'before_items' => [], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($result->uid); } } public function goodsEdit(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'uid' => 'required|string', 'title' => 'nullable|string', 'class_uid' => 'required|string', 'shops_uid' => 'required|string', 'sort' => 'nullable|integer', 'steer_level' => 'nullable|integer', 'cover' => 'nullable|string', 'status' => 'nullable|in:1,2,3,4', 'coins' => 'nullable|integer', 'original_cions' => 'nullable|integer', 'member_coins' => 'nullable|integer', 'stock' => 'nullable|integer', 'likes' => 'nullable|integer', 'browse' => 'nullable|integer', 'number_orders' => 'nullable|integer', 'appraise' => 'nullable|integer', 'introduce' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $oldGoodsInfo = []; $goodsInfo = make(OriginalRepository::class)->updateOne($inputData, $oldGoodsInfo); if (!$goodsInfo) { return json_fail('修改失败失败'); } else { $logSubject = '修改一个商品:' . $inputData['title']; $logSvalue = $oldGoodsInfo['uid']; $logDbData = [ 'after_items' => [ $goodsInfo ], 'before_items' => [ $oldGoodsInfo, ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($goodsInfo->uid); } } /** * 删除商品 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed|PaymentSuccessUidResponse */ public function shopsDelete(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'uid' => 'required|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $goodsInfo = make(OriginalRepository::class)->findBy('uid', $inputData['uid']); if (empty($goodsInfo)) { return json_fail('商品不存在'); } $oldGoodsInfo = clone $goodsInfo; $result = $goodsInfo->delete(); if (!$result) { return json_fail('删除失败'); } else { $logSubject = '删除一个类原味分类,名字:' . $goodsInfo->title; $logSvalue = $oldGoodsInfo->uid; $logDbData = [ 'after_items' => [ ], 'before_items' => [ $oldGoodsInfo->toArray(), ], ]; $this->log($logSubject, $logSvalue, $logDbData); return new PaymentSuccessUidResponse($inputData['uid']); } } /** * 收货地址 * * @param ValidatorFactoryInterface $validatorFactory * @return mixed */ public function userAddress(ValidatorFactoryInterface $validatorFactory) { $inputData = $this->getJsonData(); $rules = [ 'user_uid' => 'nullable|string', 'name' => 'nullable|string', ]; $validator = $validatorFactory->make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $orders = [ ['created_at', 'DESC'], ]; $pageSize = $inputData['page_size'] ?? CommonConstant::PAGE_SIZE; if ($pageSize > 500) { $pageSize = CommonConstant::PAGE_SIZE; } $page = format_page($inputData['page'] ?? 1); $res = make(UserShippingAddressRepository::class)->pushCriteria(new UserShippingAddressCriterias($inputData))->pushCriteria(new OrderLimitCriteria($orders))->paginate($pageSize, ['*'], $page); foreach ($res->items() as &$value) { $value->user_nick = $value->user->nick; unset($value->user); } return json_success($res); } /** * 商品所需下拉 * * @return mixed */ public function getDown() { $res['category'] = make(OriginalCategoryRepository::class)->findAllBy('type', 1, ['uid', 'name'])->keyBy('uid'); $res['shops'] = make(ShopsRepository::class)->findAllBy('is_certified', 2, ['uid', 'title'])->keyBy('uid'); return json_success($res); } }