12345678910111213141516171819202122232425262728293031323334353637383940 |
- package user_merchant
- import (
- "context"
- "gd_management/apis"
- "gd_management/common.in/storage"
- "gd_management/common.in/utils"
- "gd_management/errors"
- "fmt"
- "github.com/astaxie/beego/orm"
- "go.uber.org/zap"
- )
- func ManagementSetMerchantOrderPrice(ctx context.Context, req *apis.ManagementSetMerchantOrderPriceReq, reply *apis.ManagementSetMerchantOrderPriceReply) (err error) {
- task := func(o orm.Ormer) error {
- _, err := o.Raw("update t_gd_data_api_order set goods_price=? where id=?", req.Price, req.OrderId).Exec()
- if err != nil {
- l.Error("mysql",
- zap.String("sql", "update t_gd_data_api_order set goods_price=?where id=?"),
- zap.String("fields", fmt.Sprintf("goods_price:%f id:%d", req.Price, req.OrderId)),
- zap.String("error", err.Error()))
- if err == orm.ErrNoRows {
- return errors.DataBaseNoRecord
- }
- return errors.DataBaseError
- }
- return nil
- }
- tasks := []storage.DbaTasker{}
- tasks = append(tasks, storage.GenerateDbaTask(task))
- storage.ExecTrans(tasks...)
- l.Debug(utils.MarshalJsonString(req, reply))
- return nil
- }
|