Example #1
0
<?php

/**
 * 初始化所有计划任务
 */
include_once "common.php";
$conn = new Table("local189");
$conn->query("TRUNCATE TABLE  `tianyunzi`.`360_jihua`");
$api = "https://api.e.360.cn/account/clientLogin";
$postData = array("format" => "json", "username" => "郑州悉知", "passwd" => "7232275XZgcw");
$md = md5("7232275XZgcw");
$key = "15fdeq7buepvssh8z899rusa6ynxufyn";
$m = new Xcrypt(substr($key, 0, 16), 'cbc', substr($key, 16, 16));
$postData["passwd"] = $m->encrypt($md, 'hex');
$header = array();
$header[] = "serveToken:" . microtime(1);
$header[] = "apiKey:1kg8tunzfxt8zvzpf53vjr5es45lvszh";
$str = curlPost($api, $header, $postData);
if (!isset($str["accessToken"])) {
    exit("用户登录验证失败!\n");
} else {
    echo "用户登录验证成功!\n";
}
/*查询下所有的推广计划 */
$api = "https://api.e.360.cn/2.0/account/getCampaignIdList";
$header[] = "accessToken:" . $str["accessToken"];
$header[] = "sessionToken:" . $str["sessionToken"];
$params = array("format" => "json");
$str = curlPost($api, $header, $params);
if (!isset($str["campaignIdList"])) {
    exit("无法获取到任何推广计划id\n");
$req->setIsGuaranteeOrCharged(false);
$Contact = new Contact();
$Contact->Name = '张飞';
$Contact->Mobile = '18611648888';
$Contact->Gender = 'Female';
$req->setContact($Contact);
$customer1_1 = new Customer();
$customer1_1->Name = '李静C';
$customer1_1->Mobile = '18611648888';
$customer1_1->Gender = 'Female';
$customer1_2 = new Customer();
$customer1_2->Name = '李静D';
$customer1_2->Mobile = '18611648888';
$customer1_2->Gender = 'Female';
$customers_1 = new Customers();
$customers_1->add($customer1_1);
$customers_1->add($customer1_2);
$OrderRooms = new OrderRooms();
$OrderRooms->add($customers_1);
$req->setOrderRooms($OrderRooms->OrderRooms);
$CreditCard = new CreditCard();
$CreditCard->Number = Xcrypt::encrypt(time() . '#4033910000000000', substr($c->appKey, -8));
$CreditCard->CVV = '875';
$CreditCard->ExpirationYear = '2015';
$CreditCard->ExpirationMonth = '06';
$CreditCard->HolderName = 'wangxu';
$CreditCard->IdType = '1';
$CreditCard->IdNo = '123456';
$req->setCreditCard($CreditCard);
$resp = $c->execute($req);
echo $resp;