diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java index 1e53ee26..9cfdc8b9 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java @@ -1,5 +1,10 @@ package cn.iocoder.yudao.module.custom.controller.admin; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.service.CustomerMainService; @@ -17,8 +22,11 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.net.ssl.HttpsURLConnection; import javax.validation.Valid; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.List; import static cn.iocoder.yudao.common.BaseConstants.*; @@ -171,4 +179,27 @@ public class CustomerMainController { busiLabelService.saveBusiLable(saveReqVO.getId(), TABLE_BASE_CUSTOMER_MAIN, saveReqVO.getLabelList()); return success(true); } + + /** + * 小程序客户注册 + * cusName,phoneNumber,birthday,sex,inviter + */ + @PostMapping("/addUniUser") + public CommonResult addUniUser(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) { + if(!saveReqVO.getCode().isEmpty()){ + String code = saveReqVO.getCode(); + JSONObject jsonObj = new JSONObject(); + String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=" + +code+"&grant_type=authorization_code"; + String response = HttpRequest.get(url).execute().body(); + JSONObject json = JSONUtil.parseObj(response); + if (json.containsKey("access_token") && json.containsKey("openid")) { + String accessToken = json.getStr("access_token"); + String openid = json.getStr("openid"); + } + + } + return null; + } + } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java index 1989cd30..007e71b3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java @@ -19,4 +19,8 @@ public class CustomerMainSaveReqVO extends CustomerMain { /**标签信息*/ List labelList; + /** + * Code + */ + private String Code; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java new file mode 100644 index 00000000..26799651 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.app.controller; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.app.service.UniShopConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/userClient/uniShopConfig") +public class UniShopConfigController { + + @Autowired + UniShopConfigService uniShopConfigService; + + @GetMapping("/getRepairTel") + public CommonResult getRepairTel() { + return CommonResult.success(uniShopConfigService.getRepairTel()); + } + +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java new file mode 100644 index 00000000..5092a40a --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java @@ -0,0 +1,11 @@ +package cn.iocoder.yudao.module.app.mapper; + +import cn.iocoder.yudao.module.project.entity.RepairProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UniShopConfigMapper { + + public String getRepairTel(); +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java new file mode 100644 index 00000000..588b379e --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java @@ -0,0 +1,6 @@ +package cn.iocoder.yudao.module.app.service; + +public interface UniShopConfigService { + + public String getRepairTel(); +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java new file mode 100644 index 00000000..a267d5fd --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.app.service.impl; + +import cn.iocoder.yudao.module.app.mapper.UniShopConfigMapper; +import cn.iocoder.yudao.module.app.service.UniShopConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UniShopConfigServiceImpl implements UniShopConfigService { + + + @Autowired + UniShopConfigMapper uniShopConfigMapper; + @Override + public String getRepairTel() { + return uniShopConfigMapper.getRepairTel(); + } +} diff --git a/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml b/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml new file mode 100644 index 00000000..301b3f84 --- /dev/null +++ b/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml @@ -0,0 +1,9 @@ + + + + + + +