Commit d14e7516 authored by 孙磊's avatar 孙磊

变量规范

Signed-off-by: 孙磊's avatarsunlei <sunlei@romens.cn>
parent aac74497
......@@ -336,20 +336,20 @@ class AuthorityNodeController extends BaseController
//获取登陆用户节点信息
$userGuid = Yii::$app->user->identity->GUID;
$userinfo = $rbac->getRbacUserInfo($userGuid);
$cur_role_id = $userinfo['ROLE_ID'];
$cur_auth_all = $roleAcessModel->getRoleAuthorities($cur_role_id);
if (!$cur_auth_all) {
$curRoleId = $userinfo['ROLE_ID'];
$curAuthAll = $roleAcessModel->getRoleAuthorities($curRoleId);
if (!$curAuthAll) {
throw new BadRequestHttpException('没有找到登陆用户的权限信息,请核查');
}
//获取登陆用户节点ID
$cur_role_nodes = array();
foreach ($cur_auth_all as $k => $v) {
$cur_role_nodes[] = $v['NODE_ID'];
$curRoleNodes = array();
foreach ($curAuthAll as $k => $v) {
$curRoleNodes[] = $v['NODE_ID'];
}
if ($cur_role_nodes) {
$cur_role_authorities = $nodeModel->getRoleAuthrities($cur_role_nodes);
if ($curRoleNodes) {
$curRoleAuthorities = $nodeModel->getRoleAuthrities($curRoleNodes);
} else {
$cur_role_authorities = '';
$curRoleAuthorities = '';
}
//每个角色拥有的节点信息获取
$params = Yii::$app->request->queryParams;
......@@ -375,7 +375,7 @@ class AuthorityNodeController extends BaseController
}
//拼装数组
$roleNodeInfo = array(
'cur_role_nodes' => $cur_role_authorities,
'cur_role_nodes' => $curRoleAuthorities,
'every_role_node_ids' => $roleHasAuthInfo,
'every_role_name' => $name
);
......
......@@ -202,14 +202,14 @@ class AuthorityRoleController extends BaseController
}
$nodes_arr = explode(',', $params['NODE_ID']);
//拼装信息
$role_access = array();
$roleAccess = array();
foreach ($nodes_arr as $k => $v) {
$role_access[$k]['ROLE_ID'] = $params['ROLE_ID'];
$role_access[$k]['NODE_ID'] = $v;
$role_access[$k]['ORG_GUID'] = Yii::$app->user->identity->ORG_GUID;
$roleAccess[$k]['ROLE_ID'] = $params['ROLE_ID'];
$roleAccess[$k]['NODE_ID'] = $v;
$roleAccess[$k]['ORG_GUID'] = Yii::$app->user->identity->ORG_GUID;
}
//保存信息
foreach ($role_access as $attributes) {
foreach ($roleAccess as $attributes) {
$_model = clone $model;
$_model->setAttributes($attributes);
if (!$_model->save()) {
......
......@@ -111,8 +111,8 @@ class BranchController extends BaseController
{
$model = new $this->modelClass();
$params = Yii::$app->request->queryParams;
$branch_service = new ShopBranchService();
$branch_service_type = new BranchServiceType();
$branchService = new ShopBranchService();
$branchServiceType = new BranchServiceType();
$model->attributes = $params;
if ($model->validate()) {
......@@ -122,24 +122,24 @@ class BranchController extends BaseController
throw new BadRequestHttpException('未找到符合的门店列表信息');
}
//获取门店服务类目关系信息
$branch_service_relation = $branch_service->BranchSeviceRelation($params['GUID']);
$branchServiceRelation = $branchService->BranchSeviceRelation($params['GUID']);
//获取门店服务类目名称
if ($branch_service_relation) {
foreach ($branch_service_relation as $k => $v) {
$branch_s_type = $branch_service_type->BranchServiceInfo('', '', $v['SERVICE_TYPE_GUID']);
$branch_ser_type = $branch_s_type->getModels();
if ($branchServiceRelation) {
foreach ($branchServiceRelation as $k => $v) {
$branchSType = $branchServiceType->BranchServiceInfo('', '', $v['SERVICE_TYPE_GUID']);
$branchSerType = $branchSType->getModels();
//获取服务类目信息
if ($branch_ser_type) {
$branch_service_relation[$k]['BRANCH_SERVICE_TYPE_NAME'] = $branch_ser_type[0]['NAME'];
// unset($branch_service_relation[$k]['GUID']);
// unset($branch_service_relation[$k]['BRANCH_GUID']);
if ($branchSerType) {
$branchServiceRelation[$k]['BRANCH_SERVICE_TYPE_NAME'] = $branchSerType[0]['NAME'];
// unset($branchServiceRelation[$k]['GUID']);
// unset($branchServiceRelation[$k]['BRANCH_GUID']);
} else {
$branch_service_relation[$k]['SERVICE_TYPE_GUID'] = '';
$branch_service_relation[$k]['BRANCH_SERVICE_TYPE_NAME'] = '';
$branchServiceRelation[$k]['SERVICE_TYPE_GUID'] = '';
$branchServiceRelation[$k]['BRANCH_SERVICE_TYPE_NAME'] = '';
}
}
}
$info['BRANCH_SERVICE_TYPE'] = $branch_service_relation;
$info['BRANCH_SERVICE_TYPE'] = $branchServiceRelation;
return $info;
} else {
//验证失败:$errors 是一个包含错误信息的数组
......@@ -356,7 +356,7 @@ class BranchController extends BaseController
$rbac = new ShopRbacUser();
$userGuid = Yii::$app->user->identity->GUID;
$userinfo = $rbac->getRbacUserInfo($userGuid);
$auth_role = $userinfo['ROLE_ID'];
$authRole = $userinfo['ROLE_ID'];
$model = new $this->modelClass();
$SUPPROVINCE_GUID = $model->SUPPROVINCE_GUID = Yii::$app->request->get('SUPPROVINCE_GUID');
......@@ -367,7 +367,7 @@ class BranchController extends BaseController
if (!$info) {
throw new BadRequestHttpException('未找到符合的门店区域信息');
}
$info[0]['ROLE_ID'] = $auth_role;
$info[0]['ROLE_ID'] = $authRole;
return $info;
} else {
//验证失败:$errors 是一个包含错误信息的数组
......@@ -395,7 +395,7 @@ class BranchController extends BaseController
$rbac = new ShopRbacUser();
$userGuid = Yii::$app->user->identity->GUID;
$userinfo = $rbac->getRbacUserInfo($userGuid);
$auth_role = $userinfo['ROLE_ID'];
$authRole = $userinfo['ROLE_ID'];
$model = new $this->modelClass();
$SUPPROVINCE_GUID = $model->SUPPROVINCE_GUID = Yii::$app->request->get('SUPPROVINCE_GUID');
......@@ -406,7 +406,7 @@ class BranchController extends BaseController
if (!$info) {
throw new BadRequestHttpException('未找到符合的门店区域信息');
}
$info[0]['ROLE_ID'] = $auth_role;
$info[0]['ROLE_ID'] = $authRole;
return $info;
} else {
//验证失败:$errors 是一个包含错误信息的数组
......
......@@ -67,21 +67,21 @@ class ImportGoodsInfoController extends BaseController
$subsidiaryModel = new ShopGoodsSubsidiary();
$ORG_GUID = Yii::$app->user->identity->ORG_GUID;
//图片相关
$host_name = YUNUO_YUN_URL;
$pic_ext = PIC_EXTENSIONS;
$hostName = YUNUO_YUN_URL;
$picExt = PIC_EXTENSIONS;
//批量处理商品标签、品牌
$all_tag = array();
$all_brand = array();
$allTag = array();
$allBrand = array();
foreach ($tempArr as $k => $v) {
$all_brand[] = $v[3];
$all_tag[] = $v[18];
$allBrand[] = $v[3];
$allTag[] = $v[18];
}
//查看商品品牌表是否有值,没有则添加
if ($all_brand) {
$goods_brand_info = $brandModel->validateBrand($all_brand);
if ($allBrand) {
$goodsBrandInfo = $brandModel->validateBrand($allBrand);
//存在则添加
if ($goods_brand_info) {
foreach ($goods_brand_info as $k => $v) {
if ($goodsBrandInfo) {
foreach ($goodsBrandInfo as $k => $v) {
$_brandModel = clone $brandModel;
$_brandModel->GUID = Func::create_guid();
$_brandModel->ORG_GUID = $ORG_GUID;
......@@ -94,12 +94,12 @@ class ImportGoodsInfoController extends BaseController
}
}
//查看商品标签表是否有值,没有则添加
if ($all_tag) {
foreach ($all_tag as $k => $v) {
if ($allTag) {
foreach ($allTag as $k => $v) {
$v = preg_replace("/,/", ",", $v);
$all_tag[$k] = explode(',', $v);
$allTag[$k] = explode(',', $v);
}
$setgoodstag = $propertyModel->validateProperty($all_tag);
$setgoodstag = $propertyModel->validateProperty($allTag);
//存在则添加
if ($setgoodstag) {
foreach ($setgoodstag as $val) {
......@@ -181,8 +181,8 @@ class ImportGoodsInfoController extends BaseController
$_shopModel->BRAND_GUID = $brandInfo[0]['GUID'];
}
//添加或更新
$_shopModel->HOST_NAME = $host_name; //图品域名
$_shopModel->PIC_EXTENSIONS = $pic_ext; //图品后缀
$_shopModel->HOST_NAME = $hostName; //图品域名
$_shopModel->PIC_EXTENSIONS = $picExt; //图品后缀
$_shopModel->CODE = $value[0]; //商品编码
$_shopModel->NAME = $value[1]; //药品名
$_shopModel->APPROVAL_NUMBER = $value[2]; //批准文号
......@@ -367,9 +367,9 @@ class ImportGoodsInfoController extends BaseController
$fileLoadPath = $supCompanyGuid . '/' . $value[0] . '/' . $value[0];
//条件验证
if ($value[3] == 1) {
$host_name = YUNUO_YUN_URL;
$hostName = YUNUO_YUN_URL;
$picFilePath = $fileLoadPath . '-1.jpg';
$imgUrl = $host_name . $picFilePath;
$imgUrl = $hostName . $picFilePath;
$value[3] = $imgUrl; //商品图片
} else {
$value[3] = '';
......@@ -433,7 +433,7 @@ class ImportGoodsInfoController extends BaseController
$_attachModel->GOODS_CODE = $value[0]; //商品编码
$_attachModel->GOODS_TITLE = $value[1]; //商品标题
$_attachModel->GOODS_ABSTRACT = $value[2]; //商品摘要
$_attachModel->HOST_NAME = $host_name; //商品图片 域名
$_attachModel->HOST_NAME = $hostName; //商品图片 域名
$_attachModel->URI = $value[3]; //商品图片 路径
$_attachModel->TRANSPORT_TYPE = $value[5]; //配送方式
$_attachModel->STOCK_REDUCE_TYPE = $value[6]; //支付前减库存
......@@ -498,7 +498,7 @@ class ImportGoodsInfoController extends BaseController
public function BatchUpdateGoodsExteninfo($GoodAttachGuid, $AttachInfoNum, $goodCode)
{
$ORG_GUID = Yii::$app->user->identity->ORG_GUID;
$host_name = YUNUO_YUN_URL;
$hostName = YUNUO_YUN_URL;
//先删除原有 子图信息
$SAttachModel = new ShopSAttach();
$SAttachModel->deleteByGoodsGuid($GoodAttachGuid);
......@@ -514,14 +514,14 @@ class ImportGoodsInfoController extends BaseController
$fileLoadPath = $supCompanyGuid . '/' . $goodCode . '/' . $goodCode . '-';
for ($i = 2; $i <= $AttachInfoNum; $i++) {
$imgsNewId = Func::create_guid();
// $filePath = $host_name . $fileLoadPath . $i . '.jpg';
// $filePath = $hostName . $fileLoadPath . $i . '.jpg';
$filesPath = $fileLoadPath . $i . '.jpg';
//验证
$_SAttachModel = clone $SAttachModel;
$_SAttachModel->GUID = $imgsNewId;
$_SAttachModel->ORG_GUID = $ORG_GUID;
$_SAttachModel->GOODS_GUID = $GoodAttachGuid;
$_SAttachModel->HOST_NAME = $host_name;
$_SAttachModel->HOST_NAME = $hostName;
$_SAttachModel->URI = $filesPath;
$_SAttachModel->ORDER_INDEX = (string) $i;
$_SAttachModel->TYPE = 1;
......
......@@ -55,19 +55,19 @@ class ShopBranchService extends BaseModel
//删除门店原有服务类目
public function BranchServiceDel($b_guid)
{
$branch_service = static::deleteAll(['BRANCH_GUID' => $b_guid]);
return $branch_service;
$branchService = static::deleteAll(['BRANCH_GUID' => $b_guid]);
return $branchService;
}
//获取门店服务类目关系
public function BranchSeviceRelation($b_guid)
{
$branch_service = static::find()
$branchService = static::find()
->select('GUID,BRANCH_GUID,SERVICE_TYPE_GUID')
->where(['STATE' => 1])
->andwhere(['BRANCH_GUID' => $b_guid])
->asArray()
->all();
return $branch_service;
return $branchService;
}
}
......@@ -73,7 +73,7 @@ class ShopGoodsBrand extends BaseModel
/**
* 获取商品品牌是否存在
*/
public function validateBrand($all_brand)
public function validateBrand($allBrand)
{
$query = static::find()
->select('GUID,NAME')
......@@ -81,7 +81,7 @@ class ShopGoodsBrand extends BaseModel
//获取所有品牌名
$brandsName = array_column($query, 'NAME');
$list = array();
foreach ($all_brand as $key => $value) {
foreach ($allBrand as $key => $value) {
if (!in_array($value, $brandsName)) {
$list[] = $value;
}
......
......@@ -57,7 +57,7 @@ class ShopGoodsProperty extends BaseModel
/**
* 获取商品标签信息
*/
public function validateProperty($all_tag)
public function validateProperty($allTag)
{
$query = static::find()
->select('GUID,NAME')
......@@ -65,7 +65,7 @@ class ShopGoodsProperty extends BaseModel
//获取所有标签名
$tagsName = array_column($query, 'NAME');
$list = array();
foreach ($all_tag as $key => $value) {
foreach ($allTag as $key => $value) {
foreach ($value as $k => $v) {
if (!in_array($v, $tagsName)) {
$list[] = $v;
......
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