|
@@ -5,6 +5,7 @@ namespace app\admin\controller\user;
|
|
|
use app\common\controller\Backend;
|
|
|
use app\common\library\Auth;
|
|
|
use app\common\model\SysConfig;
|
|
|
+use app\common\service\DiscountService;
|
|
|
|
|
|
/**
|
|
|
* 会员管理
|
|
@@ -108,7 +109,7 @@ class User extends Backend
|
|
|
if ($this->request->isAjax()) {
|
|
|
$levels=$this->model::getLevels();;
|
|
|
$list=[];
|
|
|
- $config=SysConfig::look('user_level_discount')?:[];
|
|
|
+ $config=DiscountService::getById();
|
|
|
foreach ($levels as $id=>$level){
|
|
|
$list[]=[
|
|
|
'id'=>$id,
|
|
@@ -122,4 +123,18 @@ class User extends Backend
|
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
+ public function level_discount_edit($ids){
|
|
|
+ if($this->request->isGet()){
|
|
|
+ $this->assign('row',DiscountService::getById($ids));
|
|
|
+ $this->assign('id',$ids);
|
|
|
+ return $this->fetch();
|
|
|
+ }else{
|
|
|
+ $data=input('row/a');
|
|
|
+ $this->validate($data,[
|
|
|
+ 'discount|折扣'=>['require','gt:0','lt:10'],
|
|
|
+ ]);
|
|
|
+ DiscountService::saveDiscount($ids,$data['discount']);
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|