dataLists(new MerchantLists()); } /** * @notes 商户申请列表 */ public function apply_lists() { $page_no = $this->request->get('page_no', 1); $page_size = $this->request->get('page_size', 15); $data = Db::name('user_auth_shop')->where('type', 1)->page($page_no, $page_size)->select()->each(function ($item) { $data = Merchant::where('mer_id', $item['pid'])->find(); $item['merchant'] = $data; $item['apply_id'] = $item['id']; return $item; })->toArray(); $count = Db::name('user_auth_shop')->where('type', 1)->count(); return $this->success('请求成功', ['lists' => $data, 'count' => $count, 'page_no' => $page_no, 'page_size' => $page_size]); } /** * @notes 添加商户列表 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function add() { $params = (new MerchantValidate())->post()->goCheck('add'); $result = MerchantLogic::add($params); if (true === $result) { return $this->success('添加成功', [], 1, 1); } return $this->fail(MerchantLogic::getError()); } /** * @notes 编辑商户列表 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function edit() { $params = (new MerchantValidate())->post()->goCheck('edit'); $result = MerchantLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(MerchantLogic::getError()); } /** * @notes 审核状态 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function status() { $params = (new MerchantValidate())->post()->goCheck('status'); $result = MerchantLogic::status($params); if (true === $result && $params['status'] == 1) { return $this->success('审核成功', [], 1, 1); } if (true === $result && $params['status'] == -1) { return $this->success('驳回成功', [], 1, 1); } return $this->fail(MerchantLogic::getError()); } /** * @notes 删除商户列表 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function delete() { $params = (new MerchantValidate())->post()->goCheck('delete'); MerchantLogic::delete($params); return $this->success('删除成功', [], 1, 1); } /** * @notes 获取商户列表详情 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function detail() { $params = (new MerchantValidate())->goCheck('detail'); $result = MerchantLogic::detail($params); return $this->data($result); } public function bind_goods() { $params = (new MerchantValidate())->post()->goCheck('detail'); $result = MerchantLogic::bindGoods($params); if (true === $result) { return $this->success('绑定成功', [], 1, 1); } return $this->fail(MerchantLogic::getError()); } public function bind_goods_lists() { $mer_id = $this->request->get('mer_id'); $page_no = $this->request->get('page_no', 1); $page_size = $this->request->get('page_size', 15); if (empty($mer_id)) { return $this->fail('参数错误'); } $data = Db::name('merchant_bind_goods')->where('mer_id', $mer_id)->page($page_no, $page_size)->select()->each(function ($item) { $item['goods_info'] = Goods::where('id', $item['goods_id'])->with(['className', 'brandName', 'unitName', 'warehouseName'])->findOrEmpty(); if (!empty($item['goods_info']['sys_labels'])) { $goodslabel = GoodsLabel::where('id', 'in', trim($item['goods_info']['sys_labels'], ','))->column('name'); $item['goods_info']['sys_labels_text'] = implode(',', $goodslabel); } else { $item['goods_info']['sys_labels_text'] = ''; } return $item; })->toArray(); $count = Db::name('merchant_bind_goods')->where('mer_id', $mer_id)->count(); return $this->success('请求成功', ['lists' => $data, 'count' => $count, 'page_no' => $page_no, 'page_size' => $page_size]); } }