Merge branch 'dev'
This commit is contained in:
commit
d53bd83725
|
|
@ -95,9 +95,9 @@
|
|||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">折扣</p> :{$vo['zhe']*1}折</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">折扣金额</p> :{$vo['order_zhe_total']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">微信支付</p> :{$vo['price']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">余额抵扣</p> :{$vo['use_money']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">吧唧币抵扣</p> :{$vo['use_integral']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">积分支付</p> :{$vo['use_score']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">钻石抵扣</p> :{$vo['use_money']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">UU抵扣</p> :{$vo['use_integral']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">达达券抵扣</p> :{$vo['use_money2']}</div>
|
||||
<div style="display: flex;font-weight: bold;"><p style="width: 60px;display: inline">优惠券抵扣</p> :{$vo['use_coupon']}</div>
|
||||
</td>
|
||||
<td>{$vo['addtime']|date="Y-m-d H:i:s"}</td>
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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("下单失败");
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user