Commit fef9454f authored by 姚书霞's avatar 姚书霞 🐘

代码优化

parents 7a95cd5a 440117d7
...@@ -22,7 +22,7 @@ use backend\components\v1\authorizationFilter; ...@@ -22,7 +22,7 @@ use backend\components\v1\authorizationFilter;
* ), * ),
* @OA\Server( * @OA\Server(
* description="Api server", * description="Api server",
* url="/yaoshuxia/shopback", * url="/guoyongzhi/weiShopNew",
* ), * ),
* @OA\SecurityScheme( * @OA\SecurityScheme(
* securityScheme="Authorization", * securityScheme="Authorization",
...@@ -60,7 +60,7 @@ class BaseController extends ActiveController ...@@ -60,7 +60,7 @@ class BaseController extends ActiveController
public $serializer = [ public $serializer = [
'class' => 'yii\rest\Serializer', 'class' => 'yii\rest\Serializer',
'collectionEnvelope' => 'data', 'collectionEnvelope' => 'data',
'preserveKeys'=>true, 'preserveKeys' => true,
]; ];
public function behaviors() public function behaviors()
{ {
......
...@@ -6,7 +6,7 @@ use Yii; ...@@ -6,7 +6,7 @@ use Yii;
use backend\controllers\v1\BaseController; use backend\controllers\v1\BaseController;
use backend\helpers\Func; use backend\helpers\Func;
use yii\web\BadRequestHttpException; use yii\web\BadRequestHttpException;
use yii\web\ServerErrorHttpException; use yii\web\HttpException;
use app\models\v1\rbacuser\ShopRbacRoleAccess; use app\models\v1\rbacuser\ShopRbacRoleAccess;
class AuthorityRoleController extends BaseController class AuthorityRoleController extends BaseController
...@@ -116,7 +116,6 @@ class AuthorityRoleController extends BaseController ...@@ -116,7 +116,6 @@ class AuthorityRoleController extends BaseController
if ($model->save()) { if ($model->save()) {
Yii::$app->getResponse()->setStatusCode(201); Yii::$app->getResponse()->setStatusCode(201);
} elseif (!$model->hasErrors()) { } elseif (!$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
throw new HttpException(500, '添加失败'); throw new HttpException(500, '添加失败');
} }
return $model; return $model;
...@@ -163,7 +162,6 @@ class AuthorityRoleController extends BaseController ...@@ -163,7 +162,6 @@ class AuthorityRoleController extends BaseController
$model->setAttributes(Yii::$app->getRequest()->post()); $model->setAttributes(Yii::$app->getRequest()->post());
if ($model->save() === false && !$model->hasErrors()) { if ($model->save() === false && !$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
throw new HttpException(500, '修改失败'); throw new HttpException(500, '修改失败');
} }
Yii::$app->getResponse()->setStatusCode(202); Yii::$app->getResponse()->setStatusCode(202);
......
...@@ -12,7 +12,6 @@ use app\models\v1\transport\ShopTransportType; ...@@ -12,7 +12,6 @@ use app\models\v1\transport\ShopTransportType;
use app\models\v1\branch\ShopBranchService; use app\models\v1\branch\ShopBranchService;
use yii\web\BadRequestHttpException; use yii\web\BadRequestHttpException;
use backend\helpers\Func; use backend\helpers\Func;
use yii\web\ServerErrorHttpException;
use yidas\phpSpreadsheet\Helper; use yidas\phpSpreadsheet\Helper;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use app\models\v1\rbacuser\ShopRbacUser; use app\models\v1\rbacuser\ShopRbacUser;
...@@ -60,7 +59,6 @@ class BranchController extends BaseController ...@@ -60,7 +59,6 @@ class BranchController extends BaseController
$rbac = new ShopRbacUser(); $rbac = new ShopRbacUser();
$userGuid = Yii::$app->user->identity->GUID; $userGuid = Yii::$app->user->identity->GUID;
$userinfo = $rbac->getRbacUserInfo($userGuid); $userinfo = $rbac->getRbacUserInfo($userGuid);
// print_r($userinfo);die();
$where_branch = ''; $where_branch = '';
//是否是 分公司管理员 是的话只显示所管理门店的数据 //是否是 分公司管理员 是的话只显示所管理门店的数据
if ($userinfo['ROLE_ID'] == USER_ROLE_REGION_ADMIN) { if ($userinfo['ROLE_ID'] == USER_ROLE_REGION_ADMIN) {
...@@ -79,7 +77,7 @@ class BranchController extends BaseController ...@@ -79,7 +77,7 @@ class BranchController extends BaseController
if ($model->validate()) { if ($model->validate()) {
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$info = $model->BranchInfo($params); $info = $model->branchInfo($params);
if (!$list = $info->getModels()) { if (!$list = $info->getModels()) {
throw new BadRequestHttpException('未找到符合的门店列表信息'); throw new BadRequestHttpException('未找到符合的门店列表信息');
} }
...@@ -117,16 +115,16 @@ class BranchController extends BaseController ...@@ -117,16 +115,16 @@ class BranchController extends BaseController
if ($model->validate()) { if ($model->validate()) {
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$info = $model->BranchDetail($params['GUID']); $info = $model->branchDetail($params['GUID']);
if (!$list = $info->getModels()) { if (!$list = $info->getModels()) {
throw new BadRequestHttpException('未找到符合的门店列表信息'); throw new BadRequestHttpException('未找到符合的门店列表信息');
} }
//获取门店服务类目关系信息 //获取门店服务类目关系信息
$branchServiceRelation = $branchService->BranchSeviceRelation($params['GUID']); $branchServiceRelation = $branchService->branchSeviceRelation($params['GUID']);
//获取门店服务类目名称 //获取门店服务类目名称
if ($branchServiceRelation) { if ($branchServiceRelation) {
foreach ($branchServiceRelation as $k => $v) { foreach ($branchServiceRelation as $k => $v) {
$branchSType = $branchServiceType->BranchServiceInfo('', '', $v['SERVICE_TYPE_GUID']); $branchSType = $branchServiceType->branchServiceInfo('', '', $v['SERVICE_TYPE_GUID']);
$branchSerType = $branchSType->getModels(); $branchSerType = $branchSType->getModels();
//获取服务类目信息 //获取服务类目信息
if ($branchSerType) { if ($branchSerType) {
...@@ -212,7 +210,7 @@ class BranchController extends BaseController ...@@ -212,7 +210,7 @@ class BranchController extends BaseController
if (isset($param['BRANCH_SERVICE_TYPE']) && !empty($param['BRANCH_SERVICE_TYPE'])) { if (isset($param['BRANCH_SERVICE_TYPE']) && !empty($param['BRANCH_SERVICE_TYPE'])) {
$ShopBranchService->scenario = 'create'; //创建的场景 $ShopBranchService->scenario = 'create'; //创建的场景
//删除门店原有服务类目 //删除门店原有服务类目
$ShopBranchService->BranchServiceDel($branch_guid); $ShopBranchService->branchServiceDel($branch_guid);
$BST = $param['BRANCH_SERVICE_TYPE']; $BST = $param['BRANCH_SERVICE_TYPE'];
//判断门店服务类目类型 //判断门店服务类目类型
if (is_string($BST)) { if (is_string($BST)) {
...@@ -252,7 +250,6 @@ class BranchController extends BaseController ...@@ -252,7 +250,6 @@ class BranchController extends BaseController
$model = new $this->modelClass(); $model = new $this->modelClass();
$model->scenario = 'create'; //创建的场景 $model->scenario = 'create'; //创建的场景
$other_param = array( $other_param = array(
//'GUID'=>Func::create_guid(),
'GUID' => $branch_guid, 'GUID' => $branch_guid,
'ORG_GUID' => Yii::$app->user->identity->ORG_GUID, 'ORG_GUID' => Yii::$app->user->identity->ORG_GUID,
'UPDATE_TIME' => date('Y-m-d H:i:s', time()), 'UPDATE_TIME' => date('Y-m-d H:i:s', time()),
...@@ -265,7 +262,6 @@ class BranchController extends BaseController ...@@ -265,7 +262,6 @@ class BranchController extends BaseController
if ($model->save()) { if ($model->save()) {
Yii::$app->getResponse()->setStatusCode(201); Yii::$app->getResponse()->setStatusCode(201);
} elseif (!$model->hasErrors()) { } elseif (!$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
throw new HttpException(500, '添加失败'); throw new HttpException(500, '添加失败');
} }
return $model; return $model;
...@@ -292,7 +288,7 @@ class BranchController extends BaseController ...@@ -292,7 +288,7 @@ class BranchController extends BaseController
public function actionBranchServices() public function actionBranchServices()
{ {
$model = new BranchServiceType(); $model = new BranchServiceType();
$info = $model->BranchServiceInfoAll(); $info = $model->branchServiceInfoAll();
if (!$info) { if (!$info) {
throw new BadRequestHttpException('未找到符合的门店服务类目信息'); throw new BadRequestHttpException('未找到符合的门店服务类目信息');
} }
...@@ -317,9 +313,9 @@ class BranchController extends BaseController ...@@ -317,9 +313,9 @@ class BranchController extends BaseController
public function actionBranchTransportType() public function actionBranchTransportType()
{ {
$model = new ShopTransportType; $model = new ShopTransportType;
$info = $model->BranchTransportInfo(); $info = $model->branchTransportInfo();
if (!$info) { if (!$info) {
throw new BadRequestHttpException('未找到符合的门店门店配送方式'); throw new BadRequestHttpException('未找到符合的门店配送方式');
} }
return new ActiveDataProvider([ return new ActiveDataProvider([
'models' => $info, 'models' => $info,
...@@ -501,7 +497,7 @@ class BranchController extends BaseController ...@@ -501,7 +497,7 @@ class BranchController extends BaseController
if (isset($BRANCH_SERVICE_TYPE) && !empty($BRANCH_SERVICE_TYPE)) { if (isset($BRANCH_SERVICE_TYPE) && !empty($BRANCH_SERVICE_TYPE)) {
$ShopBranchService->scenario = 'create'; //创建的场景 $ShopBranchService->scenario = 'create'; //创建的场景
//删除门店原有服务类目 //删除门店原有服务类目
$ShopBranchService->BranchServiceDel($branch_guid); $ShopBranchService->branchServiceDel($branch_guid);
//判断门店服务类目类型 //判断门店服务类目类型
if (is_string($BRANCH_SERVICE_TYPE)) { if (is_string($BRANCH_SERVICE_TYPE)) {
$BST_arr = explode(',', $BRANCH_SERVICE_TYPE); $BST_arr = explode(',', $BRANCH_SERVICE_TYPE);
...@@ -547,7 +543,6 @@ class BranchController extends BaseController ...@@ -547,7 +543,6 @@ class BranchController extends BaseController
$model->setAttributes(Yii::$app->getRequest()->post()); $model->setAttributes(Yii::$app->getRequest()->post());
if ($model->save() === false && !$model->hasErrors()) { if ($model->save() === false && !$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
throw new HttpException(500, '修改失败'); throw new HttpException(500, '修改失败');
} }
Yii::$app->getResponse()->setStatusCode(202); Yii::$app->getResponse()->setStatusCode(202);
...@@ -582,7 +577,6 @@ class BranchController extends BaseController ...@@ -582,7 +577,6 @@ class BranchController extends BaseController
if (!$branchservice) { if (!$branchservice) {
throw new BadRequestHttpException('没有找到要删除的记录'); throw new BadRequestHttpException('没有找到要删除的记录');
} else if ($branchservice->delete() === false) { } else if ($branchservice->delete() === false) {
// throw new ServerErrorHttpException('Failed to delete the object for unknown reason.');
throw new HttpException(500, '删除失败'); throw new HttpException(500, '删除失败');
} }
...@@ -795,7 +789,7 @@ class BranchController extends BaseController ...@@ -795,7 +789,7 @@ class BranchController extends BaseController
$string = substr($string, 0, strlen($string) - 1); $string = substr($string, 0, strlen($string) - 1);
$_branchModel->TRANSPORT_TYPE = (string) $string; $_branchModel->TRANSPORT_TYPE = (string) $string;
$_servicModel = clone $servicModel; $_servicModel = clone $servicModel;
$_servicModel->BranchServiceDel($_branchModel->GUID); $_servicModel->branchServiceDel($_branchModel->GUID);
$serviceCode = explode(',', $_branchModel->SERVICE_TYPE_CODE); $serviceCode = explode(',', $_branchModel->SERVICE_TYPE_CODE);
$serviceArr = []; $serviceArr = [];
foreach ($serviceCode as $servValue) { foreach ($serviceCode as $servValue) {
...@@ -1028,7 +1022,7 @@ class BranchController extends BaseController ...@@ -1028,7 +1022,7 @@ class BranchController extends BaseController
$model = new $this->modelClass(); $model = new $this->modelClass();
$guid = Yii::$app->request->getQueryParam('guid'); $guid = Yii::$app->request->getQueryParam('guid');
$info = $model->BranchDetail($guid); $info = $model->branchDetail($guid);
if (!$info->getModels()) { if (!$info->getModels()) {
throw new BadRequestHttpException('未找到符合的DC信息'); throw new BadRequestHttpException('未找到符合的DC信息');
} }
...@@ -1104,7 +1098,6 @@ class BranchController extends BaseController ...@@ -1104,7 +1098,6 @@ class BranchController extends BaseController
$model->setAttributes($other_param); $model->setAttributes($other_param);
$model->setAttributes(Yii::$app->getRequest()->post()); $model->setAttributes(Yii::$app->getRequest()->post());
if ($model->save() === false && !$model->hasErrors()) { if ($model->save() === false && !$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
throw new HttpException(500, '修改失败'); throw new HttpException(500, '修改失败');
} }
return $model; return $model;
......
...@@ -9,10 +9,7 @@ use backend\helpers\Func; ...@@ -9,10 +9,7 @@ use backend\helpers\Func;
use backend\helpers\UploadFiles; use backend\helpers\UploadFiles;
use yidas\phpSpreadsheet\Helper; use yidas\phpSpreadsheet\Helper;
use yii\web\HttpException; use yii\web\HttpException;
use yii\web\ServerErrorHttpException;
use yii\web\UploadedFile; use yii\web\UploadedFile;
use app\models\v1\branch\BranchServiceType;
use app\models\v1\rbacuser\ShopRbacUser;
class BranchServiceTypeController extends BaseController class BranchServiceTypeController extends BaseController
...@@ -52,7 +49,7 @@ class BranchServiceTypeController extends BaseController ...@@ -52,7 +49,7 @@ class BranchServiceTypeController extends BaseController
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$code = $model->CODE; $code = $model->CODE;
$name = $model->NAME; $name = $model->NAME;
$info = $model->BranchServiceInfo($code, $name); $info = $model->branchServiceInfo($code, $name);
if (!$info->getModels()) { if (!$info->getModels()) {
throw new BadRequestHttpException('未找到符合的门店服务类目信息'); throw new BadRequestHttpException('未找到符合的门店服务类目信息');
} }
...@@ -91,7 +88,7 @@ class BranchServiceTypeController extends BaseController ...@@ -91,7 +88,7 @@ class BranchServiceTypeController extends BaseController
if ($model->validate()) { if ($model->validate()) {
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$code = $model->CODE; $code = $model->CODE;
$info = $model->BranchServiceInfo($code, ''); $info = $model->branchServiceInfo($code, '');
if (!$info->getModels()) { if (!$info->getModels()) {
throw new BadRequestHttpException('未找到符合的门店服务类目信息'); throw new BadRequestHttpException('未找到符合的门店服务类目信息');
} }
...@@ -145,7 +142,6 @@ class BranchServiceTypeController extends BaseController ...@@ -145,7 +142,6 @@ class BranchServiceTypeController extends BaseController
if ($model->save()) { if ($model->save()) {
Yii::$app->getResponse()->setStatusCode(201); Yii::$app->getResponse()->setStatusCode(201);
} elseif (!$model->hasErrors()) { } elseif (!$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
throw new HttpException(500, '添加失败'); throw new HttpException(500, '添加失败');
} }
return $model; return $model;
...@@ -186,7 +182,6 @@ class BranchServiceTypeController extends BaseController ...@@ -186,7 +182,6 @@ class BranchServiceTypeController extends BaseController
$model->setAttributes(Yii::$app->getRequest()->post()); $model->setAttributes(Yii::$app->getRequest()->post());
if ($model->save() === false && !$model->hasErrors()) { if ($model->save() === false && !$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
throw new HttpException(500, '修改失败'); throw new HttpException(500, '修改失败');
} }
Yii::$app->getResponse()->setStatusCode(202); Yii::$app->getResponse()->setStatusCode(202);
...@@ -221,7 +216,6 @@ class BranchServiceTypeController extends BaseController ...@@ -221,7 +216,6 @@ class BranchServiceTypeController extends BaseController
if (!$branchservice) { if (!$branchservice) {
throw new BadRequestHttpException('没有找到要删除的记录'); throw new BadRequestHttpException('没有找到要删除的记录');
} else if ($branchservice->delete() === false) { } else if ($branchservice->delete() === false) {
// throw new ServerErrorHttpException('Failed to delete the object for unknown reason.');
throw new HttpException(500, '删除失败'); throw new HttpException(500, '删除失败');
} }
...@@ -334,7 +328,7 @@ class BranchServiceTypeController extends BaseController ...@@ -334,7 +328,7 @@ class BranchServiceTypeController extends BaseController
throw new HttpException(422, json_encode($model->errors)); throw new HttpException(422, json_encode($model->errors));
} }
$list = $model->BranchServiceExport($params); $list = $model->branchServiceExport($params);
if (!$list) { if (!$list) {
throw new BadRequestHttpException('未找到符合条件的数据'); throw new BadRequestHttpException('未找到符合条件的数据');
} }
......
...@@ -383,7 +383,7 @@ class ImportGoodsInfoController extends BaseController ...@@ -383,7 +383,7 @@ class ImportGoodsInfoController extends BaseController
$value[5] = preg_replace("/,/", ",", $value[5]); $value[5] = preg_replace("/,/", ",", $value[5]);
$transportType = explode(',', $value[5]); $transportType = explode(',', $value[5]);
//获取配送方式信息 //获取配送方式信息
$getTransportTypeInfo = $transportModel->BranchTransportInfo($transportType); $getTransportTypeInfo = $transportModel->branchTransportInfo($transportType);
if ($getTransportTypeInfo) { if ($getTransportTypeInfo) {
$transportGuid = array_column($getTransportTypeInfo, 'GUID'); $transportGuid = array_column($getTransportTypeInfo, 'GUID');
$transportGuid_str = implode(',', $transportGuid); $transportGuid_str = implode(',', $transportGuid);
...@@ -734,7 +734,7 @@ class ImportGoodsInfoController extends BaseController ...@@ -734,7 +734,7 @@ class ImportGoodsInfoController extends BaseController
$value[3] = preg_replace("/,/", ",", $value[3]); $value[3] = preg_replace("/,/", ",", $value[3]);
$transportType = explode(',', $value[3]); $transportType = explode(',', $value[3]);
//获取配送方式信息 //获取配送方式信息
$getTransportTypeInfo = $transportModel->BranchTransportInfo($transportType); $getTransportTypeInfo = $transportModel->branchTransportInfo($transportType);
if ($getTransportTypeInfo) { if ($getTransportTypeInfo) {
$transportGuid = array_column($getTransportTypeInfo, 'GUID'); $transportGuid = array_column($getTransportTypeInfo, 'GUID');
$transportGuid_str = implode(',', $transportGuid); $transportGuid_str = implode(',', $transportGuid);
......
...@@ -33,15 +33,15 @@ class UserComplainController extends BaseController ...@@ -33,15 +33,15 @@ class UserComplainController extends BaseController
if ($model->validate()) { if ($model->validate()) {
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$phone = $model->TS_PHONE; $phone = $model->TS_PHONE;
$info = $model->UserComplainInfo($phone); $info = $model->userComplainInfo($phone);
if (!$info->getModels()) { if (!$info->getModels()) {
throw new BadRequestHttpException('未找到符合的留言信息'); throw new BadRequestHttpException('未找到符合的留言信息');
} }
return $info; return $info;
} else { } else {
//验证失败:$errors 是一个包含错误信息的数组 //验证失败:$errors 是一个包含错误信息的数组
$errors = $model->errors; Yii::$app->response->statusCode = 422;
return $errors; return $model->errors;
} }
} }
} }
...@@ -36,15 +36,15 @@ class UserDepartmentController extends BaseController ...@@ -36,15 +36,15 @@ class UserDepartmentController extends BaseController
//所有输入数据都有效 all inputs are valid //所有输入数据都有效 all inputs are valid
$code = $model->CODE; $code = $model->CODE;
$name = $model->NAME; $name = $model->NAME;
$info = $model->DepartmentInfo($code, $name); $info = $model->departmentInfo($code, $name);
if (!$info->getModels()) { if (!$info->getModels()) {
throw new BadRequestHttpException('未找到符合的部门信息'); throw new BadRequestHttpException('未找到符合的部门信息');
} }
return $info; return $info;
} else { } else {
//验证失败:$errors 是一个包含错误信息的数组 //验证失败:$errors 是一个包含错误信息的数组
$errors = $model->errors; Yii::$app->response->statusCode = 422;
return $errors; return $model->errors;
} }
} }
} }
...@@ -77,7 +77,7 @@ class O2oDeliveryController extends BaseController ...@@ -77,7 +77,7 @@ class O2oDeliveryController extends BaseController
->andFilterWhere(['scds.SETTING_TYPE'=>O2O_FLAG])//设定为o2o配送 ->andFilterWhere(['scds.SETTING_TYPE'=>O2O_FLAG])//设定为o2o配送
->andFilterWhere(['or',['sb.CODE'=>$model->BRANCH_INFO],['like','sb.NAME',$model->BRANCH_INFO]]) ->andFilterWhere(['or',['sb.CODE'=>$model->BRANCH_INFO],['like','sb.NAME',$model->BRANCH_INFO]])
->andFilterWhere(['sb.GUID'=>$branchGuid]) ->andFilterWhere(['sb.GUID'=>$branchGuid])
->orFilterWhere(['sb.PARENTGUID'=>$parentBranchGuid]) ->orFilterWhere(['sb.PARENT_GUID'=>$parentBranchGuid])
->asArray()->all(); ->asArray()->all();
return new ArrayDataProvider( return new ArrayDataProvider(
[ [
......
...@@ -6,11 +6,9 @@ use Yii; ...@@ -6,11 +6,9 @@ use Yii;
use backend\controllers\v1\BaseController; use backend\controllers\v1\BaseController;
use app\models\v1\branch\ShopCityDistributionRegion; use app\models\v1\branch\ShopCityDistributionRegion;
use yii\web\BadRequestHttpException; use yii\web\BadRequestHttpException;
use yii\web\ServerErrorHttpException;
use yii\web\UploadedFile; use yii\web\UploadedFile;
use backend\helpers\UploadFiles; use backend\helpers\UploadFiles;
use yidas\phpSpreadsheet\Helper; use yidas\phpSpreadsheet\Helper;
use backend\helpers\Func;
use yii\web\HttpException; use yii\web\HttpException;
use app\models\v1\rbacuser\ShopRbacUser; use app\models\v1\rbacuser\ShopRbacUser;
use app\models\v1\branch\ShopBranch; use app\models\v1\branch\ShopBranch;
...@@ -135,7 +133,6 @@ class TransportInitialPriceController extends BaseController ...@@ -135,7 +133,6 @@ class TransportInitialPriceController extends BaseController
$model->setAttributes($param); $model->setAttributes($param);
if ($model->save() === false && !$model->hasErrors()) { if ($model->save() === false && !$model->hasErrors()) {
// throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
throw new HttpException(500, '修改失败'); throw new HttpException(500, '修改失败');
} }
Yii::$app->getResponse()->setStatusCode(202); Yii::$app->getResponse()->setStatusCode(202);
...@@ -208,8 +205,8 @@ class TransportInitialPriceController extends BaseController ...@@ -208,8 +205,8 @@ class TransportInitialPriceController extends BaseController
// if ($userinfo['ROLE_ID'] == USER_ROLE_REGION_ADMIN) { // if ($userinfo['ROLE_ID'] == USER_ROLE_REGION_ADMIN) {
// //如果是省级,查询出该门店是否是该省级下的 // //如果是省级,查询出该门店是否是该省级下的
// $branchModel = new ShopBranch(); // $branchModel = new ShopBranch();
// $isbrancharr = $branchModel->GetBranch($CS_BRANCH_GUID, $userinfo['BRANCH_GUID']); // $isbrancharr = $branchModel->getBranch($CS_BRANCH_GUID, $userinfo['BRANCH_GUID']);
// // $isbrancharr = $branchModel->GetBranch(003, 003); // // $isbrancharr = $branchModel->getBranch(003, 003);
// if (!$isbrancharr) { // if (!$isbrancharr) {
// continue; // continue;
// } // }
......
...@@ -61,7 +61,7 @@ class BranchServiceType extends BaseModel ...@@ -61,7 +61,7 @@ class BranchServiceType extends BaseModel
]; ];
} }
//门店-门店服务类目信息 //门店-门店服务类目信息
public function BranchServiceInfo($code, $name, $guid = '') public function branchServiceInfo($code, $name, $guid = '')
{ {
$query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME'); $query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME');
...@@ -81,13 +81,13 @@ class BranchServiceType extends BaseModel ...@@ -81,13 +81,13 @@ class BranchServiceType extends BaseModel
[ [
'query' => $query->asArray(), 'query' => $query->asArray(),
'pagination' => [ 'pagination' => [
'pageSize' => 15, 'pageSize' => PAGE_SIZE,
] ]
] ]
); );
} }
//门店-门店服务类目信息 全部 //门店-门店服务类目信息 全部
public function BranchServiceInfoAll() public function branchServiceInfoAll()
{ {
$query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME') $query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME')
->all(); ->all();
...@@ -95,7 +95,7 @@ class BranchServiceType extends BaseModel ...@@ -95,7 +95,7 @@ class BranchServiceType extends BaseModel
return $query; return $query;
} }
//门店服务类目导出 //门店服务类目导出
public function BranchServiceExport($params) public function branchServiceExport($params)
{ {
$query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME'); $query = static::find()->select('GUID,NAME,CODE,THEME_COLOR,DESCRIPTION,CREATE_TIME');
......
...@@ -276,7 +276,7 @@ class ShopBranch extends BaseModel ...@@ -276,7 +276,7 @@ class ShopBranch extends BaseModel
* @params array $params 查询参数数组 * @params array $params 查询参数数组
* @return array|null 返回查询结果 * @return array|null 返回查询结果
*/ */
public function BranchInfo($params) public function branchInfo($params)
{ {
$query = static::find()->alias('sb') $query = static::find()->alias('sb')
->select("sb.GUID,sb.NAME,sb.CONTACT_NAME,sb.PARENT_GUID,sb.CODE,sb.ADDRESS,sb.PHONE,sb.LAT, ->select("sb.GUID,sb.NAME,sb.CONTACT_NAME,sb.PARENT_GUID,sb.CODE,sb.ADDRESS,sb.PHONE,sb.LAT,
...@@ -349,7 +349,7 @@ class ShopBranch extends BaseModel ...@@ -349,7 +349,7 @@ class ShopBranch extends BaseModel
* @params array $params 查询参数数组 * @params array $params 查询参数数组
* @return array|null 返回查询结果 * @return array|null 返回查询结果
*/ */
public function BranchDetail($GUID) public function branchDetail($GUID)
{ {
$query = static::find() $query = static::find()
->select('GUID,NAME,CODE,LICENCE_IMAGE_PATH,RECIVER_PROVINCE,RECIVER_CITY,RECIVER_REGION,ADDRESS,PARENT_GUID, ->select('GUID,NAME,CODE,LICENCE_IMAGE_PATH,RECIVER_PROVINCE,RECIVER_CITY,RECIVER_REGION,ADDRESS,PARENT_GUID,
...@@ -363,7 +363,7 @@ class ShopBranch extends BaseModel ...@@ -363,7 +363,7 @@ class ShopBranch extends BaseModel
]); ]);
} }
//获取门店(权限下的) //获取门店(权限下的)
public function GetBranch($GUID, $SUPPROVINCE_GUID) public function getBranch($GUID, $SUPPROVINCE_GUID)
{ {
$query = static::find() $query = static::find()
->select('GUID,SUPPROVINCE_GUID') ->select('GUID,SUPPROVINCE_GUID')
......
...@@ -53,13 +53,13 @@ class ShopBranchService extends BaseModel ...@@ -53,13 +53,13 @@ class ShopBranchService extends BaseModel
]; ];
} }
//删除门店原有服务类目 //删除门店原有服务类目
public function BranchServiceDel($b_guid) public function branchServiceDel($b_guid)
{ {
$branchService = static::deleteAll(['BRANCH_GUID' => $b_guid]); $branchService = static::deleteAll(['BRANCH_GUID' => $b_guid]);
return $branchService; return $branchService;
} }
//获取门店服务类目关系 //获取门店服务类目关系
public function BranchSeviceRelation($b_guid) public function branchSeviceRelation($b_guid)
{ {
$branchService = static::find() $branchService = static::find()
->select('GUID,BRANCH_GUID,SERVICE_TYPE_GUID') ->select('GUID,BRANCH_GUID,SERVICE_TYPE_GUID')
......
...@@ -77,7 +77,7 @@ class UserComplain extends BaseModel ...@@ -77,7 +77,7 @@ class UserComplain extends BaseModel
]; ];
} }
//用户留言信息 //用户留言信息
public function UserComplainInfo($phone) public function userComplainInfo($phone)
{ {
$query = static::find() $query = static::find()
->from('shop_user_complain suc') ->from('shop_user_complain suc')
...@@ -90,7 +90,7 @@ class UserComplain extends BaseModel ...@@ -90,7 +90,7 @@ class UserComplain extends BaseModel
[ [
'query' => $query->asArray(), 'query' => $query->asArray(),
'pagination' => [ 'pagination' => [
'pageSize' => 15, 'pageSize' => PAGE_SIZE,
] ]
] ]
); );
......
...@@ -57,11 +57,9 @@ class UserDepartment extends BaseModel ...@@ -57,11 +57,9 @@ class UserDepartment extends BaseModel
]; ];
} }
//用户-部门信息 //用户-部门信息
public function DepartmentInfo($code, $name) public function departmentInfo($code, $name)
{ {
//$org_guid = 2;
$query = static::find()->select('GUID,NAME,CODE,COMPANY,SUB_COMPANY,UPDATE_TIME'); $query = static::find()->select('GUID,NAME,CODE,COMPANY,SUB_COMPANY,UPDATE_TIME');
//->where(['ORG_GUID' => $org_guid]);
if (isset($name) && !empty($name)) { if (isset($name) && !empty($name)) {
$query->andWhere(['like', 'NAME', $name]); $query->andWhere(['like', 'NAME', $name]);
...@@ -74,7 +72,7 @@ class UserDepartment extends BaseModel ...@@ -74,7 +72,7 @@ class UserDepartment extends BaseModel
[ [
'query' => $query->asArray(), 'query' => $query->asArray(),
'pagination' => [ 'pagination' => [
'pageSize' => 15, 'pageSize' => PAGE_SIZE,
] ]
] ]
); );
......
...@@ -72,7 +72,7 @@ class ShopTransportType extends BaseModel ...@@ -72,7 +72,7 @@ class ShopTransportType extends BaseModel
]; ];
} }
//门店-配送方式信息 //门店-配送方式信息
public function BranchTransportInfo($name = '') public function branchTransportInfo($name = '')
{ {
return $query = static::find() return $query = static::find()
->select('GUID,NAME') ->select('GUID,NAME')
......
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