package com.jzdsh.auto.app.controller.front;

import com.jfinal.aop.Inject;
import com.jfinal.kit.PathKit;
import com.jfinal.kit.Ret;
import com.jfinal.upload.UploadFile;
import com.jzdsh.auto.app.controller.BaseController;
import com.jzdsh.auto.biz.HomepageService;
import com.jzdsh.auto.biz.ShopService;

/**
 * @ProjectName: auto
 * @Package: com.jzdsh.auto.app.controller.front
 * @ClassName: HomepageController
 * @Author: Jzdsh
 * @Description: 首页
 * @Date: 2020/3/21 10:42
 * @Version: 1.0
 */
public class HomepageController extends BaseController {

    @Inject
    HomepageService homepageService;

    @Inject
    ShopService shopService;


    /**
     * 首页
     */
    public void index( ) {
        renderJson(homepageService.show(get("token"), get("longitude"), get("latitude"),getInt("pageNum",1)));
    }


    /**
     *      免费入住
     *      token
     *      role 商家类型 (1服务商2经销商)
     *      coName 公司名
     *      name 店铺名
     *      city 省市县
     *      street 详细地址
     *      mainBusiness 主营业务逗号隔开
     *      pMainBusiness 父类主营业务
     *      introduce 业务介绍
     *      authPhone  认证电话
     *      referrerPhone 推荐人手机号
     */
    public void save(){
        renderJson(shopService.save(get("token"),get("role"),get("coName"),get("name"),get("city"),get("street"),get("houseNumber",""),get("mainBusiness"),get("pMainBusiness"),get("introduce"),get("authPhone"),get("referrerPhone"),get("paramType")));
    }


    public void sendSMS(){
        renderJson(shopService.sendSMS(get("phone")));
    }


    /**
     * 用户绑定
     * 判断 用户 是否 认领操作还是免费入驻操作
     *
     * @param token
     * @param phone     手机号
     * @param code      验证码
     * @param isSave    是否保存手机号操作  true/false (个人中心修改手机号用)
     * @param roleType  角色类型 1服务商 2经销商
     * @param sessionId
     * @return
     */
    public void userBinding(){

            renderJson(shopService.userBinding(get("token"),get("phone"),get("code"),get("role"),getBoolean("isSave",false)));
    }


}
