Initial commit: queue workspace

Made-with: Cursor
This commit is contained in:
apple
2026-03-21 02:55:24 +08:00
commit 78de918c37
12388 changed files with 1840126 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\pc\CartServices;
use think\annotation\Inject;
use think\Response;
/**
* Class CartController
* @author 等风来
* @email 136327134@qq.com
* @date 2023/9/19
* @package app\controller\api\pc
*/
class Cart
{
/**
* @var CartServices
*/
#[Inject]
protected CartServices $services;
/**
* 获取用户购物车列表
* @param Request $request
* @return Response
*/
public function getCartList(Request $request): Response
{
$uid = $request->uid();
$data = $this->services->getCartList((int)$uid);
return app('json')->successful($data);
}
}

View File

@@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\other\QrcodeServices;
use app\services\pc\ProductServices;
use crmeb\services\SystemConfigService;
/**
* Class HomeController
* @package app\api\controller\pc
*/
class Home
{
/**
* PC端首页轮播图
* @return mixed
*/
public function getBanner()
{
$list = sys_data('pc_home_banner');
return app('json')->successful(compact('list'));
}
/**
* 首页分类尚品
* @param Request $request
* @param ProductServices $productServices
* @return mixed
*/
public function getCategoryProduct(Request $request, ProductServices $productServices)
{
return app('json')->successful($productServices->getCategoryProduct((int)$request->uid()));
}
/**
* 获取手机购买跳转url配置
* @return string
*/
public function getProductPhoneBuy()
{
$data = SystemConfigService::more(['product_phone_buy_url', 'site_url']);
return app('json')->successful(['phone_buy' => $data['product_phone_buy_url'] ?? 1, 'sit_url' => $data['site_url'] ?? '']);
}
/**
* 付费会员购买二维码
* @return mixed
*/
public function getPayVipCode()
{
$type = sys_config('product_phone_buy_url', 1);
$url = '/pages/annex/vip_paid/index';
$name = "wechat_pay_vip_code.png";
/** @var QrcodeServices $QrcodeService */
$QrcodeService = app()->make(QrcodeServices::class);
if ($type == 1) {
$codeUrl = $QrcodeService->getWechatQrcodePath($name, $url, false, false);
} else {
//生成小程序地址
$codeUrl = $QrcodeService->getRoutineQrcodePath(0, 0, 105, $name, false);
}
return app('json')->successful(['url' => $codeUrl ? $codeUrl : '']);
}
}

View File

@@ -0,0 +1,72 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\services\pc\LoginServices;
use crmeb\services\CacheService;
use think\annotation\Inject;
class Login
{
/**
* @var LoginServices
*/
#[Inject]
protected LoginServices $services;
/**
* 获取扫码登陆KEY
* @return mixed
*/
public function getLoginKey()
{
$key = md5(time() . uniqid());
$time = time() + 600;
CacheService::set($key, 1, 600);
return app('json')->success(['key' => $key, 'time' => $time]);
}
/**
* 扫码登陆
* @param string $key
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function scanLogin(string $key)
{
return app('json')->success($this->services->scanLogin($key));
}
/**
* 开放平台扫码登录
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function wechatAuth()
{
return app('json')->success($this->services->wechatAuth());
}
/**
* 获取公众平台id
* @return mixed
*/
public function getAppid()
{
return app('json')->success([
'appid' => sys_config('wechat_open_app_id'),
'version' => get_crmeb_version()
]);
}
}

View File

@@ -0,0 +1,101 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\order\StoreOrderRefundServices;
use app\services\order\StoreOrderServices;
use app\services\pc\OrderServices;
use think\annotation\Inject;
class Order
{
/**
* @var OrderServices
*/
#[Inject]
protected OrderServices $services;
/**
* 轮询订单状态
* @param Request $request
* @return mixed
*/
public function checkOrderStatus(Request $request)
{
[$order_id, $end_time] = $request->getMore([
['order_id', ''],
['end_time', ''],
], true);
$data['status'] = $this->services->checkOrderStatus((string)$order_id);
$time = $end_time - time();
$data['time'] = $time > 0 ? $time : 0;
return app('json')->successful($data);
}
/**
* 获取订单列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrderList(Request $request)
{
$where = $request->getMore([
['type', '', '', 'status'],
['search', '', '', 'real_name'],
]);
$where['uid'] = $request->uid();
$where['is_del'] = 0;
$where['is_system_del'] = 0;
if (!in_array($where['status'], [-1, -2, -3])) $where['pid'] = 0;
return app('json')->successful($this->services->getOrderList($where));
}
/**
* 获取退货商品列表
* @param StoreOrderCartInfoServices $services
* @param $id
* @return mixed
*/
public function refundCartInfoList(Request $request, StoreOrderServices $services)
{
[$cart_ids, $id] = $request->postMore([
['cart_ids', ''],
['id', 0],
], true);
if (!$id) {
return app('json')->fail('缺少发货ID');
}
$cart_id = [];
if ($cart_ids) $cart_id[] = ['cart_id' => $cart_ids];
return app('json')->success($services->refundCartInfoList((array)$cart_id, (int)$id));
}
/**
* 订单列表
* @param Request $request
* @return mixed
*/
public function refundList(Request $request, StoreOrderRefundServices $services)
{
$where = $request->getMore([
['refund_type', '', '', 'refundTypes']
]);
$where['uid'] = $request->uid();
$data['list'] = $services->getRefundOrderList($where);
$data['count'] = $services->count($where);
return app('json')->successful($data);
}
}

View File

@@ -0,0 +1,133 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\pc\ProductServices;
use app\services\product\category\StoreProductCategoryServices;
use app\services\product\product\StoreProductServices;
use crmeb\services\SystemConfigService;
use think\annotation\Inject;
/**
* 商品
* Class Product
* @package app\controller\api\pc
*/
class Product
{
/**
* @var ProductServices
*/
#[Inject]
protected ProductServices $services;
/**
* 获取商品列表
* @param Request $request
* @param StoreProductCategoryServices $services
* @return mixed
*/
public function getProductList(Request $request, StoreProductCategoryServices $services)
{
$where = $request->getMore([
[['sid', 'd'], 0],
[['cid', 'd'], 0],
[['tid', 'd'], 0],
['keyword', '', '', 'store_name'],
['priceOrder', ''],
['salesOrder', ''],
[['news', 'd'], 0, '', 'timeOrder'],
[['type', ''], '', '', 'status'],
['ids', ''],
['selectId', ''],
['brand_id', ''],
]);
if ($where['selectId'] && (!$where['sid'] || !$where['cid'])) {
$level = $services->value(['id' => (int)$where['selectId']], 'level') ?? 0;
$levelArr = $services->cateField;
$where[$levelArr[$level] ?? 'cid'] = $where['selectId'];
}
if ($where['ids'] && is_string($where['ids'])) {
$where['ids'] = stringToIntArray($where['ids']);
}
if (!$where['ids']) {
unset($where['ids']);
}
if ($where['store_name']) {//搜索
$where['pid'] = 0;
}
$where['brand_id'] =stringToIntArray($where['brand_id']);
return app('json')->successful($this->services->getProductList($where, $request->uid()));
}
/**
* PC端商品详情小程序码
* @param Request $request
* @return mixed
*/
public function getProductRoutineCode(Request $request)
{
[$product_id] = $request->getMore([
['product_id', 0],
], true);
$data = SystemConfigService::more(['product_phone_buy_url', 'site_url']);
$routineCode = '';
if (isset($data['product_phone_buy_url']) && $data['product_phone_buy_url'] == 2) {//小程序
$routineCode = $this->services->getProductRoutineCode((int)$product_id);
}
return app('json')->successful(['site_url' => $data['site_url'], 'routineCode' => $routineCode]);
}
/**
* 推荐商品
* @param Request $request
* @param $type
* @return mixed
*/
public function getRecommendList(Request $request, $type)
{
$data = [];
$data['list'] = [];
$where['is_show'] = 1;
$where['is_del'] = 0;
if ($type == 1) {// 精品推荐
$where['is_best'] = 1;
} else if ($type == 2) {// 热门榜单
$where['is_hot'] = 1;
} else if ($type == 3) {// 首发新品
$where['is_new'] = 1;
} else if ($type == 4) {// 促销单品
$where['is_benefit'] = 1;
}
/** @var StoreProductServices $product */
$product = app()->make(StoreProductServices::class);
$uid = (int)$request->uid();
$data['list'] = $product->getRecommendProduct($uid, $where, 0, 'mid');
$data['count'] = $product->getCount($where);
return app('json')->successful($data);
}
/**
* 获取优品推荐
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getGoodProduct()
{
/** @var StoreProductServices $product */
$product = app()->make(StoreProductServices::class);
$list = get_thumb_water($product->getProducts(['is_good' => 1, 'is_del' => 0, 'is_show' => 1, 'is_verify' => 1], '', 0, ['couponId']), 'mid');
return app('json')->successful(compact('list'));
}
}

View File

@@ -0,0 +1,86 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\other\CityAreaServices;
use crmeb\services\SystemConfigService;
class PublicController
{
/**
* 获取城市数据
* @param Request $request
* @return mixed
*/
public function getCity(Request $request, CityAreaServices $services)
{
[$pid] = $request->getMore([
[['pid', 'd'], 0],
], true);
return app('json')->success($services->getCityTreeList((int)$pid));
}
/**
* 获取公司信息
* @return mixed
*/
public function getCompanyInfo()
{
$data = SystemConfigService::more(['contact_number', 'links_open', 'links_list', 'company_address', 'copyright', 'record_No', 'site_name', 'site_keywords', 'site_description', 'pc_logo', 'filing_list']);
$logoUrl = $data['pc_logo'] ?? '';
if (strstr($logoUrl, 'http') === false && $logoUrl) {
$logoUrl = sys_config('site_url') . $logoUrl;
}
$logoUrl = str_replace('\\', '/', $logoUrl);
$data['logoUrl'] = $logoUrl;
if ($data['links_open']) {
$linksList = $data['links_list'];
$linksList = is_array($linksList) ? $linksList : [];
$edition = $volume = [];
foreach ($linksList as $key => $row) {
$volume[$key] = $row['sort'];
$edition[$key] = $row['url'];
}
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $linksList);
$data['links_list'] = $linksList;
} else {
$data['links_list'] = [];
}
if ($data['filing_list']) {
$filingList = $data['filing_list'];
$filingList = is_array($filingList) ? $filingList : [];
$edition = $volume = [];
foreach ($filingList as $key => $row) {
$volume[$key] = $row['sort'];
$edition[$key] = $row['url'];
}
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $filingList);
$data['filing_list'] = $filingList;
} else {
$data['filing_list'] = [];
}
return app('json')->successful($data);
}
/**
* 获取关注微信二维码
* @return mixed
*/
public function getWechatQrcode()
{
$data['wechat_qrcode'] = sys_config('wechat_qrcode');
return app('json')->successful($data);
}
}

View File

@@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\order\StoreOrderRefundServices;
use think\annotation\Inject;
/**
* 售后订单
* Class RefundController
* @package app\controller\api\v1\order
*/
class Refund
{
/**
* @var StoreOrderRefundServices
*/
#[Inject]
protected StoreOrderRefundServices $services;
/**
* 订单列表
* @param Request $request
* @return mixed
*/
public function lst(Request $request)
{
$where = $request->getMore([
['refund_type', '', '', 'refundTypes']
]);
$where['uid'] = $request->uid();
$list = $this->services->getRefundOrderList($where);
return app('json')->successful($list);
}
/**
* 订单详情
* @param Request $request
* @param $uni
* @return mixed
*/
public function detail(StoreOrderRefundServices $services, Request $request, $uni)
{
$orderData = $services->refundDetail($uni);
return app('json')->successful('ok', $orderData);
}
/**
* 取消申请
* @param $id
* @return mixed
*/
public function cancelApply(Request $request, $uni)
{
if (!strlen(trim($uni))) return app('json')->fail('参数错误');
$uid = (int)$request->uid();
$this->services->cancelApplyRefund($uid, $uni);
return app('json')->success('取消成功');
}
/**
* 删除已退款和拒绝退款的订单
* @param Request $request
* @param $uni
* @return mixed
*/
public function delRefundOrder(Request $request, $uni)
{
if (!strlen(trim($uni))) return app('json')->fail('参数错误');
$uid = (int)$request->uid();
$this->services->delRefundOrder($uid, $uni);
return app('json')->success('删除成功');
}
}

View File

@@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\user\UserRelationServices;
use app\services\user\UserBrokerageServices;
use app\services\user\UserMoneyServices;
/**
* pc端用户信息类
* Class User
* @package app\controller\api\pc
*/
class User
{
/**
* 用户记录0所有余额1余额消费2余额充值3佣金4提现
* @param Request $request
* @param $type
* @return mixed
*/
public function getBalanceRecord(Request $request, $type)
{
$where = $request->getMore([
['start', 0],
['stop', 0],
['keyword', ''],
]);
$uid = (int)$request->uid();
switch ((int)$type) {
case 0:
case 1:
case 2:
/** @var UserMoneyServices $services */
$services = app()->make(UserMoneyServices::class);
$data = $services->userMoneyList($uid, (int)$type, $where);
break;
case 3:
/** @var UserBrokerageServices $services */
$services = app()->make(UserBrokerageServices::class);
$data = $services->userBrokerageList($uid, $where);
break;
case 4:
/** @var UserBrokerageServices $services */
$services = app()->make(UserBrokerageServices::class);
$data = $services->userExtractList($uid, $where);
break;
default:
$data = [];
}
return app('json')->successful($data);
}
/**
* 获取收藏列表
* @param Request $request
* @param UserRelationServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCollectList(Request $request, UserRelationServices $services)
{
$uid = (int)$request->uid();
$list = $services->getUserRelationList($uid);
$count = $services->getUserCount($uid);
return app('json')->successful(compact('list', 'count'));
}
}