think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

Model::update() 当MySQL字段类型为bigint整型,更新条件字段值长度大于16的字符串类型,无法更新成功

Open xmzhy opened this issue 4 years ago • 0 comments

CREATE TABLE test ( id int unsigned NOT NULL AUTO_INCREMENT COMMENT '表自增id', order_no bigint NOT NULL DEFAULT '0' COMMENT '分单编号', order_sn bigint NOT NULL DEFAULT '0' COMMENT '订单编号', update_time int unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', create_time int unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (id), UNIQUE KEY order_no (order_no), KEY order_sn (order_sn) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试';

INSERT INTO test (id, order_no, order_sn, update_time, create_time) VALUES (1, 3021080720351340511, 0, 0, 0);

// $data = ['order_sn'=>'21080715996084293','order_no'=>'3021080720351340511']; //字符串类型长度大于16更新不了
$data = ['order_sn'=>'21080715996084293','order_no'=>3021080720351340511]; //整型这样可以更新
$result =  \app\model\Test::update($data,['order_no'=>$data['order_no']]);
return json($result);

xmzhy avatar Aug 09 '21 04:08 xmzhy