Commit 0f466f9b authored by 姚书霞's avatar 姚书霞 🐘

DC仓编辑

parent 982577b0
...@@ -49,6 +49,8 @@ return [ ...@@ -49,6 +49,8 @@ return [
'GET,OPTIONS export-branch' => 'export-branch', 'GET,OPTIONS export-branch' => 'export-branch',
'GET,OPTIONS dc-branch-list' => 'dc-branch-list', 'GET,OPTIONS dc-branch-list' => 'dc-branch-list',
'GET,OPTIONS dc-branch-export' => 'dc-branch-export', 'GET,OPTIONS dc-branch-export' => 'dc-branch-export',
'GET,OPTIONS dc-branch-detail' => 'dc-branch-detail',
'PUT,OPTIONS dc-branch-revise' => 'dc-branch-revise',
], ],
], ],
//门店评分 //门店评分
......
...@@ -886,4 +886,100 @@ class BranchController extends BaseController ...@@ -886,4 +886,100 @@ class BranchController extends BaseController
->addRows($export_result) ->addRows($export_result)
->output("DC仓列表","Csv"); ->output("DC仓列表","Csv");
} }
/**
* @OA\Get(
* path="/backend/web/v1/branch/branches/dc-branch-detail",
* tags={"门店&DC"},
* description="DC仓详情接口",
* summary="DC仓详情(姚书侠)",
* @OA\Parameter(name="guid",in="query",description="DC仓GUID",@OA\Schema(type="string")),
* @OA\Response(response="200",description="success"),
* security={{"Authorization": {}}}
* )
*/
public function actionDcBranchDetail()
{
$model = new $this->modelClass();
$guid = Yii::$app->request->getQueryParam('guid');
$info = $model->BranchDetail($guid);
if (!$info) {
throw new BadRequestHttpException('未找到符合的DC信息');
}
return $info;
}
/**
* @OA\PUT(
* path="/backend/web/v1/branch/branches/dc-branch-revise",
* tags={"门店&DC"},
* summary="修改DC接口(姚书侠)",
* description="修改DC接口",
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="application/x-www-form-urlencoded",
* @OA\Schema(
* type="object",
* @OA\Property(property="GUID",description="要修改的DC的GUID",type="string"),
* @OA\Property(property="NAME",description="DC名称,最长20字",type="string"),
* @OA\Property(property="BRANCH_NAME",description="DC简称",type="string"),
* @OA\Property(property="RECIVER_PROVINCE",description="省份编号",type="string"),
* @OA\Property(property="RECIVER_CITY",description="城市编号",type="string"),
* @OA\Property(property="RECIVER_REGION",description="区域编号",type="string"),
* @OA\Property(property="ADDRESS",description="详细地址",type="string"),
* @OA\Property(property="PHONE",description="电话/手机号",type="string"),
* @OA\Property(property="CONTACT_NAME",description="联系人姓名",type="string"),
* @OA\Property(property="BRANCH_TYPE",description="DC仓类型 1分公司 2区域",type="string"),
* @OA\Property(property="LAT",description="坐标LAT",type="string"),
* @OA\Property(property="LNG",description="坐标LNG",type="string"),
* @OA\Property(property="IS_SHELVE",description="是否营业",type="int"),
* @OA\Property(property="WORK_TIME_START",description="开始营业时间",type="string"),
* @OA\Property(property="WORK_TIME_END",description="结束营业时间",type="string"),
* @OA\Property(property="DELIVERY_TIME_START",description="开始配送时间",type="string"),
* @OA\Property(property="DELIVERY_TIME_END",description="结束配送时间",type="string"),
* @OA\Property(property="RETURN_ADDRESS",description="退货地址",type="string"),
* @OA\Property(property="DESCRIPTION",description="描述",type="string")
* )
* )
* ),
* @OA\Response(response=200,description="success"),
* security={{"Authorization": {}}}
* )
*/
public function actionDcBranchRevise()
{
$param = Yii::$app->request->getBodyParams();
$guid = Yii::$app->request->getBodyParam('GUID');
$model = $this->modelClass::findOne($guid);
if(!$model){
throw new BadRequestHttpException('没有找到要修改的记录');
}
//营业时间
if(!empty($param['WORK_TIME_START']) && !empty($param['WORK_TIME_END'])){
$WORK_TIME = $param['WORK_TIME_START'].'-'.$param['WORK_TIME_END'];
}else{
$WORK_TIME = '';
}
//配送时间
if(!empty($param['DELIVERY_TIME_START']) && !empty($param['DELIVERY_TIME_END'])){
$DELIVERY_TIME = $param['DELIVERY_TIME_START'].'-'.$param['DELIVERY_TIME_END'];
}else{
$DELIVERY_TIME = '';
}
//门店信息修改
$model->scenario = 'dcUpdate';//创建的场景
$other_param = array(
'UPDATE_TIME'=>date('Y-m-d H:i:s',time()),
'WORK_TIME'=>$WORK_TIME,
'DELIVERY_TIME'=>$DELIVERY_TIME,
);
$model->setAttributes($other_param);
$model->setAttributes(Yii::$app->getRequest()->post());
if ($model->save() === false && !$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
}
return $model;
}
} }
...@@ -21,7 +21,15 @@ class CompanyController extends BaseController ...@@ -21,7 +21,15 @@ class CompanyController extends BaseController
* description="快递方式列表接口", * description="快递方式列表接口",
* @OA\Parameter(in = "query",name = "page",description = "分页页码",required = false,@OA\Schema(type="string")), * @OA\Parameter(in = "query",name = "page",description = "分页页码",required = false,@OA\Schema(type="string")),
* @OA\Parameter(in = "query",name = "pageSize",description = "分页大小",required = false,@OA\Schema(type="string")), * @OA\Parameter(in = "query",name = "pageSize",description = "分页大小",required = false,@OA\Schema(type="string")),
* @OA\Response(response = 200,description = "success"), * @OA\Response(response = 200,description = "
* GUID:快递方式GUID,
* CODE:快递方式CODE,
* NAME:快递方式名称,
* PHONE:手机号,
* SORT:排序,
* DESCRIPTION:描述,
* IS_DEFAULT:是否默认 1是0否
* "),
* security={{"Authorization": {}}} * security={{"Authorization": {}}}
* ) * )
*/ */
...@@ -47,7 +55,15 @@ class CompanyController extends BaseController ...@@ -47,7 +55,15 @@ class CompanyController extends BaseController
* summary="快递方式详情接口(姚书侠)", * summary="快递方式详情接口(姚书侠)",
* description="快递方式详情接口", * description="快递方式详情接口",
* @OA\Parameter(name="guid",in="query",required=true,description="快递方式id",@OA\Schema(type="string")), * @OA\Parameter(name="guid",in="query",required=true,description="快递方式id",@OA\Schema(type="string")),
* @OA\Response(response = 200,description = "success"), * @OA\Response(response = 200,description = "
* GUID:快递方式GUID,
* CODE:快递方式CODE,
* NAME:快递方式名称,
* PHONE:手机号,
* SORT:排序,
* DESCRIPTION:描述,
* IS_DEFAULT:是否默认 1是0否
* "),
* security={{"Authorization": {}}} * security={{"Authorization": {}}}
* ) * )
*/ */
...@@ -123,7 +139,7 @@ class CompanyController extends BaseController ...@@ -123,7 +139,7 @@ class CompanyController extends BaseController
* ) * )
* ) * )
* ), * ),
* @OA\Response(response=200,description="成功时返回access-token"), * @OA\Response(response=200,description="success"),
* security={{"Authorization": {}}} * security={{"Authorization": {}}}
* ) * )
*/ */
...@@ -161,7 +177,7 @@ class CompanyController extends BaseController ...@@ -161,7 +177,7 @@ class CompanyController extends BaseController
* ) * )
* ) * )
* ), * ),
* @OA\Response(response=200,description="成功时返回access-token"), * @OA\Response(response=204,description="success"),
* security={{"Authorization": {}}} * security={{"Authorization": {}}}
* ) * )
*/ */
......
...@@ -92,6 +92,7 @@ class ShopBranch extends BaseModel ...@@ -92,6 +92,7 @@ class ShopBranch extends BaseModel
{ {
return 'shop_branch'; return 'shop_branch';
} }
const SCENARIO_DCUPDATE = 'dcUpdate';
public $IS_BRANCH_SELF_MENTION;//是否门店自提 public $IS_BRANCH_SELF_MENTION;//是否门店自提
public $IS_BRANCH_EXPRESS_DELIVERY;//是否门店快递配送 public $IS_BRANCH_EXPRESS_DELIVERY;//是否门店快递配送
...@@ -103,6 +104,19 @@ class ShopBranch extends BaseModel ...@@ -103,6 +104,19 @@ class ShopBranch extends BaseModel
public $IS_TWO_HOUR_DELIVERY;//是否2小时达 public $IS_TWO_HOUR_DELIVERY;//是否2小时达
public $IS_DAY_DELIVERY;//是否当日定时达 public $IS_DAY_DELIVERY;//是否当日定时达
public $SERVICE_TYPE_CODE;//服务门店CODE public $SERVICE_TYPE_CODE;//服务门店CODE
/**
* 场景值的重写
* {@inheritdoc}
*/
public function scenarios()
{
$scenarios = parent::scenarios();
$scenarios[self::SCENARIO_DCUPDATE] = ['NAME','BRANCH_NAME', 'RECIVER_PROVINCE', 'RECIVER_CITY','RECIVER_REGION','ADDRESS','PHONE',
'CONTACT_NAME','BRANCH_TYPE','LAT','LNG','IS_SHELVE','WORK_TIME','DELIVERY_TIME','RETURN_ADDRESS','DESCRIPTION',
'UPDATE_TIME'];
return $scenarios;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -138,6 +152,8 @@ class ShopBranch extends BaseModel ...@@ -138,6 +152,8 @@ class ShopBranch extends BaseModel
'IS_DAY_DELIVERY'], 'in','range' => [0,1],'on'=>['import'],'message' => '{attribute}只能为0或1'], 'IS_DAY_DELIVERY'], 'in','range' => [0,1],'on'=>['import'],'message' => '{attribute}只能为0或1'],
[['SERVICE_TYPE_CODE'], 'validateEffective'],//如果影响性能就注释掉 [['SERVICE_TYPE_CODE'], 'validateEffective'],//如果影响性能就注释掉
[['BRANCH_NAME', 'NAME','BRANCH_TYPE'], 'required','on'=>[self::SCENARIO_DCUPDATE]],
[['BRANCH_TYPE'], 'in', 'range' => [1, 2],'on'=>[self::SCENARIO_DCUPDATE]],
]; ];
} }
//验证服务类目的有效性 //验证服务类目的有效性
...@@ -167,7 +183,7 @@ class ShopBranch extends BaseModel ...@@ -167,7 +183,7 @@ class ShopBranch extends BaseModel
'GUID' => '主键', 'GUID' => '主键',
'ORG_GUID' => '组织机构号', 'ORG_GUID' => '组织机构号',
'CODE' => '门店编码', 'CODE' => '门店编码',
'NAME' => '门店称', 'NAME' => '门店称',
'PARENT_GUID' => '上级GUID', 'PARENT_GUID' => '上级GUID',
'DESCRIPTION' => '描述', 'DESCRIPTION' => '描述',
'ADDRESS' => '地址', 'ADDRESS' => '地址',
......
...@@ -50,8 +50,8 @@ class ShopTransportCompany extends BaseModel ...@@ -50,8 +50,8 @@ class ShopTransportCompany extends BaseModel
public function rules() public function rules()
{ {
return [ return [
[['GUID', 'ORG_GUID', 'CODE', 'IS_DEFAULT','NAME'], 'required','message'=>'{attribute}为必填项','on'=>['create']], [['GUID', 'ORG_GUID', 'CODE', 'IS_DEFAULT','NAME'], 'required','message'=>'{attribute}为必填项','on'=>self::SCENARIO_CREATE],
[['CODE', 'IS_DEFAULT','NAME'], 'required','message'=>'{attribute}为必填项','on'=>['update']], [['CODE', 'IS_DEFAULT','NAME'], 'required','message'=>'{attribute}为必填项','on'=>self::SCENARIO_UPDATE],
[['PHONE'], 'match','pattern' => '/^1\d{10}$/','message'=>'手机号格式不正确'], [['PHONE'], 'match','pattern' => '/^1\d{10}$/','message'=>'手机号格式不正确'],
[['IS_DEFAULT'], 'boolean','message'=>'{attribute}传值错误'], [['IS_DEFAULT'], 'boolean','message'=>'{attribute}传值错误'],
]; ];
......
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