123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\common\logic;
- use app\common\server\UrlServer;
- use think\facade\Db;
- class CommonLogic{
-
-
- public static function changeTableValue($table,$pk_name,$pk_value,$field,$field_value){
-
- $allow_field = [
- 'is_show','sort','status','is_new','is_best','is_like','is_recommend', 'del'
- ];
- if(!in_array($field,$allow_field)){
- return false;
- }
- if(is_array($pk_value)){
- $where[] = [$pk_name,'in',$pk_value];
- }else{
- $where[] = [$pk_name,'=',$pk_value];
- }
-
- $data= [
- $field => $field_value,
- 'update_time' => time(),
- ];
-
- return Db::name($table)->where($where)->update($data);
- }
-
- }
|