关于小程序菜品详情页
来源:4-13 课程常见错误解决方案汇总
SuperMan_GYD
2020-04-15
今天测试了一下,发现小程序的详情页购买次数和评论次数,没有记录,然后我去看了一下数据库,发现并没有数据,说明购买成功后并没有让food的销售量和评论量进行改变和更新,但是我找了很久,没找到地方,,,
api下的Order.py文件部分代码:
def orderCallback():
以上省略
target_pay = PayService()
target_pay.orderSuccess( pay_order_id = pay_order_info.id,params = { “pay_sn”:callback_data[‘transaction_id’] } )
target_pay.addPayCallbackData( pay_order_id = pay_order_info.id, data = request.data)
return target_wechat.dict_to_xml(result_data), header
我觉得是在addPayCallbackData这里面去改变food的数据(如下):
def addPayCallbackData(self,pay_order_id = 0,type = ‘pay’,data = ‘’):
model_callback = PayOrderCallbackData()
model_callback.pay_order_id = pay_order_id
if type == “pay”:
model_callback.pay_data = data
model_callback.refund_data = ''
else:
model_callback.refund_data = data
model_callback.pay_data = ''
model_callback.created_time = model_callback.updated_time = getCurrentDate()
db.session.add( model_callback )
db.session.commit()
return True请问是这样吗
1回答
-
012020-04-15
相似问题