You've already forked qlg.tsgz.moe
							
							
		
			
				
	
	
		
			34 lines
		
	
	
		
			901 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			901 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| 
 | |
| namespace wstmart\app\controller;
 | |
| 
 | |
| 
 | |
| use think\Db;
 | |
| 
 | |
| class TradeRule extends Base
 | |
| {
 | |
|     public function index()
 | |
|     {
 | |
|         $model = Db::name("trade_rule")->field(true)
 | |
|             ->order("create_time", "desc")
 | |
|             ->where('isShow', '1')
 | |
|             ->select();
 | |
|         foreach ($model as &$detail) {
 | |
|             $detail['content'] = htmlspecialchars_decode($detail['content']);
 | |
|         }
 | |
|         return WSTReturn("OK", 1, $model);
 | |
|     }
 | |
| 
 | |
|     public function detail()
 | |
|     {
 | |
|         if(($id = (int)input( 'id', 0)) > 0){
 | |
|             $detail = Db::name("trade_rule")->field(true)
 | |
|                 ->where(["id"=>$id])->find();
 | |
|             if(!$detail) return WSTReturn("该条内容已被删除",0);
 | |
|             $detail['content'] = htmlspecialchars_decode($detail['content']);
 | |
|             return WSTReturn("OK", 1, $detail);
 | |
|         }
 | |
|         return WSTReturn("异常请求",0);
 | |
|     }
 | |
| } |