71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
async def yunying_gai_zhekou_dijia(ns={}):
|
|
"""
|
|
修改售价管理
|
|
:return:
|
|
"""
|
|
# ns = {
|
|
# 'zi_biao_id': '0MDi3KG0DNiEulXKM8MOX',
|
|
# 'price': 200,
|
|
# 'discount': 0.7
|
|
# }
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
if ns.get('sor'):
|
|
sor = ns.get('sor')
|
|
if ns.get('price'):
|
|
await sor.U('product_salemode', {'id': ns.get('zi_biao_id'), 'price': ns.get('price')})
|
|
elif ns.get('discount'):
|
|
await sor.U('product_salemode', {'id': ns.get('zi_biao_id'), 'discount': ns.get('discount')})
|
|
return {
|
|
'status': True,
|
|
'msg': '修改成功'
|
|
}
|
|
except Exception as e:
|
|
raise e
|
|
return {
|
|
'status': False,
|
|
'msg': '修改失败'
|
|
}
|
|
|
|
|
|
async def productUpdate(ns={}):
|
|
"""
|
|
only use primary key to delete
|
|
update product
|
|
`providerid`: 供应商编号,
|
|
`providerpid`: 供应方产品id,
|
|
`name`: 名称,
|
|
`description`: 描述,
|
|
`ptype`: 产品类型,
|
|
`state`: 状态,
|
|
`effect_date`: 起效日期,
|
|
`expire_date`: 失效日期,
|
|
`publish_method`: 发布方式,
|
|
`publish_url`: 发布url,
|
|
`product_code`: 产品编码,
|
|
`specific_pattern`: 规格模版
|
|
:param ns:
|
|
:return:
|
|
"""
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
ns['id'] = ns.get('productid')
|
|
await sor.U('product',ns)
|
|
await yunying_gai_zhekou_dijia({'zi_biao_id': ns.get('zi_biao_id'), 'discount': ns.get('discount'),
|
|
'price': ns.get('price'), 'sor': sor})
|
|
return {
|
|
"status": True,
|
|
"msg": "product update success",
|
|
}
|
|
except Exception as e:
|
|
raise e
|
|
return {
|
|
"status": False,
|
|
"msg": "product update failed",
|
|
}
|
|
|
|
|
|
ret = await productUpdate(params_kw)
|
|
return ret |