mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev
This commit is contained in:
commit
d990f35db0
@ -151,7 +151,7 @@ class StoreSeckill extends AuthController
|
||||
public function seckillPeople($id)
|
||||
{
|
||||
[$keyword] = $this->request->getMore([
|
||||
['keyword', '']
|
||||
['real_name', '', '', 'keyword']
|
||||
], true);
|
||||
return app('json')->success($this->services->seckillPeople($id, $keyword));
|
||||
}
|
||||
|
||||
@ -85,6 +85,9 @@ class LuckLottery extends AuthController
|
||||
/**
|
||||
* 添加抽奖
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
|
||||
@ -34,8 +34,10 @@ class SystemNotification extends AuthController
|
||||
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@ -47,8 +49,10 @@ class SystemNotification extends AuthController
|
||||
|
||||
/**
|
||||
* 显示编辑
|
||||
*
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
|
||||
@ -102,7 +102,11 @@ class LuckLotteryController
|
||||
/**
|
||||
* 领取奖品
|
||||
* @param Request $request
|
||||
* @param LuckLotteryRecordServices $lotteryRecordServices
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
|
||||
{
|
||||
@ -125,6 +129,9 @@ class LuckLotteryController
|
||||
* @param Request $request
|
||||
* @param LuckLotteryRecordServices $lotteryRecordServices
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
|
||||
{
|
||||
|
||||
@ -894,7 +894,7 @@ class StoreOrderDao extends BaseDao
|
||||
*/
|
||||
public function seckillPeople($id, $keyword, $page = 0, $limit = 0)
|
||||
{
|
||||
return $this->getModel()
|
||||
return $this->getModel()->where('paid', 1)->whereIn('refund_type', [0, 3])
|
||||
->when($id != 0, function ($query) use ($id) {
|
||||
$query->where('seckill_id', $id);
|
||||
})->when($keyword != '', function ($query) use ($keyword) {
|
||||
@ -902,6 +902,7 @@ class StoreOrderDao extends BaseDao
|
||||
})->where('paid', 1)->field([
|
||||
'real_name',
|
||||
'uid',
|
||||
'user_phone',
|
||||
'SUM(total_num) as goods_num',
|
||||
'COUNT(id) as order_num',
|
||||
'SUM(pay_price) as total_price',
|
||||
|
||||
@ -70,6 +70,7 @@ class NoticeListener implements ListenerInterface
|
||||
case 'bind_spread_uid':
|
||||
if (isset($data['spreadUid']) && $data['spreadUid']) {
|
||||
$name = $data['nickname'] ?? '';
|
||||
crmebLog('绑定推广关系');
|
||||
//站内信
|
||||
$SystemMsg->sendMsg($data['spreadUid'], ['nickname' => $name]);
|
||||
//模板消息公众号模版消息
|
||||
@ -354,7 +355,7 @@ class NoticeListener implements ListenerInterface
|
||||
$link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
|
||||
$WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
|
||||
//企业微信通知
|
||||
EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
|
||||
$EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
|
||||
break;
|
||||
//确认收货给客服
|
||||
case 'send_admin_confirm_take_over':
|
||||
@ -371,7 +372,7 @@ class NoticeListener implements ListenerInterface
|
||||
$link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
|
||||
$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;
|
||||
//申请退款给客服发消息
|
||||
case 'send_order_apply_refund':
|
||||
@ -381,7 +382,7 @@ class NoticeListener implements ListenerInterface
|
||||
//短信
|
||||
$NoticeSms->sendAdminRefund($order);
|
||||
//企业微信通知
|
||||
EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
|
||||
$EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
|
||||
//公众号
|
||||
$storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
|
||||
$title = '亲,您有个退款订单待处理!';
|
||||
@ -394,7 +395,7 @@ class NoticeListener implements ListenerInterface
|
||||
//站内信
|
||||
$SystemMsg->kefuSystemSend($data);
|
||||
//企业微信通知
|
||||
EnterpriseWechatJob::dispatch($data);
|
||||
$EnterpriseWechat->weComSend($data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -365,30 +365,13 @@ class StoreCouponIssueServices extends BaseServices
|
||||
$issueCouponInfo = $this->dao->getInfo((int)$id);
|
||||
$uid = $user->uid;
|
||||
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 */
|
||||
$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 */
|
||||
$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) {
|
||||
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
|
||||
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "get");
|
||||
if ($issueCouponInfo['total_count'] > 0) {
|
||||
$issueCouponInfo['remain_count'] -= 1;
|
||||
$issueCouponInfo->save();
|
||||
}
|
||||
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
|
||||
});
|
||||
}
|
||||
|
||||
@ -429,6 +412,9 @@ class StoreCouponIssueServices extends BaseServices
|
||||
* @param int $uid
|
||||
* @param $types
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getUserCouponList(int $uid, $types)
|
||||
{
|
||||
@ -512,6 +498,9 @@ class StoreCouponIssueServices extends BaseServices
|
||||
* 获取单个优惠券类型
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getOne(array $where)
|
||||
{
|
||||
@ -538,6 +527,8 @@ class StoreCouponIssueServices extends BaseServices
|
||||
/**
|
||||
* 给会员发放优惠券
|
||||
* @param $uid
|
||||
* @param int $couponId
|
||||
* @return bool
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
|
||||
@ -46,6 +46,9 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
* 获取抽奖记录列表
|
||||
* @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)
|
||||
{
|
||||
@ -108,7 +111,11 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
* 写入中奖纪录
|
||||
* @param int $uid
|
||||
* @param array $prize
|
||||
* @param array $userInfo
|
||||
* @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 = [])
|
||||
{
|
||||
@ -218,13 +225,6 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
throw new ApiException(410053);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//TODO 未完善
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
$this->dao->update($lottery_record_id, $data, 'id');
|
||||
});
|
||||
@ -272,7 +272,11 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
/**
|
||||
* 获取中奖记录
|
||||
* @param int $uid
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getRecord(int $uid, $where = [])
|
||||
{
|
||||
|
||||
@ -154,7 +154,6 @@ class LuckLotteryServices extends BaseServices
|
||||
}
|
||||
$lottery = $lottery->toArray();
|
||||
if (isset($lottery['prize']) && $lottery['prize']) {
|
||||
$products = $coupons = [];
|
||||
$product_ids = array_unique(array_column($lottery['prize'], 'product_id'));
|
||||
$coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id'));
|
||||
/** @var StoreProductServices $productServices */
|
||||
@ -173,6 +172,9 @@ class LuckLotteryServices extends BaseServices
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($lottery['user_level'] as &$item) {
|
||||
$item = (int)$item;
|
||||
}
|
||||
/** @var UserLabelServices $userLabelServices */
|
||||
$userLabelServices = app()->make(UserLabelServices::class);
|
||||
$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
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add(array $data)
|
||||
{
|
||||
@ -400,6 +405,11 @@ class LuckLotteryServices extends BaseServices
|
||||
* 抽奖
|
||||
* @param int $uid
|
||||
* @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)
|
||||
{
|
||||
|
||||
@ -362,7 +362,7 @@ class StoreSeckillServices extends BaseServices
|
||||
$header[] = ['title' => $item['value'], 'key' => 'value' . ($key + 1), 'align' => 'center', 'minWidth' => 80];
|
||||
}
|
||||
$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' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
|
||||
$header[] = ['title' => '库存', 'key' => 'stock', 'align' => 'center', 'minWidth' => 80];
|
||||
@ -732,7 +732,7 @@ class StoreSeckillServices extends BaseServices
|
||||
$orderServices = app()->make(StoreOrderServices::class);
|
||||
$pay_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['paid', '=', 1]], 'uid', false);
|
||||
$order_count = $orderServices->getDistinctCount([['seckill_id', '=', $id]], '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);
|
||||
$pay_rate = $seckillInfo['quota'] . '/' . $seckillInfo['quota_show'];
|
||||
return compact('pay_count', 'order_count', 'all_price', 'pay_rate');
|
||||
|
||||
@ -950,7 +950,7 @@ class StoreProductServices extends BaseServices
|
||||
}
|
||||
$header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
|
||||
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' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
|
||||
} elseif ($type == 2) {
|
||||
|
||||
@ -1246,7 +1246,11 @@ class UserServices extends BaseServices
|
||||
$userInfo['birthday'] = $userInfo['birthday'] < 0 ? 0 : $userInfo['birthday'];
|
||||
if ($userInfo['addres'] == '') {
|
||||
$defaultAddressInfo = app()->make(UserAddressServices::class)->getUserDefaultAddress($uid);
|
||||
$userInfo['addres'] = $defaultAddressInfo['province'] . $defaultAddressInfo['city'] . $defaultAddressInfo['district'] . $defaultAddressInfo['detail'];
|
||||
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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user