Merge branch 'master' of http://116.62.159.90:3000/dlh/dlh_test_server
This commit is contained in:
commit
f461f04085
@ -81,28 +81,28 @@
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">活动开启</lable>
|
||||
<div class="info">
|
||||
<input type="checkbox" name="status" lay-skin="switch" lay-text="开启|关闭" {if condition="$config.status == 1"} checked {/if}>
|
||||
<input type="checkbox" name="status" lay-skin="switch" lay-text="开启|关闭" {if condition="!empty($config) && $config.status == 1"} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">活动倒计时(结束)时间</lable>
|
||||
<div class="info">
|
||||
<input type="text" class="layui-input" id="end-time" name="end_time" value="{$config.end_time}">
|
||||
<input type="text" class="layui-input" id="end-time" name="end_time" value="{$config.end_time ?? ''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">规则说明:</lable>
|
||||
<div class="info">
|
||||
<textarea name="rule" id="rule" class="layui-input" style="width: 763px; height: 100px;" placeholder="请填写规则说明">{$config.rule}</textarea>
|
||||
<textarea name="rule" id="rule" class="layui-input" style="width: 763px; height: 100px;" placeholder="请填写规则说明">{$config.rule ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">服务:</lable>
|
||||
<div class="info">
|
||||
<input placeholder="如果有多个参数请用逗号分隔" value="{$config.service}" type="text" class="layui-input" id="service" name="service" style="width: 763px;">
|
||||
<input placeholder="如果有多个参数请用逗号分隔" value="{$config.service ?? ''}" type="text" class="layui-input" id="service" name="service" style="width: 763px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -36,11 +36,11 @@ class Order extends Api
|
||||
$post['user_id'] = $this->user_id;
|
||||
$post['client'] = $this->client;
|
||||
(new OrderValidate())->goCheck('add', $post);
|
||||
if(isset($post['order_type'])){
|
||||
if($post['order_type'] == 4){
|
||||
return JsonServer::error("活动正在预热,敬请等待");
|
||||
}
|
||||
}
|
||||
// if(isset($post['order_type'])){
|
||||
// if($post['order_type'] == 4){
|
||||
// return JsonServer::error("活动正在预热,敬请等待");
|
||||
// }
|
||||
// }
|
||||
$order = OrderLogic::add($post);
|
||||
if (false === $order) {
|
||||
return JsonServer::error(OrderLogic::getError());
|
||||
|
||||
@ -115,7 +115,7 @@ class DistributionLogic extends Logic
|
||||
// 'cost_card' => $post['cost_card'],
|
||||
'partner_id' => $post['partner_id'],
|
||||
'store_id' => $post['store_id'],
|
||||
'own_city' => $post['own_city'],
|
||||
'own_city' => $post['own_city'] ?? '',
|
||||
];
|
||||
|
||||
\app\common\logic\DistributionLogic::add($post['user_id']);
|
||||
|
||||
@ -111,7 +111,6 @@ class GoodsLogic extends Logic
|
||||
|
||||
// 转数组
|
||||
$goodsDetailArr = $goodsDetail->toArray();
|
||||
|
||||
$goodsDetailArr['poster'] = !empty($goodsDetailArr['poster']) ? UrlServer::getFileUrl($goodsDetailArr['poster']) : '';
|
||||
foreach ($goodsDetailArr['goods_item'] as &$valItem){
|
||||
$valItem['limited_num'] = 0;
|
||||
@ -1130,17 +1129,13 @@ class GoodsLogic extends Logic
|
||||
}
|
||||
|
||||
foreach($GroupbuyGoods as $item) {
|
||||
// 获取该商品的秒杀信息
|
||||
$GroupbuyGoods_info = GroupbuyGoods::where([
|
||||
'goods_id' => $goods['id'],
|
||||
])->column('goods_id,item_id,activity_price,stock,limited_num', 'item_id');
|
||||
|
||||
// 获取该商品的秒杀信息
|
||||
$GroupbuyGoods_info = GroupbuyGoods::where([
|
||||
'goods_id' => $goods['id'],
|
||||
])->column('goods_id,item_id,activity_price,stock,limited_num', 'item_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 确定是抢购商品
|
||||
// 先将商品市场价换成原SKU最小价
|
||||
// 确定是抢购商品 先将商品市场价换成原SKU最小价
|
||||
$goods['market_price'] = $goods['min_price'];
|
||||
// 替换活动价
|
||||
foreach($goods['goods_item'] as &$item) {
|
||||
@ -1159,15 +1154,29 @@ class GoodsLogic extends Logic
|
||||
}
|
||||
|
||||
// 如果当前用户参与了抢购的活动(则不允许再次抢购)
|
||||
$in_activity = Order::where(['user_id' => $userId, 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
// $in_activity = Order::where(['user_id' => $userId, 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
//
|
||||
// $goods['activity'] = [
|
||||
// 'type' => 4,
|
||||
// 'type_desc' => '抢购商品',
|
||||
// 'in_groupbuy_activity' => (bool)$in_activity,
|
||||
// 'msg' => '您已参与过本次活动,无法再次参与!'
|
||||
// ];
|
||||
|
||||
// 2024-11-29 更改规则:活动中的每件商品用户都能购买,但是只能买一件
|
||||
$in_activity = Order::alias('a')
|
||||
->join('order_goods og', 'a.id = og.order_id')
|
||||
->where(['a.user_id' => $userId, 'a.order_type' => 4, 'og.goods_id' => $goods['id']])
|
||||
->where('a.order_status', '<', 4)
|
||||
->find();
|
||||
|
||||
$goods['activity'] = [
|
||||
'type' => 4,
|
||||
'type_desc' => '抢购商品',
|
||||
'in_groupbuy_activity' => (bool)$in_activity,
|
||||
'msg' => '您已参与过本次活动,无法再次参与!'
|
||||
'in_groupbuy_activity' => !empty($in_activity),
|
||||
'msg' => '您已购买过此商品!'
|
||||
];
|
||||
return $goods;
|
||||
|
||||
return $goods;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,9 +54,10 @@ class GroupBuyLogic extends Logic
|
||||
$v['value'] = strtotime($v['value']);
|
||||
}
|
||||
|
||||
if ($v['name'] == 'service') {
|
||||
if ($v['name'] == 'service' && $v['value']) {
|
||||
$v['value'] = explode(',', $v['value']);
|
||||
}
|
||||
|
||||
$config[$v['name']] = $v['value'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,22 +120,32 @@ class OrderLogic extends Logic
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($post['order_type'] == 4) {
|
||||
$in_activity = Order::where(['user_id' => $post['user_id'], 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
if ($in_activity) {
|
||||
throw new Exception('每位用户只能限抢一件商品');
|
||||
}
|
||||
if ($post['order_type'] == OrderEnum::GROUP_BUY) {
|
||||
// $in_activity = Order::where(['user_id' => $post['user_id'], 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
// if ($in_activity) {
|
||||
// throw new Exception('每位用户只能限抢一件商品');
|
||||
// }
|
||||
|
||||
foreach ($goods as $activ) {
|
||||
$isOrder = Db::name('order')->where([
|
||||
'activity_sn' => $activ['activity_sn'],
|
||||
'user_id' => $post['user_id']
|
||||
])
|
||||
->where('order_status', '<>', 4)
|
||||
->find();
|
||||
if($isOrder){
|
||||
throw new Exception('您已抢购过此商品');
|
||||
// 2024-11-29 更改规则:活动中的每件商品用户都能购买,但是只能买一件
|
||||
foreach ($goods as $v) {
|
||||
$in_activity = Order::alias('a')
|
||||
->join('order_goods og', 'a.id = og.order_id')
|
||||
->where(['a.user_id' => $post['user_id'], 'a.order_type' => 4, 'og.goods_id' => $v['goods_id']])
|
||||
->where('a.order_status', '<', 4)
|
||||
->find();
|
||||
|
||||
if ($in_activity) {
|
||||
throw new Exception('您已购买过此商品');
|
||||
}
|
||||
// $isOrder = Db::name('order')->where([
|
||||
// 'activity_sn' => $activ['activity_sn'],
|
||||
// 'user_id' => $post['user_id']
|
||||
// ])
|
||||
// ->where('order_status', '<>', 4)
|
||||
// ->find();
|
||||
// if($isOrder){
|
||||
// throw new Exception('您已抢购过此商品');
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -315,9 +315,9 @@ class Order extends Models
|
||||
return $btn;
|
||||
}
|
||||
|
||||
if(($data['pay_status'] == PayEnum::ISPAID && $data['order_type'] == '4') || ($data['pay_status'] == PayEnum::ISPAID && $data['order_type'] == '抢购订单')){
|
||||
return $btn;
|
||||
}
|
||||
// if(($data['pay_status'] == PayEnum::ISPAID && $data['order_type'] == '4') || ($data['pay_status'] == PayEnum::ISPAID && $data['order_type'] == '抢购订单')){
|
||||
// return $btn;
|
||||
// }
|
||||
|
||||
if (($data['order_status'] == OrderEnum::ORDER_STATUS_NO_PAID && $data['pay_status'] == PayEnum::UNPAID)
|
||||
|| ($data['pay_status'] == PayEnum::ISPAID && $data['order_status'] == OrderEnum::ORDER_STATUS_DELIVERY)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user