初始版本

This commit is contained in:
贾祥聪
2025-08-19 14:16:51 +08:00
commit f937a1f9b9
4373 changed files with 359728 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\AccountLogLists;
class AccountLogController extends BaseApiController
{
/**
* @notes 账户明细列表
* @return \think\response\Json
* @author ljj
* @date 2022/6/9 10:21 上午
*/
public function lists()
{
return $this->dataLists(new AccountLogLists());
}
}

View File

@@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\AdLists;
class AdController extends BaseApiController
{
public array $notNeedLogin = ['lists'];
/**
* @notes 广告列表
* @return \think\response\Json
* @author ljj
* @date 2022/3/25 9:55 上午
*/
public function lists()
{
return $this->dataLists(new AdLists());
}
}

View File

@@ -0,0 +1,40 @@
<?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\api\controller;
use app\common\controller\BaseLikeShopController;
class BaseApiController extends BaseLikeShopController
{
protected int $userId = 0;
protected array $userInfo = [];
public function initialize()
{
if (isset($this->request->userInfo) && $this->request->userInfo) {
$this->userInfo = $this->request->userInfo;
$this->userId = $this->request->userInfo['user_id'];
}
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\api\controller;
use app\api\logic\CityLogic;
class CityController extends BaseApiController
{
/**
* @notes 获取城市列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author cjhao
* @date 2024/10/6 17:50
*/
public function getCityLists()
{
$lists = (new CityLogic())->getCityLists();
return $this->success('',$lists);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace app\api\controller;
use app\api\lists\CoachLists;
use app\api\logic\CoachLogic;
/**
* 技师控制器类
* Class CoachController
* @package app\api\controller
*/
class CoachController extends BaseApiController
{
public array $notNeedLogin = ['skillLists','lists','detail'];
/**
* @notes 技能列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author cjhao
* @date 2024/9/4 17:03
*/
public function skillLists()
{
$data = ((new CoachLogic())->skillLists());
return $this->success('',$data);
}
/**
* @notes 获取技师列表
* @return \think\response\Json
* @author cjhao
* @date 2024/9/3 23:37
*/
public function lists()
{
return $this->dataLists((new CoachLists()));
}
/**
* @notes 详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author cjhao
* @date 2024/9/4 17:05
*/
public function detail()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$data = (new CoachLogic())->detail($params);
return $this->success('',$data);
}
}

View File

@@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\ConfigLogic;
class ConfigController extends BaseApiController
{
public array $notNeedLogin = ['config','agreement'];
/**
* @notes 基础配置信息
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/23 10:31 上午
*/
public function config()
{
$result = (new ConfigLogic())->config();
return $this->success('获取成功',$result);
}
/**
* @notes 政策协议
* @return \think\response\Json
* @author ljj
* @date 2022/2/23 11:42 上午
*/
public function agreement()
{
$result = (new ConfigLogic())->agreement();
return $this->success('获取成功',$result);
}
/**
* @notes 获取客服配置
* @return \think\response\Json
* @author cjhao
* @date 2024/11/1 18:16
*/
public function getKefuConfig()
{
$result = (new ConfigLogic())->getKefuConfig();
return $this->success('',$result);
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace app\api\controller;
use app\api\logic\DecorateLogic;
/**
* 装修风格控制器类
* Class DecorateController
* @package app\api\controller
*/
class DecorateController extends BaseApiController
{
public array $notNeedLogin = ['page','style','tabbar','decorateGoods'];
/**
* @notes 获取装修页面
* @return \think\response\Json
* @author cjhao
* @date 2024/10/8 15:13
*/
public function page()
{
$type = $this->request->get('type',1);
$cityId = $this->request->get('city_id',0);
$detail = (new DecorateLogic())->page($type,$cityId);
return $this->success('',$detail);
}
/**
* @notes 获取装修风格
* @return \think\response\Json
* @author cjhao
* @date 2024/10/8 15:14
*/
public function style()
{
$detail = (new DecorateLogic())->style();
return $this->success('',$detail);
}
/**
* @notes 底部菜单
* @return \think\response\Json
* @author cjhao
* @date 2024/10/8 15:57
*/
public function tabbar()
{
$detail = (new DecorateLogic())->tabbar();
return $this->success('',$detail);
}
}

View File

@@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\GoodsCategoryLists;
use app\api\logic\GoodsCategoryLogic;
class GoodsCategoryController extends BaseApiController
{
public array $notNeedLogin = ['lists','otherLists'];
/**
* @notes 服务分类列表
* @return \think\response\Json
* @author ljj
* @date 2022/2/18 10:55 上午
*/
public function lists()
{
return $this->dataLists(new GoodsCategoryLists());
}
/**
* @notes 其它分类列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/29 3:16 下午
*/
public function otherLists()
{
$id = $this->request->get('id',0);
$result = (new GoodsCategoryLogic)->otherLists($id);
return $this->success('',$result);
}
}

View File

@@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\CommentGoodsLists;
use app\api\lists\GoodsCommentLists;
use app\api\logic\GoodsCommentLogic;
use app\api\validate\GoodsCommentValidate;
class GoodsCommentController extends BaseApiController
{
public array $notNeedLogin = ['lists','commentCategory'];
/**
* @notes 服务评价列表
* @return \think\response\Json
* @author ljj
* @date 2022/2/18 11:24 上午
*/
public function lists()
{
return $this->dataLists(new GoodsCommentLists());
}
/**
* @notes 服务评价分类
* @return \think\response\Json
* @author ljj
* @date 2022/2/18 2:10 下午
*/
public function commentCategory()
{
$params = (new GoodsCommentValidate())->get()->goCheck('CommentCategory');
$result = (new GoodsCommentLogic())->commentCategory($params);
return $this->success('',$result);
}
/**
* @notes 评价商品列表
* @return \think\response\Json
* @author ljj
* @date 2022/2/21 6:00 下午
*/
public function commentGoodsLists()
{
return $this->dataLists(new CommentGoodsLists());
}
/**
* @notes 评价服务信息
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/21 6:12 下午
*/
public function commentGoodsInfo()
{
$params = (new GoodsCommentValidate())->goCheck('CommentGoodsInfo',['user_id'=>$this->userId]);
$result = (new GoodsCommentLogic())->commentGoodsInfo($params);
return $this->success('',$result);
}
/**
* @notes 添加服务评价
* @return \think\response\Json
* @author ljj
* @date 2022/2/21 6:23 下午
*/
public function add()
{
$params = (new GoodsCommentValidate())->post()->goCheck('add');
$params['user_id'] = $this->userId;
$result = (new GoodsCommentLogic())->add($params);
if (false === $result) {
return $this->fail(GoodsCommentLogic::getError());
}
return $this->success('评价成功',[],1,1);
}
/**
* @notes 评价详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2024/7/31 下午5:37
*/
public function commentDetail()
{
$params = (new GoodsCommentValidate())->goCheck('commentDetail',['user_id'=>$this->userId]);
$result = (new GoodsCommentLogic())->commentDetail($params);
return $this->success('',$result);
}
}

View File

@@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\GoodsLists;
use app\api\logic\GoodsLogic;
use app\api\validate\GoodsValidate;
class GoodsController extends BaseApiController
{
public array $notNeedLogin = ['lists','detail'];
/**
* @notes 服务列表
* @return \think\response\Json
* @author ljj
* @date 2022/2/17 5:51 下午
*/
public function lists()
{
return $this->dataLists(new GoodsLists());
}
/**
* @notes 服务详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/18 10:40 上午
*/
public function detail(): \think\response\Json
{
$params = (new GoodsValidate())->get()->goCheck('detail');
$params['user_id'] = $this->userId;
$result = (new GoodsLogic())->detail($params);
return $this->success('获取成功',$result);
}
/**
* @notes 预约上门时间
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/11 2:32 下午
*/
public function appointTime()
{
$result = (new GoodsLogic())->appointTime();
return $this->success('获取成功',$result);
}
/**
* @notes 收藏服务
* @return \think\response\Json
* @author ljj
* @date 2022/3/16 4:14 下午
*/
public function collect()
{
$params = (new GoodsValidate())->post()->goCheck('collect');
$params['user_id'] = $this->userId;
(new GoodsLogic())->collect($params);
return $this->success('操作成功',[],1,1);
}
}

View File

@@ -0,0 +1,172 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\IndexServerLists;
use app\api\logic\IndexLogic;
class IndexController extends BaseApiController
{
public array $notNeedLogin = ['searchLog','getNearbyLocation','index','visit','geocoder','geocoderCoordinate','address','getNearbyCity','serverLists'];
/**
* @notes 搜索记录
* @return \think\response\Json
* @author cjhao
* @date 2024/9/5 10:44
*/
public function searchLog()
{
$result = (new IndexLogic())->searchLog($this->userId);
return $this->success('',$result);
}
/**
* @notes 首页信息
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/23 4:49 下午
*/
public function index()
{
$get = $this->request->get();
$result = (new IndexLogic())->index($get);
return $this->success('',$result);
}
/**
* @notes 首页访客记录
* @author Tab
* @date 2021/9/11 9:16
*/
public function visit()
{
$result = IndexLogic::visit();
if ($result) {
return $this->success('');
}
return $this->fail(IndexLogic::getError(), [], 0, 0);
}
/**
* @notes 地址解析(地址转坐标)
* @return \think\response\Json
* @author ljj
* @date 2022/10/13 12:06 下午
* 本接口提供由文字地址到经纬度的转换能力,并同时提供结构化的省市区地址信息。
*/
public function geocoder()
{
$get = $this->request->get();
if (!isset($get['address']) || $get['address'] == '') {
return $this->fail('地址缺失');
}
$result = IndexLogic::geocoder($get);
if ($result['status'] !== 0) {
return $this->fail($result['message']);
}
return $this->success('',$result);
}
/**
* @notes 逆地址解析(坐标位置描述)
* @return \think\response\Json
* @author ljj
* @date 2022/10/13 2:44 下午
* 本接口提供由经纬度到文字地址及相关位置信息的转换能力
*/
public function geocoderCoordinate()
{
$get = $this->request->get();
if (!isset($get['location']) || $get['location'] == '') {
return $this->fail('经纬度缺失');
}
$result = IndexLogic::geocoderCoordinate($get);
if ($result['status'] !== 0) {
return $this->fail($result['message']);
}
return $this->success('',$result);
}
/**
* @notes 搜索附近地址
* @return \think\response\Json
* @author ljj
* @date 2024/7/23 上午11:21
*/
public function getNearbyLocation()
{
$params = $this->request->get();
$result = (new IndexLogic())->getNearbyLocation($params);
if ($result['status'] !== 0) {
return $this->fail($result['message']);
}
return $this->success('',$result);
}
/**
* @notes 获取当前位置最近的城市
* @return \think\response\Json
* @author cjhao
* @date 2024/9/3 17:34
*/
public function getNearbyCity()
{
$params = $this->request->get();
$result = (new IndexLogic())->getNearbyCity($params);
if(false === $result){
return $this->fail(IndexLogic::getError());
}
return $this->success('',$result);
}
/**
* @notes 获取首页的服务列表
* @return \think\response\Json
* @author cjhao
* @date 2024/9/3 23:01
*/
public function serverLists()
{
return $this->dataLists((new IndexServerLists()));
}
/**
* @notes 收藏接口
* @return \think\response\Json
* @author cjhao
* @date 2024/9/5 09:32
*/
public function collect()
{
$params = $this->request->post();
(new IndexLogic())->collect($params,$this->userId);
return $this->success('操作成功');
}
}

View File

@@ -0,0 +1,193 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\LoginLogic;
use app\api\validate\{LoginAccountValidate, RegisterValidate, WechatLoginValidate};
/**
* 登录注册
* Class LoginController
* @package app\api\controller
*/
class LoginController extends BaseApiController
{
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin'];
/**
* @notes 注册账号
* @return \think\response\Json
* @author 段誉
* @date 2022/9/7 15:38
*/
public function register()
{
$params = (new RegisterValidate())->post()->goCheck('register');
$result = LoginLogic::register($params);
if (true === $result) {
return $this->success('注册成功', [], 1, 1);
}
return $this->fail(LoginLogic::getError());
}
/**
* @notes 账号密码/手机号密码/手机号验证码登录
* @return \think\response\Json
* @author 段誉
* @date 2022/9/16 10:42
*/
public function account()
{
$params = (new LoginAccountValidate())->post()->goCheck();
$result = LoginLogic::login($params);
if (false === $result) {
return $this->fail(LoginLogic::getError());
}
return $this->data($result);
}
/**
* @notes 退出登录
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/16 10:42
*/
public function logout()
{
LoginLogic::logout($this->userInfo);
return $this->success();
}
/**
* @notes 获取微信请求code的链接
* @return \think\response\Json
* @author 段誉
* @date 2022/9/15 18:27
*/
public function codeUrl()
{
$url = $this->request->get('url');
$result = ['url' => LoginLogic::codeUrl($url)];
return $this->success('获取成功', $result);
}
/**
* @notes 公众号登录
* @return \think\response\Json
* @throws \GuzzleHttp\Exception\GuzzleException
* @author 段誉
* @date 2022/9/20 19:48
*/
public function oaLogin()
{
$params = (new WechatLoginValidate())->post()->goCheck('oa');
$res = LoginLogic::oaLogin($params);
if (false === $res) {
return $this->fail(LoginLogic::getError());
}
return $this->success('', $res);
}
/**
* @notes 小程序-登录接口
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 19:48
*/
public function mnpLogin()
{
$params = (new WechatLoginValidate())->post()->goCheck('mnpLogin');
$res = LoginLogic::mnpLogin($params);
if (false === $res) {
return $this->fail(LoginLogic::getError());
}
return $this->success('', $res);
}
/**
* @notes 小程序绑定微信
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 19:48
*/
public function mnpAuthBind()
{
$params = (new WechatLoginValidate())->post()->goCheck("wechatAuth");
$params['user_id'] = $this->userId;
$result = LoginLogic::mnpAuthLogin($params);
if ($result === false) {
return $this->fail(LoginLogic::getError());
}
return $this->success('绑定成功', [], 1, 1);
}
/**
* @notes 公众号绑定微信
* @return \think\response\Json
* @throws \GuzzleHttp\Exception\GuzzleException
* @author 段誉
* @date 2022/9/20 19:48
*/
public function oaAuthBind()
{
$params = (new WechatLoginValidate())->post()->goCheck("wechatAuth");
$params['user_id'] = $this->userId;
$result = LoginLogic::oaAuthLogin($params);
if ($result === false) {
return $this->fail(LoginLogic::getError());
}
return $this->success('绑定成功', [], 1, 1);
}
/**
* @notes 解绑微信(测试用)
* @return \think\response\Json
* @author ljj
* @date 2023/1/11 10:35 上午
*/
public function unbinding()
{
LoginLogic::unbinding($this->userId);
return $this->success('解绑成功', [], 1, 1);
}
/**
* @notes 更新用户头像昵称
* @return \think\response\Json
* @throws \think\db\exception\DbException
* @author ljj
* @date 2023/2/2 6:36 下午
*/
public function updateUser()
{
$params = (new WechatLoginValidate())->post()->goCheck("updateUser");
LoginLogic::updateUser($params,$this->userId);
return $this->success('操作成功',[],1,1);
}
}

View File

@@ -0,0 +1,235 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\OrderLists;
use app\api\logic\OrderLogic;
use app\api\validate\OrderAppendValidate;
use app\api\validate\OrderCommentValidate;
use app\api\validate\OrderGapValidate;
use app\api\validate\OrderValidate;
use app\api\validate\PlaceOrderValidate;
use app\common\service\ConfigService;
use app\common\service\storage\Driver as StorageDriver;
use Exception;
/**
* 订单控制器类
* Class OrderController
* @package app\api\controller
*/
class OrderController extends BaseApiController
{
public array $notNeedLogin = ['test'];
/**
* @notes 提交订单
* @return \think\response\Json
* @author ljj
* @date 2022/2/25 10:12 上午
*/
public function placeOrder()
{
$data = [
'terminal' => $this->userInfo['terminal'],
'user_id'=> $this->userId
];
$params = (new PlaceOrderValidate())->post()->goCheck('', $data);
//订单结算信息
$settlement = (new OrderLogic())->settlement($params);
if (false === $settlement) {
return $this->fail(OrderLogic::getError());
}
//结算信息
if ($params['action'] == 'settlement') {
unset($settlement['city']);
return $this->data($settlement);
}
//提交订单
$result = (new OrderLogic())->submitOrder($settlement);
if (false === $result) {
return $this->fail(OrderLogic::getError());
}
return $this->data($result);
}
/**
* @notes 获取技师服务时间
* @return \think\response\Json
* @author cjhao
* @date 2024/9/14 14:03
*/
public function getCoachServerTime()
{
$coachId = $this->request->get('coach_id');
$goodsId = $this->request->get('goods_id');
$result = (new OrderLogic())->getCoachServerTime($coachId,$goodsId);
if (false === $result) {
return $this->fail(OrderLogic::getError());
}
return $this->data($result);
}
/**
* @notes 订单列表
* @return \think\response\Json
* @author ljj
* @date 2022/2/28 10:01 上午
*/
public function lists()
{
return $this->dataLists(new OrderLists());
}
/**
* @notes 订单详情
* @return \think\response\Json
* @author ljj
* @date 2022/2/28 11:23 上午
*/
public function detail()
{
$params = (new OrderValidate())->get()->goCheck('detail');
$result = (new OrderLogic())->detail($params['id']);
return $this->success('',$result);
}
/**
* @notes 取消订单
* @return \think\response\Json
* @author ljj
* @date 2022/2/28 11:36 上午
*/
public function cancel()
{
$params = (new OrderValidate())->post()->goCheck('cancel');
$params['user_id'] = $this->userId;
$result = (new OrderLogic())->cancel($params);
if (true !== $result) {
return $this->fail($result);
}
return $this->success('操作成功',[],1,1);
}
/**
* @notes 删除订单
* @return \think\response\Json
* @author ljj
* @date 2022/2/28 11:50 上午
*/
public function del()
{
$params = (new OrderValidate())->post()->goCheck('del');
(new OrderLogic())->del($params['id']);
return $this->success('操作成功',[],1,1);
}
/**
* @notes 支付方式
* @return \think\response\Json
* @author ljj
* @date 2024/7/24 下午7:08
*/
public function payWay()
{
$params = (new OrderValidate())->get()->goCheck('payWay',['user_id'=>$this->userId]);
$result = OrderLogic::payWay($params);
if(false === $result){
return $this->fail(OrderLogic::getError());
}
return $this->data($result);
}
/**
* @notes 订单补差价
* @return \think\response\Json
* @author cjhao
* @date 2024/9/18 12:34
*/
public function orderGap()
{
$params = (new OrderGapValidate())->post()->goCheck('',['user_id'=>$this->userId]);
$result = (new OrderLogic())->orderGap($params);
if (false === $result) {
return $this->fail(OrderLogic::getError());
}
return $this->data($result);
}
/**
* @notes 订单加钟
* @return \think\response\Json
* @author cjhao
* @date 2024/9/18 13:45
*/
public function orderAppend()
{
$params = (new OrderAppendValidate())->post()->goCheck('',['user_id'=>$this->userId]);
$result = (new OrderLogic())->orderAppend($params);
if (false === $result) {
return $this->fail(OrderLogic::getError());
}
return $this->data($result);
}
/**
* @notes 订单评论
* @return \think\response\Json
* @author cjhao
* @date 2024/9/24 20:43
*/
public function comment()
{
$params = (new OrderCommentValidate())->post()->goCheck('',['user_id'=>$this->userId]);
$result = (new OrderLogic())->comment($params);
if (false === $result) {
return $this->fail(OrderLogic::getError());
}
return $this->success('评论成功',[],1,1,);
}
public function test(){
// 存储引擎
$config = [
'default' => ConfigService::get('storage', 'default', 'local'),
'engine' => ConfigService::get('storage')
];
// 第三方存储
$avatar = 'uploads/user/avatar/' . md5(22 . time()) . '.jpeg';
$headimgurl = 'https://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaEK0ymicw4pcTUx7ZZaQrsnK46O8atVibKY4WbcBpaic9rUapwlul4fJXx87EgkYQwypzYNnAib3evXM9hU8a54IMtE02OXNeAxxDCXmmGKUmwbCbw/132';
$StorageDriver = new StorageDriver($config);
dd($StorageDriver->fetch($headimgurl, $avatar));
if (!$StorageDriver->fetch($headimgurl, $avatar)) {
throw new Exception('头像保存失败:' . $StorageDriver->getError());
}
dd(123);
}
}

View File

@@ -0,0 +1,128 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\PayLogic;
use app\api\validate\PayValidate;
use app\common\enum\user\UserTerminalEnum;
use app\common\service\AliPayService;
use app\common\service\WeChatPayService;
use think\facade\Log;
class PayController extends BaseApiController
{
public array $notNeedLogin = ['notifyMnp','notifyOa','aliNotify'];
/**
* @notes 支付方式
* @return \think\response\Json
* @author ljj
* @date 2022/2/28 2:56 下午
*/
public function payWay()
{
$params = (new PayValidate())->get()->goCheck('payWay',['user_id'=>$this->userId]);
$result = PayLogic::payWay($params);
if ($result === false) {
return $this->fail(PayLogic::getError());
}
return $this->data($result);
}
/**
* @notes 预支付
* @return \think\response\Json
* @throws \Exception
* @author ljj
* @date 2022/3/1 11:20 上午
*/
public function prepay()
{
$params = (new PayValidate())->post()->goCheck('prepay');
//支付流程
$result = PayLogic::pay($params['pay_way'], $params['from'], $params['order_id'], $this->userInfo['terminal']);
if (false === $result) {
return $this->fail(PayLogic::getError(), $params);
}
return $this->success('', $result);
}
/**
* @notes 小程序支付回调
* @return \Symfony\Component\HttpFoundation\Response
* @author 段誉
* @date 2021/8/13 14:17
*/
public function notifyMnp()
{
return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify();
}
/**
* @notes 公众号支付回调
* @return \Symfony\Component\HttpFoundation\Response
* @author 段誉
* @date 2021/8/13 14:17
*/
public function notifyOa()
{
return (new WeChatPayService(UserTerminalEnum::WECHAT_OA))->notify();
}
/**
* @notes 支付宝回调
* @return bool
* @author 段誉
* @date 2021/8/13 14:16
*/
public function aliNotify()
{
$params = $this->request->post();
$result = (new AliPayService())->notify($params);
if (true === $result) {
echo 'success';
} else {
echo 'fail';
}
}
/**
* @notes 获取支付结果
* @return \think\response\Json
* @author ljj
* @date 2024/3/21 5:49 下午
*/
public function getPayResult()
{
$params = (new PayValidate())->get()->goCheck('getPayResult');
//支付流程
$result = PayLogic::getPayResult($params);
if (false === $result) {
return $this->fail(PayLogic::getError());
}
return $this->success('', $result);
}
}

View File

@@ -0,0 +1,53 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\RechargeLists;
use app\api\logic\RechargeLogic;
use app\api\validate\RechargeValidate;
class RechargeController extends BaseApiController
{
/**
* @notes 充值
* @return \think\response\Json
* @throws \think\Exception
* @author ljj
* @date 2022/12/16 16:03
*/
public function recharge()
{
$params = (new RechargeValidate())->post()->goCheck('recharge',['user_id'=>$this->userId,'terminal'=>$this->userInfo['terminal']]);
$result = (new RechargeLogic())->recharge($params);
return $this->success('',$result);
}
/**
* @notes 充值记录列表
* @return \think\response\Json
* @author ljj
* @date 2022/6/9 3:13 下午
*/
public function logLists()
{
return $this->dataLists(new RechargeLists());
}
}

View File

@@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\common\logic\RegionLogic;
class RegionController extends BaseApiController
{
public array $notNeedLogin = ['region','city'];
/**
* @notes 地区
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/4/6 10:51 上午
*/
public function region()
{
$params = $this->request->get();
$result = (new RegionLogic())->region($params);
return $this->success('获取成功',$result);
}
/**
* @notes 地级市列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/4/6 2:41 下午
*/
public function city()
{
$params = $this->request->get();
$result = (new RegionLogic())->city($params);
return $this->success('获取成功',$result);
}
}

View File

@@ -0,0 +1,74 @@
<?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\api\controller;
use app\api\logic\RegisterLogic;
use app\api\validate\RegisterValidate;
use app\common\enum\notice\NoticeEnum;
/**
* 注册控制器
* Class RegisterController
* @package app\api\controller
*/
class RegisterController extends BaseApiController
{
public array $notNeedLogin = ['captcha', 'register'];
/**
* @notes 发送验证码 - 注册
* @author Tab
* @date 2021/8/25 11:20
*/
public function captcha()
{
$params = (new RegisterValidate())->post()->goCheck('captcha');
$code = mt_rand(1000, 9999);
$result = event('Notice', [
'scene_id' => NoticeEnum::LOGIN_CAPTCHA,
'params' => [
'mobile' => $params['mobile'],
'code' => $code,
]
]);
if ($result[0] === true) {
return $this->success('发送成功',[],1,1);
}
return $this->fail($result[0], [], 0, 1);
}
/**
* @notes 手机号注册
* @return \think\response\Json
* @author Tab
* @date 2021/8/25 11:47
*/
public function register()
{
$params = (new RegisterValidate())->post()->goCheck('register');
$result = RegisterLogic::register($params);
if($result) {
return $this->success('注册成功', [], 1, 1);
}
return $this->fail(RegisterLogic::getError());
}
}

View File

@@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SearchLogic;
/**
* 搜索
* Class HotSearchController
* @package app\api\controller
*/
class SearchController extends BaseApiController
{
public array $notNeedLogin = ['hotLists'];
/**
* @notes 热门搜素
* @return \think\response\Json
* @author 段誉
* @date 2022/9/22 10:14
*/
public function hotLists()
{
return $this->data(SearchLogic::hotLists());
}
}

View File

@@ -0,0 +1,49 @@
<?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\api\controller;
use app\api\logic\ShareLogic;
use app\api\validate\ShareValidate;
/**
* 分享控制器
* Class ShareController
* @package app\shopapi\controller
*/
class ShareController extends BaseApiController
{
public array $notNeedLogin = ['getMnpQrCode'];
/**
* @notes 获取小程序码
* @return \think\response\Json
* @author ljj
* @date 2023/2/28 5:08 下午
*/
public function getMnpQrCode()
{
$params = (new ShareValidate())->goCheck('getMnpQrCode');
$res = (new ShareLogic())->getMnpQrCode($params);
if(true !== $res){
return $this->fail(ShareLogic::getReturnData());
}
return $this->success('获取成功',['qr_code'=>ShareLogic::getReturnData()]);
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace app\api\controller;
use app\api\lists\ShopCommentGoodsLists;
use app\api\lists\ShopLists;
use app\api\logic\ShopLogic;
/**
* 门店控制器类
* Class ShopController
* @package app\api\controller
*/
class ShopController extends BaseApiController
{
public array $notNeedLogin = ['lists','detail','commentCategory','commentLists'];
/**
* @notes 商家列表
* @return \think\response\Json
* @author cjhao
* @date 2024/11/20 20:40
*/
public function lists()
{
return $this->dataLists((new ShopLists()));
}
/**
* @notes 门店详情
* @return \think\response\Json
* @author cjhao
* @date 2024/10/18 01:54
*/
public function detail(){
$params = $this->request->get();
$detail = (new ShopLogic())->detail($params,$this->userInfo);
return $this->success('',$detail);
}
/**
* @notes 分类列表
* @return \think\response\Json
* @author cjhao
* @date 2024/10/28 15:26
*/
public function commentCategory()
{
$shopId = $this->request->get('shop_id');
$lists = (new ShopLogic())->commentCategory($shopId);
return $this->success('',$lists);
}
/**
* @notes 分类列表
* @return \think\response\Json
* @author cjhao
* @date 2024/10/28 16:06
*/
public function commentLists()
{
return $this->dataLists((new ShopCommentGoodsLists()));
}
}

View File

@@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\validate\SendSmsValidate;
use app\common\logic\SmsLogic;
/**
* 短信
* Class SmsController
* @package app\api\controller
*/
class SmsController extends BaseApiController
{
public array $notNeedLogin = ['sendCode'];
/**
* @notes 发送短信验证码
* @return \think\response\Json
* @author 段誉
* @date 2022/9/15 16:17
*/
public function sendCode()
{
$params = (new SendSmsValidate())->post()->goCheck();
$result = SmsLogic::sendCode($params);
if (true === $result) {
return $this->success('发送成功');
}
return $this->fail(SmsLogic::getError());
}
}

View File

@@ -0,0 +1,35 @@
<?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\api\controller;
use app\api\logic\SubscribeLogic;
/**
* 小程序订阅消息
*/
class SubscribeController extends BaseApiController
{
public array $notNeedLogin = ['lists'];
public function lists()
{
$result = SubscribeLogic::lists();
return $this->data($result);
}
}

View File

@@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\common\enum\FileEnum;
use app\common\service\UploadService;
use Exception;
use think\response\Json;
/** 上传文件
* Class UploadController
* @package app\api\controller
*/
class UploadController extends BaseApiController
{
/**
* @notes 上传图片
* @return Json
* @author 段誉
* @date 2022/9/20 18:11
*/
public function image()
{
try {
$result = UploadService::image(0, $this->userId,FileEnum::SOURCE_USER);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
}

View File

@@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\UserAddressLogic;
use app\api\validate\UserAddressValidate;
class UserAddressController extends BaseApiController
{
/**
* @notes 地址列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/24 10:45 上午
*/
public function lists()
{
$params = $this->request->get();
$result = (new UserAddressLogic())->lists($this->userId,$params);
return $this->success('',$result);
}
/**
* @notes 添加地址
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 10:52 上午
*/
public function add()
{
$params = (new UserAddressValidate())->post()->goCheck('add');
$params['user_id'] = $this->userId;
(new UserAddressLogic())->add($params);
return $this->success('操作成功',[],1,1);
}
/**
* @notes 地址详情
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 11:56 上午
*/
public function detail()
{
$id = $this->request->get('id');
$result = (new UserAddressLogic())->detail($id);
return $this->success('',$result);
}
/**
* @notes 编辑地址
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 11:59 上午
*/
public function edit()
{
$params = (new UserAddressValidate())->post()->goCheck('edit');
$params['user_id'] = $this->userId;
(new UserAddressLogic())->edit($params);
return $this->success('操作成功',[],1,1);
}
/**
* @notes 设置默认地址
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 12:08 下午
*/
public function setDefault()
{
$params['id'] = $this->request->post('id');
$params['user_id'] = $this->userId;
(new UserAddressLogic())->setDefault($params);
return $this->success('操作成功',[],1,1);
}
/**
* @notes 删除地址
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 2:35 下午
*/
public function del()
{
$id = $this->request->post('id');
(new UserAddressLogic())->del($id);
return $this->success('操作成功',[],1,1);
}
}

View File

@@ -0,0 +1,294 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\lists\CollectLists;
use app\api\logic\UserLogic;
use app\api\validate\PasswordValidate;
use app\api\validate\UserValidate;
use app\common\enum\notice\NoticeEnum;
class UserController extends BaseApiController
{
public array $notNeedLogin = ['customerService','resetPasswordCaptcha','resetPassword'];
/**
* @notes 用户中心
* @return \think\response\Json
* @author ljj
* @date 2022/2/23 5:25 下午
*/
public function center()
{
$result = (new UserLogic())->center($this->userInfo);
return $this->success('',$result);
}
/**
* @notes 收藏列表
* @return \think\response\Json
* @author cjhao
* @date 2024/10/17 15:14
*/
public function collectLists()
{
return $this->dataLists(new CollectLists());
}
/**
* @notes 客服配置
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 2:53 下午
*/
public function customerService()
{
$result = (new UserLogic())->customerService();
return $this->success('',$result);
}
// /**
// * @notes 用户收藏列表
// * @return \think\response\Json
// * @author ljj
// * @date 2022/2/24 3:07 下午
// */
// public function collectLists()
// {
// $lists = (new UserLogic())->collectLists($this->userId);
// return $this->success('',$lists);
// }
/**
* @notes 用户信息
* @return \think\response\Json
* @author ljj
* @date 2022/3/7 5:53 下午
*/
public function info()
{
$code = $this->request->get('code');
$result = UserLogic::info($this->userId,$code);
if(false === $result){
return $this->fail(UserLogic::getError());
}
return $this->data($result);
}
/**
* @notes 设置用户信息
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 3:44 下午
*/
public function setInfo()
{
$params = (new UserValidate())->post()->goCheck('setInfo', ['id' => $this->userId]);
(new UserLogic)->setInfo($this->userId, $params);
return $this->success('操作成功', [],1,1);
}
/**
* @notes 获取微信手机号并绑定
* @return \think\response\Json
* @author ljj
* @date 2022/2/24 4:41 下午
*/
public function getMobileByMnp()
{
$params = (new UserValidate())->post()->goCheck('getMobileByMnp');
$params['user_id'] = $this->userId;
$result = UserLogic::getMobileByMnp($params);
if($result === false) {
return $this->fail(UserLogic::getError());
}
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 发送验证码 - 重置登录密码
* @author Tab
* @date 2021/8/25 16:33
*/
public function resetPasswordCaptcha()
{
$params = (new UserValidate())->post()->goCheck('resetPasswordCaptcha');
$code = mt_rand(1000, 9999);
$result = event('Notice', [
'scene_id' => NoticeEnum::RESET_PASSWORD_CAPTCHA,
'params' => [
'user_id' => $this->userId,
'code' => $code,
'mobile' => $params['mobile']
]
]);
if ($result[0] === true) {
return $this->success('发送成功');
}
return $this->fail($result[0], [], 0, 1);
}
/**
* @notes 重置密码
* @return \think\response\Json
* @author 段誉
* @date 2022/9/16 18:06
*/
public function resetPassword()
{
$params = (new PasswordValidate())->post()->goCheck('resetPassword');
$result = UserLogic::resetPassword($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 设置登录密码
* @return \think\response\Json
* @author Tab
* @date 2021/10/22 18:09
*/
public function setPassword()
{
$params = (new UserValidate())->post()->goCheck('setPassword');
$params['user_id'] = $this->userId;
$result = UserLogic::setPassword($params);
if($result) {
return $this->success('设置成功',[], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 修改密码
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 19:16
*/
public function changePassword()
{
$params = (new PasswordValidate())->post()->goCheck('changePassword');
$result = UserLogic::changePassword($params, $this->userId);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 判断用户是否设置登录密码
* @return mixed
* @author Tab
* @date 2021/10/22 18:24
*/
public function hasPassword()
{
$result = UserLogic::hasPassword($this->userId);
return $this->data([
'has_password' => $result
]);
}
/**
* @notes 发送验证码 - 绑定手机号
* @author Tab
* @date 2021/8/25 17:35
*/
public function bindMobileCaptcha()
{
$params = (new UserValidate())->post()->goCheck('bindMobileCaptcha');
$code = mt_rand(1000, 9999);
$result = event('Notice', [
'scene_id' => NoticeEnum::BIND_MOBILE_CAPTCHA,
'params' => [
'user_id' => $this->userId,
'code' => $code,
'mobile' => $params['mobile']
]
]);
if ($result[0] === true) {
return $this->success('发送成功');
}
return $this->fail($result[0], [], 0, 1);
}
/**
* @notes 发送验证码 - 变更手机号
* @author Tab
* @date 2021/8/25 17:35
*/
public function changeMobileCaptcha()
{
$params = (new UserValidate())->post()->goCheck('changeMobileCaptcha');
$code = mt_rand(1000, 9999);
$result = event('Notice', [
'scene_id' => NoticeEnum::CHANGE_MOBILE_CAPTCHA,
'params' => [
'user_id' => $this->userId,
'code' => $code,
'mobile' => $params['mobile']
]
]);
if ($result[0] === true) {
return $this->success('发送成功');
}
return $this->fail($result[0], [], 0, 1);
}
/**
* @notes 绑定手机号
* @return \think\response\Json
* @author Tab
* @date 2021/8/25 17:46
*/
public function bindMobile()
{
$params = (new UserValidate())->post()->goCheck('bindMobile');
$params['id'] = $this->userId;
$result = UserLogic::bindMobile($params);
if($result) {
return $this->success('绑定成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 我的钱包
* @return \think\response\Json
* @author ljj
* @date 2022/12/12 9:35 上午
*/
public function wallet()
{
$result = UserLogic::wallet($this->userId);
return $this->data($result);
}
}

View File

@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | LikeShop有特色的全开源社交分销电商系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 微信公众号:好象科技
// | 访问官网http://www.likemarket.net
// | 访问社区http://bbs.likemarket.net
// | 访问手册http://doc.likemarket.net
// | 好象科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | Author: LikeShopTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\WechatLogic;
use app\api\validate\WechatValidate;
/**
* 微信控制器
* Class WechatController
* @package app\api\controller
*/
class WechatController extends BaseApiController
{
public array $notNeedLogin = ['jsConfig'];
/**
* @notes 微信JSSDK授权接口
* @return \think\response\Json
* @author Tab
* @date 2021/8/30 19:20
*/
public function jsConfig()
{
$params = (new WechatValidate())->goCheck('jsConfig');
$result = WechatLogic::jsConfig($params);
if ($result === false) {
return $this->fail(WechatLogic::getError());
}
return $this->data($result);
}
}