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