コード例 #1
0
ファイル: mylTest.py プロジェクト: wz139704646/FinancialRobot
 def test4(self):
     goods_dao = GoodsDao()
     add = goods_dao.add("手机", 20, "1", "电子", "kg")
     # res = goods_dao.query_all()
     # res = goods_dao.query_by_companyId('1', '苹', None)
     # j = json.dumps(return_success({'goodsList': GoodsDao.to_dict(res)}), cls=DecimalEncoder, ensure_ascii=False)
     print(add)
コード例 #2
0
def addGoods():
    _json = request.json
    print(_json)
    goods_dao = GoodsDao()
    try:
        res = goods_dao.add(_json.get('name'), _json.get('sellprice'),
                            _json.get('companyId'), _json.get('type'),
                            _json.get('unitInfo'), _json.get('barcode'))
        return json.dumps(return_success({"id": res["id"]}))
    except Exception as e:
        print(e)
        return json.dumps(return_unsuccess("添加商品失败 " + str(e)),
                          ensure_ascii=False)