admin - 新增根据入会类型id获取权益接口
This commit is contained in:
@@ -107,6 +107,30 @@ class Level extends Backend
|
||||
$this->error(__('No rows were deleted'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据入会类型筛选权益
|
||||
*
|
||||
* @param type $param
|
||||
* @return type
|
||||
*/
|
||||
public function benefits()
|
||||
{
|
||||
$join_config_id = $this->request->get('join_config_id');
|
||||
$benefits = $this->benefit_model->getSimpleByStatus(0, $join_config_id);
|
||||
if (empty($benefits)) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => __('No benefits found'),
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => 'success',
|
||||
'data' => $benefits,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
||||
@@ -54,12 +54,15 @@ class MemberBenefits extends Model
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getSimpleByStatus($disabled = 0)
|
||||
public function getSimpleByStatus($disabled = 0, $join_config_id = null)
|
||||
{
|
||||
return Self::field(['id', 'title'])->where(function($query) use ($disabled) {
|
||||
return Self::field(['id', 'title'])->where(function($query) use ($disabled, $join_config_id) {
|
||||
if (null !== $disabled) {
|
||||
$query->where('disabled', '=', $disabled);
|
||||
}
|
||||
if (null !== $join_config_id) {
|
||||
$query->where('join_config_id', '=', $join_config_id);
|
||||
}
|
||||
})->order('sort', 'asc')->select();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user