service = WxUserService::getInstance(); $this->updateField = ['id']; $this->notRequest = ['nick_name', 'phone', 'enterprise_id', 'show_price', 'price_number', 'is_p']; } /** * 设置 / 取消代理商身份 * @Method POST * @throws Exception */ public function updateUserIsP(): JsonResponse { $this->insertField = ['id']; $this->notRequest = ['is_p']; $params = $this->checkRequiredFields(request()->post()); return jok( $this->service->updateUserIsP($params['id'], $params['is_p'] ?? null), '操作成功' ); } /** * 设置价格倍率 * @Method POST * @throws Exception */ public function updateShowPrice(): JsonResponse { $this->insertField = ['id', 'number']; $this->notRequest = []; $params = $this->checkRequiredFields(request()->post()); return jok($this->service->updateShowPrice($params['id'], $params['number']), '操作成功'); } /** * 单独开关价格可见性 * @Method POST * @throws Exception */ public function updateShowPriceStatus(): JsonResponse { $this->insertField = ['id', 'show_price']; $this->notRequest = []; $params = $this->checkRequiredFields(request()->post()); return jok($this->service->updateShowPriceStatus($params['id'], $params['show_price']), '操作成功'); } /** * 绑定所属企业 * @Method POST * @throws Exception */ public function bindUser(): JsonResponse { $this->insertField = ['id', 'enterprise_id']; $this->notRequest = []; $params = $this->checkRequiredFields(request()->post()); return jok($this->service->bindUser($params['id'], $params['enterprise_id']), '绑定成功'); } /** * 经销商绑定专属装修模板(template_code 空=跟随品牌默认) * @Method POST * @throws Exception */ public function bindTemplate(): JsonResponse { $this->insertField = ['id']; $this->notRequest = ['template_code']; $params = $this->checkRequiredFields(request()->post()); return jok( $this->service->bindTemplate($params['id'], $params['template_code'] ?? ''), '模板绑定成功' ); } /** * 该代理商名下的下级用户 * @Method GET */ public function children(): JsonResponse { return jok($this->service->children((int) request()->get('id', 0)), '列表获取成功'); } }