<?php
namespace app\admin\server\index;
use app\admin\model\CardOrder;
use app\admin\model\User;

/**
 * 会员服务层
 * Class UsersServer
 * @package app\api\server\user
 */
class CardServer
{
    /**
     * Notes:获取会员账户
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function getCardList($member_id,$mobile)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcMemberAccountList";
        if($member_id != ""){
            $params['join_account_member_id'] = $member_id;
        }
        if($mobile != ''){
            $params['member_sys_mobile'] = $mobile;
        }
        

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:会员绑定卡
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function memberBindCard($cardno,$verifycode,$cardpswd,$cardmonies,$cardadded,$member_id)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcMemberBindCard";
        $params['cardno'] = $cardno;
        $params['verifycode'] = $verifycode;
        $params['cardpswd'] = $cardpswd;
        $params['cardmonies'] = $cardmonies;
        $params['cardadded'] = $cardadded;
        $params['member_id'] = $member_id;

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:会员账户出入账
     * @return \support\Response
     * User: ycp
     * Date: 2023/5/5
     */
    public static function memberAccountPay($member_id,$cardno,$orderno,$io,$expenses,$added,$detail)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcMemberAccountPay";
        $params['member_id'] = $member_id;
        $params['cardno'] = $cardno;   
        $params['orderno'] = $orderno;
        $params['io'] = $io;
        $params['expenses'] = $expenses;
	$params['added'] = $added;
        $params['detail'] = $detail;

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:卡品种列表
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainCategoryList()
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainCategoryList";

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:添加卡品种
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainCategoryAdd($card_main_category_name)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainCategoryAdd";
        $params['card_main_category_name'] = $card_main_category_name;

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:删除卡品种
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainCategoryDel($card_main_category_name)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainCategoryDel";
        $params['card_main_category_name'] = $card_main_category_name;

        $result = curlPost($url,$params);

        return $result;
    }


    /**
     * Notes:编辑卡品种
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainCategoryUpd($card_main_category_name,$card_main_category_configs,$card_main_category_addtimes)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainCategoryUpd";
        $params['card_main_category_name'] = $card_main_category_name;
        $data['card_main_category_configs'] = $card_main_category_configs;
        $data['card_main_category_addtimes'] = $card_main_category_addtimes;
        $params['data'] = $data;


        $result = curlPost($url,json_encode($params));
        //$result = $params;

        return $result;
    }

    /**
     * Notes:储值卡-卡分类-读取[R]
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainList($card_main_category)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainList";
        $params['card_main_category'] = $card_main_category;

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:储值卡-卡分类-创建[C]
     * @return \support\Response
     * User: ycp
     * Date: 2023/8/15
     */
    public static function cardMainAdd($card_main_status,$card_main_name,$card_main_category,$card_main_validday,$card_main_configs)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainAdd";
        $params['card_main_status'] = $card_main_status;
        $params['card_main_name'] = $card_main_name;
        $params['card_main_category']= $card_main_category;
        $params['card_main_validday']= $card_main_validday;
        $params['card_main_configs']= $card_main_configs;

        $result = curlPost($url,$params);

        return $result;
    }

    /**
     * Notes:编辑卡品种
     * @return \support\Response
     * User: ycp
     * Date: 2023/4/24
     */
    public static function cardMainUpd($card_main_id,$card_main_status,$card_main_name,$card_main_category,$card_main_validday,$card_main_configs)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainUpd";
        $params['card_main_id'] = $card_main_id;
        $data['card_main_status'] = $card_main_status;
        $data['card_main_name'] = $card_main_name;
        $data['card_main_category'] = $card_main_category;
        $data['card_main_validday'] = $card_main_validday;
        $data['card_main_configs'] = $card_main_configs;
        $data['card_main_addtimes'] = '';
        $params['data'] = $data;


        $result = curlPost($url,json_encode($params));

        return $result;
    }

    /**
     * Notes:删除卡分类
     * @return \support\Response
     * User: ycp
     * Date: 2023/8/16
     */
    public static function cardMainDel($card_main_id)
    {
        $url = "http://core.wanyuewellness.cn/api.php";
        $params['func'] = "functions.funcCardMainDel";
        $params['card_main_id'] = $card_main_id;

        $result = curlPost($url,$params);

        return $result;
    }


}
