67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2021-4-17
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
|
|
namespace app\modules\api\components;
|
|
|
|
|
|
use app\models\Coach;
|
|
use app\models\Detection;
|
|
use app\models\Order;
|
|
use app\models\OrderDetail;
|
|
use app\models\StoreUser;
|
|
use app\models\User;
|
|
|
|
|
|
class ApiHelper
|
|
{
|
|
public static function findOneUser($user_id, $cx_mch_id = 0)
|
|
{
|
|
return User::findOne([
|
|
'cx_mch_id' => $cx_mch_id,
|
|
'id' => $user_id,
|
|
'is_delete' => 0,
|
|
'status' => User::STATUS_NORMAL,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 检测员
|
|
* @param $user_id
|
|
* @return Detection|null
|
|
*/
|
|
public static function findOneUserDetection($user_id)
|
|
{
|
|
return Detection::findOne(['user_id' => $user_id, 'is_delete' => 0]);
|
|
}
|
|
|
|
/**
|
|
* 教练信息
|
|
* @param $user_id
|
|
* @return Coach|null
|
|
*/
|
|
public static function findOneCoach($user_id)
|
|
{
|
|
return Coach::findOne(['user_id' => $user_id, 'is_delete' => 0]);
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取当前门店用户的门店ID
|
|
*/
|
|
public static function findOneUserStoreId($user_id)
|
|
{
|
|
$userData = StoreUser::find()->andWhere(['user_id' => $user_id,'is_delete' => 0,'status' => 0])->select('*')->orderBy([
|
|
'id' => SORT_DESC
|
|
])->one();
|
|
return $userData;
|
|
}
|
|
} |