123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\model;
- use think\Db;
- class AppIos extends Base
- {
- protected $createTime = 'create_time';
- public function updates(){
- $data = request()->post();
- $result = validate('AppIos')->check($data,[],'');
- if(true !== $result){
- $this->error = validate('AppIos')->getError();
- return false;
- }
- $id = $data['id'];
- unset($data['id']);
- if($id > 0){
- $ret = $this->allowField(true)->save($data,['id'=>$id]);
- }else{
- $data['create_time'] = date('Y-m-d H:i:s');
- $ret = $this->allowField(true)->save($data);
- }
- if(!$ret){
- $this->error = '操作失败';
- return false;
- }
- return true;
- }
- }
|