SettledData.php 4.07 KB
<?php

namespace LibModels\Web\Shop;

use Api\Yohobuy;
use Api\Sign;
/**
 * 商家入驻的接口
 * 
 * @name SettledData
 * @package shop
 * @copyright yoho.inc
 * @author xiaoxiao.hao <xiaoxiao.hao@yoho.cn>
 */
class SettledData
{
    /**
     * 添加入驻申请保存
     * @param type string $brand_name 品牌名称
     * @param type string $registerStatus 品牌注册情况
     * @param type string $sellerName 公司名称
     * @param type string $sellerAddress 公司地址
     * @param type int $zipCode 邮编
     * @param type string $contacts 联系人
     * @param type int $contactPhone 电话|手机
     * @param type string $contactEmail 邮箱
     * @param type string $sellerRole 与品牌关系
     * @param type string $brandWebsite 品牌官网
     * @param type string $onlineShopWebsite 店铺连接
     * @param type json $categoryInfo 品类信息['category_one'=> '', 'category_two'=> '', 'category_price'=> '']
     * @param type string $billingCycle 结算周期
     * @param type string $warehouseAddress 仓库地址
     * @param type string $producer 商品产地
     * @param type string $invoiceType 发票类型
     * @param type string $newCycle 商品上新周期
     * @param type int $quarterNum 款式数量
     * @param type string $supplyCycle 商品补货周期
     * @param type int 1:有, 0:无 $haveStore 品牌线上店状况
     * @param type json $storeInfo 品牌线下店 ['store_address' => '店铺地址', 'store_sales_volume' => '月均销售']
     * @param type string $brandMaterial 品牌资料
     * @param type string $goodsMaterial 当季产品
     * @param type int $uid 用户ID
     * @return type []
     */
    public static function insertApply($brandName, $registerStatus, $sellerName, $sellerAddress, $zipCode,
        $contacts, $contactPhone, $contactEmail, $sellerRole, $brandWebsite, $onlineShopWebsite, $categoryInfo,
        $billingCycle, $warehouseAddress, $producer, $invoiceType, $newCycle, $quarterNum, $supplyCycle, $haveStore,
        $storeInfo, $brandMaterial, $goodsMaterial, $uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.shops.insertApply';
        $param['brandName'] = $brandName;
        $param['registerStatus'] = $registerStatus;
        $param['sellerName'] = $sellerName;
        $param['sellerAddress'] = $sellerAddress;
        $param['zipCode'] = $zipCode;
        $param['contacts'] = $contacts;
        $param['contactPhone'] = $contactPhone;
        $param['contactEmail'] = $contactEmail;
        $param['sellerRole'] = $sellerRole;
        $param['brandWebsite'] = $brandWebsite;
        $param['onlineShopWebsite'] = $onlineShopWebsite;
        $param['categoryInfo'] = $categoryInfo;
        $param['billingCycle'] = $billingCycle;
        $param['warehouseAddress'] = $warehouseAddress;
        $param['producer'] = $producer;
        $param['invoiceType'] = $invoiceType;
        $param['newCycle'] = $newCycle;
        $param['quarterNum'] = $quarterNum;
        $param['supplyCycle'] = $supplyCycle;
        $param['haveStore'] = $haveStore;
        $param['storeInfo'] = $storeInfo;
        $param['brandMaterial'] = $brandMaterial;
        $param['goodsMaterial'] = $goodsMaterial;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::post(API_URL, $param);
    }
    
    /**
     * 获取一级品类
     * @return type []
     */
    public static function getOneCategory()
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.category.queryMax';
        $param['client_secret'] = Sign::getSign($param);
        
        return Yohobuy::get(API_URL, $param);
    }

    /**
     * 通过一级品类,获取二级分类
     * @param type int $parentId 一级品类id
     * @return type []
     */
    public static function getTwoCategory($parentId)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.category.queryMin';
        $param['parent_id'] = intval($parentId);
        $param['client_secret'] = Sign::getSign($param);
        
        return Yohobuy::get(API_URL, $param);
    }
}