在thinkphp5.1 中 模型->where()->save()报错:method not exist:app\daogou\model\Goods->save

报错:在thinkphp5.1 中 模型->where()->save()报错:method not exist:app\daogou\model\Goods->save_第1张图片

代码:

 






order = new Order();
        $this->good = new Goods();
        $this->cion = new Coin();
        $this->validate = new OrderValidate();
    }




 public function goodSwitch($userId,$goodId,$status){

        $isMaster = FpeService::isMaster($userId);

        $isExist = $this->good->where('id',$goodId)->find();

        if($isExist['user_id'] !==$userId && !$isMaster){
            return $this->fail("没有操权限");
        }
        if($isExist){


            //____________
            $modifyStatus =$this->good->where('id',$goodId)->save([
                'status' => $status
            ]);

模型:

'json',
    ];



    //type_params:
    //      type = 1 : [['coin_id'=>1,'award'=>"0.80000000"],……]
    //      type = 2 : ['max_number'=>10,'winner'=>1]
    //      type = 3 : null

    public function user()
    {
        return $this->hasOne('user','user_id','id')->bind(['username']);
    }
}
TimeModel继承了Model  但是不能使用save 就很离谱

你可能感兴趣的:(java,前端,javascript)