Browse Source

商户奖励(平台新用户BUG)

master
weigang 5 years ago
parent
commit
0785999db0
  1. 2
      app/Controller/NotifyController.php
  2. 4
      app/Service/UserService.php
  3. 3
      app/Service/UserServiceInterface.php

2
app/Controller/NotifyController.php

@ -309,7 +309,7 @@ class NotifyController extends BaseController
StoreAccount::query()->insert(array_merge($recordBase, $record));
// 平台新用户奖励给商户
$isStageNewUser = $this->userService->isStageNewUser($orderItem['user_id']);
$isStageNewUser = $this->userService->isStageNewUser($orderItem['user_id'], $orderMain->id);
$needAward = false;
$awardAmount = 0;
if ($isStageNewUser) {

4
app/Service/UserService.php

@ -15,12 +15,14 @@ class UserService implements UserServiceInterface
* 判定条件:
* 没有在平台下过单(包括线上和线下)
* @param $user_id
* @param $order_main_id
* @return mixed|void
*/
public function isStageNewUser($user_id): bool
public function isStageNewUser($user_id, $order_main_id): bool
{
$exist = OrderMain::query()
->where(['user_id' => $user_id])
->where('id', '!=', $order_main_id)
->where(function ($query){
$query->whereIn('state', [OrderMain::ORDER_STATE_COMPLETE,OrderMain::ORDER_STATE_EVALUATED,OrderMain::ORDER_STATE_UNREFUND])
->orWhereIn('dm_state', [OrderMain::ORDER_STATE_UNTAKE,OrderMain::ORDER_STATE_DELIVERY]);

3
app/Service/UserServiceInterface.php

@ -9,9 +9,10 @@ interface UserServiceInterface
/**
* 是否平台新用户
* @param $user_id
* @param $order_main_id
* @return mixed
*/
public function isStageNewUser($user_id): bool;
public function isStageNewUser($user_id, $order_main_id): bool;
public function saveUserUnionid($openid,$unionid);

Loading…
Cancel
Save