123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * 后台开关相关
- * Date: 2017/9/5 0005
- * Time: 18:48
- */
- defined( 'IN_WEB') or die( 'Include Error!');
- class Switches{
- /**
- * 获取开关
- */
- public function getList(){
- $tb = otable::configSwitch();
- $sql = " SELECT * FROM {$tb} WHERE 1";
- $ret = oo::commonOprDb('common')->getAll($sql, MYSQLI_ASSOC);
- return json_encode($ret);
- }
- /**
- * 更新开关,顺便删除缓存
- */
- public function actionswi($param){
- $id = intval($param['id']);
- $status = intval($param['status']);
- $tb = otable::configSwitch();
- $sql = "UPDATE {$tb} SET status={$status} WHERE id={$id} LIMIT 1";
- oo::commonOprDb('common')->query($sql);
- oo::commonOprRedis('common')->delete(okeys::configSwitch($id));
- }
- /**
- * 获取开关
- */
- public function getBullet(){
- $tb = otable::configBullet();
- $sql = " SELECT * FROM {$tb} WHERE 1";
- $ret = oo::commonOprDb('common')->getAll($sql, MYSQLI_ASSOC);
- return json_encode($ret);
- }
- /**
- * 更新开关,顺便删除缓存
- */
- public function actionBullet($param){
- $id = intval($param['id']);
- $status = intval($param['status']);
- $tb = otable::configBullet();
- $sql = "UPDATE {$tb} SET status={$status} WHERE id={$id} LIMIT 1";
- oo::commonOprDb('common')->query($sql);
- oo::commonOprRedis('common')->delete(okeys::configSwitch($id));
- }
- }
|