提交其他文件

This commit is contained in:
2026-03-14 16:20:49 +08:00
parent a227deaecd
commit 0a19b334f8
1385 changed files with 73568 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?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\lists\AccountLogLists;
/**
* 账户流水
* Class AccountLogController
* @package app\api\controller
*/
class AccountLogController extends BaseApiController
{
/**
* @notes 账户流水
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 14:34
*/
public function lists()
{
return $this->dataLists(new AccountLogLists());
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace app\api\controller;
use app\api\logic\AreaLogic;
class AreaController extends BaseApiController
{
public array $notNeedLogin = ['getArea'];
/**
* @notes 开通城市列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/15 16:32
*/
public function getArea(){
$data = $this->request->post();
// $params = (new TeamasterValidate())->goCheck();
$result = AreaLogic::getArea();
$default = AreaLogic::getDfaultArea($data);
$d['area_list'] = $result;
$d['default'] = $default;
return $this->success('查询成功', $d, 1, 1);
}
}

View File

@ -0,0 +1,111 @@
<?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\lists\article\ArticleCollectLists;
use app\api\lists\article\ArticleLists;
use app\api\logic\ArticleLogic;
/**
* 文章管理
* Class ArticleController
* @package app\api\controller
*/
class ArticleController extends BaseApiController
{
public array $notNeedLogin = ['lists', 'cate', 'detail'];
/**
* @notes 文章列表
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 15:30
*/
public function lists()
{
return $this->dataLists(new ArticleLists());
}
/**
* @notes 文章分类列表
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 15:30
*/
public function cate()
{
return $this->data(ArticleLogic::cate());
}
/**
* @notes 收藏列表
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 16:31
*/
public function collect()
{
return $this->dataLists(new ArticleCollectLists());
}
/**
* @notes 文章详情
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 17:09
*/
public function detail()
{
$id = $this->request->get('id/d');
$result = ArticleLogic::detail($id, $this->userId);
return $this->data($result);
}
/**
* @notes 加入收藏
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 17:01
*/
public function addCollect()
{
$articleId = $this->request->post('id/d');
ArticleLogic::addCollect($articleId, $this->userId);
return $this->success('操作成功');
}
/**
* @notes 取消收藏
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 17:01
*/
public function cancelCollect()
{
$articleId = $this->request->post('id/d');
ArticleLogic::cancelCollect($articleId, $this->userId);
return $this->success('操作成功');
}
}

View File

@ -0,0 +1,31 @@
<?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\controller\BaseLikeAdminController;
class BaseApiController extends BaseLikeAdminController
{
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,57 @@
<?php
namespace app\api\controller;
use app\api\logic\CommonLogic;
use app\api\validate\CommonValidate;
class CommonController extends BaseApiController
{
public array $notNeedLogin = ['get7Time','cityAddress','speaker','qrcode','ce_ttlock'];
/**
* @notes 获取时间查询
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/20 17:02
*/
public function get7Time(){
$params = (new CommonValidate())->post()->goCheck('addGroup');
$result = CommonLogic::get7Time($params);
if ($result === false) {
return $this->fail(CommonLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @notes 城市解析
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/29 16:30
*/
public function cityAddress(){
$data = $this->request->post();
$result = CommonLogic::getCityAddress($data);
return $this->success('查询成功', $result, 1, 1);
}
public function speaker(){
$result = CommonLogic::speaker();
return $this->success('查询成功', $result, 1, 1);
}
public function qrcode(){
$result = CommonLogic::qrcode();
return $this->success('查询成功', $result, 1, 1);
}
/**
* @return \think\response\Json
* 用户门锁控制
*/
public function ce_ttlock(){
$data = $this->request->post();
$result = CommonLogic::ce_ttlock($data);
if ($result === false) {
return $this->fail(CommonLogic::getError());
}
return $this->success('', [], 1, 1);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\api\controller;
use app\api\logic\DouyinAfterVerifiLogic;
use app\api\validate\DouyinAfterVerifiValidate;
class DouyinAfterVerifiController extends BaseApiController
{
public array $notNeedLogin = [''];
/**
* @param $params
* @return false|void
* 抖音核销
*/
public function setDouy(){
$params = (new DouyinAfterVerifiValidate())->post()->goCheck('setDouy');
$params['user_id'] =$this->userId;
$result = DouyinAfterVerifiLogic::setDouy($params);
if ($result === false) {
return $this->fail(DouyinAfterVerifiLogic::getError());
}
return $this->success('', $result, 1, 1);
}
}

View File

@ -0,0 +1,121 @@
<?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\IndexLogic;
use app\common\logic\PayNotifyLogic;
use app\common\model\store\StoreUser;
use app\common\model\teastore\TeaStore;
use think\response\Json;
/**
* index
* Class IndexController
* @package app\api\controller
*/
class IndexController extends BaseApiController
{
public array $notNeedLogin = ['index', 'carouselLists', 'config', 'policy', 'decorate'];
/**
* @notes 首页数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/21 19:15
*/
public function index()
{
$result = IndexLogic::getIndexData();
return $this->data($result);
}
/**
* @notes 首页轮播图列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/11 14:07
*/
public function carouselLists(){
$result = IndexLogic::carouselLists();
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 全局配置
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/21 19:41
*/
public function config()
{
$result = IndexLogic::getConfigData();
return $this->data($result);
}
/**
* @notes 政策协议
* @return Json
* @author 段誉
* @date 2022/9/20 20:00
*/
public function policy()
{
$type = $this->request->get('type/s', '');
$result = IndexLogic::getPolicyByType($type);
return $this->data($result);
}
/**
* @notes 装修信息
* @return Json
* @author 段誉
* @date 2022/9/21 18:37
*/
public function decorate()
{
$id = $this->request->get('id/d');
$result = IndexLogic::getDecorate($id);
return $this->data($result);
}
public function test()
{
$result = StoreUser::select();
foreach($result as $key=>$value){
$r = TeaStore::where("id","in",$value['store_ids'])->select();
$rstore_user_id = $r['store_user_id'];
foreach($r as $k=>$v){
if( $rstore_user_id == 0){
$rstore_user_id = $value['id'];
}else{
$rstore_user_id.=",".$value['id'];
}
TeaStore::where("id",$v['id'])->update(['store_user_id'=>$rstore_user_id]);
}
}
}
}

View File

@ -0,0 +1,218 @@
<?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\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
use app\api\logic\LoginLogic;
use think\facade\Log;
/**
* 登录注册
* Class LoginController
* @package app\api\controller
*/
class LoginController extends BaseApiController
{
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin'];
/**
* @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');
// log::write($params,1111);
$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 段誉
* @date 2022/10/20 18:25
*/
public function getScanCode()
{
$redirectUri = $this->request->get('url/s');
$result = LoginLogic::getScanCode($redirectUri);
if (false === $result) {
return $this->fail(LoginLogic::getError() ?? '未知错误');
}
return $this->success('', $result);
}
/**
* @notes 网站扫码登录
* @return \think\response\Json
* @author 段誉
* @date 2022/10/21 10:28
*/
public function scanLogin()
{
$params = (new WebScanLoginValidate())->post()->goCheck();
$result = LoginLogic::scanLogin($params);
if (false === $result) {
return $this->fail(LoginLogic::getError() ?? '登录失败');
}
return $this->success('', $result);
}
/**
* @notes 更新用户头像昵称
* @return \think\response\Json
* @author 段誉
* @date 2023/2/22 11:15
*/
public function updateUser()
{
$params = (new WechatLoginValidate())->post()->goCheck("updateUser");
LoginLogic::updateUser($params, $this->userId);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,383 @@
<?php
namespace app\api\controller;
use app\api\logic\OrderLogic;
class OrderController extends BaseApiController
{
/**
* 公众号订单
* Class TeaUser
* @package app\common\model\order
*/
public array $notNeedLogin = [];
/**
* @notes 提交订单信息
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/30 14:35
* @data
*/
public function submitOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = OrderLogic::addOrder($data);
if($result){
$d['id'] = $result;
return $this->success('操作成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 订单列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 14:57
* @data id
*/
public function orderList(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::orderList($data,$userId);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 订单详情
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/16 14:55
* @data
*/
public function orderDetails(){
$data = $this->request->post();
$result = OrderLogic::orderDetails($data);
if($result){
$d['details'] = $result;
return $this->success('查询成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 取消订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 14:59
* @data
*/
public function cancelOrder(){
$data = $this->request->post();
$result = OrderLogic::cancelOrder($data);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 删除订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 14:38
* @data
*/
public function delOrder(){
$data = $this->request->post();
$result = OrderLogic::delOrder($data);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 用户确认订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 15:36
* @data
*/
public function userConfirmOrder(){
$data = $this->request->post();
$result = OrderLogic::userConfirmOrder($data);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 提交包间订单信息
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:05
* @data
*/
public function submitStoreOrder(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::addStoreOrder($data,$userId);
if($result){
$d['id'] = $result;
return $this->success('操作成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 包间订单列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:03
* @data id
*/
public function orderStoreList(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::orderStoreList($data,$userId);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 包间订单详情
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:25
* @data
*/
public function orderStoreDetails(){
$data = $this->request->post();
$result = OrderLogic::orderStoreDetails($data);
if($result){
$d['details'] = $result;
return $this->success('查询成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 获取包间预定价格
* @return \think\response\Json
* @author Yzt
* @date 2026/01/19 15:25
* @data
*/
public function getOrderAmount(){
$data = $this->request->post();
$result = OrderLogic::getOrderAmount($data);
if($result){
$d['details'] = $result;
return $this->success('查询成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 获取续订包间价格
* @return \think\response\Json
* @author Yzt
* @date 2026/01/19 15:25
* @data
*/
public function getOrderRenewAmount(){
$data = $this->request->post();
$result = OrderLogic::getOrderRenewAmount($data);
if($result){
$d['details'] = $result;
return $this->success('查询成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 取消包间订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:38
* @data
*/
public function cancelOrderStore(){
$data = $this->request->post();
$result = OrderLogic::cancelOrderStore($data);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 删除包间订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:38
* @data
*/
public function delOrderStore(){
$data = $this->request->post();
// $result = OrderLogic::delOrderStore($data);
return $this->success('暂不支持', [], 1, 1);
}
/**
* @notes 用户确认包间订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:38
* @data
*/
public function userConfirmOrderStore(){
$data = $this->request->post();
$result = OrderLogic::userConfirmOrderStore($data);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 用户续订
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/20 15:38
* @data
*/
public function renewDtime(){
$data = $this->request->post();
$result = OrderLogic::renewDtime($data,$this->userId);
if($result){
return $this->success('操作成功', $result, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 提交团购订单信息
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/27 11:19
* @data
*/
public function submitGroupOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = OrderLogic::addGroupOrder($data);
if($result){
$d['id'] = $result['id'];
$d['order_amount'] = $result['order_amount'];
return $this->success('操作成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 团购订单列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/27 11:20
* @data id
*/
public function orderGroupList(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::orderGroupList($data,$userId);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 订单详情
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/16 14:55
* @data
*/
public function orderGroupDetails(){
$data = $this->request->post();
$result = OrderLogic::orderGroupDetails($data);
if($result){
$d['details'] = $result;
return $this->success('查询成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 茶室选择团购券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/28 15:26
* @data
*/
public function teaStoreGroupUseLists(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::teaStoreGroupUseLists($data,$userId);
if($result){
return $this->success('查询成功', $result, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 结算金额
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/28 15:26
* @data
*/
public function countPrice(){
$data = $this->request->post();
$userId = $this->userId;
$result = OrderLogic::countPrice($data,$userId);
if($result){
return $this->success('查询成功', $result, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 提交退款订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/12/21 19:23
* @data
*/
public function submitRefund(){
$data = $this->request->post();
$result = OrderLogic::submitRefund($data,$this->userId);
if($result){
$d['id'] = $result;
return $this->success('操作成功', $d, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 创建门店充值订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/12/21 19:23
* @data
*/
public function addRechargeOrder(){
$data = $this->request->post();
$result = OrderLogic::addRechargeOrder($data,$this->userId);
if($result){
return $this->success('', $result, 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 转让订单
* @return \think\response\Json
* @author 胥聪
* @date 2025/12/22 1:36
* @data
*/
public function transferOrder(){
$data = $this->request->post();
$result = OrderLogic::transferOrder($data,$this->userId);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(OrderLogic::getError());
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace app\api\controller;
use OSS\OssClient;
use OSS\Core\OssException;
class OssController extends BaseApiController
{
public array $notNeedLogin = ['testUpload'];
public function testUpload()
{var_dump(111);
$config = config('oss');
try {
$ossClient = new OssClient(
$config['accessKeyId'],
$config['accessKeySecret'],
$config['endpoint']
);
// 测试上传
$content = 'Hello OSS! ' . date('Y-m-d H:i:s');
$object = 'test/hello_' . time() . '.txt';
var_dump(111);
$r = $ossClient->putObject($config['bucket'], $object, $content);
var_dump($r);
return json([
'code' => 1,
'msg' => '上传成功',
'data' => [
'url' => 'https://' . $config['bucket'] . '.' . $config['endpoint'] . '/' . $object
]
]);
} catch (OssException $e) {
return json([
'code' => 0,
'msg' => '上传失败: ' . $e->getMessage()
]);
}
}
}

View File

@ -0,0 +1,221 @@
<?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\PayLogic;
use app\api\validate\PayValidate;
use app\common\enum\user\UserTerminalEnum;
use app\common\logic\PaymentLogic;
use app\common\service\pay\AliPayService;
use app\common\service\pay\WeChatPayService;
/**
* 支付
* Class PayController
* @package app\api\controller
*/
class PayController extends BaseApiController
{
public array $notNeedLogin = ['notifyMnp','notifyRefundMnp', 'notifyOa', 'aliNotify','notifyRefund'];
/**
* @notes 支付方式
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 17:54
*/
public function payWay()
{
$params = (new PayValidate())->goCheck('payway');
$result = PaymentLogic::getPayWay($this->userId, $this->userInfo['terminal'], $params);
if ($result === false) {
return $this->fail(PaymentLogic::getError());
}
return $this->data($result);
}
/**
* @notes 预支付
* @return \think\response\Json
* @author 段誉
* @date 2023/2/28 14:21
*/
public function prepay()
{
$params = (new PayValidate())->post()->goCheck();
$user_id = $this->userId;
//订单信息
$order = PaymentLogic::getPayOrderInfo($params,$user_id);
if (false === $order) {
return $this->fail(PaymentLogic::getError(), $params);
}
//支付流程
$result = PaymentLogic::createPay($params, $order, $user_id);
if($params['order_type'] == 1){
if($order['order_amount'] == 0){
$d['pay'] = $result;
$d['pay_type'] = 1;
return $this->success('', $d);
}
}
if($params['from'] == "wx" || $params['from'] == "recharge"){
$redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
$result = PaymentLogic::pay($params['order_type'],$params['pay_way'], $params['from'], $order, $this->userInfo['terminal'], $redirectUrl);
}
if (false === $result) {
return $this->fail(PaymentLogic::getError(), $params);
}
$d['pay'] = $result;
return $this->success('', $d);
}
/**
* @notes 预支付
* @return \think\response\Json
* @author 段誉
* @date 2023/2/28 14:21
*/
public function newprepay()
{
$params = (new PayValidate())->post()->goCheck();
$user_id = $this->userId;
//订单信息
$order = PaymentLogic::getPayInfo($params,$user_id);
if (false === $order) {
return $this->fail(PaymentLogic::getError(), $params);
}
//支付流程
if($params['from'] == "wx" || $params['from'] == "recharge"){
$redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
$result = PaymentLogic::pay($params['order_type'],$params['pay_way'], $params['from'], $order, $this->userInfo['terminal'], $redirectUrl);
}else{
$result =PaymentLogic::balancePay($order,$params);
}
if (false === $result) {
return $this->fail(PaymentLogic::getError());
}
return $this->success('', $result);
}
/**
* @notes 获取支付状态
* @return \think\response\Json
* @author 段誉
* @date 2023/3/1 16:23
*/
public function payStatus()
{
$params = (new PayValidate())->goCheck('status', ['user_id' => $this->userId]);
$result = PaymentLogic::getPayStatus($params);
if ($result === false) {
return $this->fail(PaymentLogic::getError());
}
return $this->data($result);
}
/**
* @notes 小程序支付回调
* @return \Psr\Http\Message\ResponseInterface
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
* @throws \ReflectionException
* @throws \Throwable
* @author 段誉
* @date 2023/2/28 14:21
*/
public function notifyMnp()
{
return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify();
}
public function notifyRefundMnp()
{
return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notifyRefundMnp();
}
/**
* @notes 公众号支付回调
* @return \Psr\Http\Message\ResponseInterface
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
* @throws \ReflectionException
* @throws \Throwable
* @author 段誉
* @date 2023/2/28 14:21
*/
public function notifyOa()
{
return (new WeChatPayService(UserTerminalEnum::WECHAT_OA))->notify();
}
/**
* @notes 支付宝回调
* @author mjf
* @date 2024/3/18 16:50
*/
public function aliNotify()
{
$params = $this->request->post();
$result = (new AliPayService())->notify($params);
if (true === $result) {
echo 'success';
} else {
echo 'fail';
}
}
/**
* @notes 余额支付
* @author 胥聪
* @date 2025/11/3 11:30
*/
public function yuePay()
{
$data = $this->request->post();
$user_id = $this->userId;
$result = PayLogic::yuePay($data,$user_id);
if ($result === false) {
return $this->fail(PayLogic::getError());
}
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 用户提交退款申请
* @author 胥聪
* @date 2025/12/21 15:37
*/
public function refund()
{
$data = $this->request->post();
$user_id = $this->userId;
$result = PayLogic::refund($data,$user_id);
if ($result === false) {
return $this->fail(PayLogic::getError());
}
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,95 @@
<?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\PcLogic;
use think\response\Json;
/**
* PC
* Class PcController
* @package app\api\controller
*/
class PcController extends BaseApiController
{
public array $notNeedLogin = ['index', 'config', 'infoCenter', 'articleDetail'];
/**
* @notes 首页数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/21 19:15
*/
public function index()
{
$result = PcLogic::getIndexData();
return $this->data($result);
}
/**
* @notes 全局配置
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/21 19:41
*/
public function config()
{
$result = PcLogic::getConfigData();
return $this->data($result);
}
/**
* @notes 资讯中心
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/19 16:55
*/
public function infoCenter()
{
$result = PcLogic::getInfoCenter();
return $this->data($result);
}
/**
* @notes 获取文章详情
* @return Json
* @author 段誉
* @date 2022/10/20 15:18
*/
public function articleDetail()
{
$id = $this->request->get('id/d', 0);
$source = $this->request->get('source/s', 'default');
$result = PcLogic::getArticleDetail($this->userId, $id, $source);
return $this->data($result);
}
}

View File

@ -0,0 +1,74 @@
<?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\lists\recharge\RechargeLists;
use app\api\logic\RechargeLogic;
use app\api\validate\RechargeValidate;
/**
* 充值控制器
* Class RechargeController
* @package app\shopapi\controller
*/
class RechargeController extends BaseApiController
{
/**
* @notes 获取充值列表
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 18:55
*/
public function lists()
{
return $this->dataLists(new RechargeLists());
}
/**
* @notes 充值
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 18:56
*/
public function recharge()
{
$params = (new RechargeValidate())->post()->goCheck('recharge', [
'user_id' => $this->userId,
'terminal' => $this->userInfo['terminal'],
// 'terminal' => 1,
]);
$result = RechargeLogic::recharge($params);
if (false === $result) {
return $this->fail(RechargeLogic::getError());
}
return $this->data($result);
}
/**
* @notes 充值配置
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 16:56
*/
public function config()
{
return $this->data(RechargeLogic::config($this->userId));
}
}

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
// +----------------------------------------------------------------------
// | 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\SmsLogic;
use app\api\validate\SendSmsValidate;
/**
* 短信
* 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,21 @@
<?php
namespace app\api\controller;
use app\api\logic\StoreLogic;
class StoreController extends BaseApiController
{
public array $notNeedLogin = ['storeList'];
/**
* @notes 获取门店信息
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/23 16:14
*/
public function storeList(){
$data = $this->request->post();
$result = StoreLogic::storeList($data);
return $this->success('查询成功', $result, 1, 1);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace app\api\controller;
use app\api\logic\SubmitFormLogic;
class SubmitFormController extends BaseApiController
{
public array $notNeedLogin = [];
public function addTeamaster(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = SubmitFormLogic::addTeamaster($data);
if ($result === false) {
return $this->fail(SubmitFormLogic::getError());
}
return $this->success('',$result, 1, 1);
}
public function addStore(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = SubmitFormLogic::addStore($data);
if ($result === false) {
return $this->fail(SubmitFormLogic::getError());
}
return $this->success('',$result, 1, 1);
}
public function teamasterRealStatus(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = SubmitFormLogic::teamasterRealStatus($data);
if ($result === false) {
return $this->fail(SubmitFormLogic::getError());
}
return $this->success('',$result, 1, 1);
}
public function storeRealStatus(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = SubmitFormLogic::storeRealStatus($data);
if ($result === false) {
return $this->fail(SubmitFormLogic::getError());
}
return $this->success('',$result, 1, 1);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace app\api\controller;
use app\api\logic\TaskLogic;
use app\common\model\order\OrderStore;
class TaskController extends BaseApiController
{
public array $notNeedLogin = ['taskTimer','setVip','sendSimple'];
/**
* @return void
* 脚本
*/
public function taskTimer(){
$result = TaskLogic::run();
}
public function setVip(){
$result = TaskLogic::steVip();
}
public function sendSimple(){
$result = TaskLogic::sendSimple();
}
}

View File

@ -0,0 +1,164 @@
<?php
namespace app\api\controller;
use app\api\logic\TeaStoreLogic;
class TeaStoreController extends BaseApiController
{
/**
* 小程序
* Class TeaUser
* @package app\common\model\teamaster
*/
public array $notNeedLogin = ['teaStoreLists','teaStoreCity','teaStoreDetails','teaStoreRoomLists','teaStoreGroupLists'];
/**
* @notes 首页茶室列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/5 16:23
*/
public function teaStoreLists(){
$data = $this->request->post();
// $data['user_id'] = $this->userId;
$result = TeaStoreLogic::getTeaStoreLists($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶室搜索历史
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/7 11:14
*/
public function teaStoreSearchHistory(){
$userId = $this->userId;
$result = TeaStoreLogic::getTeaStoreSearchHistory($userId);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 一键清空茶室搜索历史
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/11 16:28
*/
public function delTeaStoreSearchHistory(){
$userId = $this->userId;
$result = TeaStoreLogic::delTeaStoreSearchHistory($userId);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 茶室开通城市
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/7 17:53
*/
public function teaStoreCity(){
$result = TeaStoreLogic::getTeaStoreCity();
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶室详情页
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/11 10:53
*/
public function teaStoreDetails(){
$data = $this->request->post();
$result = TeaStoreLogic::getTeaStoreDetails($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶室包间列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/17 14:08
*/
public function teaStoreRoomLists(){
$data = $this->request->post();
$result = TeaStoreLogic::getTeaStoreRoomLists($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶室充值套餐列表
* @return \think\response\Json
* @author Yzt
* @date 2025/11/17 14:08
*/
public function rechargeLists(){
$data = $this->request->post();
$result = TeaStoreLogic::rechargeLists($data);
if($result){
return $this->success('', $result, 1, 1);
}
return $this->fail(TeaStoreLogic::getError());
}
/**
* @notes 茶室收藏/取消收藏
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/11 14:33
* @data id,status(1收藏 0取消收藏),user_id
*/
public function teaStoreCollect(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeaStoreLogic::teaStoreCollect($data);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(TeaStoreLogic::getError());
}
/**
* @notes 茶室收藏列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/11 14:35
* @data id
*/
public function teaStoreCollectList(){
$data = $this->request->post();
$userId = $this->userId;
$result = TeaStoreLogic::teaStoreCollectList($data,$userId);
return $this->success('', $result, 1, 1);
}
/**
* @notes 茶室套餐列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/26 16:00
*/
public function teaStoreGroupLists(){
$data = $this->request->post();
$result = TeaStoreLogic::getTeaStoreGroupLists($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶室套餐详情
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/26 16:00
*/
public function teaStoreGroupDetails(){
$data = $this->request->post();
$result = TeaStoreLogic::getTeaStoreGroupDetails($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 资质详情
* @return \think\response\Json
* @author 胥聪
* @date 2026/2/11 15:27
*/
public function qualDetails(){
$data = $this->request->post();
$result = TeaStoreLogic::qualDetails($data);
return $this->success('查询成功', $result, 1, 1);
}
}

View File

@ -0,0 +1,319 @@
<?php
namespace app\api\controller;
use app\api\logic\TeamasterLogic;
use app\api\validate\TeamasterValidate;
class TeamasterController extends BaseApiController
{
/**
* 茶艺师公众号
* Class TeaUser
* @package app\common\model\teamaster
*/
public array $notNeedLogin = ['teamasterList', 'LeafList'];
/**
* @notes 首页茶艺师等级
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function teamasterLevel(){
$result = TeamasterLogic::getTeaLevel();
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 首页茶艺师列表
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
* @data page size level_id
*/
public function teamasterList(){
$data = $this->request->post();
$result = TeamasterLogic::getTeamasterList($data);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 茶艺师详情
* @return \think\response\Json
* @author Yzt
* @date 2026/1/02 11:39
* @data id
*/
public function teamasterDetails(){
$data = $this->request->post();
// $params = (new TeamasterValidate())->goCheck();
$result = TeamasterLogic::getTeamasterDetails($data);
$d['teamaster'] = $result;
return $this->success('', $d, 1, 1);
}
/**
* @notes 茶叶列表
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
* @data page size level_id
*/
public function LeafList(){
$result = TeamasterLogic::LeafList();
return $this->success('', $result, 1, 1);
}
/**
* @notes 创建茶艺师订单
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function addTeamOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::addTeamOrder($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 费用明细
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function countTeamPrice(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::countTeamPrice($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 我的茶艺师优惠券列表
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function userCoupon(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::userCoupon($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 茶艺师订单列表
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function teamOrderList(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::teamOrderList($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 茶艺师订单详情
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function teamOrderDetails(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::teamOrderDetails($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 创建茶艺师续订
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function addTeamRenwOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::addTeamRenwOrder($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 取消订单
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function cancelOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::cancelOrder($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 删除订单
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function delOrder(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::delOrder($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 茶艺师退款
* @return \think\response\Json
* @author Yzt
* @date 2026/1/2 16:59
*/
public function TeamRefund(){
$data = $this->request->post();
$data['user_id'] = $this->userId;
$result = TeamasterLogic::TeamRefund($data);
if ($result === false) {
return $this->fail(TeamasterLogic::getError());
}
return $this->success('',$result, 1, 1);
}
/**
* @notes 茶艺师收藏/取消收藏
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/16 14:55
* @data id,status(1收藏 0取消收藏),user_id
*/
public function teamasterCollect(){
$data = (new TeamasterValidate())->post()->goCheck('teamasterCollect');
$data['user_id'] = $this->userId;
$result = TeamasterLogic::teamasterCollect($data);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(TeamasterLogic::getError());
}
/**
* @notes 茶艺师收藏列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/16 14:55
* @data id
*/
public function teamasterCollectList(){
$data = (new TeamasterValidate())->post()->goCheck('teamasterCollectList');
$userId = $this->userId;
$result = TeamasterLogic::teamasterCollectList($data,$userId);
return $this->success('', $result, 1, 1);
}
/**
* @notes 打赏金额列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/20 15:14
*/
public function teamasterTipAmount(){
$result = TeamasterLogic::getTipAmount();
return $this->success('', $result, 1, 1);
}
/**
* @notes 打赏
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/20 15:14
* @ @data teamaster_id tip_price pay_type(1余额 2微信)
*/
public function giveTeamasterTipAmount(){
$data = $this->request->post();
$user_id = $this->userId;
$result = TeamasterLogic::giveTeamasterTipAmount($data,$user_id);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(TeamasterLogic::getError());
}
/**
* @notes 茶叶类型查询
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/21 14:23
*/
public function teaType(){
$result = TeamasterLogic::teaType();
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 立即邀约
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/30 15:20
*/
public function invitation(){
$data = $this->request->post();
$user_id = $this->userId;
$result = TeamasterLogic::invitation($data,$user_id);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 团体预约
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 14:11
*/
public function groupReservation(){
$data = $this->request->post();
$user_id = $this->userId;
$result = TeamasterLogic::groupReservation($data,$user_id);
return $this->success('操作成功', [], 1, 1);
}
}

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,281 @@
<?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\UserLogic;
use app\api\validate\PasswordValidate;
use app\api\validate\SetUserInfoValidate;
use app\api\validate\UserValidate;
use app\api\validate\UserAddressValidate;
/**
* 用户控制器
* Class UserController
* @package app\api\controller
*/
class UserController extends BaseApiController
{
public array $notNeedLogin = ['resetPassword'];
/**
* @notes 获取个人中心
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 胥聪
* @date 2025/11/4 16:53
*/
public function center()
{
$data = UserLogic::center($this->userInfo);
return $this->success('', $data);
}
/**
* @notes 获取个人信息
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 19:46
*/
public function info()
{
$result = UserLogic::info($this->userId);
return $this->data($result);
}
/**
* @notes 获取门店钱包余额
* @return \think\response\Json
* @author 段誉
* @date 2022/9/20 19:46
*/
public function userStoreMoneyList()
{
$result = UserLogic::userStoreMoneyList($this->userId);
return $this->data($result);
}
/**
* @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 段誉
* @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 \think\response\Json
* @author 段誉
* @date 2022/9/21 16:46
*/
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 编辑用户信息
* @return \think\response\Json
* @author 段誉
* @date 2022/9/21 17:01
*/
public function setInfo()
{
$params = (new SetUserInfoValidate())->post()->goCheck(null, ['id' => $this->userId]);
$result = UserLogic::setInfo($this->userId, $params);
if (false === $result) {
return $this->fail(UserLogic::getError());
}
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 绑定/变更 手机号
* @return \think\response\Json
* @author 段誉
* @date 2022/9/21 17:29
*/
public function bindMobile()
{
$params = (new UserValidate())->post()->goCheck('bindMobile');
$params['user_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 胥聪
* @date 2022/10/21 15:00
*/
public function addressList()
{
$data['user_id'] = $this->userId;
$result = UserLogic::addressList($data);
return $this->success('', $result, 1, 1);
}
/**
* @notes 地址详情
* @return \think\response\Json
* params['id':'地址id']
* @author 胥聪
* @date 2022/10/21 16:43
*/
public function addressDetails()
{
$data = $this->request->post();
$result = UserLogic::addressDetails($data);
if($result) {
return $this->success('查询成功', $result, 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 上传地址
* @return \think\response\Json
* @author 胥聪
* @date 2022/10/21 15:00
*/
public function addAddress(){
$data = (new UserAddressValidate())->post()->goCheck('addAddress');
$data['user_id'] = $this->userId;
$result = UserLogic::addAddress($data);
if($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 修改地址
* @return \think\response\Json
* @author 胥聪
* @date 2022/10/21 15:48
*/
public function editAddress(){
$data = (new UserAddressValidate())->post()->goCheck('addAddress');
$user_id = $this->userId;
$result = UserLogic::editAddress($data,$user_id);
if($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 修改地址
* @return \think\response\Json
* @author 胥聪
* @date 2022/10/21 15:48
*/
public function delAddress(){
$data = $this->request->post();
$result = UserLogic::delAddress($data);
if($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 金额记录
* @return \think\response\Json
* @author 胥聪
* @date 2022/11/4 17:28
*/
public function moneyLogList(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserLogic::getMoneyLogList($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 获取用户门店余额
* @return \think\response\Json
* @author 胥聪
* @date 2022/11/18 15:00
*/
public function userStoreMoney(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserLogic::getUserStoreMoney($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 获取会员信息
* @return \think\response\Json
* @author 胥聪
* @date 2022/11/20 21:59
*/
public function UserMember(){
$user_id = $this->userId;
$result = UserLogic::UserMember($user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 获取会员信息详情
* @return \think\response\Json
* @author 胥聪
* @date 2022/11/20 22:34
*/
public function accountDetails(){
$data = $this->request->post();
$result = UserLogic::accountDetails($data);
return $this->success('查询成功', $result, 1, 1);
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace app\api\controller;
use app\api\logic\UserCouponLogic;
class UserCouponController extends BaseApiController
{
/**
* 用户优惠券
* Class TeaUser
* @package app\common\model\UserCoupon
*/
public array $notNeedLogin = [];
/**
* @notes 用户优惠券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/21 13:49
*/
public function UserCoupinList(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::getUserCoupinList($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
public function isCoupin(){
$user_id = $this->userId;
$result = UserCouponLogic::isCoupin($user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 用户订单优惠券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/21 13:49
*/
public function orderCoupinList(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::getOrderCoupinList($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 领取优惠券
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 14:58
* @data
*/
public function receiveCoupon(){
$data = $this->request->post();
$userId = $this->userId;
$result = UserCouponLogic::receiveCoupon($data,$userId);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserCouponLogic::getError());
}
/**
* @notes 首页领取优惠券
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 14:58
* @data
*/
public function shouyeCoupon(){
$userId = $this->userId;
$result = UserCouponLogic::shouyeCoupon($userId);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserCouponLogic::getError());
}
/**
* @notes 个人中心发券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 15:30
*/
public function coupinList(){
// $data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::coupinList($user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 脚本用户优惠券自动过期
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 10:42
*/
public function expireCoupin(){
UserCouponLogic::expireCoupin();
}
}

View File

@ -0,0 +1,46 @@
<?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\WechatLogic;
use app\api\validate\WechatValidate;
/**
* 微信
* Class WechatController
* @package app\api\controller
*/
class WechatController extends BaseApiController
{
public array $notNeedLogin = ['jsConfig'];
/**
* @notes 微信JSSDK授权接口
* @return mixed
* @author 段誉
* @date 2023/3/1 11:39
*/
public function jsConfig()
{
$params = (new WechatValidate())->goCheck('jsConfig');
$result = WechatLogic::jsConfig($params);
if ($result === false) {
return $this->fail(WechatLogic::getError(), [], 0, 0);
}
return $this->data($result);
}
}

View File

@ -0,0 +1,267 @@
<?php
namespace app\api\controller;
use app\common\service\wechat\WeChatConfigService;
use EasyWeChat\MiniApp\Application;
use think\facade\Log;
class WxCodeController extends BaseApiController
{
public function getWxacode()
{
try {
// 1. 获取参数
$scene = $this->request->param('scene', 'default');
$url = $this->request->param('page', 'pages/index/index');
$width = $this->request->param('width', 430);
// 'env_version' => 'trial',
// 'env_version' => 'develop'
$envVersion = $this->request->param('env_version', 'develop');
// 2. 参数验证
if (strlen($scene) > 32) {
return $this->fail('场景值不能超过32个字符');
}
// 3. 获取微信配置
$config = WeChatConfigService::getMnpConfig();
if (empty($config['app_id']) || empty($config['secret'])) {
return $this->fail('微信小程序配置不完整');
}
// 4. 创建微信小程序应用实例
$app = new Application($config);
// 5. 使用新的方式调用:通过 createClient() 调用API
$response = $app->createClient()->postJson('/wxa/getwxacodeunlimit', [
'scene' => 'registerSource=2' , // 0普通 1电梯 2充电宝
'page' => $url,
'width' => $width,
'auto_color' => false,
'line_color' => ['r' => 0, 'g' => 0, 'b' => 0],
'is_hyaline' => false,
'env_version' => $envVersion,
'check_path' => false,
]);
// 6. 处理响应结果
if ($this->isImageResponse($response)) {
// 保存到文件并返回URL
return $this->saveQrCodeToFile($response, $scene, $url);
} else {
// 处理错误响应
return $this->handleErrorResponse($response);
}
} catch (\Throwable $e) {
Log::error('生成小程序码异常:' . $e->getMessage());
Log::error('异常追踪:' . $e->getTraceAsString());
return $this->fail('生成失败:' . $e->getMessage());
}
}
/**
* 判断是否为图片响应
*/
private function isImageResponse($response): bool
{
$contentType = $response->getHeaderLine('content-type');
return strpos($contentType, 'image/') !== false
|| strpos($contentType, 'application/octet-stream') !== false;
}
/**
* 保存二维码到文件
*/
private function saveQrCodeToFile($response, $scene, $page)
{
try {
// 生成文件名
$filename = 'wxacode_' . date('YmdHis') . '_' . substr(md5($scene . $page), 0, 8) . '.png';
// 保存目录
$saveDir = public_path() . 'uploads/wxqrcode/';
// 确保目录存在
if (!is_dir($saveDir)) {
mkdir($saveDir, 0755, true);
}
$savePath = $saveDir . $filename;
// 保存文件(新版本方式)
$content = $response->getContent();
file_put_contents($savePath, $content);
// 验证文件
if (!file_exists($savePath) || filesize($savePath) === 0) {
throw new \Exception('文件保存失败或为空');
}
// 返回结果
$fileUrl = request()->domain() . '/uploads/wxqrcode/' . $filename;
return $this->success('生成成功', [
'url' => $fileUrl,
'path' => '/uploads/wxqrcode/' . $filename,
'filename' => $filename,
'file_size' => filesize($savePath),
'scene' => $scene,
'page' => $page,
]);
} catch (\Exception $e) {
Log::error('保存文件失败:' . $e->getMessage());
// 备用方案返回Base64
$content = $response->getContent();
$base64 = 'data:image/png;base64,' . base64_encode($content);
return $this->success('生成成功Base64格式', [
'base64' => $base64,
'scene' => $scene,
'page' => $page,
]);
}
}
/**
* 处理错误响应
*/
private function handleErrorResponse($response)
{
$content = $response->getContent();
$data = json_decode($content, true);
if (JSON_ERROR_NONE === json_last_error() && isset($data['errcode'])) {
$errorMsg = $this->getWeChatErrorMessage($data['errcode']);
Log::error('微信接口错误:' . $errorMsg . ',数据:' . $content);
return $this->fail('微信接口错误:' . $errorMsg);
}
Log::error('未知错误响应:' . $content);
return $this->fail('生成失败:未知的响应格式');
}
/**
* 获取微信错误信息
*/
private function getWeChatErrorMessage($errcode)
{
$errorMap = [
-1 => '系统繁忙,请稍候再试',
40001 => 'AppSecret错误或access_token无效',
40002 => '无效的凭证类型',
40013 => '无效的AppID',
41030 => '页面路径不存在或有权限限制',
45009 => '接口调用频率超限',
85064 => '找不到该小程序',
85065 => '小程序未发布或已下架',
86004 => '无效的scene参数',
87009 => '无效的页面路径',
9401020 => '小程序未发布',
];
return $errorMap[$errcode] ?? ('错误码:' . $errcode);
}
/**
* 测试版本 - 直接输出图片
*/
public function testGenerate()
{
try {
$scene = $this->request->param('scene', 'test');
$page = $this->request->param('page', 'pages/index/index');
$config = WeChatConfigService::getMnpConfig();
$app = new Application($config);
$response = $app->createClient()->postJson('/wxa/getwxacodeunlimit', [
'scene' => $scene,
'page' => $page,
'width' => 430,
]);
// 直接输出图片
header('Content-Type: ' . $response->getHeaderLine('content-type'));
echo $response->getContent();
exit;
} catch (\Exception $e) {
return json([
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
}
}
/**
* 检查配置和环境
*/
public function checkEnv()
{
try {
$config = WeChatConfigService::getMnpConfig();
$checks = [
'config_exists' => !empty($config),
'app_id_exists' => !empty($config['app_id']),
'secret_exists' => !empty($config['secret']),
'class_exists' => class_exists('EasyWeChat\MiniApp\Application'),
'createClient_method' => method_exists('EasyWeChat\MiniApp\Application', 'createClient'),
];
// 测试创建实例
if ($checks['class_exists']) {
$app = new Application($config);
$checks['instance_created'] = true;
// 测试获取access_token
try {
$accessToken = $app->getAccessToken()->getToken();
$checks['access_token_ok'] = !empty($accessToken);
} catch (\Exception $e) {
$checks['access_token_error'] = $e->getMessage();
}
}
return $this->success('环境检查', [
'checks' => $checks,
'config' => [
'app_id' => $config['app_id'] ?? '未设置',
'secret_set' => !empty($config['secret']),
],
'suggestions' => $this->getSuggestions($checks),
]);
} catch (\Exception $e) {
return $this->fail('检查失败:' . $e->getMessage());
}
}
private function getSuggestions($checks)
{
$suggestions = [];
if (!$checks['config_exists']) {
$suggestions[] = '配置不存在,请检查 WeChatConfigService::getMnpConfig()';
}
if (!$checks['app_id_exists']) {
$suggestions[] = '请在.env中设置 WECHAT_MINI_PROGRAM_APPID';
}
if (!$checks['secret_exists']) {
$suggestions[] = '请在.env中设置 WECHAT_MINI_PROGRAM_SECRET';
}
if (!$checks['class_exists']) {
$suggestions[] = 'EasyWeChat未安装或版本不兼容请执行composer require overtrue/wechat';
}
return $suggestions;
}
}