//自动完成 create_time
protected $autoWriteTimestamp = true;
//修改优惠券
public function updateCoupon($param){
$where['id'] = $param['id'];
$where['shop_id'] = $param['shop_id'];
$coupon = $this->where($where)->find();
if(!$coupon) ret_error("优惠券不存在");
unset($param['create_time']);
$res = $coupon->allowField(true)->save($param,$where);
$res?ret_success("修改成功", $res):ret_error('修改失败');
}如果修改参数里面有 create_time 就会报错SQLSTATE[01000]: Warning: 1265 Data truncated for column 'create_time' at row 1
是操作错误了吗, 不能传 create_time 与 update_time 吗
最佳答案