| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- // +----------------------------------------------------------------------
- // | likeshop100%开源免费商用商城系统
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 开源版本可自由商用,可去除界面版权logo
- // | 商业版本务必购买商业授权,以免引起法律纠纷
- // | 禁止对系统程序代码以任何目的,任何形式的再发布
- // | gitee下载:https://gitee.com/likeshop_gitee
- // | github下载:https://github.com/likeshop-github
- // | 访问官网:https://www.likeshop.cn
- // | 访问社区:https://home.likeshop.cn
- // | 访问手册:http://doc.likeshop.cn
- // | 微信公众号:likeshop技术社区
- // | likeshop团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | author: likeshopTeam
- // +----------------------------------------------------------------------
- namespace app\openapi\controller;
- use app\adminapi\logic\toutiao\ToutiaoSettingLogic;
- use app\openapi\logic\user\UserLogic;
- use app\openapi\validate\UserValidate;
- /**
- * 用户接口示例
- * Class UserController
- * @package app\openapi\controller
- */
- class UserController extends BaseOpenController
- {
- /**
- * 获取用户信息
- * @return \think\response\Json
- */
- public function info()
- {
- $params = (new UserValidate())->post()->goCheckStrict('info');
- // 模拟用户数据
- $userData = [
- 'user_id' => $params['user_id'],
- 'nickname' => '测试用户',
- 'avatar' => 'https://example.com/avatar.jpg',
- 'mobile' => '138****8888',
- 'created_time' => date('Y-m-d H:i:s'),
- ];
-
- return $this->success('获取成功', $userData);
- }
- /*
- * 查询会员信息
- * */
- public function getUserInfo(){
- $params = (new UserValidate())->get()->goCheckStrict('getUserInfo');
- $detail = (new UserLogic)->detail($params['mobile']);
- return $this->success('获取成功', $detail);
- }
- /*
- * 查询会员信息
- * */
- public function addUser(){
- $params = (new UserValidate())->post()->goCheckStrict('addUser');
- $result = (new UserLogic)->addUserInfo($params);
- if ($result) {
- return $this->success('新增会员成功', [],1,1);
- }
- return $this->fail(UserLogic::getError());
- }
- /*
- * 更新会员信息
- * */
- public function updateUserInfo(){
- $params = (new UserValidate())->post()->goCheckStrict('updateUserInfo');
- $result = (new UserLogic)->updateUserInfo($params);
- if ($result) {
- return $this->success('编辑会员成功', [],1,1);
- }
- return $this->fail(UserLogic::getError());
- }
- /*
- * 会员充值
- * */
- public function userRecharge(){
- $params = (new UserValidate())->post()->goCheckStrict('userRecharge');
- $result = (new UserLogic)->userRecharge($params);
- if ($result) {
- return $this->success('会员充值同步成功', [],1,1);
- }
- return $this->fail(UserLogic::getError());
- }
- /**
- * 更新用户信息
- * @return \think\response\Json
- */
- public function update()
- {
- $params = (new UserValidate())->post()->goCheckStrict('update');
-
- // 这里处理更新逻辑
- // ...
-
- return $this->success('更新成功');
- }
- }
|