#!/bin/bash
ip=$1
orderId=$2  #mall订单号
orderStatus=$3  #mall订单状态值

len=`echo $orderId |awk '{print length}'`
if [ -z "$len" ]
then
        echo "请输入订单号"
        exit -1  #exit命令同于退出shell，状态值0代表执行成功，其它值代表执行失败
fi

mysqld="-h$ip -p3306 -uqa -pqatest"

# 更新mall.mall_order表的订单状态
mysql -N $mysqld mall -e "update mall_order set order_state='$orderStatus' where order_id='$orderId'";

echo "mall.mall_order表的订单状态已改"
