初始化

缺陷:主题配色需要优化整体的同风格
This commit is contained in:
2026-08-14 23:21:21 +08:00
parent 6e2769c528
commit bcf54c2727
152 changed files with 13521 additions and 141 deletions

View File

@@ -0,0 +1,107 @@
<?php
namespace App\Http\Controllers\Api;
use App\BaseApp\BaseController;
use App\Service\business\WxUserService;
use Exception;
use Illuminate\Http\JsonResponse;
/**
* 微信用户管理
*/
class WxUserController extends BaseController
{
/**
* 微信用户只能由小程序授权登录产生,后台没有新建入口
*/
protected array $exceptRoute = ['create'];
public function __construct()
{
parent::__construct();
$this->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)), '列表获取成功');
}
}