更新开源4.7.1版本

This commit is contained in:
evoxwht 2023-04-06 18:14:33 +08:00
parent c47088346d
commit 1ebb35de61
1306 changed files with 14653 additions and 13956 deletions

View File

@ -1 +0,0 @@

View File

@ -1,5 +1,5 @@
version=CRMEB-KY v4.7.0 version=CRMEB-KY v4.7.0
version_code=470 version_code=470
platform=github platform=gitee
app_id=ze7x9rxsv09l6pvsyo app_id=ze7x9rxsv09l6pvsyo
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI

View File

@ -165,10 +165,14 @@ class ArticleCategory extends AuthController
/** /**
* 树形列表 * 树形列表
* @return mixed * @return mixed
* @throws \ReflectionException
*/ */
public function getTreeList() public function getTreeList()
{ {
$list = $this->service->getTreeList(); $list = $this->service->getTreeList();
foreach ($list as &$item) {
$item['disabled'] = !$item['status'] || $item['is_del'];
}
return app('json')->success($list); return app('json')->success($list);
} }
} }

View File

@ -72,7 +72,8 @@ class ExportExcel extends AuthController
['label_id', ''], ['label_id', ''],
['now_money', 'normal'], ['now_money', 'normal'],
['field_key', ''], ['field_key', ''],
['isMember', ''] ['isMember', ''],
['ids', []]
]); ]);
return app('json')->success($this->service->exportUserList($where)); return app('json')->success($this->service->exportUserList($where));
} }

View File

@ -182,7 +182,11 @@ class StoreCombination extends AuthController
/** /**
* 拼团人列表 * 拼团人列表
* @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function order_pink($id) public function order_pink($id)
{ {
@ -207,12 +211,20 @@ class StoreCombination extends AuthController
* 活动参与人 * 活动参与人
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function combinationStatisticsList($id) public function combinationStatisticsList($id)
{ {
$where = $this->request->getMore([
['real_name', '', '', 'keyword'],
['status', '']
]);
$where['cid'] = $id;
/** @var StorePinkServices $storePinkServices */ /** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class); $storePinkServices = app()->make(StorePinkServices::class);
$list = $storePinkServices->systemPage(['cid' => $id]); $list = $storePinkServices->systemPage($where);
return app('json')->success($list); return app('json')->success($list);
} }

View File

@ -135,7 +135,11 @@ class StoreSeckill extends AuthController
/** /**
* 秒杀统计 * 秒杀统计
* @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function seckillStatistics($id) public function seckillStatistics($id)
{ {
@ -151,7 +155,7 @@ class StoreSeckill extends AuthController
public function seckillPeople($id) public function seckillPeople($id)
{ {
[$keyword] = $this->request->getMore([ [$keyword] = $this->request->getMore([
['keyword', ''] ['real_name', '', '', 'keyword']
], true); ], true);
return app('json')->success($this->services->seckillPeople($id, $keyword)); return app('json')->success($this->services->seckillPeople($id, $keyword));
} }

View File

@ -37,7 +37,7 @@ class StorePointRecord extends AuthController
{ {
$where = $this->request->getMore([ $where = $this->request->getMore([
['time', ''], ['time', ''],
['trading_type', 0] ['trading_type', '']
]); ]);
$date = $this->services->pointRecord($where); $date = $this->services->pointRecord($where);
return app('json')->success($date); return app('json')->success($date);

View File

@ -85,6 +85,9 @@ class LuckLottery extends AuthController
/** /**
* 添加抽奖 * 添加抽奖
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function add() public function add()
{ {

View File

@ -146,7 +146,7 @@ class RefundOrder extends AuthController
return app('json')->fail(400144); return app('json')->fail(400144);
} }
if ($data['type'] == 1) { if ($data['type'] == 1 || $data['type'] == 5) {
$data['refund_type'] = 6; $data['refund_type'] = 6;
} else if ($data['type'] == 2) { } else if ($data['type'] == 2) {
$data['refund_type'] = 3; $data['refund_type'] = 3;
@ -190,7 +190,8 @@ class RefundOrder extends AuthController
$refund_data['open_id'] = $wechatUserServices->uidToOpenid((int)$order['uid'], 'routine') ?? ''; $refund_data['open_id'] = $wechatUserServices->uidToOpenid((int)$order['uid'], 'routine') ?? '';
$refund_data['refund_no'] = $orderRefund['order_id']; $refund_data['refund_no'] = $orderRefund['order_id'];
//修改订单退款状态 //修改订单退款状态
$data['refund_price'] = $data['refunded_price']; // $data['refund_price'] = $data['refunded_price'];
unset($data['refund_price']);
if ($this->services->agreeRefund($id, $refund_data)) { if ($this->services->agreeRefund($id, $refund_data)) {
$this->services->update($id, $data); $this->services->update($id, $data);
return app('json')->success(400149); return app('json')->success(400149);

View File

@ -263,6 +263,9 @@ class StoreOrder extends AuthController
* @param $id * @param $id
* @param StoreOrderDeliveryServices $services * @param StoreOrderDeliveryServices $services
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function split_delivery($id, StoreOrderDeliveryServices $services) public function split_delivery($id, StoreOrderDeliveryServices $services)
{ {
@ -317,7 +320,11 @@ class StoreOrder extends AuthController
/** /**
* 获取订单拆分子订单列表 * 获取订单拆分子订单列表
* @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function split_order($id) public function split_order($id)
{ {
@ -455,10 +462,11 @@ class StoreOrder extends AuthController
* 订单详情 * 订单详情
* @param $id 订单id * @param $id 订单id
* @return mixed * @return mixed
* @throws \ReflectionException
*/ */
public function order_info($id) public function order_info($id)
{ {
if (!$id || !($orderInfo = $this->services->get($id))) { if (!$id || !($orderInfo = $this->services->get($id, [], ['refund']))) {
return app('json')->fail(400118); return app('json')->fail(400118);
} }
/** @var UserServices $services */ /** @var UserServices $services */
@ -497,6 +505,13 @@ class StoreOrder extends AuthController
} else } else
$orderInfo['_store_name'] = ''; $orderInfo['_store_name'] = '';
$orderInfo['spread_name'] = $services->value(['uid' => $orderInfo['spread_uid']], 'nickname') ?? '无'; $orderInfo['spread_name'] = $services->value(['uid' => $orderInfo['spread_uid']], 'nickname') ?? '无';
$orderInfo['_info'] = app()->make(StoreOrderCartInfoServices::class)->getOrderCartInfo((int)$orderInfo['id']);
$cart_num = 0;
$refund_num = array_sum(array_column($orderInfo['refund'], 'refund_num'));
foreach ($orderInfo['_info'] as $items) {
$cart_num += $items['cart_info']['cart_num'];
}
$orderInfo['is_all_refund'] = $refund_num == $cart_num;
$userInfo = $userInfo->toArray(); $userInfo = $userInfo->toArray();
return app('json')->success(compact('orderInfo', 'userInfo')); return app('json')->success(compact('orderInfo', 'userInfo'));
} }
@ -551,6 +566,7 @@ class StoreOrder extends AuthController
/** /**
* 不退款表单结构 * 不退款表单结构
* @param StoreOrderRefundServices $services
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \FormBuilder\Exception\FormBuilderException * @throws \FormBuilder\Exception\FormBuilderException

View File

@ -45,6 +45,8 @@ class StoreOrderInvoice extends AuthController
{ {
$where = $this->request->getMore([ $where = $this->request->getMore([
['data', '', '', 'time'], ['data', '', '', 'time'],
['real_name', ''],
['field_key', ''],
[['type', 'd'], 0], [['type', 'd'], 0],
]); ]);
$data = $this->services->chart($where); $data = $this->services->chart($where);

View File

@ -57,7 +57,11 @@ class StoreCategory extends AuthController
/** /**
* 商品分类搜索 * 商品分类搜索
* @param $type
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function tree_list($type) public function tree_list($type)
{ {
@ -103,6 +107,9 @@ class StoreCategory extends AuthController
/** /**
* 保存新增分类 * 保存新增分类
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save() public function save()
{ {
@ -133,6 +140,9 @@ class StoreCategory extends AuthController
* 更新分类 * 更新分类
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function update($id) public function update($id)
{ {

View File

@ -34,8 +34,10 @@ class SystemNotification extends AuthController
/** /**
* 显示资源列表 * 显示资源列表
*
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function index() public function index()
{ {
@ -47,8 +49,10 @@ class SystemNotification extends AuthController
/** /**
* 显示编辑 * 显示编辑
*
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function info() public function info()
{ {

View File

@ -170,6 +170,9 @@ class User extends AuthController
* 获取用户账户详情 * 获取用户账户详情
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function read($id) public function read($id)
{ {
@ -194,6 +197,9 @@ class User extends AuthController
* 执行赠送会员等级 * 执行赠送会员等级
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save_give_level($id) public function save_give_level($id)
{ {
@ -208,6 +214,7 @@ class User extends AuthController
* 赠送付费会员时长表单 * 赠送付费会员时长表单
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/ */
public function give_level_time($id) public function give_level_time($id)
{ {
@ -219,6 +226,9 @@ class User extends AuthController
* 执行赠送付费会员时长 * 执行赠送付费会员时长
* @param $id * @param $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save_give_level_time($id) public function save_give_level_time($id)
{ {
@ -387,6 +397,9 @@ class User extends AuthController
if ($data['phone']) { if ($data['phone']) {
if (!preg_match("/^1[3456789]\d{9}$/", $data['phone'])) return app('json')->fail(400252); if (!preg_match("/^1[3456789]\d{9}$/", $data['phone'])) return app('json')->fail(400252);
} }
if ($this->services->count(['phone' => $data['phone'], 'is_del' => 0, 'not_uid' => $id])) {
return app('json')->fail(400314);
}
if ($data['card_id']) { if ($data['card_id']) {
if (!check_card($data['card_id'])) return app('json')->fail(400315); if (!check_card($data['card_id'])) return app('json')->fail(400315);
} }

View File

@ -37,7 +37,11 @@ class UserLabel extends AuthController
/** /**
* 标签列表 * 标签列表
* @param int $label_cate
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function index($label_cate = 0) public function index($label_cate = 0)
{ {
@ -60,8 +64,10 @@ class UserLabel extends AuthController
/** /**
* 保存标签表单数据 * 保存标签表单数据
* @param int $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save() public function save()
{ {

View File

@ -43,14 +43,13 @@ class MemberCardBatch extends AuthController
{ {
$where = $this->request->getMore([ $where = $this->request->getMore([
['title', ''], ['title', ''],
// ['page', 1],
// ['limit', 20],
]); ]);
$data = $this->services->getList($where); $data = $this->services->getList($where);
return app('json')->success($data); return app('json')->success($data);
} }
/** 保存卡片资源 /**
* 保存卡片资源
* @param $id * @param $id
* @return mixed * @return mixed
*/ */

View File

@ -305,10 +305,10 @@ class PublicController
['image', ''], ['image', ''],
['code', ''], ['code', ''],
], true); ], true);
if ($imageUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl)) { if ($imageUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl) && strpos($imageUrl, "phar://") !== false) {
return app('json')->success(['code' => false, 'image' => false]); return app('json')->success(['code' => false, 'image' => false]);
} }
if ($codeUrl !== '' && !(preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl) || strpos($codeUrl, 'https://mp.weixin.qq.com/cgi-bin/showqrcode') !== false)) { if ($codeUrl !== '' && !(preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl) || strpos($codeUrl, 'https://mp.weixin.qq.com/cgi-bin/showqrcode') !== false) && strpos($codeUrl, "phar://") !== false) {
return app('json')->success(['code' => false, 'image' => false]); return app('json')->success(['code' => false, 'image' => false]);
} }
try { try {

View File

@ -15,6 +15,7 @@ use app\services\order\DeliveryServiceServices;
use app\services\order\StoreOrderCartInfoServices; use app\services\order\StoreOrderCartInfoServices;
use app\services\order\StoreOrderCreateServices; use app\services\order\StoreOrderCreateServices;
use app\services\order\StoreOrderDeliveryServices; use app\services\order\StoreOrderDeliveryServices;
use app\services\order\StoreOrderEconomizeServices;
use app\services\order\StoreOrderRefundServices; use app\services\order\StoreOrderRefundServices;
use app\services\order\StoreOrderServices; use app\services\order\StoreOrderServices;
use app\services\order\StoreOrderWapServices; use app\services\order\StoreOrderWapServices;
@ -105,17 +106,16 @@ class StoreOrderController
* @param UserServices $userServices * @param UserServices $userServices
* @param $orderId * @param $orderId
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function detail(Request $request, StoreOrderServices $services, UserServices $userServices, $orderId) public function detail(Request $request, StoreOrderServices $services, UserServices $userServices, $orderId)
{ {
$order = $this->service->getOne(['order_id' => $orderId], '*', ['pink']); $economizeServices = app()->make(StoreOrderEconomizeServices::class);
if (!$order) return app('json')->fail(410173); $orderData = $services->getUserOrderByKey($economizeServices, $orderId, 0);
$order = $order->toArray(); $orderData['nickname'] = $userServices->value(['uid' => $orderData['uid']], 'nickname');
$nickname = $userServices->value(['uid' => $order['uid']], 'nickname'); return app('json')->success($orderData);
$orderInfo = $services->tidyOrder($order, true);
unset($orderInfo['uid'], $orderInfo['seckill_id'], $orderInfo['pink_id'], $orderInfo['combination_id'], $orderInfo['bargain_id'], $orderInfo['status'], $orderInfo['total_postage']);
$orderInfo['nickname'] = $nickname;
return app('json')->success($orderInfo);
} }
/** /**
@ -238,7 +238,7 @@ class StoreOrderController
$start = $middle; $start = $middle;
} }
$space = bcsub($stop, $start, 0);//间隔时间段 $space = bcsub($stop, $start, 0);//间隔时间段
$front = bcsub($start, $space, 0);//第一个时间段 $front = bcsub($start, $space, 0) - 1;//第一个时间段
/** @var StoreOrderServices $orderService */ /** @var StoreOrderServices $orderService */
$orderService = app()->make(StoreOrderServices::class); $orderService = app()->make(StoreOrderServices::class);
$order_where = [ $order_where = [
@ -246,10 +246,11 @@ class StoreOrderController
'paid' => 1, 'paid' => 1,
'refund_status' => [0, 3], 'refund_status' => [0, 3],
'is_del' => 0, 'is_del' => 0,
'is_system_del' => 0]; 'is_system_del' => 0
];
if ($type == 1) {//销售额 if ($type == 1) {//销售额
$frontPrice = $orderService->sum($order_where + ['time' => [$front, $start]], 'pay_price', true); $frontPrice = $orderService->sum($order_where + ['time' => [$front, $start - 1]], 'pay_price', true);
$afterPrice = $orderService->sum($order_where + ['time' => [$start, $stop]], 'pay_price', true); $afterPrice = $orderService->sum($order_where + ['time' => [$start, $stop]], 'pay_price', true);
$chartInfo = $orderService->chartTimePrice($start, $stop); $chartInfo = $orderService->chartTimePrice($start, $stop);
$data['chart'] = $chartInfo;//营业额图表数据 $data['chart'] = $chartInfo;//营业额图表数据
@ -262,7 +263,7 @@ class StoreOrderController
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额 $data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2 $data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
} else {//订单数 } else {//订单数
$frontNumber = $orderService->count($order_where + ['time' => [$front, $start]]); $frontNumber = $orderService->count($order_where + ['time' => [$front, $start - 1]]);
$afterNumber = $orderService->count($order_where + ['time' => [$start, $stop]]); $afterNumber = $orderService->count($order_where + ['time' => [$start, $stop]]);
$chartInfo = $orderService->chartTimeNumber($start, $stop); $chartInfo = $orderService->chartTimeNumber($start, $stop);
$data['chart'] = $chartInfo;//订单数图表数据 $data['chart'] = $chartInfo;//订单数图表数据

View File

@ -211,9 +211,13 @@ class StoreOrderController
} }
/** /**
* @param Request $request
* @param $orderId * @param $orderId
* @param string $type * @param string $type
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 等风来 * @author 等风来
* @email 136327134@qq.com * @email 136327134@qq.com
* @date 2023/2/13 * @date 2023/2/13
@ -223,7 +227,6 @@ class StoreOrderController
if (!$orderId) { if (!$orderId) {
return app('json')->fail(100100); return app('json')->fail(100100);
} }
return app('json')->success($this->services->getCashierInfo((int)$request->uid(), $orderId, $type)); return app('json')->success($this->services->getCashierInfo((int)$request->uid(), $orderId, $type));
} }
@ -247,6 +250,7 @@ class StoreOrderController
if (!$uni) return app('json')->fail(100100); if (!$uni) return app('json')->fail(100100);
$orderInfo = $this->services->get(['order_id' => $uni]); $orderInfo = $this->services->get(['order_id' => $uni]);
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid; $uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
$orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
$orderInfo->pay_uid = $uid; $orderInfo->pay_uid = $uid;
$orderInfo->save(); $orderInfo->save();
$orderInfo = $orderInfo->toArray(); $orderInfo = $orderInfo->toArray();
@ -259,9 +263,6 @@ class StoreOrderController
return app('json')->fail(410215); return app('json')->fail(410215);
} }
//重新生成订单号去支付
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
//0元支付 //0元支付
if (bcsub((string)$orderInfo['pay_price'], '0', 2) <= 0) { if (bcsub((string)$orderInfo['pay_price'], '0', 2) <= 0) {
//创建订单jspay支付 //创建订单jspay支付
@ -426,6 +427,7 @@ class StoreOrderController
* 订单删除 * 订单删除
* @param Request $request * @param Request $request
* @return mixed * @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/ */
public function del(Request $request) public function del(Request $request)
{ {
@ -465,8 +467,14 @@ class StoreOrderController
/** /**
* 订单 查看物流 * 订单 查看物流
* @param Request $request * @param Request $request
* @param StoreOrderCartInfoServices $services
* @param ExpressServices $expressServices
* @param $uni * @param $uni
* @param string $type
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function express(Request $request, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '') public function express(Request $request, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '')
{ {
@ -482,6 +490,7 @@ class StoreOrderController
foreach ($order['cart_info'] as $k => $cart) { foreach ($order['cart_info'] as $k => $cart) {
$cartNew['cart_num'] = $cart['cart_num']; $cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice']; $cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image']; $cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name']; $cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? ''; $cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
@ -505,6 +514,7 @@ class StoreOrderController
$cart = json_decode($cart, true); $cart = json_decode($cart, true);
$cartNew['cart_num'] = $cart['cart_num']; $cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice']; $cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image']; $cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name']; $cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? ''; $cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';

View File

@ -28,7 +28,11 @@ class CategoryController
/** /**
* 获取分类列表 * 获取分类列表
* @param Request $request
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function category(Request $request) public function category(Request $request)
{ {

View File

@ -50,6 +50,9 @@ class StoreCouponsController
* 领取优惠券 * 领取优惠券
* @param Request $request * @param Request $request
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function receive(Request $request) public function receive(Request $request)
{ {
@ -82,6 +85,7 @@ class StoreCouponsController
* @param StoreCouponIssueServices $service * @param StoreCouponIssueServices $service
* @param $cartId * @param $cartId
* @param $new * @param $new
* @param $shippingType
* @return mixed * @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException * @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException

View File

@ -36,6 +36,9 @@ class UserRechargeController
* 用户充值 * 用户充值
* @param Request $request * @param Request $request
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function recharge(Request $request) public function recharge(Request $request)
{ {

View File

@ -102,7 +102,11 @@ class LuckLotteryController
/** /**
* 领取奖品 * 领取奖品
* @param Request $request * @param Request $request
* @param LuckLotteryRecordServices $lotteryRecordServices
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices) public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
{ {
@ -125,6 +129,9 @@ class LuckLotteryController
* @param Request $request * @param Request $request
* @param LuckLotteryRecordServices $lotteryRecordServices * @param LuckLotteryRecordServices $lotteryRecordServices
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices) public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
{ {

View File

@ -142,7 +142,11 @@ class UserInvoiceController
$uid = (int)$request->uid(); $uid = (int)$request->uid();
$re = $this->services->saveInvoice($uid, $data); $re = $this->services->saveInvoice($uid, $data);
if ($re) { if ($re) {
return app('json')->success($re['type'] == 'edit' ? 100001 : $re['data']); if ($re['type'] == 'edit') {
return app('json')->success(100001);
} else {
return app('json')->success(100021, $re['data']);
}
} else { } else {
return app('json')->fail(100005); return app('json')->fail(100005);
} }

View File

@ -564,6 +564,7 @@ if (!function_exists('put_image')) {
//文件保存路径 //文件保存路径
ob_start(); ob_start();
$url = str_replace('phar://', '', $url);
readfile($url); readfile($url);
$img = ob_get_contents(); $img = ob_get_contents();
ob_end_clean(); ob_end_clean();

View File

@ -104,8 +104,11 @@ class StoreBargainUserDao extends BaseDao
*/ */
public function bargainUserList($where, $page = 0, $limit = 0) public function bargainUserList($where, $page = 0, $limit = 0)
{ {
return $this->search($where)->with(['getBargain', 'getUser'])->when($page != 0, function ($query) use ($page, $limit) { return $this->search($where)->with(['getBargain', 'getUser'])
$query->page($page, $limit); ->when(isset($where['real_name']) && $where['real_name'] != '', function ($query) use ($where) {
})->order('add_time desc')->select()->toArray(); $query->where('uid', $where['real_name']);
})->when($page != 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('add_time desc')->select()->toArray();
} }
} }

View File

@ -56,6 +56,8 @@ class StorePinkDao extends BaseDao
{ {
return $this->search($where)->when($where['k_id'] != 0, function ($query) use ($where) { return $this->search($where)->when($where['k_id'] != 0, function ($query) use ($where) {
$query->whereOr('id', $where['k_id']); $query->whereOr('id', $where['k_id']);
})->when(isset($where['keyword']) && $where['keyword'] != '', function ($query) use ($where) {
$query->where('uid|nickname', 'like', '%' . $where['keyword'] . '%');
})->with('getProduct')->when($page != 0, function ($query) use ($page, $limit) { })->with('getProduct')->when($page != 0, function ($query) use ($page, $limit) {
$query->page($page, $limit); $query->page($page, $limit);
})->order('add_time desc')->select()->toArray(); })->order('add_time desc')->select()->toArray();
@ -138,6 +140,7 @@ class StorePinkDao extends BaseDao
/** /**
* 获取拼团完成的个数 * 获取拼团完成的个数
* @return float * @return float
* @throws \ReflectionException
*/ */
public function getPinkOkSumTotalNum() public function getPinkOkSumTotalNum()
{ {

View File

@ -32,11 +32,15 @@ class ArticleCategoryDao extends BaseDao
} }
/** /**
* 获取文章列表 * 获取文章分类列表
* @param array $where * @param array $where
* @param int $page * @param int $page
* @param int $limit * @param int $limit
* @return mixed * @return mixed
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where, int $page = 0, int $limit = 0) public function getList(array $where, int $page = 0, int $limit = 0)
{ {
@ -73,7 +77,6 @@ class ArticleCategoryDao extends BaseDao
->where('hidden', 0) ->where('hidden', 0)
->where('is_del', 0) ->where('is_del', 0)
->where('status', 1) ->where('status', 1)
->where('pid', '>', 0)
->order('sort DESC') ->order('sort DESC')
->field('id,pid,title') ->field('id,pid,title')
->select()->toArray(); ->select()->toArray();
@ -83,9 +86,10 @@ class ArticleCategoryDao extends BaseDao
* 添加修改选择上级分类列表 * 添加修改选择上级分类列表
* @param array $where * @param array $where
* @return array * @return array
* @throws \ReflectionException
*/ */
public function getMenus(array $where) public function getMenus(array $where)
{ {
return $this->search($where)->order('sort desc,id desc')->column('title,pid,id'); return $this->search($where)->order('sort desc,id desc')->column('title,pid,id,is_del,status');
} }
} }

View File

@ -41,6 +41,7 @@ class StoreOrderDao extends BaseDao
* 订单搜索 * 订单搜索
* @param array $where * @param array $where
* @return \crmeb\basic\BaseModel|mixed|\think\Model * @return \crmeb\basic\BaseModel|mixed|\think\Model
* @throws \ReflectionException
*/ */
public function search(array $where = []) public function search(array $where = [])
{ {
@ -445,8 +446,9 @@ class StoreOrderDao extends BaseDao
/** /**
* 获取订单详情 * 获取订单详情
* @param $uid * @param string $key
* @param $key * @param int $uid
* @param array $with
* @return array|\think\Model|null * @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
@ -454,7 +456,9 @@ class StoreOrderDao extends BaseDao
*/ */
public function getUserOrderDetail(string $key, int $uid, $with = []) public function getUserOrderDetail(string $key, int $uid, $with = [])
{ {
return $this->getOne(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0], '*', $with); $where = ['order_id|unique' => $key, 'is_del' => 0];
if ($uid > 0) $where = $where + ['uid' => $uid];
return $this->getOne($where, '*', $with);
} }
/** /**
@ -495,7 +499,7 @@ class StoreOrderDao extends BaseDao
*/ */
public function chartTimePrice($start, $stop) public function chartTimePrice($start, $stop)
{ {
return $this->search(['is_del' => 0, 'paid' => 1, 'refund_status' => 0]) return $this->search(['pid' => 0, 'is_del' => 0, 'paid' => 1, 'refund_status' => [0, 3]])
->where('add_time', '>=', $start) ->where('add_time', '>=', $start)
->where('add_time', '<', $stop) ->where('add_time', '<', $stop)
->field('sum(pay_price) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time') ->field('sum(pay_price) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')
@ -511,7 +515,7 @@ class StoreOrderDao extends BaseDao
*/ */
public function chartTimeNumber($start, $stop) public function chartTimeNumber($start, $stop)
{ {
return $this->search(['is_del' => 0, 'paid' => 1, 'refund_status' => 0]) return $this->search(['pid' => 0, 'is_del' => 0, 'paid' => 1, 'refund_status' => [0, 3]])
->where('add_time', '>=', $start) ->where('add_time', '>=', $start)
->where('add_time', '<', $stop) ->where('add_time', '<', $stop)
->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time') ->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')
@ -894,7 +898,7 @@ class StoreOrderDao extends BaseDao
*/ */
public function seckillPeople($id, $keyword, $page = 0, $limit = 0) public function seckillPeople($id, $keyword, $page = 0, $limit = 0)
{ {
return $this->getModel() return $this->getModel()->where('paid', 1)->whereIn('refund_type', [0, 3])->where('is_del', 0)
->when($id != 0, function ($query) use ($id) { ->when($id != 0, function ($query) use ($id) {
$query->where('seckill_id', $id); $query->where('seckill_id', $id);
})->when($keyword != '', function ($query) use ($keyword) { })->when($keyword != '', function ($query) use ($keyword) {
@ -902,6 +906,7 @@ class StoreOrderDao extends BaseDao
})->where('paid', 1)->field([ })->where('paid', 1)->field([
'real_name', 'real_name',
'uid', 'uid',
'user_phone',
'SUM(total_num) as goods_num', 'SUM(total_num) as goods_num',
'COUNT(id) as order_num', 'COUNT(id) as order_num',
'SUM(pay_price) as total_price', 'SUM(pay_price) as total_price',
@ -927,7 +932,7 @@ class StoreOrderDao extends BaseDao
return $this->search($where)->where('seckill_id', $id) return $this->search($where)->where('seckill_id', $id)
->when($page && $limit, function ($query) use ($page, $limit) { ->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit); $query->page($page, $limit);
})->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->select()->toArray(); })->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
} }
/** /**
@ -946,7 +951,7 @@ class StoreOrderDao extends BaseDao
return $this->search($where)->where('bargain_id', $id) return $this->search($where)->where('bargain_id', $id)
->when($page && $limit, function ($query) use ($page, $limit) { ->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit); $query->page($page, $limit);
})->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->select()->toArray(); })->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
} }
/** /**
@ -965,6 +970,6 @@ class StoreOrderDao extends BaseDao
return $this->search($where)->where('combination_id', $id) return $this->search($where)->where('combination_id', $id)
->when($page && $limit, function ($query) use ($page, $limit) { ->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit); $query->page($page, $limit);
})->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->select()->toArray(); })->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
} }
} }

View File

@ -33,6 +33,10 @@ class UserBrokerageDao extends BaseDao
* @param int $limit * @param int $limit
* @param array $typeWhere * @param array $typeWhere
* @return array * @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0, array $typeWhere = []) public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0, array $typeWhere = [])
{ {
@ -68,7 +72,8 @@ class UserBrokerageDao extends BaseDao
*/ */
public function brokerageRankList(array $where, int $page = 0, int $limit = 0) public function brokerageRankList(array $where, int $page = 0, int $limit = 0)
{ {
return $this->search($where)->field('uid,SUM(IF(pm=1,`number`,-`number`)) as brokerage_price')->with(['user' => function ($query) { //SUM(IF(pm=1,`number`,-`number`))
return $this->search($where)->field('uid,SUM(number) as brokerage_price')->with(['user' => function ($query) {
$query->field('uid,avatar,nickname'); $query->field('uid,avatar,nickname');
}])->order('brokerage_price desc')->group('uid')->when($page && $limit, function ($query) use ($page, $limit) { }])->order('brokerage_price desc')->group('uid')->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit); $query->page($page, $limit);
@ -79,6 +84,7 @@ class UserBrokerageDao extends BaseDao
* 获取某些条件的佣金总数 * 获取某些条件的佣金总数
* @param array $where * @param array $where
* @return mixed * @return mixed
* @throws \ReflectionException
*/ */
public function getBrokerageSumColumn(array $where) public function getBrokerageSumColumn(array $where)
{ {
@ -92,6 +98,7 @@ class UserBrokerageDao extends BaseDao
* 获取某个账户下的冻结佣金 * 获取某个账户下的冻结佣金
* @param int $uid * @param int $uid
* @return float * @return float
* @throws \ReflectionException
*/ */
public function getUserFrozenPrice(int $uid) public function getUserFrozenPrice(int $uid)
{ {

View File

@ -82,7 +82,9 @@ class UserDao extends BaseDao
/** /**
* @param $uid * @param $uid
* @param string $field
* @return \think\Collection * @return \think\Collection
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -164,6 +166,7 @@ class UserDao extends BaseDao
->order('count desc') ->order('count desc')
->order('t0.uid desc') ->order('t0.uid desc')
->where('t1.spread_time', 'BETWEEN', $time) ->where('t1.spread_time', 'BETWEEN', $time)
->where('t0.is_del', 0)
->page($page, $limit) ->page($page, $limit)
->group('t0.uid') ->group('t0.uid')
->select()->toArray(); ->select()->toArray();

View File

@ -244,6 +244,10 @@ class UserWechatUserDao extends BaseDao
if (isset($where['is_del'])) { if (isset($where['is_del'])) {
$model->where($userAlias . 'is_del', $where['is_del']); $model->where($userAlias . 'is_del', $where['is_del']);
} }
if (isset($where['ids']) && count($where['ids'])) {
$model->whereIn($userAlias . 'uid', $where['ids']);
}
return $field ? $model->field($field) : $model; return $field ? $model->field($field) : $model;
} }

View File

@ -44,6 +44,7 @@ class WechatQrcodeRecordDao extends BaseDao
* @param $timeType * @param $timeType
* @param $field * @param $field
* @param $str * @param $str
* @param string $orderStatus
* @return mixed * @return mixed
*/ */
public function getRecordTrend($qid, $time, $timeType, $field, $str, $orderStatus = '') public function getRecordTrend($qid, $time, $timeType, $field, $str, $orderStatus = '')

View File

@ -33,7 +33,7 @@ class UnpaidOrderCancelJob extends BaseJobs
public function doJob($orderId) public function doJob($orderId)
{ {
/** @var StoreOrderServices $services */ /** @var StoreOrderServices $services */
$services = app()->make(StoreOrderServices::class); $services = app()->make(StoreOrderServices::class);
$orderInfo = $services->get($orderId); $orderInfo = $services->get($orderId);
if (!$orderInfo) { if (!$orderInfo) {
return true; return true;
@ -49,21 +49,21 @@ class UnpaidOrderCancelJob extends BaseJobs
} }
/** @var StoreOrderCartInfoServices $cartServices */ /** @var StoreOrderCartInfoServices $cartServices */
$cartServices = app()->make(StoreOrderCartInfoServices::class); $cartServices = app()->make(StoreOrderCartInfoServices::class);
$cartInfo = $cartServices->getOrderCartInfo($orderId); $cartInfo = $cartServices->getOrderCartInfo($orderId);
/** @var StoreOrderRefundServices $refundServices */ /** @var StoreOrderRefundServices $refundServices */
$refundServices = app()->make(StoreOrderRefundServices::class); $refundServices = app()->make(StoreOrderRefundServices::class);
try { try {
$res = $refundServices->transaction(function () use ($orderInfo, $refundServices) { $res = $refundServices->transaction(function () use ($orderInfo, $refundServices) {
//回退积分和优惠卷 //回退积分和优惠卷
$refundServices->integralAndCouponBack($orderInfo); $refundServices->integralAndCouponBack($orderInfo, 'cancel');
//回退库存和销量 //回退库存和销量
$refundServices->regressionStock($orderInfo); $refundServices->regressionStock($orderInfo);
return true; return true;
}); });
if ($res) { if ($res) {
$orderInfo->is_del = 1; $orderInfo->is_del = 1;
$orderInfo->mark = '订单未支付已超过系统预设时间'; $orderInfo->mark = '订单未支付已超过系统预设时间';
$orderInfo->save(); $orderInfo->save();
} }
return $res; return $res;

View File

@ -70,6 +70,7 @@ class NoticeListener implements ListenerInterface
case 'bind_spread_uid': case 'bind_spread_uid':
if (isset($data['spreadUid']) && $data['spreadUid']) { if (isset($data['spreadUid']) && $data['spreadUid']) {
$name = $data['nickname'] ?? ''; $name = $data['nickname'] ?? '';
crmebLog('绑定推广关系');
//站内信 //站内信
$SystemMsg->sendMsg($data['spreadUid'], ['nickname' => $name]); $SystemMsg->sendMsg($data['spreadUid'], ['nickname' => $name]);
//模板消息公众号模版消息 //模板消息公众号模版消息
@ -354,7 +355,7 @@ class NoticeListener implements ListenerInterface
$link = '/pages/admin/orderDetail/index?id=' . $order['order_id']; $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
$WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link); $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
//企业微信通知 //企业微信通知
EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]); $EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
break; break;
//确认收货给客服 //确认收货给客服
case 'send_admin_confirm_take_over': case 'send_admin_confirm_take_over':
@ -371,7 +372,7 @@ class NoticeListener implements ListenerInterface
$link = '/pages/admin/orderDetail/index?id=' . $order['order_id']; $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
$WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link); $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
//企业微信通知 //企业微信通知
EnterpriseWechatJob::dispatch(['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]); $EnterpriseWechat->weComSend(['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]);
break; break;
//申请退款给客服发消息 //申请退款给客服发消息
case 'send_order_apply_refund': case 'send_order_apply_refund':
@ -381,7 +382,7 @@ class NoticeListener implements ListenerInterface
//短信 //短信
$NoticeSms->sendAdminRefund($order); $NoticeSms->sendAdminRefund($order);
//企业微信通知 //企业微信通知
EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]); $EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
//公众号 //公众号
$storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']); $storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
$title = '亲,您有个退款订单待处理!'; $title = '亲,您有个退款订单待处理!';
@ -394,7 +395,7 @@ class NoticeListener implements ListenerInterface
//站内信 //站内信
$SystemMsg->kefuSystemSend($data); $SystemMsg->kefuSystemSend($data);
//企业微信通知 //企业微信通知
EnterpriseWechatJob::dispatch($data); $EnterpriseWechat->weComSend($data);
break; break;
} }

View File

@ -46,10 +46,12 @@ class OrderPaySuccessListener implements ListenerInterface
'change_time' => time() 'change_time' => time()
]); ]);
//赠送购买商品优惠券 //赠送购买商品优惠券,仅普通商品订单才会赠送
/** @var StoreProductCouponServices $storeProductCouponServices */ if (!$orderInfo['seckill_id'] && !$orderInfo['bargain_id'] && !$orderInfo['combination_id']) {
$storeProductCouponServices = app()->make(StoreProductCouponServices::class); /** @var StoreProductCouponServices $storeProductCouponServices */
$storeProductCouponServices->giveOrderProductCoupon((int)$orderInfo['uid'], $orderInfo['id']); $storeProductCouponServices = app()->make(StoreProductCouponServices::class);
$storeProductCouponServices->giveOrderProductCoupon((int)$orderInfo['uid'], $orderInfo['id']);
}
//修改开票数据支付状态 //修改开票数据支付状态
$orderInvoiceServices = app()->make(StoreOrderInvoiceServices::class); $orderInvoiceServices = app()->make(StoreOrderInvoiceServices::class);

View File

@ -78,6 +78,4 @@ class SystemStore extends BaseModel
$query->where('id|name|introduction|phone', 'LIKE', "%$value%"); $query->where('id|name|introduction|phone', 'LIKE', "%$value%");
} }
} }
} }

View File

@ -45,7 +45,7 @@ class MemberCardBatch extends BaseModel
public function searchTitleAttr($query, $value) public function searchTitleAttr($query, $value)
{ {
if ($value !== '') { if ($value !== '') {
$query->where('title', $value); $query->where('title', 'like', '%' . $value . '%');
} }
} }

View File

@ -440,4 +440,14 @@ class User extends BaseModel
{ {
if ($value !== '') $query->where('is_del', $value); if ($value !== '') $query->where('is_del', $value);
} }
/**
* 不等于uid搜索器
* @param $query
* @param $value
*/
public function searchNotUidAttr($query, $value)
{
if ($value !== '') $query->where('uid', '<>', $value);
}
} }

View File

@ -59,7 +59,7 @@ class WechatQrcode extends BaseModel
public function searchNameAttr($query, $value) public function searchNameAttr($query, $value)
{ {
if ($value != '') $query->where('name', $value); if ($value != '') $query->whereLike('name', '%' . $value . '%');
} }
public function searchIsDelAttr($query, $value) public function searchIsDelAttr($query, $value)

View File

@ -996,8 +996,8 @@ class StoreBargainServices extends BaseServices
$spread_count = $bargainUserHelp->count(['bargain_id' => $id, 'type' => 0]); $spread_count = $bargainUserHelp->count(['bargain_id' => $id, 'type' => 0]);
$start_count = $bargainUser->count(['bargain_id' => $id]); $start_count = $bargainUser->count(['bargain_id' => $id]);
$success_count = $bargainUser->count(['bargain_id' => $id, 'status' => 3]); $success_count = $bargainUser->count(['bargain_id' => $id, 'status' => 3]);
$pay_price = $orderServices->sum(['bargain_id' => $id, 'paid' => 1], 'pay_price', true); $pay_price = $orderServices->sum([['bargain_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'pay_price', false);
$pay_count = $orderServices->count(['bargain_id' => $id, 'paid' => 1]); $pay_count = $orderServices->getDistinctCount([['bargain_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'uid', false);
$pay_rate = $start_count > 0 ? bcmul(bcdiv((string)$pay_count, (string)$start_count, 2), '100', 2) : 0; $pay_rate = $start_count > 0 ? bcmul(bcdiv((string)$pay_count, (string)$start_count, 2), '100', 2) : 0;
return compact('people_count', 'spread_count', 'start_count', 'success_count', 'pay_price', 'pay_count', 'pay_rate'); return compact('people_count', 'spread_count', 'start_count', 'success_count', 'pay_price', 'pay_count', 'pay_rate');
} }
@ -1027,6 +1027,7 @@ class StoreBargainServices extends BaseServices
/** @var StoreOrderServices $orderServices */ /** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class); $orderServices = app()->make(StoreOrderServices::class);
[$page, $limit] = $this->getPageValue(); [$page, $limit] = $this->getPageValue();
$where = $where + ['paid' => 1, 'refund_status' => 0, 'is_del' => 0];
$list = $orderServices->bargainStatisticsOrder($id, $where, $page, $limit); $list = $orderServices->bargainStatisticsOrder($id, $where, $page, $limit);
$where['bargain_id'] = $id; $where['bargain_id'] = $id;
$count = $orderServices->count($where); $count = $orderServices->count($where);

View File

@ -234,6 +234,9 @@ class StoreBargainUserServices extends BaseServices
* 砍价列表 * 砍价列表
* @param $where * @param $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function bargainUserList($where) public function bargainUserList($where)
{ {

View File

@ -643,8 +643,8 @@ class StoreCombinationServices extends BaseServices
$spread_count = $pinkServices->getDistinctCount([['cid', '=', $id], ['k_id', '>', 0]], 'uid', false); $spread_count = $pinkServices->getDistinctCount([['cid', '=', $id], ['k_id', '>', 0]], 'uid', false);
$start_count = $pinkServices->count(['cid' => $id, 'k_id' => 0]); $start_count = $pinkServices->count(['cid' => $id, 'k_id' => 0]);
$success_count = $pinkServices->count(['cid' => $id, 'k_id' => 0, 'status' => 2]); $success_count = $pinkServices->count(['cid' => $id, 'k_id' => 0, 'status' => 2]);
$pay_price = $orderServices->sum(['combination_id' => $id, 'paid' => 1], 'pay_price', true); $pay_price = $orderServices->sum([['combination_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'pay_price', false);
$pay_count = $orderServices->getDistinctCount([['combination_id', '=', $id], ['paid', '=', 1]], 'uid', false); $pay_count = $orderServices->getDistinctCount([['combination_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'uid', false);
return compact('people_count', 'spread_count', 'start_count', 'success_count', 'pay_price', 'pay_count'); return compact('people_count', 'spread_count', 'start_count', 'success_count', 'pay_price', 'pay_count');
} }
@ -659,6 +659,7 @@ class StoreCombinationServices extends BaseServices
/** @var StoreOrderServices $orderServices */ /** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class); $orderServices = app()->make(StoreOrderServices::class);
[$page, $limit] = $this->getPageValue(); [$page, $limit] = $this->getPageValue();
$where = $where + ['paid' => 1, 'refund_status' => 0, 'is_del' => 0];
$list = $orderServices->combinationStatisticsOrder($id, $where, $page, $limit); $list = $orderServices->combinationStatisticsOrder($id, $where, $page, $limit);
$where['combination_id'] = $id; $where['combination_id'] = $id;
$count = $orderServices->count($where); $count = $orderServices->count($where);

View File

@ -56,6 +56,9 @@ class StorePinkServices extends BaseServices
/** /**
* @param array $where * @param array $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function systemPage(array $where) public function systemPage(array $where)
{ {
@ -88,6 +91,9 @@ class StorePinkServices extends BaseServices
* 参团人员 * 参团人员
* @param int $id * @param int $id
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getPinkMember(int $id) public function getPinkMember(int $id)
{ {
@ -96,8 +102,11 @@ class StorePinkServices extends BaseServices
/** /**
* 拼团退款 * 拼团退款
* @param $id * @param $order
* @return bool * @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function setRefundPink($order) public function setRefundPink($order)
{ {

View File

@ -123,6 +123,12 @@ class StoreCouponIssueServices extends BaseServices
$data['is_permanent'] = 1; $data['is_permanent'] = 1;
$data['total_count'] = 0; $data['total_count'] = 0;
} }
if ($data['is_permanent'] != 1 && $data['receive_limit'] > $data['total_count']) {
throw new AdminException(500031);
}
$data['add_time'] = time(); $data['add_time'] = time();
$res = $this->dao->save($data); $res = $this->dao->save($data);
if (($data['product_id'] !== '' || $data['category_id'] !== '') && $res) { if (($data['product_id'] !== '' || $data['category_id'] !== '') && $res) {
@ -259,7 +265,7 @@ class StoreCouponIssueServices extends BaseServices
$data['add_time'] = $item['start_use_time']; $data['add_time'] = $item['start_use_time'];
$data['end_time'] = $item['end_use_time']; $data['end_time'] = $item['end_use_time'];
} }
$data['type'] = 'get'; $data['type'] = 'send';
$issue['uid'] = $uid; $issue['uid'] = $uid;
$issue['issue_coupon_id'] = $item['id']; $issue['issue_coupon_id'] = $item['id'];
$issue['add_time'] = $time; $issue['add_time'] = $time;
@ -359,30 +365,13 @@ class StoreCouponIssueServices extends BaseServices
$issueCouponInfo = $this->dao->getInfo((int)$id); $issueCouponInfo = $this->dao->getInfo((int)$id);
$uid = $user->uid; $uid = $user->uid;
if (!$issueCouponInfo) throw new ApiException(400516); if (!$issueCouponInfo) throw new ApiException(400516);
/** @var MemberRightServices $memberRightService */
$memberRightService = app()->make(MemberRightServices::class);
if ($issueCouponInfo->receive_type == 4 && (!$user->is_money_level || !$memberRightService->getMemberRightStatus("coupon"))) {
if (!$user->is_money_level) throw new ApiException(400097);
if (!$memberRightService->getMemberRightStatus("coupon")) throw new ApiException(400098);
}
/** @var StoreCouponIssueUserServices $issueUserService */ /** @var StoreCouponIssueUserServices $issueUserService */
$issueUserService = app()->make(StoreCouponIssueUserServices::class); $issueUserService = app()->make(StoreCouponIssueUserServices::class);
if ($is_receive) {
$alreadyReceived = $issueUserService->count(['uid' => $uid, 'issue_coupon_id' => $id]);
if ($alreadyReceived >= $issueCouponInfo['receive_limit']) {
throw new ApiException(400518);
}
}
/** @var StoreCouponUserServices $couponUserService */ /** @var StoreCouponUserServices $couponUserService */
$couponUserService = app()->make(StoreCouponUserServices::class); $couponUserService = app()->make(StoreCouponUserServices::class);
if ($issueCouponInfo->remain_count <= 0 && !$issueCouponInfo->is_permanent) throw new ApiException(400518);
$this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) { $this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]); $issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "get"); $couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
if ($issueCouponInfo['total_count'] > 0) {
$issueCouponInfo['remain_count'] -= 1;
$issueCouponInfo->save();
}
}); });
} }
@ -423,6 +412,9 @@ class StoreCouponIssueServices extends BaseServices
* @param int $uid * @param int $uid
* @param $types * @param $types
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getUserCouponList(int $uid, $types) public function getUserCouponList(int $uid, $types)
{ {
@ -506,6 +498,9 @@ class StoreCouponIssueServices extends BaseServices
* 获取单个优惠券类型 * 获取单个优惠券类型
* @param array $where * @param array $where
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getOne(array $where) public function getOne(array $where)
{ {
@ -532,6 +527,8 @@ class StoreCouponIssueServices extends BaseServices
/** /**
* 给会员发放优惠券 * 给会员发放优惠券
* @param $uid * @param $uid
* @param int $couponId
* @return bool
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException

View File

@ -71,7 +71,7 @@ class StoreCouponService extends BaseServices
$f[] = Form::select('category_id', '选择品类')->setOptions(Form::setOptions($options))->filterable(1)->col(12); $f[] = Form::select('category_id', '选择品类')->setOptions(Form::setOptions($options))->filterable(1)->col(12);
break; break;
case 2://商品券 case 2://商品券
$f[] = Form::frameImages('image', '商品', Url::buildUrl('admin/store.StoreProduct/index', array('fodder' => 'image', 'type' => 'many')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->props(['srcKey' => 'image']); $f[] = Form::frameImages('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image', 'type' => 'many')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->props(['srcKey' => 'image']);
$f[] = Form::hidden('product_id', ''); $f[] = Form::hidden('product_id', '');
break; break;
} }

View File

@ -170,6 +170,8 @@ class StoreCouponUserServices extends BaseServices
$coupon['start_time'] = $coupon['start_time'] ? date('Y/m/d', $coupon['start_time']) : date('Y/m/d', $coupon['add_time']); $coupon['start_time'] = $coupon['start_time'] ? date('Y/m/d', $coupon['start_time']) : date('Y/m/d', $coupon['add_time']);
$coupon['add_time'] = date('Y/m/d', $coupon['add_time']); $coupon['add_time'] = date('Y/m/d', $coupon['add_time']);
$coupon['end_time'] = date('Y/m/d', $coupon['end_time']); $coupon['end_time'] = date('Y/m/d', $coupon['end_time']);
$coupon['start_use_time'] = $coupon['start_use_time'] > 0 ? date('Y/m/d', $coupon['start_use_time']) : 0;
$coupon['end_use_time'] = $coupon['start_use_time'] > 0 ? date('Y/m/d', $coupon['end_use_time']) : 0;
$coupon['title'] = $coupon['coupon_title']; $coupon['title'] = $coupon['coupon_title'];
$coupon['type'] = $coupon['applicable_type']; $coupon['type'] = $coupon['applicable_type'];
$coupon['use_min_price'] = floatval($coupon['use_min_price']); $coupon['use_min_price'] = floatval($coupon['use_min_price']);

View File

@ -45,7 +45,7 @@ class StoreCouponUserUserServices extends BaseServices
[$page, $limit] = $this->getPageValue(); [$page, $limit] = $this->getPageValue();
$list = $this->dao->sysPage($where, $page, $limit); $list = $this->dao->sysPage($where, $page, $limit);
foreach ($list as $k => &$v) { foreach ($list as $k => &$v) {
$v['start_time'] = $v['add_time']; $v['start_time'] = $v['start_time'] > 0 ? $v['start_time'] : $v['add_time'];
if ($v['end_time'] < time() || $v['use_time'] != 0) $v['is_fail'] = 1; if ($v['end_time'] < time() || $v['use_time'] != 0) $v['is_fail'] = 1;
} }
$count = $this->dao->sysCount($where); $count = $this->dao->sysCount($where);

View File

@ -160,8 +160,7 @@ class StoreIntegralOrderServices extends BaseServices
if (!$addressId) { if (!$addressId) {
throw new ApiException(410045); throw new ApiException(410045);
} }
if (!$addressInfo = $addressServices->getOne(['uid' => $uid, 'id' => $addressId, 'is_del' => 0])) if (!$addressInfo = $addressServices->getOne(['uid' => $uid, 'id' => $addressId, 'is_del' => 0])) throw new ApiException(410046);
throw new ApiException(410046);
$addressInfo = $addressInfo->toArray(); $addressInfo = $addressInfo->toArray();
$total_price = bcmul($productInfo['price'], $num, 2); $total_price = bcmul($productInfo['price'], $num, 2);
/** @var UserBillServices $userBillServices */ /** @var UserBillServices $userBillServices */
@ -226,7 +225,7 @@ class StoreIntegralOrderServices extends BaseServices
$res2 = false !== $userServices->bcDec($userInfo['uid'], 'integral', $priceIntegral, 'uid'); $res2 = false !== $userServices->bcDec($userInfo['uid'], 'integral', $priceIntegral, 'uid');
/** @var UserBillServices $userBillServices */ /** @var UserBillServices $userBillServices */
$userBillServices = app()->make(UserBillServices::class); $userBillServices = app()->make(UserBillServices::class);
$res3 = $userBillServices->income('storeIntegral_use_integral', $uid, $priceIntegral, $userInfo['integral'], $orderId); $res3 = $userBillServices->income('storeIntegral_use_integral', $uid, $priceIntegral, $userInfo['integral'] - $priceIntegral, $orderId);
$res2 = $res2 && false != $res3; $res2 = $res2 && false != $res3;
} }
if (!$res2) { if (!$res2) {
@ -334,7 +333,7 @@ class StoreIntegralOrderServices extends BaseServices
/** @var StoreProductAttrValueServices $StoreProductAttrValueServices */ /** @var StoreProductAttrValueServices $StoreProductAttrValueServices */
$StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class); $StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
$attrValue = $StoreProductAttrValueServices->uniqueByField($unique, 'product_id,suk,price,image,unique'); $attrValue = $StoreProductAttrValueServices->uniqueByField($unique, 'product_id,suk,price,image,unique');
if(!$attrValue || !isset($attrValue['storeIntegral']) || !$attrValue['storeIntegral']){ if (!$attrValue || !isset($attrValue['storeIntegral']) || !$attrValue['storeIntegral']) {
throw new ApiException(410295); throw new ApiException(410295);
} }
$data = []; $data = [];
@ -725,13 +724,16 @@ class StoreIntegralOrderServices extends BaseServices
* @param int $id * @param int $id
* @param string $remark * @param string $remark
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function remark(int $id, string $remark) public function remark(int $id, string $remark)
{ {
if (!$remark) throw new AdminException(400106); if (!$remark) throw new AdminException(400106);
if (!$id) throw new AdminException(100100); if (!$id) throw new AdminException(100100);
if (!$order = $this->services->get($id)) { if (!$order = $this->dao->get($id)) {
throw new AdminException(100025); throw new AdminException(100025);
} }
$order->remark = $remark; $order->remark = $remark;

View File

@ -92,10 +92,13 @@ class LiveAnchorServices extends BaseServices
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save(int $id, array $data) public function save(int $id, array $data)
{ {
$liveAnchor = $this->dao->get(['wechat' => $data['wechat']]); $liveAnchor = $this->dao->get(['wechat' => $data['wechat'], 'is_del' => 0]);
if (!MiniProgramService::getRoleList(2, 0, 30, $data['wechat'])) { if (!MiniProgramService::getRoleList(2, 0, 30, $data['wechat'])) {
throw new AdminException(400426); throw new AdminException(400426);
} }

View File

@ -40,6 +40,10 @@ class LiveRoomServices extends BaseServices
$where['is_del'] = 0; $where['is_del'] = 0;
[$page, $limit] = $this->getPageValue(); [$page, $limit] = $this->getPageValue();
$list = $this->dao->getList($where, '*', [], $page, $limit); $list = $this->dao->getList($where, '*', [], $page, $limit);
$liveProductServices = app()->make(LiveRoomGoodsServices::class);
foreach ($list as &$item) {
$item['product_ids'] = array_column($liveProductServices->selectList(['live_room_id' => $item['id']])->toArray(), 'live_goods_id');
}
$count = $this->dao->count($where); $count = $this->dao->count($where);
return compact('count', 'list'); return compact('count', 'list');
} }
@ -238,6 +242,7 @@ class LiveRoomServices extends BaseServices
/** /**
* 同步直播间状态 * 同步直播间状态
* @return bool * @return bool
* @throws \Exception
*/ */
public function syncRoomStatus() public function syncRoomStatus()
{ {
@ -245,7 +250,6 @@ class LiveRoomServices extends BaseServices
$limit = 50; $limit = 50;
$data = $dataAll = []; $data = $dataAll = [];
$rooms = $this->dao->getColumn([], 'id,room_id,live_status', 'room_id'); $rooms = $this->dao->getColumn([], 'id,room_id,live_status', 'room_id');
// if (!$rooms) return true;
do { do {
$wxRooms = MiniProgramService::getLiveInfo($start, $limit); $wxRooms = MiniProgramService::getLiveInfo($start, $limit);
foreach ($wxRooms as $room) { foreach ($wxRooms as $room) {

View File

@ -46,6 +46,9 @@ class LuckLotteryRecordServices extends BaseServices
* 获取抽奖记录列表 * 获取抽奖记录列表
* @param array $where * @param array $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where) public function getList(array $where)
{ {
@ -108,7 +111,11 @@ class LuckLotteryRecordServices extends BaseServices
* 写入中奖纪录 * 写入中奖纪录
* @param int $uid * @param int $uid
* @param array $prize * @param array $prize
* @param array $userInfo
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function insertPrizeRecord(int $uid, array $prize, array $userInfo = []) public function insertPrizeRecord(int $uid, array $prize, array $userInfo = [])
{ {
@ -218,13 +225,6 @@ class LuckLotteryRecordServices extends BaseServices
throw new ApiException(410053); throw new ApiException(410053);
} }
break; break;
case 7:
//TODO 未完善
break;
case 8:
break;
case 9:
break;
} }
$this->dao->update($lottery_record_id, $data, 'id'); $this->dao->update($lottery_record_id, $data, 'id');
}); });
@ -272,7 +272,11 @@ class LuckLotteryRecordServices extends BaseServices
/** /**
* 获取中奖记录 * 获取中奖记录
* @param int $uid * @param int $uid
* @param array $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getRecord(int $uid, $where = []) public function getRecord(int $uid, $where = [])
{ {

View File

@ -154,7 +154,6 @@ class LuckLotteryServices extends BaseServices
} }
$lottery = $lottery->toArray(); $lottery = $lottery->toArray();
if (isset($lottery['prize']) && $lottery['prize']) { if (isset($lottery['prize']) && $lottery['prize']) {
$products = $coupons = [];
$product_ids = array_unique(array_column($lottery['prize'], 'product_id')); $product_ids = array_unique(array_column($lottery['prize'], 'product_id'));
$coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id')); $coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id'));
/** @var StoreProductServices $productServices */ /** @var StoreProductServices $productServices */
@ -173,6 +172,9 @@ class LuckLotteryServices extends BaseServices
} }
} }
} }
foreach ($lottery['user_level'] as &$item) {
$item = (int)$item;
}
/** @var UserLabelServices $userLabelServices */ /** @var UserLabelServices $userLabelServices */
$userLabelServices = app()->make(UserLabelServices::class); $userLabelServices = app()->make(UserLabelServices::class);
$lottery['user_label'] = !empty($lottery['user_label']) ? $userLabelServices->getLabelList(['ids' => $lottery['user_label']], ['id', 'label_name']) : []; $lottery['user_label'] = !empty($lottery['user_label']) ? $userLabelServices->getLabelList(['ids' => $lottery['user_label']], ['id', 'label_name']) : [];
@ -183,6 +185,9 @@ class LuckLotteryServices extends BaseServices
* 添加抽奖活动以及奖品 * 添加抽奖活动以及奖品
* @param array $data * @param array $data
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function add(array $data) public function add(array $data)
{ {
@ -400,6 +405,11 @@ class LuckLotteryServices extends BaseServices
* 抽奖 * 抽奖
* @param int $uid * @param int $uid
* @param int $lottery_id * @param int $lottery_id
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function luckLottery(int $uid, int $lottery_id) public function luckLottery(int $uid, int $lottery_id)
{ {

View File

@ -362,7 +362,7 @@ class StoreSeckillServices extends BaseServices
$header[] = ['title' => $item['value'], 'key' => 'value' . ($key + 1), 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => $item['value'], 'key' => 'value' . ($key + 1), 'align' => 'center', 'minWidth' => 80];
} }
$header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120]; $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
$header[] = ['title' => '秒杀价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '秒杀价', 'type' => 1, 'key' => 'price', 'align' => 'center', 'minWidth' => 80];
$header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
$header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
$header[] = ['title' => '库存', 'key' => 'stock', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '库存', 'key' => 'stock', 'align' => 'center', 'minWidth' => 80];
@ -716,6 +716,9 @@ class StoreSeckillServices extends BaseServices
* @param $id * @param $id
* @param string $field * @param string $field
* @return array|false|\PDOStatement|string|\think\Model * @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getValidProduct($id, $field = '*') public function getValidProduct($id, $field = '*')
{ {
@ -724,15 +727,19 @@ class StoreSeckillServices extends BaseServices
/** /**
* 秒杀统计 * 秒杀统计
* @param $id
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function seckillStatistics($id) public function seckillStatistics($id)
{ {
/** @var StoreOrderServices $orderServices */ /** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class); $orderServices = app()->make(StoreOrderServices::class);
$pay_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['paid', '=', 1]], 'uid', false); $pay_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]]], 'uid', false);
$order_count = $orderServices->getDistinctCount([['seckill_id', '=', $id]], 'uid', false); $order_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['refund_type', 'in', [0, 3]]], 'uid', false);
$all_price = $orderServices->sum([['seckill_id', '=', $id], ['refund_type', 'in', [0, 3]]], 'pay_price'); $all_price = $orderServices->sum([['seckill_id', '=', $id], ['refund_type', 'in', [0, 3]], ['paid', '=', 1]], 'pay_price');
$seckillInfo = $this->dao->get($id); $seckillInfo = $this->dao->get($id);
$pay_rate = $seckillInfo['quota'] . '/' . $seckillInfo['quota_show']; $pay_rate = $seckillInfo['quota'] . '/' . $seckillInfo['quota_show'];
return compact('pay_count', 'order_count', 'all_price', 'pay_rate'); return compact('pay_count', 'order_count', 'all_price', 'pay_rate');
@ -768,6 +775,7 @@ class StoreSeckillServices extends BaseServices
/** @var StoreOrderServices $orderServices */ /** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class); $orderServices = app()->make(StoreOrderServices::class);
[$page, $limit] = $this->getPageValue(); [$page, $limit] = $this->getPageValue();
$where = $where + ['paid' => 1, 'refund_status' => 0, 'is_del' => 0];
$list = $orderServices->seckillOrder($id, $where, $page, $limit); $list = $orderServices->seckillOrder($id, $where, $page, $limit);
$where['seckill_id'] = $id; $where['seckill_id'] = $id;
$count = $orderServices->count($where); $count = $orderServices->count($where);

View File

@ -39,23 +39,14 @@ class ArticleCategoryServices extends BaseServices
* 获取文章分类列表 * 获取文章分类列表
* @param array $where * @param array $where
* @return array * @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where) public function getList(array $where)
{ {
[$page, $limit] = $this->getPageValue();
$list = $this->dao->getList($where); $list = $this->dao->getList($where);
if (!empty($list) && $where['title'] !== '') {
$pids = Arr::getUniqueKey($list, 'pid');
$parentList = $this->dao->getList(['id' => $pids]);
$list = array_merge($list, $parentList);
foreach ($list as $key => $item) {
$arr = $item;
unset($list[$key]);
if (!in_array($arr, $list)) {
$list[] = $arr;
}
}
}
$list = get_tree_children($list); $list = get_tree_children($list);
$count = $this->dao->count($where); $count = $this->dao->count($where);
return compact('list', 'count'); return compact('list', 'count');
@ -160,10 +151,10 @@ class ArticleCategoryServices extends BaseServices
/** /**
* 树形列表 * 树形列表
* @return array * @return array
* @throws \ReflectionException
*/ */
public function getTreeList() public function getTreeList()
{ {
$where['is_show'] = 1; return sort_list_tier($this->dao->getMenus([]));
return sort_list_tier($this->dao->getMenus($where));
} }
} }

View File

@ -64,6 +64,7 @@ class LoginServices extends BaseServices
$token = $this->createToken($kefuInfo->id, 'kefu'); $token = $this->createToken($kefuInfo->id, 'kefu');
$kefuInfo->update_time = time(); $kefuInfo->update_time = time();
$kefuInfo->ip = request()->ip(); $kefuInfo->ip = request()->ip();
$kefuInfo->online = 1;
$kefuInfo->save(); $kefuInfo->save();
return [ return [
'token' => $token['token'], 'token' => $token['token'],

View File

@ -120,7 +120,7 @@ class StoreServiceLogServices extends BaseServices
foreach ($list as &$item) { foreach ($list as &$item) {
$item['_add_time'] = $item['add_time']; $item['_add_time'] = $item['add_time'];
$item['add_time'] = strtotime($item['_add_time']); $item['add_time'] = strtotime($item['_add_time']);
$item['productInfo'] = $item['orderInfo'] = []; $item['productInfo'] = $item['orderInfo'] = null;
if ($item['msn_type'] == self::MSN_TYPE_GOODS && $item['msn']) { if ($item['msn_type'] == self::MSN_TYPE_GOODS && $item['msn']) {
$productIds[] = $item['msn']; $productIds[] = $item['msn'];
} elseif ($item['msn_type'] == self::MSN_TYPE_ORDER && $item['msn']) { } elseif ($item['msn_type'] == self::MSN_TYPE_ORDER && $item['msn']) {
@ -155,7 +155,7 @@ class StoreServiceLogServices extends BaseServices
foreach ($list as &$item) { foreach ($list as &$item) {
if ($item['msn_type'] == self::MSN_TYPE_GOODS && $item['msn']) { if ($item['msn_type'] == self::MSN_TYPE_GOODS && $item['msn']) {
$item['productInfo'] = $productList[$item['msn']] ?? []; $item['productInfo'] = $productList[$item['msn']] ?? null;
} elseif ($item['msn_type'] == self::MSN_TYPE_ORDER && $item['msn']) { } elseif ($item['msn_type'] == self::MSN_TYPE_ORDER && $item['msn']) {
$order = $orderInfo[$item['msn']] ?? null; $order = $orderInfo[$item['msn']] ?? null;
if ($order) { if ($order) {
@ -164,7 +164,7 @@ class StoreServiceLogServices extends BaseServices
$order['add_time_h'] = date('H:i:s', $order['add_time']); $order['add_time_h'] = date('H:i:s', $order['add_time']);
$item['orderInfo'] = $order; $item['orderInfo'] = $order;
} else { } else {
$item['orderInfo'] = []; $item['orderInfo'] = null;
} }
} }
$item['msn_type'] = (int)$item['msn_type']; $item['msn_type'] = (int)$item['msn_type'];

View File

@ -93,7 +93,7 @@ class StoreServiceServices extends BaseServices
if ($formData) { if ($formData) {
$field[] = $this->builder->frameImage('avatar', '客服头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]); $field[] = $this->builder->frameImage('avatar', '客服头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
} else { } else {
$field[] = $this->builder->frameImage('image', '选择用户', $this->url('admin/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']); $field[] = $this->builder->frameImage('image', '选择用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->hidden('uid', 0); $field[] = $this->builder->hidden('uid', 0);
$field[] = $this->builder->hidden('avatar', ''); $field[] = $this->builder->hidden('avatar', '');
} }

View File

@ -82,7 +82,7 @@ class DeliveryServiceServices extends BaseServices
if ($formData) { if ($formData) {
$field[] = $this->builder->frameImage('avatar', '配送员头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]); $field[] = $this->builder->frameImage('avatar', '配送员头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
} else { } else {
$field[] = $this->builder->frameImage('image', '商城用户', $this->url('admin/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']); $field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->hidden('uid', 0); $field[] = $this->builder->hidden('uid', 0);
$field[] = $this->builder->hidden('avatar', ''); $field[] = $this->builder->hidden('avatar', '');
} }

View File

@ -225,7 +225,7 @@ class OutStoreOrderServices extends BaseServices
* @param array $list * @param array $list
* @return array * @return array
*/ */
public function tidyCartList(array $cartInfo, array $list, int $cartId = 0): array public function tidyCartList(array $cartInfo, array $list, $cartId = 0): array
{ {
$list[] = [ $list[] = [
'cart_id' => $cartId, 'cart_id' => $cartId,

View File

@ -232,8 +232,10 @@ class StoreCartServices extends BaseServices
public function setCart(int $uid, int $product_id, int $cart_num = 1, string $product_attr_unique = '', int $type = 0, bool $new = true, int $combination_id = 0, int $seckill_id = 0, int $bargain_id = 0, int $advance_id = 0) public function setCart(int $uid, int $product_id, int $cart_num = 1, string $product_attr_unique = '', int $type = 0, bool $new = true, int $combination_id = 0, int $seckill_id = 0, int $bargain_id = 0, int $advance_id = 0)
{ {
if ($cart_num < 1) $cart_num = 1; if ($cart_num < 1) $cart_num = 1;
//检查限购 if ($type == 0) {
$this->checkLimit($uid, $product_id, $cart_num, $new); //检查限购
$this->checkLimit($uid, $product_id, $cart_num, $new);
}
//检测库存限量 //检测库存限量
[$attrInfo, $product_attr_unique, $bargainPriceMin, $cart_num, $productInfo] = $this->checkProductStock($uid, $cart_num, $product_attr_unique, $type, $product_id, $seckill_id, $bargain_id, $combination_id, $advance_id); [$attrInfo, $product_attr_unique, $bargainPriceMin, $cart_num, $productInfo] = $this->checkProductStock($uid, $cart_num, $product_attr_unique, $type, $product_id, $seckill_id, $bargain_id, $combination_id, $advance_id);
if ($new) { if ($new) {
@ -432,8 +434,10 @@ class StoreCartServices extends BaseServices
*/ */
public function setCartNum($uid, $productId, $num, $unique, $type) public function setCartNum($uid, $productId, $num, $unique, $type)
{ {
//检查限购 if ($type == 1) {
$this->checkLimit($uid, $productId, $num, 0); //检查限购
$this->checkLimit($uid, $productId, $num, 0);
}
/** @var StoreProductAttrValueServices $attrValueServices */ /** @var StoreProductAttrValueServices $attrValueServices */
$attrValueServices = app()->make(StoreProductAttrValueServices::class); $attrValueServices = app()->make(StoreProductAttrValueServices::class);
@ -677,6 +681,7 @@ class StoreCartServices extends BaseServices
* @param $num * @param $num
* @param $new * @param $new
* @return bool * @return bool
* @throws \ReflectionException
*/ */
public function checkLimit($uid, $product_id, $num, $new) public function checkLimit($uid, $product_id, $num, $new)
{ {
@ -699,8 +704,8 @@ class StoreCartServices extends BaseServices
} }
} else if ($limitInfo['limit_type'] == 2) { } else if ($limitInfo['limit_type'] == 2) {
$cartNum = $this->dao->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num'); $cartNum = $this->dao->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num');
$orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num'); $orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'split_status' => 0], 'cart_num');
$orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'refund_num'); $orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'split_status' => 0], 'refund_num');
$orderNum = $orderPayNum - $orderRefundNum; $orderNum = $orderPayNum - $orderRefundNum;
if (($num + $orderNum + $cartNum) > $limitInfo['limit_num']) { if (($num + $orderNum + $cartNum) > $limitInfo['limit_num']) {
throw new ApiException(410240, ['limit' => $limitInfo['limit_num'], 'pay_num' => $orderNum]); throw new ApiException(410240, ['limit' => $limitInfo['limit_num'], 'pay_num' => $orderNum]);

View File

@ -391,7 +391,7 @@ class StoreOrderComputedServices extends BaseServices
foreach ($temp_num as $k => $v) { foreach ($temp_num as $k => $v) {
if (isset($temp[$v['temp_id']]['appoint']) && $temp[$v['temp_id']]['appoint'] && isset($freeList[$v['temp_id']])) { if (isset($temp[$v['temp_id']]['appoint']) && $temp[$v['temp_id']]['appoint'] && isset($freeList[$v['temp_id']])) {
$free = $freeList[$v['temp_id']]; $free = $freeList[$v['temp_id']];
$condition = $v['type'] == 1 ? $free['number'] <= $v['number'] : $free['number'] >= $v['number']; $condition = $free['number'] <= $v['number'];
if ($free['price'] <= $v['price'] && $condition) { if ($free['price'] <= $v['price'] && $condition) {
unset($temp_num[$k]); unset($temp_num[$k]);
} }

View File

@ -75,11 +75,11 @@ class StoreOrderCreateServices extends BaseServices
$id = $snowflake->setStartTimeStamp(strtotime('2022-01-01') * 1000)->id(); $id = $snowflake->setStartTimeStamp(strtotime('2022-01-01') * 1000)->id();
} }
$replace = ''; $replace = '';
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $chars = '0123456789';
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 6; $i++) {
$replace .= $chars[mt_rand(0, strlen($chars) - 1)]; $replace .= $chars[mt_rand(0, strlen($chars) - 1)];
} }
$id = substr_replace($id, $replace, -3); $id = substr_replace($id, $replace, -6);
} else { } else {
$is_callable = function ($currentTime) { $is_callable = function ($currentTime) {
$redis = Cache::store('redis'); $redis = Cache::store('redis');
@ -281,10 +281,8 @@ class StoreOrderCreateServices extends BaseServices
} }
/** @var StoreOrderCartInfoServices $cartServices */ /** @var StoreOrderCartInfoServices $cartServices */
$cartServices = app()->make(StoreOrderCartInfoServices::class); $cartServices = app()->make(StoreOrderCartInfoServices::class);
/** @var StoreSeckillServices $seckillServices */
$seckillServices = app()->make(StoreSeckillServices::class);
$priceData['coupon_id'] = $couponId; $priceData['coupon_id'] = $couponId;
$order = $this->transaction(function () use ($cartIds, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $combinationId, $seckillId, $bargainId, $cartServices, $seckillServices, $uid, $addressId, $advanceId) { $order = $this->transaction(function () use ($cartIds, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $combinationId, $seckillId, $bargainId, $cartServices, $uid, $addressId, $advanceId) {
//创建订单 //创建订单
$order = $this->dao->save($orderInfo); $order = $this->dao->save($orderInfo);
if (!$order) { if (!$order) {
@ -800,7 +798,7 @@ class StoreOrderCreateServices extends BaseServices
//计算商品金额 //计算商品金额
if (sys_config('user_brokerage_type') == 1) { if (sys_config('user_brokerage_type') == 1) {
//按照实际支付价格返佣 //按照实际支付价格返佣
$price = bcmul((string)$cart['truePrice'], $cartNum, 4); $price = bcmul((string)bcadd((string)$cart['truePrice'], (string)$cart['postage_price'], 2), $cartNum, 4);
} else { } else {
//按照商品价格返佣 //按照商品价格返佣
if (isset($productInfo['attrInfo'])) { if (isset($productInfo['attrInfo'])) {

View File

@ -569,6 +569,7 @@ class StoreOrderDeliveryServices extends BaseServices
/** /**
* 虚拟商品自动发货 * 虚拟商品自动发货
* @param $orderInfo * @param $orderInfo
* @throws \ReflectionException
*/ */
public function virtualSend($orderInfo) public function virtualSend($orderInfo)
{ {

View File

@ -36,21 +36,28 @@ class StoreOrderInvoiceServices extends BaseServices
public function chart(array $where) public function chart(array $where)
{ {
$where['is_pay'] = 1;
//全部 //全部
$data['all'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time']]); $data['all'] = (string)$this->dao->count($where);
//待开 //待开
$data['noOpened'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 1]); $where['type'] = 1;
$data['noOpened'] = (string)$this->dao->count($where);
//已开 //已开
$data['opened'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 2]); $where['type'] = 2;
$data['opened'] = (string)$this->dao->count($where);
//退款 //退款
$data['refund'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 3]); $where['type'] = 3;
$data['refund'] = (string)$this->dao->count($where);
return $data; return $data;
} }
/** /**
* 后台获取开票列表 * 后台获取开票列表
* @param $where * @param array $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where) public function getList(array $where)
{ {
@ -155,7 +162,9 @@ class StoreOrderInvoiceServices extends BaseServices
if (!$orderInvoice) { if (!$orderInvoice) {
throw new ApiException(100026); throw new ApiException(100026);
} }
$data['invoice_time'] = time(); if ($data['is_invoice'] == 1) {
$data['invoice_time'] = time();
}
if (!$this->dao->update($id, $data, 'id')) { if (!$this->dao->update($id, $data, 'id')) {
throw new ApiException(100015); throw new ApiException(100015);
} }

View File

@ -245,7 +245,7 @@ class StoreOrderRefundServices extends BaseServices
$this->storeOrderServices->update($splitOrderInfo['id'], [ $this->storeOrderServices->update($splitOrderInfo['id'], [
'status' => -2, 'status' => -2,
'refund_status' => 2, 'refund_status' => 2,
'refund_type' => $orderRefundInfo['refund_type'], 'refund_type' => 6,
'refund_express' => $orderRefundInfo['refund_express'], 'refund_express' => $orderRefundInfo['refund_express'],
'refund_express_name' => $orderRefundInfo['refund_express_name'], 'refund_express_name' => $orderRefundInfo['refund_express_name'],
'refund_reason_wap_img' => $orderRefundInfo['refund_img'], 'refund_reason_wap_img' => $orderRefundInfo['refund_img'],
@ -426,18 +426,19 @@ class StoreOrderRefundServices extends BaseServices
/** /**
* 回退积分和优惠卷 * 回退积分和优惠卷
* @param $order * @param $order
* @param string $type
* @return bool * @return bool
*/ */
public function integralAndCouponBack($order) public function integralAndCouponBack($order, $type = 'refund')
{ {
/** @var StoreOrderStatusServices $statusService */ /** @var StoreOrderStatusServices $statusService */
$statusService = app()->make(StoreOrderStatusServices::class); $statusService = app()->make(StoreOrderStatusServices::class);
$res = true; $res = true;
//回退优惠卷 拆分子订单不退优惠券 //取消的订单退回优惠券
if (!$order['pid'] && $order['coupon_id'] && $order['coupon_price']) { if ($type == 'cancel' && $order['coupon_id'] && $order['coupon_price']) {
/** @var StoreCouponUserServices $coumonUserServices */ /** @var StoreCouponUserServices $couponUserServices */
$coumonUserServices = app()->make(StoreCouponUserServices::class); $couponUserServices = app()->make(StoreCouponUserServices::class);
$res = $res && $coumonUserServices->recoverCoupon((int)$order['coupon_id']); $res = $couponUserServices->recoverCoupon((int)$order['coupon_id']);
$statusService->save([ $statusService->save([
'oid' => $order['id'], 'oid' => $order['id'],
'change_type' => 'coupon_back', 'change_type' => 'coupon_back',
@ -1064,7 +1065,7 @@ class StoreOrderRefundServices extends BaseServices
if ($list) { if ($list) {
foreach ($list as &$item) { foreach ($list as &$item) {
$item['paid'] = 1; $item['paid'] = 1;
$item['add_time'] = $item['_add_time'] = isset($item['add_time']) ? date('Y-m-d H:i', (int)$item['add_time']) : ''; $item['add_time'] = $item['_add_time'] = isset($item['add_time']) ? date('Y-m-d H:i:s', (int)$item['add_time']) : '';
$item['cartInfo'] = $item['cart_info']; $item['cartInfo'] = $item['cart_info'];
if (in_array($item['refund_type'], [1, 2, 4, 5])) { if (in_array($item['refund_type'], [1, 2, 4, 5])) {
$item['refund_status'] = 1; $item['refund_status'] = 1;

View File

@ -82,6 +82,8 @@ class StoreOrderServices extends BaseServices
/** /**
* 获取列表 * 获取列表
* @param array $where * @param array $where
* @param array $field
* @param array $with
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
@ -768,7 +770,7 @@ HTML;
} }
/** @var StoreOrderCreateServices $createServices */ /** @var StoreOrderCreateServices $createServices */
$createServices = app()->make(StoreOrderCreateServices::class); $createServices = app()->make(StoreOrderCreateServices::class);
$data['order_id'] = $createServices->getNewOrderId(); $data['order_id'] = $createServices->getNewOrderId('cp');
/** @var StoreOrderStatusServices $services */ /** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class); $services = app()->make(StoreOrderStatusServices::class);
return $this->transaction(function () use ($id, $data, $services) { return $this->transaction(function () use ($id, $data, $services) {
@ -1855,9 +1857,10 @@ HTML;
/** /**
* 删除订单 * 删除订单
* @param $uni * @param string $uni
* @param $uid * @param int $uid
* @return bool * @return bool
* @throws \Psr\SimpleCache\InvalidArgumentException
*/ */
public function removeOrder(string $uni, int $uid) public function removeOrder(string $uni, int $uid)
{ {
@ -1879,21 +1882,6 @@ HTML;
'change_time' => time() 'change_time' => time()
]); ]);
if ($order->save() && $res) { if ($order->save() && $res) {
//未支付和已退款的状态下才可以退积分退库存退优惠券
if ($order['_status']['_type'] == 0 || $order['_status']['_type'] == -2) {
/** @var StoreOrderRefundServices $refundServices */
$refundServices = app()->make(StoreOrderRefundServices::class);
$this->transaction(function () use ($order, $refundServices) {
//回退积分和优惠卷
$res = $refundServices->integralAndCouponBack($order);
//回退库存
$res = $res && $refundServices->regressionStock($order);
if (!$res) {
throw new ApiException(100020);
}
});
}
return true; return true;
} else } else
throw new ApiException(100020); throw new ApiException(100020);
@ -1924,7 +1912,7 @@ HTML;
$refundServices = app()->make(StoreOrderRefundServices::class); $refundServices = app()->make(StoreOrderRefundServices::class);
$this->transaction(function () use ($refundServices, $order) { $this->transaction(function () use ($refundServices, $order) {
$res = $refundServices->integralAndCouponBack($order) && $refundServices->regressionStock($order); $res = $refundServices->integralAndCouponBack($order, 'cancel') && $refundServices->regressionStock($order);
$order->is_del = 1; $order->is_del = 1;
if (!($res && $order->save())) { if (!($res && $order->save())) {
throw new ApiException(100020); throw new ApiException(100020);
@ -2136,7 +2124,7 @@ HTML;
try { try {
$this->transaction(function () use ($order, $refundServices) { $this->transaction(function () use ($order, $refundServices) {
//回退积分和优惠卷 //回退积分和优惠卷
$res = $refundServices->integralAndCouponBack($order); $res = $refundServices->integralAndCouponBack($order, 'cancel');
//回退库存和销量 //回退库存和销量
$res = $res && $refundServices->regressionStock($order); $res = $res && $refundServices->regressionStock($order);
//修改订单状态 //修改订单状态
@ -2351,6 +2339,7 @@ HTML;
} }
} }
$data['_status'] = $orderInfo['_status'] ?? []; $data['_status'] = $orderInfo['_status'] ?? [];
$data['_status']['_is_back'] = $orderInfo['delivery_type'] != 'fictitious' && $orderInfo['virtual_type'] == 0;
$data['cartInfo'] = $data['cartInfo'] ?? $cartInfo; $data['cartInfo'] = $data['cartInfo'] ?? $cartInfo;
return $data; return $data;
} }
@ -2577,12 +2566,12 @@ HTML;
public function autoComment() public function autoComment()
{ {
//自动评价天数 //自动评价天数
$systemCommentTime = (int)sys_config('system_comment_time', 0); $systemCommentTime = sys_config('system_comment_time', 0);
//0为取消自动默认好评功能 //0为取消自动默认好评功能
if ($systemCommentTime == 0) { if ($systemCommentTime == 0) {
return true; return true;
} }
$sevenDay = strtotime(date('Y-m-d H:i:s', strtotime('-' . $systemCommentTime . ' day'))); $sevenDay = bcsub((string)time(), bcmul((string)$systemCommentTime, '86400'));
/** @var StoreOrderStoreOrderStatusServices $service */ /** @var StoreOrderStoreOrderStatusServices $service */
$service = app()->make(StoreOrderStoreOrderStatusServices::class); $service = app()->make(StoreOrderStoreOrderStatusServices::class);
$orderList = $service->getTakeOrderIds([ $orderList = $service->getTakeOrderIds([
@ -2590,7 +2579,7 @@ HTML;
'is_del' => 0, 'is_del' => 0,
'paid' => 1, 'paid' => 1,
'status' => 2, 'status' => 2,
'change_type' => ['take_delivery'] 'change_type' => ['take_delivery','user_take_delivery']
], 30); ], 30);
foreach ($orderList as $item) { foreach ($orderList as $item) {
AutoCommentJob::dispatch([$item['id'], $item['cart_id']]); AutoCommentJob::dispatch([$item['id'], $item['cart_id']]);
@ -2599,6 +2588,7 @@ HTML;
} }
/** /**
* @param int $uid
* @param string $orderId * @param string $orderId
* @param string $type * @param string $type
* @return array * @return array
@ -2630,14 +2620,14 @@ HTML;
if (!$info) { if (!$info) {
throw new PayException('您支付的订单不存在'); throw new PayException('您支付的订单不存在');
} }
$orderCancelTime = (int)sys_config('order_cancel_time', 0); $orderCancelTime = sys_config('order_cancel_time', 0);
$orderActivityTime = (int)sys_config('order_activity_time', 0); $orderActivityTime = sys_config('order_activity_time', 0);
if ($info->combination_id) { if ($info->combination_id) {
$time = ((int)sys_config('order_pink_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time); $time = (sys_config('order_pink_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time);
} else if ($info->seckill_id) { } else if ($info->seckill_id) {
$time = ((int)sys_config('order_seckill_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time); $time = (sys_config('order_seckill_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time);
} else if ($info->bargain_id) { } else if ($info->bargain_id) {
$time = ((int)sys_config('order_bargain_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time); $time = (sys_config('order_bargain_time', 0) ?: $orderActivityTime) * 60 * 60 + ((int)$info->add_time);
} else { } else {
$time = $orderCancelTime * 60 * 60 + ((int)$info->add_time); $time = $orderCancelTime * 60 * 60 + ((int)$info->add_time);
} }
@ -2648,7 +2638,7 @@ HTML;
$data['pay_price'] = $info['pay_price']; $data['pay_price'] = $info['pay_price'];
$data['pay_postage'] = $info['pay_postage']; $data['pay_postage'] = $info['pay_postage'];
$data['offline_postage'] = sys_config('offline_postage', 0); $data['offline_postage'] = (int)sys_config('offline_postage', 0);
$data['invalid_time'] = $time; $data['invalid_time'] = $time;
break; break;

View File

@ -160,6 +160,7 @@ class StoreOrderSplitServices extends BaseServices
'cart_info' => json_encode($_info), 'cart_info' => json_encode($_info),
]; ];
} }
$storeOrderCartInfoServices->update(['oid' => $id, 'cart_id' => $cart['cart_id']], ['surplus_num' => 0, 'split_status' => 2]);
} }
if ($orderInfo['pid'] > 0 && $key == 'other') { if ($orderInfo['pid'] > 0 && $key == 'other') {

View File

@ -522,12 +522,12 @@ class StoreOrderTakeServices extends BaseServices
public function autoTakeOrder() public function autoTakeOrder()
{ {
//7天前时间戳 //7天前时间戳
$systemDeliveryTime = (int)sys_config('system_delivery_time', 0); $systemDeliveryTime = sys_config('system_delivery_time', 0);
//0为取消自动收货功能 //0为取消自动收货功能
if ($systemDeliveryTime == 0) { if ($systemDeliveryTime == 0) {
return true; return true;
} }
$sevenDay = strtotime(date('Y-m-d H:i:s', strtotime('-' . $systemDeliveryTime . ' day'))); $sevenDay = bcsub((string)time(), bcmul((string)$systemDeliveryTime, '86400'));
/** @var StoreOrderStoreOrderStatusServices $service */ /** @var StoreOrderStoreOrderStatusServices $service */
$service = app()->make(StoreOrderStoreOrderStatusServices::class); $service = app()->make(StoreOrderStoreOrderStatusServices::class);
$orderList = $service->getTakeOrderIds([ $orderList = $service->getTakeOrderIds([

View File

@ -306,7 +306,7 @@ class ExportServices extends BaseServices
'ot_price' => $item['ot_price'], 'ot_price' => $item['ot_price'],
'quota' => $item['quota'], 'quota' => $item['quota'],
'start_name' => $item['start_name'], 'start_name' => $item['start_name'],
'activity_time' => date('Y-m-d H:i:s', $item['start_time']) . '至' . date('Y-m-d H:i:s', $item['stop_time']), 'activity_time' => date('Y-m-d', $item['start_time']) . '至' . date('Y-m-d', $item['stop_time']),
'add_time' => $item['add_time'] 'add_time' => $item['add_time']
]; ];
$export[] = $one_data; $export[] = $one_data;
@ -336,13 +336,19 @@ class ExportServices extends BaseServices
$filename = $data['title'] . '批次列表_' . date('YmdHis', time()); $filename = $data['title'] . '批次列表_' . date('YmdHis', time());
$export = $fileKey = []; $export = $fileKey = [];
if (!empty($data['data'])) { if (!empty($data['data'])) {
$userIds = array_column($data['data']->toArray(), 'use_uid');
/** @var UserServices $userService */
$userService = app()->make(UserServices::class);
$userList = $userService->getColumn([['uid', 'in', $userIds]], 'nickname,phone,real_name', 'uid');
$i = 0; $i = 0;
foreach ($data['data'] as $item) { foreach ($data['data'] as $item) {
$one_data = [ $one_data = [
'card_number' => $item['card_number'], 'card_number' => $item['card_number'],
'card_password' => $item['card_password'], 'card_password' => $item['card_password'],
'user_name' => $item['user_name'], 'user_name' => $userList[$item['use_uid']]['real_name'] ?: $userList[$item['use_uid']]['nickname'],
'user_phone' => $item['user_phone'], 'user_phone' => $userList[$item['use_uid']] ? $userList[$item['use_uid']]['phone'] : "",
'use_time' => $item['use_time'], 'use_time' => $item['use_time'],
'use_uid' => $item['use_uid'] ? '已领取' : '未领取' 'use_uid' => $item['use_uid'] ? '已领取' : '未领取'
]; ];

View File

@ -26,7 +26,10 @@ class PayNotifyServices
/** /**
* 订单支付成功之后 * 订单支付成功之后
* @param string|null $order_id 订单id * @param string|null $order_id 订单id
* @param string|null $trade_no
* @param string $payType
* @return bool * @return bool
* @throws \Psr\SimpleCache\InvalidArgumentException
*/ */
public function wechatProduct(string $order_id = null, string $trade_no = null, string $payType = PayServices::WEIXIN_PAY) public function wechatProduct(string $order_id = null, string $trade_no = null, string $payType = PayServices::WEIXIN_PAY)
{ {

View File

@ -40,6 +40,9 @@ class PayServices
//好友代付 //好友代付
const FRIEND = 'friend'; const FRIEND = 'friend';
//银行转账
const BANK = 'bank';
//支付方式 //支付方式
const PAY_TYPE = [ const PAY_TYPE = [
PayServices::WEIXIN_PAY => '微信支付', PayServices::WEIXIN_PAY => '微信支付',
@ -47,7 +50,8 @@ class PayServices
PayServices::OFFLINE_PAY => '线下支付', PayServices::OFFLINE_PAY => '线下支付',
PayServices::ALIAPY_PAY => '支付宝', PayServices::ALIAPY_PAY => '支付宝',
PayServices::FRIEND => '好友代付', PayServices::FRIEND => '好友代付',
PayServices::ALLIN_PAY => '通联支付' PayServices::ALLIN_PAY => '通联支付',
PayServices::BANK => '银行转账',
]; ];
/** /**

View File

@ -107,17 +107,16 @@ class StoreCategoryServices extends BaseServices
/** /**
* 设置分类状态 * 设置分类状态
* @param $id * @param int $id
* @param $is_show * @param int $is_show
*/ */
public function setShow(int $id, int $is_show) public function setShow(int $id, int $is_show)
{ {
$res = $this->dao->update($id, ['is_show' => $is_show]); $res = $this->dao->update($id, ['is_show' => $is_show]);
$res = $res && $this->dao->update($id, ['is_show' => $is_show], 'pid'); $res = $res && $this->dao->update($id, ['is_show' => $is_show], 'pid');
$this->cacheDriver()->clear();
if (!$res) { if (!$res) {
throw new AdminException(100005); throw new AdminException(100005);
} else {
$this->cacheDriver()->clear();
} }
} }
@ -184,6 +183,10 @@ class StoreCategoryServices extends BaseServices
/** /**
* 保存新增数据 * 保存新增数据
* @param $data * @param $data
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function createData($data) public function createData($data)
{ {

View File

@ -92,6 +92,9 @@ class StoreProductCouponServices extends BaseServices
* @param int $uid * @param int $uid
* @param $orderId * @param $orderId
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function giveOrderProductCoupon(int $uid, $orderId) public function giveOrderProductCoupon(int $uid, $orderId)
{ {

View File

@ -63,7 +63,7 @@ class StoreProductReplyServices extends BaseServices
public function createForm(int $product_id) public function createForm(int $product_id)
{ {
if ($product_id == 0) { if ($product_id == 0) {
$field[] = Form::frameImage('image', '商品', Url::buildUrl('admin/store.StoreProduct/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']); $field[] = Form::frameImage('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
} else { } else {
$field[] = Form::hidden('product_id', $product_id); $field[] = Form::hidden('product_id', $product_id);
} }

View File

@ -654,7 +654,7 @@ class StoreProductServices extends BaseServices
//采集商品下载图片 //采集商品下载图片
if ($type == -1) { if ($type == -1) {
$s_image_down = $d_image_down = []; $s_image_down = [];
//下载商品轮播图 //下载商品轮播图
foreach ($slider_image as $s_image) { foreach ($slider_image as $s_image) {
if (sys_config('queue_open', 0) == 1) { if (sys_config('queue_open', 0) == 1) {
@ -671,8 +671,7 @@ class StoreProductServices extends BaseServices
if (sys_config('queue_open', 0) == 1) { if (sys_config('queue_open', 0) == 1) {
ProductCopyJob::dispatch('copyDescriptionImage', [$res->id, $description, $d_image, count($match[1])]); ProductCopyJob::dispatch('copyDescriptionImage', [$res->id, $description, $d_image, count($match[1])]);
} else { } else {
if (!is_int(strpos($d_image, 'http'))) $d_image = 'http://' . ltrim($d_image, '\//'); $d_img = app()->make(CopyTaobaoServices::class)->downloadCopyImage(!is_int(strpos($d_image, 'http')) ? 'http://' . ltrim($d_image, '\//') : $d_image);
$d_image_down[] = $d_img = app()->make(CopyTaobaoServices::class)->downloadCopyImage($d_image);
$description = str_replace($d_image, $d_img, $description); $description = str_replace($d_image, $d_img, $description);
} }
} }
@ -951,7 +950,7 @@ class StoreProductServices extends BaseServices
} }
$header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120]; $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
if ($type == 1) { if ($type == 1) {
$header[] = ['title' => '秒杀价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '秒杀价', 'type' => 1, 'key' => 'price', 'align' => 'center', 'minWidth' => 80];
$header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
$header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80]; $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
} elseif ($type == 2) { } elseif ($type == 2) {
@ -1260,7 +1259,7 @@ class StoreProductServices extends BaseServices
$page = 1; $page = 1;
$limit = $num; $limit = $num;
} }
$list = $this->dao->getSearchList($where, $page, $limit, ['id,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,unit_name,presale']); $list = $this->dao->getSearchList($where, $page, $limit, ['id,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,unit_name,presale,is_vip,vip_price']);
$list = $this->getActivityList($list); $list = $this->getActivityList($list);
return $list; return $list;
} }
@ -1816,7 +1815,7 @@ class StoreProductServices extends BaseServices
$memberCardService = app()->make(MemberCardServices::class); $memberCardService = app()->make(MemberCardServices::class);
$vipStatus = $memberCardService->isOpenMemberCard('vip_price'); $vipStatus = $memberCardService->isOpenMemberCard('vip_price');
foreach ($list as &$item) { foreach ($list as &$item) {
if (!($vipStatus && $item['is_vip'])) { if (!$this->vipIsOpen(!!$item['is_vip'], $vipStatus)) {
$item['vip_price'] = 0; $item['vip_price'] = 0;
} }
} }

View File

@ -104,6 +104,9 @@ class CapitalFlowServices extends BaseServices
* 获取资金流水 * 获取资金流水
* @param $where * @param $where
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getFlowList($where) public function getFlowList($where)
{ {

View File

@ -144,7 +144,7 @@ class SystemLangServices extends BaseServices
$field[] = Form::input('unique_auth', '权限标识', $formData['unique_auth'] ?? '')->placeholder('不填写则后台自动生成'); $field[] = Form::input('unique_auth', '权限标识', $formData['unique_auth'] ?? '')->placeholder('不填写则后台自动生成');
$params = $formData['params'] ?? ''; $params = $formData['params'] ?? '';
// $field[] = Form::input('params', '参数', is_array($params) ? '' : $params)->placeholder('举例:a/123/b/234'); // $field[] = Form::input('params', '参数', is_array($params) ? '' : $params)->placeholder('举例:a/123/b/234');
$field[] = Form::frameInput('icon', '图标', $this->url('admin/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('505px')->modal(['footer-hide' => true]); $field[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::number('sort', '排序', (int)($formData['sort'] ?? 0))->precision(0); $field[] = Form::number('sort', '排序', (int)($formData['sort'] ?? 0))->precision(0);
$field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 2, 'label' => '接口'], ['value' => 1, 'label' => '菜单(包含页面按钮)']]); $field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 2, 'label' => '接口'], ['value' => 1, 'label' => '菜单(包含页面按钮)']]);
$field[] = Form::radio('is_show', '状态', $formData['is_show'] ?? 1)->options([['value' => 0, 'label' => '关闭'], ['value' => 1, 'label' => '开启']]); $field[] = Form::radio('is_show', '状态', $formData['is_show'] ?? 1)->options([['value' => 0, 'label' => '关闭'], ['value' => 1, 'label' => '开启']]);

View File

@ -149,7 +149,7 @@ class SystemMenusServices extends BaseServices
$field[] = Form::input('unique_auth', '权限标识', $formData['unique_auth'] ?? '')->placeholder('不填写则后台自动生成'); $field[] = Form::input('unique_auth', '权限标识', $formData['unique_auth'] ?? '')->placeholder('不填写则后台自动生成');
$params = $formData['params'] ?? ''; $params = $formData['params'] ?? '';
// $field[] = Form::input('params', '参数', is_array($params) ? '' : $params)->placeholder('举例:a/123/b/234'); // $field[] = Form::input('params', '参数', is_array($params) ? '' : $params)->placeholder('举例:a/123/b/234');
$field[] = Form::frameInput('icon', '图标', $this->url('admin/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('505px')->modal(['footer-hide' => true]); $field[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::number('sort', '排序', (int)($formData['sort'] ?? 0))->precision(0); $field[] = Form::number('sort', '排序', (int)($formData['sort'] ?? 0))->precision(0);
$field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 2, 'label' => '接口'], ['value' => 1, 'label' => '菜单(包含页面按钮)']]); $field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 2, 'label' => '接口'], ['value' => 1, 'label' => '菜单(包含页面按钮)']]);
$field[] = Form::radio('is_show', '状态', $formData['is_show'] ?? 1)->options([['value' => 0, 'label' => '关闭'], ['value' => 1, 'label' => '开启']]); $field[] = Form::radio('is_show', '状态', $formData['is_show'] ?? 1)->options([['value' => 0, 'label' => '关闭'], ['value' => 1, 'label' => '开启']]);

View File

@ -102,7 +102,7 @@ class SystemConfigTabServices extends BaseServices
$form[] = Form::select('pid', '父级分类', isset($formData['pid']) ? (string)$formData['pid'] : '')->setOptions($this->getSelectForm())->filterable(true); $form[] = Form::select('pid', '父级分类', isset($formData['pid']) ? (string)$formData['pid'] : '')->setOptions($this->getSelectForm())->filterable(true);
$form[] = Form::input('title', '分类名称', $formData['title'] ?? ''); $form[] = Form::input('title', '分类名称', $formData['title'] ?? '');
$form[] = Form::input('eng_title', '分类字段英文', $formData['eng_title'] ?? ''); $form[] = Form::input('eng_title', '分类字段英文', $formData['eng_title'] ?? '');
$form[] = Form::frameInput('icon', '图标', $this->url('admin/widget.widgets/icon', ['fodder' => 'icon'], true), $formData['icon'] ?? '')->icon('ios-ionic')->height('505px')->modal(['footer-hide' => true]); $form[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon'], true), $formData['icon'] ?? '')->icon('ios-ionic')->height('505px')->modal(['footer-hide' => true]);
$form[] = Form::radio('type', '类型', $formData['type'] ?? 0)->options([ $form[] = Form::radio('type', '类型', $formData['type'] ?? 0)->options([
['value' => 0, 'label' => '系统'], ['value' => 0, 'label' => '系统'],
['value' => 3, 'label' => '其它'] ['value' => 3, 'label' => '其它']

View File

@ -103,7 +103,7 @@ class SystemStoreStaffServices extends BaseServices
if ($formData) { if ($formData) {
$field[] = $this->builder->frameImage('image', '更换头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image'),true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]); $field[] = $this->builder->frameImage('image', '更换头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image'),true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
} else { } else {
$field[] = $this->builder->frameImage('image', '商城用户', $this->url('admin/system.User/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']); $field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.User/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
} }
$field[] = $this->builder->hidden('uid', $formData['uid'] ?? 0); $field[] = $this->builder->hidden('uid', $formData['uid'] ?? 0);
$field[] = $this->builder->hidden('avatar', $formData['avatar'] ?? ''); $field[] = $this->builder->hidden('avatar', $formData['avatar'] ?? '');

View File

@ -82,6 +82,9 @@ class UserAddressServices extends BaseServices
* @param int $uid * @param int $uid
* @param string $field * @param string $field
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getUserDefaultAddress(int $uid, string $field = '*') public function getUserDefaultAddress(int $uid, string $field = '*')
{ {

View File

@ -187,6 +187,7 @@ class UserBrokerageServices extends BaseServices
* @param array|string[] $type * @param array|string[] $type
* @param string $time * @param string $time
* @return float * @return float
* @throws \ReflectionException
*/ */
public function getUserBrokerageSum(int $uid, array $type = ['one_brokerage', 'two_brokerage', 'brokerage_user'], $time = '') public function getUserBrokerageSum(int $uid, array $type = ['one_brokerage', 'two_brokerage', 'brokerage_user'], $time = '')
{ {
@ -271,7 +272,7 @@ class UserBrokerageServices extends BaseServices
*/ */
public function brokerageRankList(string $time = 'week') public function brokerageRankList(string $time = 'week')
{ {
$where = []; $where = ['pm' => 1];
if ($time) { if ($time) {
$where['time'] = $time; $where['time'] = $time;
} }
@ -296,10 +297,14 @@ class UserBrokerageServices extends BaseServices
* 获取用户排名 * 获取用户排名
* @param int $uid * @param int $uid
* @param string $time * @param string $time
* @return false|int|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getUserBrokerageRank(int $uid, string $time = 'week') public function getUserBrokerageRank(int $uid, string $time = 'week')
{ {
$where = []; $where = ['pm' => 1];
if ($time) { if ($time) {
$where['time'] = $time; $where['time'] = $time;
} }
@ -327,6 +332,9 @@ class UserBrokerageServices extends BaseServices
* 推广数据 昨天的佣金 累计提现金额 当前佣金 * 推广数据 昨天的佣金 累计提现金额 当前佣金
* @param int $uid * @param int $uid
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function commission(int $uid) public function commission(int $uid)
{ {
@ -354,6 +362,7 @@ class UserBrokerageServices extends BaseServices
* @param array $where * @param array $where
* @param int $time * @param int $time
* @return mixed * @return mixed
* @throws \ReflectionException
*/ */
public function getUsersBokerageSum(array $where, $time = 0) public function getUsersBokerageSum(array $where, $time = 0)
{ {
@ -372,6 +381,10 @@ class UserBrokerageServices extends BaseServices
* @param $uid * @param $uid
* @param $type * @param $type
* @return array * @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getBrokerageList($uid, $type) public function getBrokerageList($uid, $type)
{ {

View File

@ -32,6 +32,7 @@ class UserCancelServices extends BaseServices
/** @var WechatUserServices $wechatUserServices */ /** @var WechatUserServices $wechatUserServices */
$wechatUserServices = app()->make(WechatUserServices::class); $wechatUserServices = app()->make(WechatUserServices::class);
$userServices->update($uid, ['is_del' => 1]); $userServices->update($uid, ['is_del' => 1]);
$userServices->update(['spread_uid' => $uid], ['spread_uid' => 0, 'spread_time' => 0]);
$wechatUserServices->update(['uid' => $uid], ['is_del' => 1]); $wechatUserServices->update(['uid' => $uid], ['is_del' => 1]);
} }

View File

@ -148,11 +148,12 @@ class UserExtractServices extends BaseServices
/** /**
* 通过提现申请 * 通过提现申请
* @param $id * @param int $id
* @param $userExtract
* @return bool * @return bool
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function changeSuccess(int $id, $userExtract) public function changeSuccess(int $id, $userExtract)
{ {
@ -164,11 +165,7 @@ class UserExtractServices extends BaseServices
$userType = $userServices->value(['uid' => $userExtract['uid']], 'user_type'); $userType = $userServices->value(['uid' => $userExtract['uid']], 'user_type');
$nickname = $userServices->value(['uid' => $userExtract['uid']], 'nickname'); $nickname = $userServices->value(['uid' => $userExtract['uid']], 'nickname');
$phone = $userServices->value(['uid' => $userExtract['uid']], 'phone'); $phone = $userServices->value(['uid' => $userExtract['uid']], 'phone');
event('NoticeListener', [['uid' => $userExtract['uid'], 'userType' => strtolower($userType), 'extractNumber' => $extractNumber, 'nickname' => $nickname], 'user_extract']);
if (!$this->dao->update($id, ['status' => 1])) {
throw new AdminException(100007);
}
switch ($userExtract['extract_type']) { switch ($userExtract['extract_type']) {
case 'bank': case 'bank':
$order_id = $userExtract['bank_code']; $order_id = $userExtract['bank_code'];
@ -246,6 +243,12 @@ class UserExtractServices extends BaseServices
'nickname' => $insertData['nickname'], 'nickname' => $insertData['nickname'],
'phone' => $insertData['phone'] 'phone' => $insertData['phone']
], 'extract'); ], 'extract');
if (!$this->dao->update($id, ['status' => 1])) {
throw new AdminException(100007);
}
event('NoticeListener', [['uid' => $userExtract['uid'], 'userType' => strtolower($userType), 'extractNumber' => $extractNumber, 'nickname' => $nickname], 'user_extract']);
return true; return true;
} }
@ -339,8 +342,10 @@ class UserExtractServices extends BaseServices
/** /**
* 通过 * 通过
* @param $id * @param int $id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function adopt(int $id) public function adopt(int $id)
{ {

View File

@ -47,8 +47,10 @@ class UserLabelRelationServices extends BaseServices
/** /**
* 用户设置标签 * 用户设置标签
* @param int $uid * @param $uids
* @param array $labels * @param array $labels
* @return bool
* @throws \Exception
*/ */
public function setUserLable($uids, array $labels) public function setUserLable($uids, array $labels)
{ {

View File

@ -40,6 +40,9 @@ class UserLabelServices extends BaseServices
* 获取某一本标签 * 获取某一本标签
* @param $id * @param $id
* @return array|\think\Model|null * @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getLable($id) public function getLable($id)
{ {
@ -110,6 +113,9 @@ class UserLabelServices extends BaseServices
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function save(int $id, array $data) public function save(int $id, array $data)
{ {
@ -144,8 +150,11 @@ class UserLabelServices extends BaseServices
/** /**
* 删除 * 删除
* @param $id * @param int $id
* @throws \Exception * @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function delLabel(int $id) public function delLabel(int $id)
{ {

View File

@ -104,11 +104,8 @@ class UserRechargeServices extends BaseServices
foreach ($list as &$item) { foreach ($list as &$item) {
switch ($item['recharge_type']) { switch ($item['recharge_type']) {
case 'routine':
$item['_recharge_type'] = '小程序充值';
break;
case PayServices::WEIXIN_PAY: case PayServices::WEIXIN_PAY:
$item['_recharge_type'] = '公众号充值'; $item['_recharge_type'] = '微信充值';
break; break;
case 'system': case 'system':
$item['_recharge_type'] = '系统充值'; $item['_recharge_type'] = '系统充值';
@ -138,8 +135,8 @@ class UserRechargeServices extends BaseServices
$data = []; $data = [];
$data['sumPrice'] = $this->getRechargeSum($where, 'price'); $data['sumPrice'] = $this->getRechargeSum($where, 'price');
$data['sumRefundPrice'] = $this->getRechargeSum($where, 'refund_price'); $data['sumRefundPrice'] = $this->getRechargeSum($where, 'refund_price');
$where['recharge_type'] = 'routine'; $where['recharge_type'] = 'alipay';
$data['sumRoutinePrice'] = $this->getRechargeSum($where, 'price'); $data['sumAlipayPrice'] = $this->getRechargeSum($where, 'price');
$where['recharge_type'] = 'weixin'; $where['recharge_type'] = 'weixin';
$data['sumWeixinPrice'] = $this->getRechargeSum($where, 'price'); $data['sumWeixinPrice'] = $this->getRechargeSum($where, 'price');
return [ return [
@ -158,14 +155,14 @@ class UserRechargeServices extends BaseServices
'col' => 6, 'col' => 6,
], ],
[ [
'name' => '小程序充值金额', 'name' => '支付宝充值金额',
'field' => '元', 'field' => '元',
'count' => $data['sumRoutinePrice'], 'count' => $data['sumAlipayPrice'],
'className' => 'logo-bitcoin', 'className' => 'logo-bitcoin',
'col' => 6, 'col' => 6,
], ],
[ [
'name' => '公众号充值金额', 'name' => '微信充值金额',
'field' => '元', 'field' => '元',
'count' => $data['sumWeixinPrice'], 'count' => $data['sumWeixinPrice'],
'className' => 'ios-bicycle', 'className' => 'ios-bicycle',
@ -174,9 +171,14 @@ class UserRechargeServices extends BaseServices
]; ];
} }
/**退款表单 /**
* @param $id * 退款表单
* @return mixed|void * @param int $id
* @return array
* @throws \FormBuilder\Exception\FormBuilderException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/24
*/ */
public function refund_edit(int $id) public function refund_edit(int $id)
{ {
@ -196,15 +198,17 @@ class UserRechargeServices extends BaseServices
$f = array(); $f = array();
$f[] = Form::input('order_id', '退款单号', $UserRecharge->getData('order_id'))->disabled(true); $f[] = Form::input('order_id', '退款单号', $UserRecharge->getData('order_id'))->disabled(true);
$f[] = Form::radio('refund_price', '状态', 1)->options([['label' => '本金(扣赠送余额)', 'value' => 1], ['label' => '仅本金', 'value' => 0]]); $f[] = Form::radio('refund_price', '状态', 1)->options([['label' => '本金(扣赠送余额)', 'value' => 1], ['label' => '仅本金', 'value' => 0]]);
// $f[] = Form::number('refund_price', '退款金额', (float)$UserRecharge->getData('price'))->precision(2)->min(0)->max($UserRecharge->getData('price'));
return create_form('编辑', $f, Url::buildUrl('/finance/recharge/' . $id), 'PUT'); return create_form('编辑', $f, Url::buildUrl('/finance/recharge/' . $id), 'PUT');
} }
/** /**
* 退款操作 * 退款操作
* @param int $id * @param int $id
* @param $refund_price * @param string $refund_price
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function refund_update(int $id, string $refund_price) public function refund_update(int $id, string $refund_price)
{ {
@ -314,6 +318,9 @@ class UserRechargeServices extends BaseServices
* @param int $uid * @param int $uid
* @param $price * @param $price
* @return bool * @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function importNowMoney(int $uid, $price) public function importNowMoney(int $uid, $price)
{ {
@ -340,7 +347,7 @@ class UserRechargeServices extends BaseServices
//写入充值记录 //写入充值记录
$rechargeInfo = [ $rechargeInfo = [
'uid' => $uid, 'uid' => $uid,
'order_id' => $this->getOrderId(), 'order_id' => app()->make(StoreOrderCreateServices::class)->getNewOrderId('cz'),
'recharge_type' => 'balance', 'recharge_type' => 'balance',
'price' => $price, 'price' => $price,
'give_price' => 0, 'give_price' => 0,
@ -381,7 +388,15 @@ class UserRechargeServices extends BaseServices
/** /**
* 申请充值 * 申请充值
* @param int $uid * @param int $uid
* @param $price
* @param $recharId
* @param $type
* @param $from
* @param bool $renten
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function recharge(int $uid, $price, $recharId, $type, $from, bool $renten = false) public function recharge(int $uid, $price, $recharId, $type, $from, bool $renten = false)
{ {
@ -437,8 +452,13 @@ class UserRechargeServices extends BaseServices
} }
/** /**
* //TODO用户充值成功后 * 用户充值成功后
* @param $orderId * @param $orderId
* @param array $other
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function rechargeSuccess($orderId, array $other = []) public function rechargeSuccess($orderId, array $other = [])
{ {
@ -475,8 +495,12 @@ class UserRechargeServices extends BaseServices
return true; return true;
} }
/**根据查询用户充值金额 /**
* 根据查询用户充值金额
* @param array $where * @param array $where
* @param string $rechargeSumField
* @param string $selectType
* @param string $group
* @return float|int * @return float|int
*/ */
public function getRechargeMoneyByWhere(array $where, string $rechargeSumField, string $selectType, string $group = "") public function getRechargeMoneyByWhere(array $where, string $rechargeSumField, string $selectType, string $group = "")

View File

@ -117,6 +117,7 @@ class UserServices extends BaseServices
* @param int $spreadUid * @param int $spreadUid
* @param string $userType * @param string $userType
* @return User|\think\Model * @return User|\think\Model
* @throws Exception
*/ */
public function setUserInfo($user, int $spreadUid = 0, string $userType = 'wechat') public function setUserInfo($user, int $spreadUid = 0, string $userType = 'wechat')
{ {
@ -992,9 +993,13 @@ class UserServices extends BaseServices
/** /**
* 执行赠送会员等级 * 执行赠送会员等级
* @param int $uid * @param int $id
* @param int $level_id
* @return mixed * @return mixed
* */ * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function saveGiveLevel(int $id, int $level_id) public function saveGiveLevel(int $id, int $level_id)
{ {
if (!$this->getUserInfo($id)) { if (!$this->getUserInfo($id)) {
@ -1039,19 +1044,26 @@ class UserServices extends BaseServices
$field[] = Form::input('time_diff', '到期时间', $timeDiff)->style(['width' => '200px'])->readonly(true); $field[] = Form::input('time_diff', '到期时间', $timeDiff)->style(['width' => '200px'])->readonly(true);
if ($userInfo['is_ever_level'] == 0) { if ($userInfo['is_ever_level'] == 0) {
$field[] = Form::input('day_diff', '剩余天数', $dayDiff)->style(['width' => '200px'])->readonly(true); $field[] = Form::input('day_diff', '剩余天数', $dayDiff)->style(['width' => '200px'])->readonly(true);
$field[] = Form::number('days', '增加时长(天)')->precision(0)->style(['width' => '200px'])->required();
} }
$field[] = Form::number('days', '增加时长(天)')->precision(0)->style(['width' => '200px'])->required();
return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT'); return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT');
} }
/** /**
* 执行赠送付费会员时长 * 执行赠送付费会员时长
* @param int $uid * @param int $id
* @param int $days
* @return mixed * @return mixed
* */ * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function saveGiveLevelTime(int $id, int $days) public function saveGiveLevelTime(int $id, int $days)
{ {
$userInfo = $this->getUserInfo($id); $userInfo = $this->getUserInfo($id);
if ($userInfo->is_ever_level == 1) {
return true;
}
if (!$userInfo) { if (!$userInfo) {
throw new AdminException(400214); throw new AdminException(400214);
} }
@ -1117,7 +1129,12 @@ class UserServices extends BaseServices
/** /**
* 用户详细信息 * 用户详细信息
* @param $uid * @param int $uid
* @param array $userIfno
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getUserDetailed(int $uid, $userIfno = []) public function getUserDetailed(int $uid, $userIfno = [])
{ {
@ -1214,6 +1231,9 @@ class UserServices extends BaseServices
* 用户详情 * 用户详情
* @param int $uid * @param int $uid
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function read(int $uid) public function read(int $uid)
{ {
@ -1222,6 +1242,20 @@ class UserServices extends BaseServices
throw new AdminException(100026); throw new AdminException(100026);
} }
$userInfo['avatar'] = strpos($userInfo['avatar'], 'http') === false ? (sys_config('site_url') . $userInfo['avatar']) : $userInfo['avatar']; $userInfo['avatar'] = strpos($userInfo['avatar'], 'http') === false ? (sys_config('site_url') . $userInfo['avatar']) : $userInfo['avatar'];
$userInfo['overdue_time'] = date('Y-m-d H:i:s', $userInfo['overdue_time']);
$userInfo['birthday'] = $userInfo['birthday'] < 0 ? 0 : $userInfo['birthday'];
if ($userInfo['addres'] == '') {
$defaultAddressInfo = app()->make(UserAddressServices::class)->getUserDefaultAddress($uid);
if ($defaultAddressInfo) {
$userInfo['addres'] = $defaultAddressInfo['province'] . $defaultAddressInfo['city'] . $defaultAddressInfo['district'] . $defaultAddressInfo['detail'];
} else {
$userInfo['addres'] = '';
}
}
$userInfo['vip_name'] = app()->make(SystemUserLevelServices::class)->value(['grade' => $userInfo['level']], 'name');
$userInfo['group_name'] = app()->make(UserGroupServices::class)->value(['id' => $userInfo['group_id']], 'group_name');
$userInfo['spread_uid_nickname'] = $this->dao->value(['uid' => $userInfo['spread_uid']], 'nickname') . '' . $userInfo['spread_uid'] . '';
$userInfo['label_list'] = implode(',', array_column(app()->make(UserLabelRelationServices::class)->getUserLabelList([$uid]), 'label_name'));
return [ return [
'uid' => $uid, 'uid' => $uid,
'userinfo' => $this->getUserDetailed($uid, $userInfo), 'userinfo' => $this->getUserDetailed($uid, $userInfo),

View File

@ -32,6 +32,10 @@ class MemberCardBatchServices extends BaseServices
/** /**
* 获取会员卡批次列表 * 获取会员卡批次列表
* @param array $where * @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function getList(array $where = []) public function getList(array $where = [])
{ {

View File

@ -49,16 +49,15 @@ class MemberCardServices extends BaseServices
} }
unset($where['is_use']); unset($where['is_use']);
$list = $this->dao->getSearchList($where, $page, $limit); $list = $this->dao->getSearchList($where, $page, $limit);
if ($list) { $userIds = array_column($list->toArray(), 'use_uid');
foreach ($list as $k => $v) { $userList = $userService->getColumn([['uid', 'in', $userIds]], 'nickname,phone,real_name', 'uid');
if ($v['use_uid']) { foreach ($list as $k => $v) {
$user_info = $userService->getUserInfo($v['use_uid'], ['nickname', 'phone', 'real_name']); if ($v['use_uid']) {
$list[$k]['username'] = $user_info['real_name'] ? $user_info['real_name'] : $user_info['nickname']; $list[$k]['username'] = $userList[$v['use_uid']]['real_name'] ?: $userList[$v['use_uid']]['nickname'];
$list[$k]['phone'] = $user_info ? $user_info['phone'] : ""; $list[$k]['phone'] = $userList[$v['use_uid']] ? $userList[$v['use_uid']]['phone'] : "";
}
$list[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
$list[$k]['use_time'] = $v['use_time'] != 0 ? date('Y-m-d H:i:s', $v['use_time']) : "未使用";
} }
$list[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
$list[$k]['use_time'] = $v['use_time'] != 0 ? date('Y-m-d H:i:s', $v['use_time']) : "未使用";
} }
$count = $this->dao->count($where); $count = $this->dao->count($where);
return compact('list', 'count'); return compact('list', 'count');

View File

@ -69,6 +69,8 @@ class WechatQrcodeCateServices extends BaseServices
*/ */
public function delCate($id = 0) public function delCate($id = 0)
{ {
$count = app()->make(WechatQrcodeServices::class)->count(['cate_id' => $id]);
if ($count) throw new AdminException(400454);
if (!$id) throw new AdminException(100100); if (!$id) throw new AdminException(100100);
$res = $this->dao->update($id, ['is_del' => 1]); $res = $this->dao->update($id, ['is_del' => 1]);
if (!$res) throw new AdminException(100008); if (!$res) throw new AdminException(100008);

View File

@ -219,7 +219,7 @@ class WechatQrcodeServices extends BaseServices
* @param int $isFollow * @param int $isFollow
* @return mixed * @return mixed
*/ */
public function wechatQrcodeRecord($qrcodeInfo, $userInfo, $spreadInfo, $isFollow = 0) public function wechatQrcodeRecord($qrcodeInfo, $userInfo, $spreadInfo, $isFollow = 1)
{ {
$response = $this->transaction(function () use ($qrcodeInfo, $userInfo, $spreadInfo, $isFollow) { $response = $this->transaction(function () use ($qrcodeInfo, $userInfo, $spreadInfo, $isFollow) {

View File

@ -13,14 +13,12 @@ namespace crmeb\services;
use Alipay\EasySDK\Payment\Wap\Models\AlipayTradeWapPayResponse; use Alipay\EasySDK\Payment\Wap\Models\AlipayTradeWapPayResponse;
use app\services\pay\PayServices; use app\services\pay\PayServices;
use crmeb\utils\Hook;
use think\facade\Event; use think\facade\Event;
use think\facade\Log; use think\facade\Log;
use think\facade\Route as Url; use think\facade\Route as Url;
use Alipay\EasySDK\Kernel\Config; use Alipay\EasySDK\Kernel\Config;
use Alipay\EasySDK\Kernel\Factory; use Alipay\EasySDK\Kernel\Factory;
use crmeb\exceptions\PayException; use crmeb\exceptions\PayException;
use app\services\pay\PayNotifyServices;
use Alipay\EasySDK\Kernel\Util\ResponseChecker; use Alipay\EasySDK\Kernel\Util\ResponseChecker;
/** /**

View File

@ -12,12 +12,10 @@
namespace crmeb\services\app; namespace crmeb\services\app;
use app\services\message\wechat\MessageServices; use app\services\message\wechat\MessageServices;
use app\services\order\StoreOrderServices;
use app\services\pay\PayServices; use app\services\pay\PayServices;
use app\services\wechat\WechatMessageServices; use app\services\wechat\WechatMessageServices;
use app\services\wechat\WechatReplyServices; use app\services\wechat\WechatReplyServices;
use crmeb\exceptions\AdminException; use crmeb\exceptions\AdminException;
use app\services\pay\PayNotifyServices;
use crmeb\exceptions\ApiException; use crmeb\exceptions\ApiException;
use crmeb\services\easywechat\Application; use crmeb\services\easywechat\Application;
use EasyWeChat\Message\Article; use EasyWeChat\Message\Article;
@ -33,7 +31,6 @@ use Symfony\Component\HttpFoundation\Request;
use think\facade\Event; use think\facade\Event;
use think\facade\Log; use think\facade\Log;
use think\Response; use think\Response;
use crmeb\utils\Hook;
use think\facade\Cache; use think\facade\Cache;
use crmeb\services\SystemConfigService; use crmeb\services\SystemConfigService;
@ -395,7 +392,7 @@ class WechatService
if ($result->return_code == 'SUCCESS' && $result->result_code != 'FAIL') { if ($result->return_code == 'SUCCESS' && $result->result_code != 'FAIL') {
return true; return true;
} else { } else {
throw new ApiException(410089); throw new ApiException($result->err_code_des ?? 400658);
} }
} }

View File

@ -13,14 +13,11 @@
namespace crmeb\services\pay\storage; namespace crmeb\services\pay\storage;
use app\services\pay\PayNotifyServices;
use app\services\pay\PayServices; use app\services\pay\PayServices;
use crmeb\exceptions\PayException; use crmeb\exceptions\PayException;
use crmeb\services\pay\BasePay; use crmeb\services\pay\BasePay;
use crmeb\services\pay\PayInterface; use crmeb\services\pay\PayInterface;
use crmeb\services\pay\extend\allinpay\AllinPay as AllinPayService; use crmeb\services\pay\extend\allinpay\AllinPay as AllinPayService;
use crmeb\utils\Hook;
use EasyWeChat\Payment\Order; use EasyWeChat\Payment\Order;
use think\facade\Event; use think\facade\Event;

View File

@ -13,18 +13,14 @@
namespace crmeb\services\pay\storage; namespace crmeb\services\pay\storage;
use app\services\pay\PayNotifyServices;
use app\services\pay\PayServices; use app\services\pay\PayServices;
use app\services\wechat\WechatMessageServices;
use crmeb\exceptions\PayException; use crmeb\exceptions\PayException;
use crmeb\services\app\MiniProgramService; use crmeb\services\app\MiniProgramService;
use crmeb\services\easywechat\Application; use crmeb\services\easywechat\Application;
use crmeb\services\pay\BasePay; use crmeb\services\pay\BasePay;
use crmeb\services\pay\PayInterface; use crmeb\services\pay\PayInterface;
use crmeb\utils\Hook;
use EasyWeChat\Payment\Order; use EasyWeChat\Payment\Order;
use think\facade\Event; use think\facade\Event;
use think\facade\Log;
/** /**
* Class 微信支付v3 * Class 微信支付v3
@ -150,7 +146,7 @@ class V3WechatPay extends BasePay implements PayInterface
*/ */
public function merchantPay(string $openid, string $orderId, string $amount, array $options = []) public function merchantPay(string $openid, string $orderId, string $amount, array $options = [])
{ {
$res = $this->instance->v3pay->setType($options['type'])->batches( return $this->instance->v3pay->setType($options['type'])->batches(
$orderId, $orderId,
$amount, $amount,
$options['batch_name'], $options['batch_name'],
@ -164,8 +160,6 @@ class V3WechatPay extends BasePay implements PayInterface
] ]
] ]
); );
return $res;
} }
/** /**

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Some files were not shown because too many files have changed in this diff Show More