Commit 422f019c authored by hujun's avatar hujun

独家

parent d10b0f24
......@@ -1035,11 +1035,15 @@ class Shop extends Basic
*/
public function editExclusive()
{
if ($this->params['houses_id']) {
$res = $this->gHousesModel->exclusive($this->params, $this->params['houses_id'], $this->agentId, $this->siteId);
} else {
return $this->response("101", "houses_id is null");
// $res = $this->gHousesModel->exclusive($this->params, $this->params['houses_id'], $this->agentId, $this->siteId);
$code = 200;
$msg = "";
$house = new HouseService();
$result = $house->addHouse($this->params, $this->agentId, 1, 0, 'exclusive');
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
}
return $this->response("200", "request success", $res);
return $this->response($code, $msg);
}
}
......@@ -47,16 +47,20 @@ class HouseService
* @param array $data
* @param int $agent_id
* @param int $is_app
* @param int $site_id
* @param $site_id
* @param string $operation_type
* @return array
*/
public function addHouse(array $data, int $agent_id, $is_app = 0, $site_id): array
public function addHouse(array $data, int $agent_id, $is_app = 0, $site_id, $operation_type = ''): array
{
$result = [];
$validate = new HouseValidate();
if (empty($data['id'])) {
$check = $validate->scene('add')->check($data);
} elseif ($operation_type == 'exclusive') {
$check = $validate->scene('exclusive')->check($data);
$this->exclusiveFile($data, $data['id']);
} else {
$check = $validate->scene('edit')->check($data);
}
......@@ -701,4 +705,38 @@ class HouseService
$where_houses_to_agents['type']=3;
return $this->agent_house->getAgentHouseValue('agents_id', $where_houses_to_agents);
}
/**
* 独家附件操作
*
* @param $data
* @param $house_id
*/
public function exclusiveFile($data, $house_id) {
$m_house_file = new GHouseFile();
//新增附件
if (!empty($data['exclusive_file'])) {
$exclusive_file_arr = explode(',', $data['exclusive_file']);
$save_data = [];
foreach ($exclusive_file_arr as $k=>$v) {
$save_data[$k]['file_name'] = $v;
$save_data[$k]['house_id'] = $house_id;
$save_data[$k]['type'] = 0;
$save_data[$k]['status'] = 0;
}
$m_house_file->insertAll($save_data);
}
//伪删除附件
if (!empty($data['del_file_id'])) {
$file_id_arr = explode(',', $data['del_file_id']);
foreach ($file_id_arr as $k=>$v) {
$m_house_file->where('id', $v)->update(['status'=>1]);
}
}
return ;
}
}
\ No newline at end of file
......@@ -35,7 +35,10 @@ class HouseValidate extends Validate
'is_show' => 'require|in:0,1',
'fee_rule' => 'require|length:1,500',
'business_district_id' => 'require|between: 1,99999999999',
'id' => 'require|between: 1,99999999999'
'id' => 'require|between: 1,99999999999',
'agent_start_time' => 'require',
'agent_end_time' => 'require',
'is_exclusive_type' => 'require|in: 0,1'
];
protected $message = [
'internal_title.require' => '对内商铺名为必填',
......@@ -77,7 +80,11 @@ class HouseValidate extends Validate
'business_district_id.require' => '商圈必选',
'business_district_id.between' => '商圈参数错误',
'id.require' => '商铺id必传',
'id.between' => '商铺id错误'
'id.between' => '商铺id错误',
'agent_start_time.require' => '独家开始时间必填',
'agent_end_time.require' => '独家结束时间必填',
'is_exclusive_type.require' => '是否独家必填|是否独家参数错误',
'is_exclusive_type.is_exclusive_type' => '是否独家参数错误',
];
protected $scene = [
......@@ -88,6 +95,7 @@ class HouseValidate extends Validate
'rent_price', 'industry_type', 'shop_type', 'shop_sign', 'management_fee', 'slotting_fee', 'residue_num',
'total', 'longitude', 'latitude', 'fee_rule', 'fee_rule', 'business_district_id'],
'show' => 'id,is_show',
'vip' => 'id,vip'
'vip' => 'id,vip',
'exclusive' => 'agent_start_time,agent_end_time,is_exclusive_type,id'
];
}
\ No newline at end of file
......@@ -276,6 +276,8 @@ Route::group('index', [
'getCollectionDetail' => ['index/Finance/getCollectionDetail', ['method' => 'post|get']],//收款详情
'getCollectionEdit' => ['index/Finance/getCollectionEdit', ['method' => 'post']],//收款修改保存
'collectingBill' => ['index/Finance/collectingBill', ['method' => 'post']],//收款
'getBeForNum' => ['index/Finance/getBeForNum', ['method' => 'get']],//getBeForNum
'getAdjustment' => ['index/Finance/getAdjustment', ['method' => 'get']],//剩余可以调整或退款的钱
'performanceInfo' => ['index/PerformanceInfo/performanceInfo', ['method' => 'post|get']],//业绩明细
'getPerformanceInfoExcel' => ['index/PerformanceInfo/getPerformanceInfoExcel', ['method' => 'post|get']],//业绩明细
......
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