将负双精度保存在mysql数据库中

时间:2018-10-27 06:44:04

标签: mysql laravel eloquent

我想使用laravel在mysql db中使用此数据创建记录(例如):

class Transaction(models.Model):
DocRef = models.CharField(max_length=10,default="missing")
DocDate = models.DateField()
AcCrIsMinus1 = models.CharField(max_length=10,default="missing")
AcCurWTaxAmt = models.CharField(max_length=10,default="missing")
HomeWTaxAmt = models.CharField(max_length=10,default="missing")
CalculatedAmt = models.CharField(max_length=10, default="missing")
ProjectCode = models.CharField(max_length=10,default="missing")
Location = models.CharField(max_length=10,default="missing")
Sales_Person = models.ForeignKey('Salesperson', on_delete=models.CASCADE)
AcCode = models.CharField(max_length=8,default="missing")
Customer_Name = models.CharField(max_length=30,default="missing")

def __str__(self):
    return "%s" % self.id


class Salesperson(models.Model):
    Sales_Person_P = models.CharField(max_length=10,default="missing",primary_key=True)
    Sales_Person_Name = models.CharField(max_length=10,default="missing")
    Sales_Person_Contact = models.CharField(max_length=10,default="missing")

    def __str__(self):
        return "%s" % self.Sales_Person_P

但是 $data=[[chatid] => -1001412042053 [title] => 'Bdd_grp' [type] => 1]] Model::create($data); 字段将另存为另一个数字,例如chatid !!!为什么会发生? mysql中的-684662113数据类型为chatid

0 个答案:

没有答案