Files
websopy-taro/.workbuddy/memory/MEMORY.md
赵忠林 babcf36439 feat(user): 补充开发者审核通过时添加店员记录功能
- 引入 addShopStoreUser 接口用于新增门店店员记录
- 新增 clerkStoreId 和 clerkTenantId 状态,保存当前审核店员的门店和租户信息
- 在审核通过后调用 addShopStoreUser,添加申请人为当前门店店员
- 保证只有当 clerkStoreId 存在时才执行新增操作
- 更新工作记录文档,补充审核通过流程中新添加的店员记录步骤
- 保持原有升级开发者逻辑和接口调用不变
2026-07-23 17:59:22 +08:00

5.2 KiB
Raw Blame History

项目长期记忆websopy-taro

核心约定

开发者身份的表示方式

  • 开发者身份主校验位 = sys_user.is_developer 布尔位(数据库列 is_developer),登录态 MainController.loginByDeveloperSms 校验它才允许开发者登录。
  • 后端仓库:/Users/gxwebsoft/JAVA/com.gxwebsoft.core(单 Maven 模块,包名 com.gxwebsoft 分包)。
  • 标记接口:PUT /api/system/user/developer/{userId}UserController.setDeveloperUserService.markAsDeveloper),成功后经 syncMessageProducer 同步 websopy。
  • 前端调用:@/api/system/usersetUserDeveloper(userId)
  • vip-review 审核通过流程(用户 2026-07-22 最终确认2026-07-23 补充):前端 handleApprove 依次调 ① updateShopDealerApply(applyStatus=20);② setUserDeveloper(userId)(不碰 sys_user_role);③ addShopStoreUser——在当前门店下给申请人补一条 shop_store_user(店员)记录(userId=申请人, storeId=审核店员所属门店, tenantId=同店员, isDelete=0)。后端 markAsDeveloper 做两件事:① 把 sys_user.is_developer1;② 替换用户角色为 developer——roleService.getByRoleCode(roleCode=developer, tenantId=用户租户) 找到角色 → 删掉该用户现有 sys_user_role → 只绑定 developer 这一个角色,不与原角色并存(角色替换包 try/catch失败不影响 isDeveloper 落库)。即"升级为开发者 = 单角色 developer + isDeveloper 标记位 + 一条门店店员记录",不是新增第二个角色。审核店员的 storeId/tenantId 来自 getMyClerk() 返回值(存于 clerkStoreId/clerkTenantId state
  • 注意:前端 vip-review / vip-upgrade 等页面的变量名仍残留 VIP_ROLE_*pendingVipCountdealerPrice 等旧标识符(仅文案改成了「开发者」),后端角色与缓存 key 仍对应这些旧名,重命名需谨慎。

后端代码风格com.gxwebsoft.core

  • Controller 继承 BaseController,统一返回 ApiResult(成功 code=0,失败 code=1),用 success()/fail()
  • 「按 userId 置一个标志位」的范式:new User(){{setUserId(); setXxx();}}userService.updateById(u)(参考 updateStatus/updateRecommend/auditUser)。
  • 用户变更后如需同步 websopysyncMessageProducer.sendUserSyncMessage("websopy","UPDATE",user)(在 UserServiceImpl 内,@Autowired(required=false) 注入)。
  • 用户相关代码都在 com.gxwebsoft.common.systementity/service/controller业务应用数据在 com.gxwebsoft.websopy(无 Controller

⚠️ Taro 小程序 nutui-react-taro 兼容性陷阱2026-07-23 确认)

问题@nutui/nutui-react-taro@2.7.4Cell / Price / Divider / Button 等展示类组件,内部用 React.createElement("div", ...) 构建布局。Taro 4 的 babel/swc 没有把这些 div 转成 view,而 dist/base.wxml 里完全没有 <div> 模板,导致这些组件在 weapp 中"空壳化"——外层元素不存在,内层内容(<div>)被丢弃。

症状:组件位置完全空白 / 按钮不可见 / 价格显示为空。Text/View 与 @nutui/icons-react-taro 的图标Tips/Check/Close/Clock基于 SVG渲染正常。

解决办法(最小改动):在该页面用 Taro 原生组件替代:

nutui不可用 Taro 原生 / 项目自定义
import { Button, Cell, Price, Divider } from '@nutui/nutui-react-taro' import { Button } from '@tarojs/components' + import Price from '@/components/common/Price'
<Cell title="X" description={Y} /> <View className="flex justify-between px-4 py-3 border-b border-gray-100"><Text className="text-gray-600">X</Text><Text className="text-gray-800">{Y}</Text></View>
<Price price={n} size="large" thousands /> <Price price={n} size="large" />用项目自定义 Price,不用 nutui 的)
<Divider /> border-b border-gray-100 替代
<Button type="primary" block loading={x} onClick={y}>...</Button> <Button loading={x} onClick={y} className="flex-1 bg-blue-500 text-white rounded-full border-0">...</Button>className 控制颜色,loading prop 仍然支持)

适用范围判断项目里其它页面qr-login、register、passport/forget 等)也用了 nutui 的 Cell/Card/Divider/Button遇到同类"组件消失"现象时按同样模式替换即可。已修:src/passport/pay/index.tsx2026-07-23扫码进入小程序后支付页空白的 bug

验证手段:跑 npm run build:weapp 后在 dist/<page>/index.js 里 grep nut-cell|nut-button|nut-divider|nut-price,应为 0grep l.zxTaro Button 在 weapp 编译后的局部变量名)应出现 2 次(取消 + 立即支付)。

已知的 nutui 组件清单(按 2026-07-23 grep 结果):Buttonpassport/pay, passport/login/setting/forget/register, pages/order/*, pages/booking/*, components/common/{FixedButton,EmptyState} 等大量页面;Cellpassport/pay, pages/order/order.tsxDividerpassport/pay, passport/qr-loginPricepassport/pay。修复顺序建议pay已修→ 视觉影响最大的页面 → 批量。