dataLists(new SupplierLists()); } /** * @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', 2)->order('id desc')->page($page_no, $page_size)->select()->each(function ($item) { $data = Supplier::where('id', $item['pid'])->find(); $item['supplier'] = $data; $item['apply_id'] = $item['id']; return $item; })->toArray(); $count = Db::name('user_auth_shop')->where('type', 2)->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/27 14:33 */ public function add() { $params = (new SupplierValidate())->post()->goCheck('add'); $result = SupplierLogic::add($params); if (true === $result) { return $this->success('添加成功', [], 1, 1); } return $this->fail(SupplierLogic::getError()); } /** * @notes 编辑供应商管理 * @return \think\response\Json * @author likeadmin * @date 2024/04/27 14:33 */ public function edit() { $params = (new SupplierValidate())->post()->goCheck('edit'); $result = SupplierLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(SupplierLogic::getError()); } /** * @notes 编辑状态 * @return \think\response\Json * @author likeadmin * @date 2024/04/23 16:35 */ public function status() { $params = (new SupplierValidate())->post()->goCheck('status'); $result = SupplierLogic::status($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(SupplierLogic::getError()); } /** * @notes 设置余额 */ public function set_money(){ $set_money = $this->request->post('set_money',0); $id=$this->request->post('id',0); $type=$this->request->post('type',1); $result = SupplierLogic::set_money($id,$set_money,$type); if (true === $result) { return $this->success('设置成功', [], 1, 1); } return $this->fail(SupplierLogic::getError()); } /** * @notes 删除供应商管理 * @return \think\response\Json * @author likeadmin * @date 2024/04/27 14:33 */ public function delete() { $params = (new SupplierValidate())->post()->goCheck('delete'); SupplierLogic::delete($params); return $this->success('删除成功', [], 1, 1); } /** * @notes 绑定用户 */ public function bind_user() { $params = $this->request->post(); if (!isset($params['id']) && !isset($params['uid'])) { return $this->fail('参数错误'); } $find = Supplier::where('uid', $params['uid'])->find(); if ($find) { return $this->fail('该用户已绑定商户'); } $res = Supplier::where('id', $params['id'])->update(['uid' => $params['uid']]); if ($res) { return $this->success('绑定成功', [], 1, 1); } return $this->fail('绑定失败'); } /** * @notes 获取供应商管理详情 * @return \think\response\Json * @author likeadmin * @date 2024/04/27 14:33 */ public function detail() { $params = (new SupplierValidate())->goCheck('detail'); $result = SupplierLogic::detail($params); return $this->data($result); } public function setLabel() { $params = $this->request->post(); $result = SupplierLogic::setLabel($params); if (true === $result) { return $this->success('设置成功', [], 1, 1); } return $this->fail(SupplierLogic::getError()); } }