You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

665 regels
24 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Steven
  5. * Date: 2017/12/14
  6. * Time: 10:54
  7. */
  8. namespace backend\modules\hotel\controllers;
  9. use backend\common\Utils;
  10. use backend\modules\api\logic\BaseBalance;
  11. use backend\modules\api\util\Util;
  12. use backend\modules\hotel\models\Ali\AliOrder;
  13. use backend\modules\hotel\models\Ali\TopLogger;
  14. use backend\modules\hotel\models\ApiService;
  15. use backend\modules\hotel\models\OperaHotel;
  16. use backend\modules\hotel\models\OperaHotelRoom;
  17. use backend\modules\hotel\models\OperaRoomDistrib;
  18. use backend\modules\hotel\models\CommonOrder;
  19. use backend\modules\hotel\models\OrderMain;
  20. use backend\modules\hotel\models\RunHotelDistrib;
  21. use backend\modules\hotel\pinyin\Pinyin;
  22. use phpDocumentor\Reflection\DocBlock\Tags\Return_;
  23. use Yii;
  24. use yii\base\Request;
  25. use yii\filters\AccessControl;
  26. use yii\filters\ContentNegotiator;
  27. use yii\web\Response;
  28. use backend\modules\hotel\models\CtripOrder;
  29. class ApiController extends BaseController
  30. {
  31. public $enableCsrfValidation = false;
  32. public $request_params;
  33. private $service = null;
  34. private function service()
  35. {
  36. if ($this->service == null) {
  37. $this->service = new ApiService();
  38. }
  39. return $this->service;
  40. }
  41. /**
  42. * Notes:
  43. * User: Steven
  44. * Date: 2018/1/17
  45. * Time: 13:12
  46. * @param $action
  47. * @return bool
  48. * @throws \yii\web\BadRequestHttpException
  49. */
  50. public function beforeAction($action)
  51. {
  52. //如果传入的是json串,由于在main中配置了JsonParser,所以接收到的json串都会转成数组 因此,这个控制器中的方法,接受json和数组都行
  53. if (Yii::$app->request->isPost) {
  54. $this->request_params = empty(Yii::$app->request->post()) ?
  55. [] : Yii::$app->request->post();
  56. }
  57. return parent::beforeAction($action);
  58. }
  59. public function behaviors()
  60. {
  61. //配置ContentNegotiator支持JSON和XML响应格式
  62. $behaviors['contentNegotiator'] = [
  63. 'class' => ContentNegotiator::className(),
  64. 'formats' => [
  65. 'application/xml' => Response::FORMAT_JSON,
  66. ],
  67. // 'only' => ['index'],//指定只是针对于index有效
  68. // 'except'=>[''] //只想剔除某个action
  69. /*$behaviors['access'] = [
  70. 'class' => AccessControl::className(),
  71. 'rules' => [
  72. [
  73. ],
  74. ],
  75. ];*/
  76. ];
  77. return $behaviors;
  78. }
  79. /**
  80. * Author:Steven
  81. * Desc:
  82. * @return array
  83. */
  84. public function actionIndex()
  85. {
  86. //需要传入区域ID、住离店日期、酒店名称(模糊)
  87. return ['name' => 'shifupeng', 'age' => 12];
  88. }
  89. /**
  90. * Created by PhpStorm.
  91. * Desc: * Desc:对于设置了保留房的取消时间,即最晚立即确认时间的渠道房型,应该轮询清除符合条件的库存
  92. * 1、到达失效日期后,该子房型-渠道,满足清除库存日期的库存(固定数量),需清零
  93. * 2、对于该子房型所属的基础房型的库存,需要按照先保留,再买断的顺序进行库存的扣除
  94. * 3、注意:这里一定要去除阿里渠道,因为阿里是没有保留房的,都是一单一询,但是要想售卖,必须设置库存,所以对于阿里来说,这里的库存只是为了正常售卖,因此没有保留房的概念,所以不需要库存的扣除
  95. * User: Steven
  96. * Date: 2018/2/28jiu
  97. * Time: 14:05
  98. * Class actionClearReservingRoom
  99. * @return bool
  100. * @throws \yii\db\Exception
  101. */
  102. public function actionClearReservingRoom()
  103. {
  104. $room_distrib = new OperaRoomDistrib();
  105. $data = $room_distrib->getNeedClearReservingRoom();
  106. foreach ($data as $item) {
  107. if ($item['DISTRIB_ID'] == Yii::$app->params['ali']['supplier_id']) { //阿里渠道无保留房概念之说,所以不做库存的扣除
  108. continue;
  109. }
  110. $time_now = date('H:i');
  111. $Invalid_time = explode(',', $item['LATEST_COMFIRM_TIME']);
  112. if ($time_now < $Invalid_time[1]) {
  113. continue;
  114. }
  115. $end_date = date('Y-m-d', strtotime("+ $Invalid_time[0] day"));
  116. $run_hotel_distrib = new RunHotelDistrib();
  117. $res = $run_hotel_distrib->clearReservingRoom($item['DISTRIB_ID'], $end_date, $item['HOTEL_ID'], $item['PARENT_ROOM_TYPE'], $item['ROOM_TYPE']);
  118. if (!$res) {
  119. return false;
  120. }
  121. }
  122. return true;
  123. }
  124. /**
  125. * Author:Steven
  126. * @param $HOTEL_ID //酒店ID
  127. * Desc:下单前的可定检查
  128. * @param $ROOM_ID //房型ID,oprea_hotel_room的 ID
  129. * @param $ROOM_NUM //预定间数
  130. * @param $CHECK_IN //入住日期
  131. * @param $CHECK_OUT //离店日期
  132. * @param $DISTRIB_ID //渠道ID
  133. * @param $ROOM_PRICES /价格日历
  134. * @param $IF_CHECK_PRICE //是否需要校验价格
  135. * @return array
  136. */
  137. public function actionCheckRoomAvail()
  138. {
  139. /*$param = [
  140. 'HotelID' => '339',
  141. 'RoomID' => '2474',
  142. 'RoomNum' => '3',
  143. 'CheckIn' => '2018-01-18',
  144. 'CheckOut' => '2018-01-20',
  145. 'DistribID' => 1536,
  146. 'CreateUserID' => 713,
  147. 'RoomPrices' => [
  148. 0 => [
  149. 'RunDate' => '2018-01-10',
  150. 'Price' => '100'
  151. ],
  152. 1 => [
  153. 'RunDate' => '2018-01-10',
  154. 'Price' => '100'
  155. ],
  156. ],
  157. 'IfCheckPrice' => false,
  158. ];*/
  159. $newOrder = new CommonOrder(['scenario' => 'CheckRoomAvail']);
  160. if (!$newOrder->load($this->request_params, '') || !$newOrder->validate()) {
  161. $error = array_values($newOrder->getFirstErrors());
  162. return ['code' => 1, 'info' => $error[0]];
  163. } else {
  164. return $newOrder->checkRoomAvail();
  165. }
  166. }
  167. /**
  168. * Des:获取底价
  169. * Name: getLowPrice
  170. * @return array
  171. * @author 倪宗锋
  172. */
  173. public function actionGetLowPrice()
  174. {
  175. /*$param = [
  176. 'HotelID' => '197',
  177. 'RoomID' => '2284',
  178. 'RoomNum' => '1',
  179. 'CheckIn' => '2018-01-12',
  180. 'CheckOut' => '2018-01-14',
  181. 'DistribID' => 669,
  182. 'CreateUserID' => 1,
  183. 'RoomPrices' => [
  184. 0 => [
  185. 'RunDate' => '2018-01-12',
  186. 'Price' => '150'
  187. ],
  188. 1 => [
  189. 'RunDate' => '2018-01-13',
  190. 'Price' => '150'
  191. ]
  192. ],
  193. 'IfCheckPrice' => false,
  194. ];*/
  195. $newOrder = new CommonOrder(['scenario' => 'CheckRoomAvail']);
  196. if (!$newOrder->load($this->request_params, '') || !$newOrder->validate()) {
  197. $error = array_values($newOrder->getFirstErrors());
  198. return ['code' => 1, 'info' => $error[0]];
  199. } else {
  200. $check = $newOrder->checkRoomAvail();
  201. if (isset($check['code']) && $check['code'] == 0) {
  202. $data['low_price'] = round($check['data']['total_price'] * 0.965, 2);
  203. return ['code' => 0, 'info' => 'success', 'data' => $data];
  204. } else {
  205. return $check;
  206. }
  207. }
  208. }
  209. /**
  210. * Notes:酒店下单接口
  211. * User: Steven
  212. * Date: 2017/12/28
  213. * Time: 15:50
  214. * @return array
  215. * @throws \yii\db\Exception
  216. */
  217. public function actionBookHotelOrder()
  218. {
  219. /*$param = [
  220. 'CreateUserID' => '259',
  221. 'OrderID' => '8959468131823000', //渠道订单号
  222. 'HotelID' => '197', //酒店ID
  223. 'RoomID' => '2284', //房型ID
  224. 'DistribID' => 669,//渠道ID
  225. 'RoomNum' => '1', //房间数量
  226. 'CheckIn' => '2018-01-12', //入住日期
  227. 'CheckOut' => '2018-01-13', //离店日期,
  228. 'TotalPrice' => '150',//订单总价
  229. 'Currency' => 'RMB', //币种
  230. 'ContactName' => '石福鹏',//联系人姓名
  231. 'ContactTel' => '17602134075', //联系人电话
  232. 'PayType' => 278, // 638:支付宝支付; 221:现金支付 ;275:授信支付;278:微信支付
  233. 'PayTradeNo' => '2018010221001001590200826788', //支付流水号
  234. 'OrderGuests' => [
  235. 0 => [
  236. 'Name' => '石福鹏',
  237. ],
  238. 1 => [
  239. 'Name' => 'Steven',
  240. ],
  241. ], //入住人信息
  242. 'Comment' => '无', //客人备注
  243. 'NeedInvoice' => 1,
  244. 'InvoiceInfos' => [ //发票信息
  245. 'PostType' => '2', //发票领取方式 1:前台自取 2:邮寄
  246. 'InvoiceType' => 1, //发票类型 1:增值税普通发票;2:增值税专用发票
  247. 'Comment' => '代订房费', // 开票项目 一段文本(例如:代订房费、住宿费、会议费、旅游费等)
  248. 'InvoiceTitle' => '上海蜘蛛行网络科技有限公司',// 发票抬头
  249. 'CompanyTel' => '021-25684654', //公司电话
  250. 'CompanyTax' => '50524684554545454545', //公司税号
  251. 'RegisterAddress' => '上海闵行区虹桥万科中心1号楼', // 公司注册地址
  252. 'Bank' => '', // 开户行
  253. 'BankAccount' => '', //银行账号
  254. 'ReceiverAddress' => '', //邮寄地址
  255. 'ReceiverName' => '石福鹏', //收件人姓名
  256. 'ReceiverMobile' => '17602134075', //收件人手机号
  257. ],
  258. 'RoomPrices' => [
  259. 0 => [
  260. 'RunDate' => '2018-01-12',
  261. 'Price' => '150'
  262. ]
  263. ],
  264. 'OrderTitleID' => 0 //是否是组合订单,不是传入0,是组合单传入组合单号
  265. ];*/
  266. //处理组合订单下单,非组合单,该字段为0
  267. if (!isset($this->request_params['OrderTitleID'])) {
  268. $this->request_params['OrderTitleID'] = 0;
  269. }
  270. $newOrder = new CommonOrder(['scenario' => 'BookHotelOrder']);
  271. if ($newOrder->load($this->request_params, '') && $newOrder->validate()) {
  272. $res = $newOrder->bookHotelOrder();
  273. if ($res['code'] == 0) {
  274. OrderMain::updateAll(['DOCKING_TYPE' => OrderMain::ORDER_TYPE_CHANNEL, 'CHANNEL_ORDER_STATUS' => OrderMain::ORDER_CHANNEL_STATUS_WAITING, 'UPDATE_TIME' => date('Y-m-d H:i:s', time())],
  275. ['and', ['CANCEL_FLAG' => 0], ['or', ['ORDER_ID' => $res['data']['order_id']], ['PARENT_ORDER_ID' => $res['data']['order_id']]]]);
  276. return $res;
  277. } else {
  278. return $res;
  279. }
  280. } else {
  281. $error = array_values($newOrder->getFirstErrors());
  282. return ['code' => 1, 'info' => $error[0]];
  283. }
  284. }
  285. /**
  286. * Notes: 取消订单
  287. * User: Steven
  288. * Date: 2018/1/26
  289. * Time: 14:29
  290. * @return array|int
  291. * @throws \Exception
  292. * @throws \yii\db\Exception
  293. */
  294. public function actionCancelHotelOrder()
  295. {
  296. /*$param = [
  297. 'CreateUserID' => '1',
  298. 'OrderID' => '11771',
  299. 'HotelID' => '12',
  300. 'DistribID' => 164,
  301. 'RoomID' => '25',
  302. 'Reason' => '测试取消',
  303. ];*/
  304. $newOrder = new CommonOrder(['scenario' => 'CancelHotelOrder']);
  305. if ($newOrder->load($this->request_params, '') && $newOrder->validate()) {
  306. $res_code = $newOrder->cancelHotelOrder();
  307. return ['code' => $res_code, 'info' => CommonOrder::RETURN_MSG[$res_code]];
  308. } else {
  309. $error = array_values($newOrder->getFirstErrors());
  310. return ['code' => CommonOrder::RETURN_CODE_CANCEL_FAIL, 'info' => $error[0]];
  311. }
  312. }
  313. /**
  314. * 修改订单
  315. * Notes:这里的修改是指修改与入住需求有关的,比如渠道、日期、间数(但同时也会更新其他辅助信息,如客人姓名等) ,如果只需要更新单个客人姓名、采购价等,单独接口支持
  316. * 该接口在调用之前,先要请求可定检查接口,确认修改后的房态依然可定
  317. * User: Steven
  318. * Date: 2018/1/5
  319. * Time: 11:48
  320. * @return array
  321. * @throws \yii\db\Exception
  322. */
  323. public function actionUpdateHotelOrder()
  324. {
  325. /*$param = [
  326. 'CreateUserID' => '713',
  327. 'ZZ_ORDER_ID' => '2000350', //蜘蛛订单号
  328. 'OrderID' => '11603', //渠道订单号
  329. 'HotelID' => '339', //酒店ID
  330. 'RoomID' => '2474', //房型ID
  331. 'DistribID' => 1536,//渠道ID
  332. 'RoomNum' => '3', //房间数量
  333. 'CheckIn' => '2018-01-18', //入住日期
  334. 'CheckOut' => '2018-01-19', //离店日期,
  335. 'TotalPrice' => '600.00',//订单总价
  336. 'Currency' => 'RMB', //币种
  337. 'ContactName' => '郑雯 蒋绮嵘 李峥',//联系人姓名
  338. 'ContactTel' => '13795379620', //联系人电话
  339. 'OrderGuests' => [
  340. 0 => [
  341. 'Name' => '郑雯',
  342. ],
  343. 1 => [
  344. 'Name' => '蒋绮嵘',
  345. ],
  346. ], //入住人信息
  347. 'Comment' => '无', //客人备注
  348. 'NeedInvoice' => 0,
  349. 'InvoiceInfos' => [ //发票信息
  350. 'PostType' => '2', //发票领取方式 1:前台自取 2:邮寄
  351. 'InvoiceType' => 1, //发票类型 1:增值税普通发票;2:增值税专用发票
  352. 'Comment' => '代订房费', // 开票项目 一段文本(例如:代订房费、住宿费、会议费、旅游费等)
  353. 'InvoiceTitle' => '上海蜘蛛行网络科技有限公司',// 发票抬头
  354. 'CompanyTel' => '021-25684654', //公司电话
  355. 'CompanyTax' => '50524684554545454545', //公司税号
  356. 'RegisterAddress' => '上海闵行区虹桥万科中心1号楼', // 公司注册地址
  357. 'Bank' => '', // 开户行
  358. 'BankAccount' => '', //银行账号
  359. 'ReceiverAddress' => '', //邮寄地址
  360. 'ReceiverName' => '石福鹏', //收件人姓名
  361. 'ReceiverMobile' => '17602134075', //收件人手机号
  362. ],
  363. 'RoomPrices' => [
  364. 0 => [
  365. 'RunDate' => '2018-01-18',
  366. 'Price' => '100',
  367. ],
  368. 1 => [
  369. 'RunDate' => '2018-01-19',
  370. 'Price' => '100',
  371. ],
  372. ],
  373. ];*/
  374. $newOrder = new CommonOrder(['scenario' => 'UpdateHotelOrder']);
  375. if ($newOrder->load($this->request_params, '') && $newOrder->validate()) {
  376. //if ($newOrder->load($this->request_params, '') && $newOrder->validate()) {
  377. $res = $newOrder->updateHotelOrder();
  378. if ($res['code'] == 0) {
  379. return $res;
  380. } else {
  381. return $res;
  382. }
  383. } else {
  384. $error = array_values($newOrder->getFirstErrors());
  385. return ['code' => 1, 'info' => $error[0]];
  386. }
  387. }
  388. /**
  389. * Notes:库存共享导致的部分渠道的库存大于基础房型的买断+保留
  390. * 解决方案:将其他库存大于基础房型买断+保留的渠道库存设置为买断+保留
  391. * User: Steven
  392. * Date: 2018/1/9
  393. * Time: 18:11
  394. */
  395. public function actionUpdateStockByShare()
  396. {
  397. if (empty($this->request_params['hotel_id']) || empty($this->request_params['check_in']) || empty($this->request_params['check_out']) ||
  398. empty($this->request_params['distrib_id']) || empty($this->request_params['room_id'])
  399. ) {
  400. return ['code' => 3, 'info' => 'params error'];
  401. }
  402. $order_main = new OrderMain();
  403. $order_main->UpdateStockByShare($this->request_params);
  404. }
  405. /**
  406. * Des:获取酒店的房型列表
  407. * Name: actionGetHotelRoomList
  408. * @author 倪宗锋
  409. */
  410. public function actionGetHotelRoomListByDate()
  411. {
  412. $params = [
  413. 'hotel_id' => Yii::$app->request->post('hotel_id', ''),//酒店ID 必传
  414. 'start_date' => Yii::$app->request->post('start_date', ''),//入住日期 必传
  415. 'end_date' => Yii::$app->request->post('end_date', ''),//离店日期 必传
  416. 'org_id' => Yii::$app->request->post('org_id', ''),//分销商ID 必传
  417. 'room_id' => Yii::$app->request->post('room_id', ''),//房型ID 非必传
  418. ];
  419. if (empty($params['hotel_id']) || empty($params['start_date']) || empty($params['end_date']) || empty($params['org_id'])) {
  420. return ['code' => 3, 'info' => 'params error'];
  421. }
  422. $getList = $this->service()->getHotelRoomListByDate($params);
  423. return $getList;
  424. }
  425. /**
  426. * Des:获取房型基础信息
  427. * Name: actionGetHotelInfo
  428. * @return array
  429. * @author 倪宗锋
  430. */
  431. public function actionGetHotelInfo()
  432. {
  433. $params = [
  434. 'hotel_id' => Yii::$app->request->post('hotel_id', ''),//酒店ID 必传
  435. ];
  436. if (empty($params['hotel_id'])) {
  437. return ['code' => 3, 'info' => 'params error'];
  438. }
  439. $getList = $this->service()->getHotelInfo($params);
  440. return $getList;
  441. }
  442. /**
  443. * 获取酒店的地点
  444. * @return array
  445. * 田玲菲
  446. */
  447. public function actionGetAreaName()
  448. {
  449. $data = array();
  450. $operaHotel = new OperaHotel();
  451. $res = $operaHotel->getHotelArea();
  452. $arr2 = array();
  453. foreach ($res as $k => $v) {
  454. $arr2[$k]['id'] = $v['id'];
  455. $arr2[$k]['area_name'] = str_replace("市", "", $v['area_name']);
  456. }
  457. $data['cities'] = $arr2;
  458. $newArr = array();
  459. foreach ($res as $v) {
  460. $firstChar = Pinyin::getShortPinyin(mb_substr($v['area_name'], 0, 1, 'utf-8')); //取出第一个汉字的首字母
  461. $newArr[strtoupper($firstChar)][] = str_replace("市", "", $v);;//以这个首字母作为key
  462. }
  463. ksort($newArr);
  464. $data['city_list'] = $newArr;
  465. $data['hot_city'] = [
  466. [
  467. 'area_name' => '上海',
  468. 'id' => 791,
  469. ],
  470. [
  471. 'area_name' => '杭州',
  472. 'id' => 923,
  473. ],
  474. [
  475. 'area_name' => '舟山',
  476. 'id' => 999,
  477. ],
  478. [
  479. 'area_name' => '嘉兴',
  480. 'id' => 961,
  481. ],
  482. [
  483. 'area_name' => '苏州',
  484. 'id' => 850,
  485. ],
  486. ];
  487. return $data;
  488. }
  489. /**
  490. * Function Description:微信端获取酒店列表缓存
  491. * Function Name: actionGetHotelListCache
  492. *
  493. * @return array
  494. *
  495. * @author 娄梦宁
  496. */
  497. public function actionGetHotelListCache()
  498. {
  499. $getList = $this->service()->getHotelListCache();
  500. return $getList;
  501. }
  502. /**
  503. * @Author wanglg
  504. * @Desc 订单操作相关渠道商供应商预付款接口
  505. * $type扣款类型,不同扣款类型执行不同操作1.下单操作,2.取消订单,3.修改订单
  506. * @param int $order_id订单ID
  507. */
  508. public function actionSupplierAndChannelPP($type, $order_id)
  509. {
  510. if (empty($type) || empty($order_id)) {
  511. $this->sendAliMsgToRtx('渠道预付款处理失败:', "关联订单号:" . $order_id . "\n错误信息:缺少必要参数", $this->_private);
  512. }
  513. $model = new CommonOrder();
  514. $res = $model->previousBalance($type, $order_id);
  515. if ($res['code'] != 0) {
  516. $send_msg = "关联订单号:" . $order_id . "\n错误信息:" . $res['msg'];
  517. $this->sendAliMsgToRtx('渠道预付款处理失败:', $send_msg, $this->_private);
  518. }
  519. }
  520. /**
  521. * Function Description:获取酒店列表筛选条件
  522. * Function Name: actionGetHotelType
  523. * @return array
  524. * @author 李健
  525. */
  526. public function actionGetHotelType()
  527. {
  528. $getInfo = $this->service()->getHotelType();
  529. return ['code' => 0, 'data' => $getInfo];
  530. }
  531. /**
  532. * @Author wanglg
  533. * @Desc 推送房态接口,统一推送房态接口
  534. * @param $type1 . 表示携程推送,2. 阿里推送房态信息
  535. * @param array $param房态数组信息
  536. */
  537. public function actionPushRoomInfo(array $param = [])
  538. {
  539. $hotel_id = isset($param['hotel_id']) ? $param['hotel_id'] : false;
  540. $base_room_id = isset($param['parent_room_type']) ? $param['parent_room_type'] : false;
  541. $room_id = isset($param['room_type']) ? $param['room_type'] : false;
  542. $param['begin_date'] = empty($param['begin_date']) ? date('Y-m-d') : $param['begin_date'];
  543. $param['end_date'] = empty($param['end_date']) ? date('Y-m-d', strtotime('+90 days')) : $param['end_date'];
  544. // 判断渠道是否满足目前的直连渠道,不满足则不推送
  545. if (!in_array($param['channel_id'], [Yii::$app->params['ali']['supplier_id'], Yii::$app->params['ctrip']['supplier_id']])) {
  546. return false;
  547. }
  548. if (empty($hotel_id) || empty($base_room_id) || empty($room_id)) {
  549. $this->sendAliMsgToRtx('房态推送统一接口:', "错误信息:缺少必要参数,酒店信息:" . $hotel_id . ',基础房型信息:' . $base_room_id . ',子房型信息' . $room_id, $this->_private);
  550. return array('code' => 1, 'msg' => '缺少必要参数,酒店信息:' . $hotel_id . ',基础房型信息:' . $base_room_id . ',子房型信息' . $room_id);
  551. }
  552. $logger = new TopLogger();
  553. $logger->log(array(
  554. date("Y-m-d H:i:s"),
  555. '携程推送参数记录:' . __FUNCTION__ . json_encode($param)
  556. ));
  557. $model = new CommonOrder();
  558. $model->pushRoomStatus($param);
  559. }
  560. /**
  561. * @Author wanglg
  562. * @Desc 获取酒店下单可用库存
  563. * @param hotel_id酒店id
  564. * @param parent_room_type酒店基础房型id
  565. * @param room_type子房型
  566. * @param channel_id渠道id
  567. * @param start_date开始日期
  568. * @param end_date结束日期
  569. */
  570. public function actionGetStock()
  571. {
  572. /*$param = [
  573. 'RoomID' => 2474,
  574. 'DistribID' => 669,
  575. 'CheckIn' => '2018-01-18',
  576. 'CheckOut' => '2018-01-21',
  577. ];*/
  578. $request = Yii::$app->request->post();
  579. $orderModel = new CommonOrder(['scenario' => 'Product']);
  580. if ($orderModel->load($request, '') && $orderModel->validate()) {
  581. $getStockRes = $orderModel->getMinStock();
  582. return json_encode(array('code' => 0, 'info' => '成功', 'data' => $getStockRes));
  583. } else {
  584. $error = array_values($orderModel->getFirstErrors());
  585. return json_encode(['code' => 1, 'info' => $error[0]]);
  586. }
  587. }
  588. /**
  589. * Des:返回蜘蛛官网酒店列表
  590. * Name: actionGetWwwHotelList
  591. * @return array
  592. * @author 倪宗锋
  593. */
  594. public function actionGetWwwHotelList()
  595. {
  596. $DistribID = Yii::$app->request->post('DistribID', '');//分销商ID 必传
  597. $operaHotel = new OperaHotel();
  598. $list = $operaHotel->getWwwHotelList($DistribID);
  599. return $list;
  600. }
  601. public function actionTest()
  602. {
  603. $res = AliOrder::findOne(Yii::$app->request->get('id'));
  604. }
  605. }
  606. ?>