Messages.php 1.76 KB
<?php

/**
 * Description of Messages
 *
 * @author Elkan
 * @datetime 2014-10-25  18:06:53
 */
class YHMIm_Messages {

    static function pay($orderCode) {
        //支付后发消息给卖家提醒发货
        /*$orderGoodsInfo = YHMOrders_Models_Orders_Client::getOneGoodsByOrderCode($orderCode);
        $stockInfo = YHMProduct_Models_Stock_Client::getStockBySku($orderGoodsInfo['product_sku']);
        $goodsInfo = YHMProduct_Models_Goods_Client::getOneByProductSkc($orderGoodsInfo['product_skc']);
        $goodsImage = YHMProduct_Models_Goodsimages_Client::getDefaultImageBySkc($orderGoodsInfo['product_skc']);*/
        $orderGoodsList = YHMOrders_Models_Orders_Client::getGoodsInfoByOrderCode($orderCode); 
        $orderGoodsInfo = current($orderGoodsList);
        $goodsInfo = YHMProduct_Models_Goods_Client::getOneByProductSkc($orderGoodsInfo['product_skc']);
        $goodsImage=$orderGoodsInfo['goods_images'];
        if(empty($orderGoodsInfo) ||  empty($goodsInfo) || empty($goodsImage)){
            return;
        }
        $message = new YHMIm_MessagesParam_YHMOrderStatus;
        $message->text = '您的商品已售出,请及时发货.';
        $message->seller_uid = $goodsInfo['uid'];
        $message->product_skc = $orderGoodsInfo['product_skc'];
        $message->product_name = $orderGoodsInfo['goods_name'];
        $message->image_url = YHMUpload_Images::template($goodsImage, 'yhfair-product');
        $message->sale_price = (int) $orderGoodsInfo['last_price'];
        $message->stock_number = empty($orderGoodsInfo) ? 0 : $orderGoodsInfo['buy_number'];
        $message->size_name = empty($orderGoodsInfo) ? 0 : $orderGoodsInfo['size_name'];
        $message->order_code = $orderCode;
        YHMIm_Client::yhmOrderStatus(0, $goodsInfo['uid'], $message);
    }

}