package com.cnd3b.restcontroller.system.wechatdock;

import com.cnd3b.common.Controller;
import com.cnd3b.utility.wechatdock.WechatDock_gzh;
import com.cnd3b.utility.wechatdock.WechatDock_xcx;
import com.alibaba.fastjson.JSONObject;

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

    /**
     * 创建微信第三方调用请求参数，如微信分享等
     *
     * @return
     */
    public String getWechatDock() {
        String url = content.getString("url");
        String app = "";
        if (content.containsKey("app")) {
            app = content.getString("app");
        }
        if ("".equals(app)) {
            return getSucReturnObject().setData(WechatDock_gzh.wechatDock(url)).toString();
        } else if ("wechatapp".equals(app)) {
            return getSucReturnObject().setData(WechatDock_xcx.wechatDock(url)).toString();
        } else {
            return getErrReturnObject().setErrMsg("错误").toString();
        }
    }
}
