diff --git a/.env b/.env
index bd89d32..d30629e 100644
--- a/.env
+++ b/.env
@@ -6,9 +6,9 @@ DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
-DATABASE = youda
-USERNAME = youda
-PASSWORD = youda
+DATABASE = youda_test
+USERNAME = youda_test
+PASSWORD = youda_test
HOSTPORT = 3306
CHARSET = utf8
DEBUG = false
@@ -20,4 +20,4 @@ default_lang = zh-cn
HOST = 127.0.0.1
PORT = 6379
PASSWORD =
-DB = 2
\ No newline at end of file
+DB = 3
\ No newline at end of file
diff --git a/app/admin/view/Order/buy_order.html b/app/admin/view/Order/buy_order.html
index d51a185..bde0e6a 100755
--- a/app/admin/view/Order/buy_order.html
+++ b/app/admin/view/Order/buy_order.html
@@ -95,9 +95,9 @@
折扣金额
:{$vo['order_zhe_total']}
-
- 吧唧币抵扣
:{$vo['use_integral']}
-
+
+ UU抵扣
:{$vo['use_integral']}
+ 达达券抵扣
:{$vo['use_money2']}
优惠券抵扣
:{$vo['use_coupon']}
{$vo['addtime']|date="Y-m-d H:i:s"} |
diff --git a/app/api/controller/CardGoods.php b/app/api/controller/CardGoods.php
index 24359e3..307f912 100755
--- a/app/api/controller/CardGoods.php
+++ b/app/api/controller/CardGoods.php
@@ -506,7 +506,7 @@ class CardGoods extends Base
$body = '购买盒子' . $card_goods['title'];
$attach = 'order_ckj';
- $payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['id'], $body, $attach);
if ($payRes['status'] == 1) {
#结果集
$new_data = [
diff --git a/app/api/controller/Cardextractor.php b/app/api/controller/Cardextractor.php
index 9d26fbd..f24d718 100755
--- a/app/api/controller/Cardextractor.php
+++ b/app/api/controller/Cardextractor.php
@@ -494,7 +494,7 @@ class Cardextractor extends Base
if ($price > 0) {
$body = '购买盒子' . $goods['title'];
$attach = 'order_ckj';
- $payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['id'], $body, $attach);
if ($payRes['status'] == 1) {
#结果集
$new_data = [
diff --git a/app/api/controller/Config.php b/app/api/controller/Config.php
index ba26285..212704d 100755
--- a/app/api/controller/Config.php
+++ b/app/api/controller/Config.php
@@ -26,7 +26,7 @@ class Config extends Base
return $this->renderSuccess('获取成功', [
'good_type' => $goodsTypeList,
'app_setting' => $app_setting,
- 'version' => '107'
+ 'version' => '108'
]);
}
diff --git a/app/api/controller/Goods.php b/app/api/controller/Goods.php
index a7e8538..ea53b6f 100755
--- a/app/api/controller/Goods.php
+++ b/app/api/controller/Goods.php
@@ -1114,7 +1114,7 @@ class Goods extends Base
// $redis->del($redis_key);
// return $this->renderError("支付未开放");
// }
- $payRes = (new Pay())->wxCreateOrder($order_num, $paymentResult['price'], $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($order_num, $paymentResult['price'], $user['id'], $body, $attach);
if ($payRes['status'] == 1) {
#结果集
$new_data = [
diff --git a/app/api/controller/Infinite.php b/app/api/controller/Infinite.php
index d27ba7a..dc932f6 100755
--- a/app/api/controller/Infinite.php
+++ b/app/api/controller/Infinite.php
@@ -703,7 +703,7 @@ class Infinite extends Base
// $redis->del($redis_key);
// return $this->renderError("支付未开放");
// }
- $payRes = (new Pay())->wxCreateOrder($order_num, $paymentResult['price'], $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($order_num, $paymentResult['price'], $user['id'], $body, $attach);
if ($payRes['status'] == 1) {
#结果集
$new_data = [
diff --git a/app/api/controller/Login.php b/app/api/controller/Login.php
index c2afdc7..d379e19 100755
--- a/app/api/controller/Login.php
+++ b/app/api/controller/Login.php
@@ -199,6 +199,16 @@ class Login extends Base
$wxServer = new \app\common\server\Wx($this->app);
$user_base = $wxServer->getOpenid($code);
$openid = $user_base['openid'];
+
+ // 添加Redis防抖锁
+ $redis = (new RedisHelper())->getRedis();
+ $lockKey = 'login:debounce:' . $openid;
+ if (!$redis->set($lockKey, 1, ['nx', 'ex' => 3])) {
+ $logMessages[] = '用户登录请求过于频繁: ' . $openid;
+ Log::warning(end($logMessages));
+ return $this->renderError('请勿频繁登录,请稍后再试');
+ }
+
$user = null;
$wx_unionid = null;
if ($user_base['unionid'] != null && $user_base['unionid'] != '') {
@@ -397,7 +407,7 @@ class Login extends Base
$num = ProfitDraw::where(['type' => 5, 'user_id' => $pid, 'share_uid' => $user_id])->count();
if (bccomp("$num", "$draw_people_num") < 0) {
#可以获得一张抽奖券
- $res[] = User::changeDraw($pid, 1, 5, '获得一张抽奖券', $user_id);
+ // $res[] = User::changeDraw($pid, 1, 5, '获得一张抽奖券', $user_id);
}
}
@@ -452,6 +462,15 @@ class Login extends Base
$retrieved_openid = $user_base['openid'];
$openid = $retrieved_openid;
+
+ // 添加Redis防抖锁
+ $redis = (new RedisHelper())->getRedis();
+ $lockKey = 'login:h5:debounce:' . $openid;
+ if (!$redis->set($lockKey, 1, ['nx', 'ex' => 3])) {
+ Log::warning('用户公众号登录请求过于频繁: ' . $openid);
+ return $this->renderError('请勿频繁登录,请稍后再试');
+ }
+
$user = null;
if ($user_base['unionid'] != null && $user_base['unionid'] != '') {
@@ -870,6 +889,14 @@ class Login extends Base
// 验证通过后删除Redis中的验证码
$redis->del($redisKey);
+ // 添加Redis防抖锁
+ $lockKey = 'login:mobile:debounce:' . $mobile;
+ if (!$redis->set($lockKey, 1, ['nx', 'ex' => 3])) {
+ $logMessages[] = '用户手机号登录请求过于频繁: ' . $mobile;
+ Log::warning(end($logMessages));
+ return $this->renderError('请勿频繁登录,请稍后再试');
+ }
+
// 检查用户是否已存在
$user = User::getInfo(['mobile' => $mobile]);
diff --git a/app/api/controller/Notify.php b/app/api/controller/Notify.php
index 66abfd2..43b97c2 100755
--- a/app/api/controller/Notify.php
+++ b/app/api/controller/Notify.php
@@ -2392,6 +2392,7 @@ class Notify extends Base
if ($orderInfo['status'] != 0) {
writelog('pay_notify_error', "订单状态不正确: " . $order_num . ", 状态: " . $orderInfo['status']);
\app\common\model\OrderNotify::updateStatus($orderNotify['id'], 2, '订单状态不正确');
+ Order::where(['order_num' => $order_num])->update(['kd_is' => 1]);
Db::rollback();
$this->CallbackSuccess();
return;
@@ -2401,6 +2402,7 @@ class Notify extends Base
if ($orderInfo['user_id'] != $user_id) {
writelog('pay_notify_error', "用户ID不匹配: 通知中的用户ID={$user_id}, 订单中的用户ID={$orderInfo['user_id']}");
\app\common\model\OrderNotify::updateStatus($orderNotify['id'], 2, '用户ID不匹配');
+ Order::where(['order_num' => $order_num])->update(['kd_is' => 1]);
Db::rollback();
$this->CallbackSuccess();
return;
diff --git a/app/api/controller/Pay.php b/app/api/controller/Pay.php
index 85c5023..99468f1 100755
--- a/app/api/controller/Pay.php
+++ b/app/api/controller/Pay.php
@@ -286,21 +286,16 @@ class Pay extends Base
* 微信小程序下单方法
* @param $params 下单参数
*/
- public function wxCreateOrder($order_no, $price, $openid, $body, $attach)
+ public function wxCreateOrder($order_no, $price, $user_id, $body, $attach)
{
// 根据订单号设置正确的商户配置
$this->setMerchantByOrderNum($order_no);
- $openidx = $openid;
- if ($this->ish5()) {
- $user = User::getInfo(['openid' => $openidx]);
- if ($user != null && $user['gzh_openid'] != null && $user['gzh_openid'] != "") {
- $openidx = $user['gzh_openid'];
- }
- }
+
$body = mb_substr($body, 0, 30);
// 使用新的动态路由生成通知URL
- $user = User::where('openid', $openidx)->find();
+ $user = User::where('id', $user_id)->find();
+ $openid = $user['openid'];
$payment_type = 'wxpay';
$order_type = $attach;
$user_id = $user ? $user['id'] : 0;
@@ -338,7 +333,7 @@ class Pay extends Base
$params['total_fee'] = round($price * 100, 2);
$params['spbill_create_ip'] = $this->get_client_ip();
$params['trade_type'] = 'JSAPI';
- $params['openid'] = $openidx;
+ $params['openid'] = $openid;
$params['sign'] = $this->MakeSign($params);
$xml = $this->data_to_xml($params);
$url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
diff --git a/app/api/controller/User.php b/app/api/controller/User.php
index fce2fc4..c063099 100755
--- a/app/api/controller/User.php
+++ b/app/api/controller/User.php
@@ -1050,7 +1050,7 @@ class User extends Base
]);
$body = '充值金额' . $money;
$attach = 'user_recharge';
- $payRes = (new Pay())->wxCreateOrder($order_num, $money, $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($order_num, $money, $user['id'], $body, $attach);
if ($payRes['status'] != 1) {
Db::rollback();
return $this->renderError("下单失败");
diff --git a/app/api/controller/Warehouse.php b/app/api/controller/Warehouse.php
index 1c272ef..4b89f80 100755
--- a/app/api/controller/Warehouse.php
+++ b/app/api/controller/Warehouse.php
@@ -799,7 +799,7 @@ class Warehouse extends Base
if ($free_post > $count && $post_money > 0) {
$body = '背包发货' . $count . '件';
$attach = 'order_list_send';
- $payRes = (new Pay())->wxCreateOrder($send_num, $post_money, $user['openid'], $body, $attach);
+ $payRes = (new Pay())->wxCreateOrder($send_num, $post_money, $user['id'], $body, $attach);
if ($payRes['status'] == 1) {
#结果集
$new_data = [
diff --git a/app/common/model/User.php b/app/common/model/User.php
index ffb7c53..58d0f67 100755
--- a/app/common/model/User.php
+++ b/app/common/model/User.php
@@ -342,7 +342,8 @@ class User extends Base
if ($jiangli > 0) {
$pid = self::field('id')->where('id', '=', $order['user_id'])->value('pid');
if ($pid) {
- $res[] = self::changeMoney($pid, $jiangli, 5, '推荐奖励', $order['user_id'], '奖励比例:' . $fx_bili);
+ //赠送Uu币
+ $res[] = self::changeIntegral($pid, $jiangli * 100, 5, '邀请好友奖励', $order['user_id'], '奖励比例:' . $fx_bili);
}
}
if (empty($res)) {