TradeRule后台完成

This commit is contained in:
2020-05-28 21:57:14 +08:00
parent 82289534e9
commit 2cdb659785
6 changed files with 72 additions and 105 deletions

View File

@ -46,7 +46,7 @@ class TradeRule extends Base
*/
public function add(){
$data = input('post.');
WSTUnset($data,'id,dataFlag');
WSTUnset($data,'id,dataFlag,isShow');
$data['create_time'] = date('Y-m-d H:i:s');
Db::startTrans();
try{
@ -68,7 +68,7 @@ class TradeRule extends Base
public function edit(){
$id = input('post.id/d');
$data = input('post.');
WSTUnset($data,'id,dataFlag,create_time');
WSTUnset($data,'id,dataFlag,isShow,create_time');
Db::startTrans();
try{
$result = $this->validate('TradeRule.edit')->allowField(true)->save($data,['articleId'=>$articleId]);
@ -126,5 +126,22 @@ class TradeRule extends Base
}
/**
* 显示是否显示/隐藏
*/
public function editiIsShow(){
$id = input('post.id/d');
$isShow = (input('post.isShow/d')==1)?1:0;
$result = $this->where(['id'=>$id])->update(['isShow' => $isShow]);
if(false !== $result){
WSTClearAllCache();
return WSTReturn("操作成功", 1);
}else{
return WSTReturn($this->getError(),-1);
}
}
}