package com.cnd3b.restcontroller.system.customerservice;

import com.alibaba.fastjson.JSONObject;
import com.cnd3b.common.Controller;
import com.cnd3b.common.D3bException;
import com.cnd3b.common.data.SQLFactory;

public class Customerservice extends Controller {
    public Customerservice(JSONObject content) {
        super(content);
    }

    public String getCustomerserviceid() {
        long tcustomerserviceid = createTableID("tcustomerservice", "tcustomerserviceid");
        return getSucReturnObject().setData(String.valueOf(tcustomerserviceid)).toString();
    }

    public String submit() throws D3bException {
        String fmessage = content.getString("fmessage", "tcustomerservice.fmessage", "ÄÚÈÝ");
        String fsysfrom = content.getString("fsysfrom");
        String tcustomerserviceid = content.getString("tcustomerserviceid");
        SQLFactory factory = new SQLFactory(this, "app×ÉÑ¯²åÈë");
        factory.addParameter("tcustomerserviceid", tcustomerserviceid);
        factory.addParameter("siteid", siteid);
        factory.addParameter("createby", username);
        factory.addParameter("fmessage", fmessage);
        factory.addParameter("fphonenumber", fphonenumber);
        factory.addParameter("tenterprise_userid", userid);
        factory.addParameter("fsysfrom", fsysfrom);

        String status = dbConnect.runSqlUpdate(factory.getSQL());
        if ("true".equals(status)) {
            return getSucReturnObject().toString();
        } else {
            return getErrReturnObject().setErrMsg("Ìá½»Ê§°Ü").toString();
        }
    }
}
