Support.php 2.88 KB
<?php

/**
 * 其他运费支持
 * @author tongdesheng
 *
 */
class YHMApi_App_V1_Support extends YHMApi_App_V1_Base {

    /**
     * 添加建议
     * @param array $params
     * @param string $fields
     */
    public static function setAdvise(array $params, $fields = '*') {
        if (empty($params['uid'])) {
            return self::result(400, "uid不能为空");
        }
        if (empty($params['content'])) {
            return self::result(400, "投诉内容不能为空");
        }
     
        $id = YHMSupport_Models_Advise_Client::setAdvise($params['uid'], $params['content'],$params['client_version'], $params['client_type'], $params['os_version']);
        if ($id < 1) {
            return self::result(500, "提交失败");
        }
        return self::result(200, "提交成功", $id);
    }

    /**
     * 获取通知设置
     * @param array $params
     * @param string $fields
     */
    public static function getNoticeSetting(array $params, $fields = '*') {
        if (empty($params['uid'])) {
            return self::result(400, 'uid不能为空');
        }
        $uid = $params['uid'];
        $Data = YHMSupport_Models_Notice_Client::getOne($uid);
        $settingData = array(
            'uid'            => $Data['uid'],
            'message_notice' => $Data['message_notice'],
            'order_notice'   => $Data['order_notice'],
            'system_notice'  => $Data['system_notice'],
            'start_time'     => $Data['notice_begin_time'],
            'end_time'       => $Data['notice_end_time']
        );
        if (empty($Data)) {
            $settingData = array(
                'uid'            => $uid,
                'message_notice' => 'Y',
                'order_notice'   => 'Y',
                'system_notice'  => 'Y',
                'start_time'     => '08:00:00',
                'end_time'       => '20:00:00'
            );
        }
        return self::result(200, '获取成功', $settingData);
    }

    /**
     * 设置通知参数
     * @param array $params
     * @param string $fields
     */
    public static function setNoticeSetting(array $params, $fields = '*') {
        if (empty($params['uid'])) {
            return self::result(400, 'uid不能为空');
        }
        $uid = $params['uid'];
        $message_notice = empty($params['message_notice']) ? 'Y' : $params['message_notice'] ;
        $order_notice   = empty($params['order_notice']) ? 'Y' : $params['order_notice'];
        $system_notice  = empty($params['system_notice']) ? 'Y' :$params['system_notice'];
        $start_time     = empty($params['start_time']) ? '08:00' : $params['start_time'];
        $end_time       = empty($params['end_time']) ? '20:00' : $params['end_time'];
        YHMSupport_Models_Notice_Client::setNoticeByUid($uid, $message_notice, $order_notice, $system_notice, $start_time, $end_time);
        return self::result(200, '设置成功');
    }

}