97 行
2.2 KiB
PHP
可执行文件
97 行
2.2 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Common\Business;
|
|
|
|
use Common\Model\SPurchaseWarehouseModel;
|
|
|
|
//[1.6.48]
|
|
|
|
/**
|
|
* 采购仓库类
|
|
* Class PurchaseWarehouse
|
|
* [
|
|
* 指定字段采购仓库列表 getList
|
|
* 查询条件 Term
|
|
* 参数验证 verify
|
|
* ]
|
|
* @package Common\Business
|
|
*/
|
|
class PurchaseWarehouse
|
|
{
|
|
/**
|
|
* 指定字段采购仓库列表
|
|
* @param $param
|
|
* [
|
|
* user_type 3商户 4门店
|
|
* merchant_id
|
|
* store_id
|
|
* fields
|
|
* ]
|
|
* @return mixed
|
|
*/
|
|
public function getList($param)
|
|
{
|
|
$verifyResult = $this->verify($param); //参数验证
|
|
if ($verifyResult['status'] != 1) {
|
|
return $verifyResult;
|
|
}
|
|
$where = $this->Term($param);
|
|
$fields = $param['fields'] ? $param['fields'] : '*';
|
|
switch ($param['user_type']) {
|
|
case 3:
|
|
//商户
|
|
break;
|
|
case 4:
|
|
//门店
|
|
$PurchaseWarehouseModel = new SPurchaseWarehouseModel();
|
|
break;
|
|
}
|
|
try {
|
|
$list = $PurchaseWarehouseModel->getSelect($where, '', '', $fields, 'default_state desc');
|
|
return $list ? $list : [];
|
|
} catch (\Exception $e) {
|
|
return [];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 查询条件
|
|
* @param $param
|
|
* [
|
|
* user_type 3商户 4门店
|
|
* merchant_id
|
|
* store_id
|
|
* ]
|
|
* @return mixed
|
|
*/
|
|
public function Term($param)
|
|
{
|
|
$where = [
|
|
'merchant_id' => $param['merchant_id'],
|
|
'store_id' => $param['store_id'],
|
|
'status' => 1
|
|
];
|
|
return $where;
|
|
}
|
|
|
|
|
|
/**
|
|
* 参数验证
|
|
* @param $param
|
|
* [
|
|
* user_type 3商户 4门店
|
|
* merchant_id
|
|
* store_id
|
|
* ]
|
|
* @return mixed
|
|
*/
|
|
public function verify($param)
|
|
{
|
|
if (!in_array($param['user_type'], ['3', '4']) || empty($param['merchant_id']) || ($param['user_type'] == 4 && empty($p
|
|
['store_id']))) {
|
|
return callBack(statusCode()['error'], "登录超时");
|
|
}
|
|
return callBack(statusCode()['success'], "验证成功");
|
|
}
|
|
} |