Commit 6438a1e7 authored by 侯贺政's avatar 侯贺政

用户

parent 1f241398
......@@ -5,6 +5,7 @@ namespace backend\controllers\v1\shopuser;
use Yii;
use backend\controllers\v1\BaseController;
use app\models\v1\shopuser\ShopUser;
use yii\web\BadRequestHttpException;
class ShopUserController extends BaseController
{
......@@ -18,9 +19,8 @@ class ShopUserController extends BaseController
* @OA\GET(
* path="/backend/web/v1/shopuser/shop-users/employee-list",
* tags={"用户&员工接口"},
* summary="员工信息列表",
* summary="员工信息列表(侯贺政)",
* description="员工信息列表",
* operationId="returnGetParam",
* @OA\Parameter(name="page",in="query",@OA\Schema(type="int")),
* @OA\Parameter(name="NAME",in="query",@OA\Schema(type="string")),
* @OA\Parameter(name="CODE",in="query",@OA\Schema(type="string")),
......@@ -39,10 +39,7 @@ class ShopUserController extends BaseController
$model = new ShopUser();
$list = $model->employeeSearch(Yii::$app->request->queryParams);
if (!$list) {
return [
'message' => '未找到符合条件的数据',
'data' => [],
];
throw new BadRequestHttpException('未找到符合条件的数据');
}
return $list;
}
......@@ -51,9 +48,8 @@ class ShopUserController extends BaseController
* @OA\GET(
* path="/backend/web/v1/shopuser/shop-users/employee-info",
* tags={"用户&员工接口"},
* summary="员工信息",
* summary="员工信息(侯贺政)",
* description="某员工的信息详情",
* operationId="returnGetParam",
* @OA\Parameter(name="id",in="query",required=true,@OA\Schema(type="string")),
* @OA\Response(response="200",description="
* GUID:用户GUID,
......@@ -73,11 +69,7 @@ class ShopUserController extends BaseController
$model = new ShopUser();
$data = $model->employeeInfo($id);
if (!$data) {
Yii::$app->response->statusCode = 400;
return [
'message' => '请求错误,该用户不存在',
'data' => [],
];
throw new BadRequestHttpException('请求错误,该员工不存在');
}
return $data;
}
......
......@@ -180,11 +180,8 @@ class ShopUser extends BaseModel
*/
public function employeeSearch($params)
{
// $org_guid = Yii::$app->user->identity->ORG_GUID;
//$org_guid = (Yii::$app->redis->get('access_token'))['ORG_GUID'];
$org_guid = 100;
$query = static::find()->select('GUID,NAME,EMPLOYEE_CODE,MOBILE_PHONE,EMPLOYEE_BRANCH_GUID')
->where(['ORG_GUID' => $org_guid, 'BELONG' => 1]);
->where(['BELONG' => 1]);
if (isset($params['NAME']) && !empty($params['NAME'])) {
$query->andWhere(['like', 'NAME', $params['NAME']]);
......@@ -220,10 +217,8 @@ class ShopUser extends BaseModel
*/
public function employeeInfo($id)
{
// $org_guid = Yii::$app->user->identity->ORG_GUID;
$org_guid = 100;
$info = static::find()->select('GUID,NAME,EMPLOYEE_CODE,MOBILE_PHONE,AGE,CONTACT_SEX,MEMBER_NO,IS_DISTRIBUTOR,EMPLOYEE_IS_MANAGER,EMPLOYEE_BRANCH_GUID')
->where(['GUID' => $id, 'BELONG' => 1, 'ORG_GUID' => $org_guid])
->where(['GUID' => $id, 'BELONG' => 1])
->one();
return $info;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment